-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GATT Server API for decriptors is incompatable with BLE spec (IDFGH-14165) #14967
Comments
After spending day in looking for possible quick fix I found that both characteristics and descriptors are stored in "service database" and treated equally as service attributes. |
Thank you for reporting this issue. Currently, Bluedroid supports two methods for creating GATT server databases:
Addressing Your Concern: You pointed out that the native method has issues with the following aspects:
Let me clarify why using the In the database, services, characteristics, and descriptors are all treated as attributes, and Bluedroid organizes these attributes sequentially during database creation. Here’s how it works:
The You can verify the attribute hierarchy and sequence using the If you require multiple descriptors or characteristics within the same service, the database creation process will handle this seamlessly, as each attribute is assigned a unique index (or handle) sequentially. If you still have concerns or require further clarification, feel free to reach out. We're here to help! |
Thansk for reply The problem I'm addressing is the follows.
To create it I call esp_ble_gatts_create_service, esp_ble_gatts_start_service, esp_ble_gatts_add_char and esp_ble_gatts_add_char_descr and get the service three exactly as I described above. Now I wait for ESP_GATTS_ADD_CHAR_EVT and ESP_GATTS_ADD_CHAR_DESCR_EVT to save attribute handles for further handling of read/write events. Let's say I receive ESP_GATTS_ADD_CHAR_DESCR_EVT:
How do I distiguish to which of my characteristics (0x2000, 0x2001, 0x2002 or 0x2002) this descriptor was added? Later, when ESP_GATTS_READ_EVT/ESP_GATTS_READ_EVT arrives I have only attribute handle and need to find which one of all attributes it is by search through saved handles, but I can't because of the previous problem. If you find that "sequential adding" concept fine and don't want to chage esp_ble_gatts_add_char_descr signature could you at least add parent characteristic uuid or handle to gatts_add_char_descr_evt_param so that added descritpr can be bound to characteristic as it should? |
If you're unsure how to manage this sequence, I recommend using a table-based approach to create your database. |
@leonid-galperin Does the table-based approach address your issue? |
Answers checklist.
General issue report
Hello,
According to BLE spec (e.g. Bluetooth® Core Specification Version 5.4)
GATT services characteristics and descriptors have have very clear tree structure as shown on page 37:
Services have characteristics and characteristics have descriptors.
The following ESP32 calls violate this structure:
esp_err_t esp_ble_gatts_add_char_descr(uint16_t service_handle, esp_bt_uuid_t *descr_uuid, esp_gatt_perm_t perm, esp_attr_value_t *char_descr_val, esp_attr_control_t *control)
Accepts service handle while have to accept characteristic handle. Even function names says that descriptor belongs to characteristic, not service
struct gatts_add_char_descr_evt_param have field service_handle instead of characteristic handle
Suche vilation prohibits having same decriptor id within different characteristics.
E.g. having CCCD for each characteristics within same service
The text was updated successfully, but these errors were encountered: