SDK version: nRF5_SDK_15.3.0
Platform: nRF52840 DK
I use ble_app_blinky example and Android nRF Blinky SDK to add new function.
Recently, I add a new characteristic and use sd_ble_gatts_value_set() to set JSON format string.
On Android APP side, call readCharacteristic(mCharacteristic) API to read the JSON string.
It works if the JSON string less than 512 bytes.
I know that the p_value of the function packet format of sd_ble_gatts_value_set() is 0~512 bytes. (0xA5-sd_ble_gatts_value_set).
I think I need to break the JSON string into multiple packets to avoid p_value more than 512 bytes.
but I have no idea how to do multiple packets and let APP call readCharacteristic(mCharacteristic) API one time to get all packets?
Is there any example of sd_ble_gatts_value_set() more than 512byes or any suggestion?
A common solution is to use write + notifications instead. You write a command to some characteristic that it's time to send the large value. Then the peripheral splits up the large value and send as many notifications that are needed to send the full value on another characteristic.
Hi Emil, Thank you for your relay.
but I still confuse that.
your mean is I can create more characteristic and use sd_ble_gatts_value_set() set large value?
1st characteristic: set 0~512 bytes value by sd_ble_gatts_value_set()
2nd characteristic: set 513~1024 bytes value by sd_ble_gatts_value_set()
similar it above?
On the first notification event you get, you read the characteristic value(0~512 bytes) in the notification event and store it. Then you get another notification event with updated characteristic value (513~1024 bytes), and store that. Then you have access to the whole value.
Get it. Thank you.