gatts_add_char_descr_evt_param missing info?
Posted: Thu Jan 11, 2018 6:53 pm
Hi all,
I am struggling to find a way to correctly handle ESP_GATTS_ADD_CHAR_DESCR_EVT in a gatt server. The struct passed to this event is:
From the header, it says that char_uuid is "Characteristic uuid", but in reality it appears to be the descriptor uuid. My characteristics each include the same descriptor (ESP_GATT_UUID_CHAR_CLIENT_CONFIG) so I cannot figure out a way to unique identify which characteristic / descriptor pair the event is targeting.
It seems like the event parameter should also include the characteristic uuid, or the handle of the characteristic.
My code is proprietary, so I cannot post it, but in psuedocode the situation looks like this:
1. Call esp_ble_gatts_add_char with characteristic uuid 1111.
2. Receive ESP_GATTS_ADD_CHAR_EVT with characteristic uuid 1111.
3. Call esp_ble_gatts_add_char_descr with descriptor uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
4. Call esp_ble_gatts_add_char with characteristic uuid 2222.
5. Receive ESP_GATTS_ADD_CHAR_EVT with characteristic uuid 2222.
6. Call esp_ble_gatts_add_char_descr with descriptor uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
7. Receive ESP_GATTS_ADD_CHAR_DESCR_EVT with characteristic uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
8. Receive ESP_GATTS_ADD_CHAR_DESCR_EVT with characteristic uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
So, I register two characteristics and each one has one descriptor, which is ESP_GATT_UUID_CHAR_CLIENT_CONFIG. But when I get the ESP_GATTS_ADD_CHAR_DESCR_EVT event, so that I can store the handle, I have no way of knowing which characteristic the event is for.
Can someone tell me if I am missing something, or if this is a bug in the API?
Thanks,
Jason
I am struggling to find a way to correctly handle ESP_GATTS_ADD_CHAR_DESCR_EVT in a gatt server. The struct passed to this event is:
Code: Select all
struct gatts_add_char_descr_evt_param {
esp_gatt_status_t status; /*!< Operation status */
uint16_t attr_handle; /*!< Descriptor attribute handle */
uint16_t service_handle; /*!< Service attribute handle */
esp_bt_uuid_t char_uuid; /*!< Characteristic uuid */
} add_char_descr; /*!< Gatt server callback param of ESP_GATTS_ADD_CHAR_DESCR_EVT */
It seems like the event parameter should also include the characteristic uuid, or the handle of the characteristic.
My code is proprietary, so I cannot post it, but in psuedocode the situation looks like this:
1. Call esp_ble_gatts_add_char with characteristic uuid 1111.
2. Receive ESP_GATTS_ADD_CHAR_EVT with characteristic uuid 1111.
3. Call esp_ble_gatts_add_char_descr with descriptor uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
4. Call esp_ble_gatts_add_char with characteristic uuid 2222.
5. Receive ESP_GATTS_ADD_CHAR_EVT with characteristic uuid 2222.
6. Call esp_ble_gatts_add_char_descr with descriptor uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
7. Receive ESP_GATTS_ADD_CHAR_DESCR_EVT with characteristic uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
8. Receive ESP_GATTS_ADD_CHAR_DESCR_EVT with characteristic uuid ESP_GATT_UUID_CHAR_CLIENT_CONFIG (0x2902)
So, I register two characteristics and each one has one descriptor, which is ESP_GATT_UUID_CHAR_CLIENT_CONFIG. But when I get the ESP_GATTS_ADD_CHAR_DESCR_EVT event, so that I can store the handle, I have no way of knowing which characteristic the event is for.
Can someone tell me if I am missing something, or if this is a bug in the API?
Thanks,
Jason