feat: ✨ tune service advertisement so apps like OpenTracks can find the hrm service
parent
0f431d53cf
commit
8271b7472d
|
|
@ -4,14 +4,30 @@
|
|||
* This function prepares BLE heart rate Advertisement.
|
||||
*/
|
||||
|
||||
NRF.setAdvertising(
|
||||
{
|
||||
0x180d: undefined
|
||||
},
|
||||
{
|
||||
// We need custom Advertisement settings for Apps like OpenTracks
|
||||
connectable: true,
|
||||
discoverable: true,
|
||||
scannable: true,
|
||||
whenConnected: true,
|
||||
}
|
||||
);
|
||||
|
||||
NRF.setServices({
|
||||
0x180D: { // heart_rate
|
||||
0x2A37: { // heart_rate_measurement
|
||||
notify: true,
|
||||
value: [0x06, 0],
|
||||
},
|
||||
0x2A38: { // Sensor Location: Wrist
|
||||
value: 0x02,
|
||||
}
|
||||
}
|
||||
}, { advertise: [0x180d] });
|
||||
});
|
||||
|
||||
}
|
||||
function updateBLEHeartRate(hrm) {
|
||||
|
|
@ -23,11 +39,11 @@
|
|||
NRF.updateServices({
|
||||
0x180D: {
|
||||
0x2A37: {
|
||||
value: [
|
||||
0x06, //
|
||||
hrm.bpm
|
||||
],
|
||||
value: [0x06, hrm.bpm],
|
||||
notify: true
|
||||
},
|
||||
0x2A38: {
|
||||
value: 0x02,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue