Page 1 of 1

BLE GATT - Read/Change Char value from IDF side

Posted: Tue Jul 24, 2018 12:32 am
by saden123
Hi,
I'm running through the various GATT server examples, YouTube, forums, etc.... but can't see how to do the following:
1. Read the value of a characteristic from my IDF code
2. Change the value of a characteristic from my IDF code, and have that updated out to the client (notification)
Is there a sample project out there that can point me in the right direction?
Thanks.

Re: BLE GATT - Read/Change Char value from IDF side

Posted: Tue Jul 24, 2018 3:54 pm
by saden123
I've found what I need:

Code: Select all

esp_err_t esp_ble_gatts_set_attr_value(uint16_t attr_handle, uint16_t length, const uint8_t *value)
esp_gatt_status_t esp_ble_gatts_get_attr_value(uint16_t attr_handle, uint16_t *length, const uint8_t **value)
But these require the attribute handle (attr_handle), how do I get the handle when I have created the attributes via the table method:

Code: Select all

esp_err_t create_attr_ret = esp_ble_gatts_create_attr_tab(gatt_db, gatts_if, HRS_IDX_NB, SVC_INST_ID);
Any pointers appreciated.

Re: BLE GATT - Read/Change Char value from IDF side

Posted: Tue Jul 24, 2018 6:02 pm
by chegewara

Re: BLE GATT - Read/Change Char value from IDF side

Posted: Tue Jul 24, 2018 9:01 pm
by fly135
I'm using Kolban's open source library to do just that.

https://github.com/nkolban/esp32-snippe ... /cpp_utils

John A

Re: BLE GATT - Read/Change Char value from IDF side

Posted: Sat Oct 06, 2018 10:33 pm
by saden123
Thanks chegewara and fly123, I'm getting there now.
Si.