Questions regarding GATT table in examples

budavargas
Posts: 1
Joined: Mon Nov 08, 2021 12:37 pm

Questions regarding GATT table in examples

Postby budavargas » Mon Nov 08, 2021 1:54 pm

Hello!

I'm quite new to the ESP32 and ESP-IDF, so some patience will be greatly appretiated. :D

I'm trying to understand the GATT table on several GATT Server examples included in the ESP-IDF suite. I'll show the code where the table is generated
  1. /* Full Database Description - Used to add attributes into the database */
  2. static const esp_gatts_attr_db_t gatt_db[HRS_IDX_NB] =
  3. {
  4.     // Service Declaration
  5.     [IDX_SVC]        =
  6.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&primary_service_uuid, ESP_GATT_PERM_READ,
  7.       sizeof(uint16_t), sizeof(GATTS_SERVICE_UUID_TEST), (uint8_t *)&GATTS_SERVICE_UUID_TEST}},
  8.  
  9.     /* Characteristic Declaration */
  10.     [IDX_CHAR_A]     =
  11.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
  12.       CHAR_DECLARATION_SIZE, CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read_write_notify}},
  13.  
  14.     /* Characteristic Value */
  15.     [IDX_CHAR_VAL_A] =
  16.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&GATTS_CHAR_UUID_TEST_A, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
  17.       GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(char_value), (uint8_t *)char_value}},
  18.  
  19.     /* Client Characteristic Configuration Descriptor */
  20.     [IDX_CHAR_CFG_A]  =
  21.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_client_config_uuid, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
  22.       sizeof(uint16_t), sizeof(heart_measurement_ccc), (uint8_t *)heart_measurement_ccc}},
  23.  
  24.     /* Characteristic Declaration */
  25.     [IDX_CHAR_B]      =
  26.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
  27.       CHAR_DECLARATION_SIZE, CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read}},
  28.  
  29.     /* Characteristic Value */
  30.     [IDX_CHAR_VAL_B]  =
  31.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&GATTS_CHAR_UUID_TEST_B, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
  32.       GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(char_value), (uint8_t *)char_value}},
  33.  
  34.     /* Characteristic Declaration */
  35.     [IDX_CHAR_C]      =
  36.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
  37.       CHAR_DECLARATION_SIZE, CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_write}},
  38.  
  39.     /* Characteristic Value */
  40.     [IDX_CHAR_VAL_C]  =
  41.     {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&GATTS_CHAR_UUID_TEST_C, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
  42.       GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(char_value), (uint8_t *)char_value}},
  43.  
  44. };
  45.  
When checking with the nRF Connect app, I get the information shown on the attached image

I'm having a hard time figuring out how both things are related. Some UUID apears, others don't, why? How different elements of the table are related to the same attribute if no variables are shared between table elements? What does each element of the table means? What is that I'm not getting?

It would be great if somebody would be so kind to point me in the right direction or explain to me a little bit what's happening

Regards!
Attachments
WhatsApp Image 2021-11-08 at 10.48.18 AM.jpeg
WhatsApp Image 2021-11-08 at 10.48.18 AM.jpeg (117.95 KiB) Viewed 879 times

Who is online

Users browsing this forum: artisdom, axellin, Dennie and 130 guests