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
Note that there is no call to "gatt.writeDescriptor()" in the "unsubscribe" function called by the "UnregisterForValues" function of the BluetoothLE extension. This means that while the callback gets disabled and the App Inventor app does not receive any notifications from the BLE device any more, the BLE device still generates notifications in the background. The notification bit in the corresponding CCCD on the BLE device has not been cleared.
This is probably not the intended behavior. As BLE devices often try to save power wherever possible, being able to disable notifications on the device is important.
Note that the call to "gatt.writeDescriptor()" is used as expected in the "subscribe" function called by the "RegisterForX" functions of the BluetoothLE extension. Notifications are enabled by a write request to the corresponding CCCD.
I suggest to review the internals of the "unsubscribe" function and to include a call to "gatt.writeDescriptor()" such as to disable the notification bit in the CCCD.
The text was updated successfully, but these errors were encountered:
Hmm, unfortunately, the simple change that I proposed in the pull request has not been considered for the latest release of the extension. The bug is still alive.
@sleven79 There are a lot of changes in #27 that seem beyond the solution you've proposed here. If you want to clean up that PR to update the descriptor accordingly, that would be fine. We may want to balance the number of calls to RegisterForX(service, characteristic) and UnregisterForValues(service, characteristic) so that we only reset the notification flag once all existing registrations have been unwound.
Note that there is no call to "gatt.writeDescriptor()" in the "unsubscribe" function called by the "UnregisterForValues" function of the BluetoothLE extension. This means that while the callback gets disabled and the App Inventor app does not receive any notifications from the BLE device any more, the BLE device still generates notifications in the background. The notification bit in the corresponding CCCD on the BLE device has not been cleared.
This is probably not the intended behavior. As BLE devices often try to save power wherever possible, being able to disable notifications on the device is important.
Note that the call to "gatt.writeDescriptor()" is used as expected in the "subscribe" function called by the "RegisterForX" functions of the BluetoothLE extension. Notifications are enabled by a write request to the corresponding CCCD.
I suggest to review the internals of the "unsubscribe" function and to include a call to "gatt.writeDescriptor()" such as to disable the notification bit in the CCCD.
The text was updated successfully, but these errors were encountered: