1
0
Fork 0

Merge pull request #2807 from AnotherStranger/feature/support-hrm-further

[bootgatthrm] Added BLE sensor location and tuned HRM service advertisement settings
master
Gordon Williams 2023-06-12 09:13:26 +01:00 committed by GitHub
commit 780337971f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View File

@ -1 +1,2 @@
0.01: Initial release. 0.01: Initial release.
0.02: Added compatibility to OpenTracks and added HRM Location

View File

@ -4,14 +4,30 @@
* This function prepares BLE heart rate Advertisement. * 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({ NRF.setServices({
0x180D: { // heart_rate 0x180D: { // heart_rate
0x2A37: { // heart_rate_measurement 0x2A37: { // heart_rate_measurement
notify: true, notify: true,
value: [0x06, 0], value: [0x06, 0],
},
0x2A38: { // Sensor Location: Wrist
value: 0x02,
} }
} }
}, { advertise: [0x180d] }); });
} }
function updateBLEHeartRate(hrm) { function updateBLEHeartRate(hrm) {
@ -23,11 +39,11 @@
NRF.updateServices({ NRF.updateServices({
0x180D: { 0x180D: {
0x2A37: { 0x2A37: {
value: [ value: [0x06, hrm.bpm],
0x06, //
hrm.bpm
],
notify: true notify: true
},
0x2A38: {
value: 0x02,
} }
} }
}); });

View File

@ -2,7 +2,7 @@
"id": "bootgatthrm", "id": "bootgatthrm",
"name": "BLE GATT HRM Service", "name": "BLE GATT HRM Service",
"shortName": "BLE HRM Service", "shortName": "BLE HRM Service",
"version": "0.01", "version": "0.02",
"description": "Adds the GATT HRM Service to advertise the measured HRM over Bluetooth.\n", "description": "Adds the GATT HRM Service to advertise the measured HRM over Bluetooth.\n",
"icon": "bluetooth.png", "icon": "bluetooth.png",
"type": "bootloader", "type": "bootloader",