You are reading a single comment by @AnotherStranger and its replies.
Click here to read the full conversation.
-
Hey there I got your example working using following code:
NRF.setServices({ 0x180D: { // heart_rate 0x2A37: { // heart_rate_measurement notify: true, value : [0x06, 0], } } }, { advertise: [ '180D' ] }); Bangle.setHRMPower(1); Bangle.on('HRM', function(hrm) { NRF.updateServices({ '180d': { '2a37': { value: [0x06, hrm.bpm], notify: true } } }); });
With this code, I could see the heart rate inside the nRF connect app as well as in FitoTrack for Android. However, I got two problems to solve: First, setServices requires a BLE restart. Secondly, if the device is already connected to e.g. gadgetbridge it is not discoverable except when I trigger it within the bluetooth settings.
I just tried to run
on 52840 dongle with recent 2.17 build and it simply works, I see
Service Data 0x180d Data:0x6450
in nrfconnect on android near the device name in scan list and also see values in the "RAW" popup.
It even works when already connected to the device due to
whenConnected: true
, device is still advertising.As for the setServices, that worked too
I just tried it without and also with the
, { advertise: ['180d'] }
part and both work for me.With the part in I see 0x180d both in service uuids and stil also as as direct servicee data as before.
When connecting via nrfconnect I see "Heart Rate" service and can read the value of 0 bpm