Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why Android App doesn't automatically get the attribute value

Dear Sir/Madam,

I am working on a 51822 project which send data to Android App. This project is actually an replacement to an old BLE sensor which is obsolete now.  I have no idea how the obsolete sensor product was designed because that is not our product. When I open a Bluetooth App, such as "BLE Reader"(a free app found in google play store), the product displays "battery service" which has a battery level characteristic of UUID 2A19 and is marked as "write notify".   If I click this characteristic, I could see it automatically sends sensor data to the App at speed of about  3K Bytes per second, as shown on the captured pictures attached to this message.  So, the value of battery level characteristic is actually used as a UART TX path to send out sensor data.

My job is to make a new BLE device to simulate this obsolete sensor based on nRF51822 and S110. The SDK version is 9.0.

I reused an existing BLE UART project which has all other functions but doesn't have battery service. Then added "ble_bas.c" and "ble_bas.h" to the project. Then tried to modify the code to simulate the behavior of the old sensor. But when I first time give the code a run, I found that the battery level characteristic of UUID 2A19 is already in the code. That is good for me. Then I found that the originally battery level characteristic has only 1 byte length of its value, I have manually modified it to 20 bytes. And it works.  

Then the real problem appears: I have to push "Read" button on the Android App to get a new value. If I don't press the "Read" button, the BLE Reader won't display any new value.  It seems that the old sensor could automatically "Push" its new data to the Android App, but my code doesn't, even the Battery Level characteristic both have "Notify".

My problems is:  How could I make the characteristic value automatically "pushed" to the Android App, just like the old device does its job? 

I am a newbie to nRF5 DK and BLE programming.  Could someone help me to fix this trouble? 

The attached pictures are the screen shots from my cell phone of BLE Reader app.

Thanks,

Jun  

Parents Reply Children
No Data
Related