I use the esp 32 device as a server and read the descriptor values and characteristics from it with my smartphone. As a test, I sent the same values from the characteristics and from the descriptors. The values of the characteristics are read correctly, but the values of the descriptors are different each time. The read response is transmitted automatically by the bluetooth stack. What could be the problem?
Here is an example of initializing a character and descriptor.
Code: Select all
.char_uuid = {.len = ESP_UUID_LEN_128, .uuid = {.uuid128 = CHANNEL_CHARACTERISTIC_UUID}},
.perm = ESP_GATT_PERM_READ,
.property = ESP_GATT_CHAR_PROP_BIT_READ,
.value = &versionCharacteristicValue,
.autoResponse = &autoresp,
.numOfDescriptors = 1,
.descrs = (descriptor_handle[1]) {... }
Code: Select all
[0] = {.descr_uuid = {.len = ESP_UUID_LEN_128, .uuid = {.uuid128 = CHANNEL_DESCRIPTOR_UUID}}, .perm = ESP_GATT_PERM_READ, .value = &versionCharacteristicValue, .autoResponse = &autoresp}
Code: Select all
static esp_attr_value_t versionCharacteristicValue = {.attr_max_len = GATTS_DEMO_CHAR_VAL_LEN_MAX, .attr_len = sizeof(version), version};