BLE GATT - Read/Change Char value from IDF side

saden123
Posts: 12
Joined: Tue Jul 24, 2018 12:18 am

BLE GATT - Read/Change Char value from IDF side

Postby saden123 » Tue Jul 24, 2018 12:32 am

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.

saden123
Posts: 12
Joined: Tue Jul 24, 2018 12:18 am

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

Postby saden123 » Tue Jul 24, 2018 3:54 pm

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.


User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

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

Postby fly135 » Tue Jul 24, 2018 9:01 pm

I'm using Kolban's open source library to do just that.

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

John A

saden123
Posts: 12
Joined: Tue Jul 24, 2018 12:18 am

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

Postby saden123 » Sat Oct 06, 2018 10:33 pm

Thanks chegewara and fly123, I'm getting there now.
Si.

Who is online

Users browsing this forum: No registered users and 334 guests