Hi,
My project is designed around two tasks :
1 - First task for global init and periodical sensors reading
2 - Second task is running a gatt_server with gatts_services_table initialization.
One of my sensor return a float value, and i want to map it on a BLE characteristic.
Reading the various examples given with the ESP-IDF and various topics on reading BLE characteristic, it seems that the characterics values are always managed as a string ? is it possible to set directly a float value using the esp_ble_gatts_set_attr_value ? In this case, what is the way to define the characteristic in the service table ?
I try to used the native Gatts-server API.
Thanks a lot for your responses.
Regards.
H2 read Float BLE Characteristic
Re: H2 read Float BLE Characteristic
Characteristic value is just a byte representation of any value, so all what you need is to find a way to store float value in byte array. I know you are using esp-idf, but here you have only example how it can be done:
https://github.com/nkolban/esp32-snippe ... #L715-L716
EDIT you can add descriptor 0x2904 to allow client to get information about value in characteristic:
https://www.bluetooth.com/specification ... format.xml
https://github.com/nkolban/esp32-snippe ... #L715-L716
EDIT you can add descriptor 0x2904 to allow client to get information about value in characteristic:
https://www.bluetooth.com/specification ... format.xml
-
- Posts: 29
- Joined: Wed Aug 09, 2017 6:16 am
Re: H2 read Float BLE Characteristic
thanks for chegewara's help. please Please follow the chegewara to try.
Re: H2 read Float BLE Characteristic
Congrats on your first comment on forum.Weijian-Espressif wrote: ↑Mon Nov 19, 2018 7:15 amthanks for chegewara's help. please Please follow the chegewara to try.
Who is online
Users browsing this forum: Baidu [Spider], brsmdnlr and 118 guests