Android Question BLE2 NOTIFICATIONS NOT ACTIVATED

Status
Not open for further replies.
I have identical issue with previous thread, unable to activate notifications from BLE device.
manager.SetNotify succeeds, but DataAvailable event after that is never raised and notifications are not detected. BLE2 Ver.1.36, trying to communicate with BLE Body Thermometer
Service and characteristics are discovered without problems:
Service 0000fff0-0000-1000-8000-00805f9b34fb
Characteristics: (MyMap) {0000fff1-0000-1000-8000-00805f9b34fb=[B@3fa37eed
Characteristic's parameters are Read/Write/Notify
We need an access to Characteristic's descriptor 2902 to activate notification.
As I understand it, writing x01 directly to characteristic is wrong, we need to write to descriptor which has different UUID.
Also, as has been explained earlier, SetNotify only activates notifications listener on Android device; writing x01 to peripheral device makes it to start transmitting data (notifications) without waiting for read request from Android device.
 
Last edited:
As I said above, call to manager.SetNotify succeeds, that is, it produces standard lines in log
Setting descriptor. Success = true
writing descriptor: true
My current plan is to verify if it actually 'happens internally" using BLE logging app nRF Logger. There is a native app for this BLE Thermometer and logger shows explicit calls (write and read) to 2902 descriptor. I will try to deploy my app and see if nRF Logger can intercept packets and compare them to native app log.
 
Last edited:
Upvote 0
You are claiming notifications flag was set. To prove that the only way would be to read descriptor value, but we cannot do this with B4A.
BTW this functionality is the only purpose I purchased B4A for. I will not claim a refund because I have other ideas to implement with this IDE. But this issue comes up time and again across the forum. In the past you were listening to these complaints and was fixing BLE library.
I would suggest creating and explicit methods for ReadDescriptor and WriteDescriptor as well as a function Characteristics.GetDescriptor. This way it will be way easier to understand why your software does not work as intended.
 
Last edited:
Upvote 0
I am using NRF Logger to research this issue. Here is what I found:
The device has total of 3 characteristics with property 'Notify' - 2 of them belongs to the service I am working with, and another one is under different service:
Service 00001801-0000-1000-8000-00805f9b34fb
characteristic 00002a05-0000-1000-8000-00805 (I don't need this service)
Service 0000fff0-0000-1000-8000-00805f9b34fb
characteristic 0000fff1-0000-1000-8000-00805f9b34fb - this is the one I need
characteristic 0000fff2-0000-1000-8000-00805f9b34fb
When I call Starter.manager.SetNotify(service_id,characteristic_id,True)
for Characteristic 0000fff1-0000-1000-8000-00805f9b34fb,
NRF Log shows 3 calls one after another for _EACH_ characteristics above, that is, single call actually generates 3 calls for all characteristics of connected device that have 'Notify' property:
gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
gatt.setCharacteristicNotification(0000fff1-0000-1000-8000-00805f9b34fb, true)
gatt.setCharacteristicNotification(0000fff2-0000-1000-8000-00805f9b34fb, true)

Is this expected functionality?

Also, NRF log shows that after these 3 calls are registered - nothing else happens after that, that is, the log ends. Even though I send SetNotify(..,False), and then Disconnect - logger does not register that. So BLE communication is actually completely stalled after this.
When I disconnect from device and try to scan for it again, it does not shows up in discovered list, and status LED on device show it is still connected. This confirms that after sending SetNotify no further BLE commands are actually transmitted.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You are claiming notifications flag was set. To prove that the only way would be to read descriptor value, but we cannot do this with B4A.
BTW this functionality is the only purpose I purchased B4A for. I will not claim a refund because I have other ideas to implement with this IDE. But this issue comes up time and again across the forum. In the past you were listening to these complaints and was fixing BLE library.
I would suggest creating and explicit methods for ReadDescriptor and WriteDescriptor as well as a function Characteristics.GetDescriptor. This way it will be way easier to understand why your software does not work as intended.
Not sure why this negative attitude. I did try to help you however you insist that it is a bug in the BLE library without showing any real explanation or without trying other things.
This is not the correct way to get help here and I will not help you.

Many developers use the BLE library and call SetNotify to register for notifications.

You are claiming notifications flag was set.
We are not in court. I don't claim anything. I tried to help you.

To prove that the only way would be to read descriptor value, but we cannot do this with B4A.
It should be simple to read descriptors with JavaObject. If you would have asked it before then I would have shown you how to do it.
I could have also shown you the Java code that is called. It is very simple.

This thread is closed. If you like you can start a new thread with the purpose of a fruitful discussion between developers. No claims and no proofs.
 
Upvote 0
Status
Not open for further replies.
Top