You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In GattCharacteristic.js, in the startNotifications method :
asyncstartNotifications(){awaitthis.helper.callMethod('StartNotify')constcb=(propertiesChanged)=>{if('Value'inpropertiesChanged){const{ value }=propertiesChanged.Valuethis.emit('valuechanged',Buffer.from(value))}}this.helper.on('PropertiesChanged',cb)}
The startNotify method is called before attaching the callback / event handler. Depending on how your system is busy / scheduled, you might loose 0, 1 or more event notifications.
Hi @nmasse-itix,
thanks for the deep analysis that you did. Looking at the code, I think that you're right, there could be some timings when the notification loose some events.
Your suggested solution should work. Can you submit a PR and some unit test around this fix?
Thanks a lot
Environment
I'm using the following code to connect to a Lego Powered Up Hub using
node-ble
on a Framework Laptop 13 AMD running Fedora 40.Code to reproduce the issue
Expected behavior
Upon startNotifications, exactly 5 notifications are received.
Current behavior
Only 3 to 4 notifications are received.
Possible explanation
In
GattCharacteristic.js
, in thestartNotifications
method :The
startNotify
method is called before attaching the callback / event handler. Depending on how your system is busy / scheduled, you might loose 0, 1 or more event notifications.Possible fix
Warning
The sample code in the README might also require a fix.
Applying this fix on the supplied sample code produces the expected behavior :
The text was updated successfully, but these errors were encountered: