[TW#12341] BLE characteristics value read/write operations
Posted: Thu Feb 09, 2017 3:53 pm
Hi,
I am working on the gatt_server example. I have modified the code to define a 'propietary' (128bit UUID) with a characteristic.
When callin esp_ble_gatts_add_char function:
static uint8_t char_value[10] = {0};
esp_attr_value_t gatts_char_value =
{
.attr_max_len = sizeof(char_value),
.attr_len = sizeof(char_value),
.attr_value = char_value,
};
My problems are that once connected and discovered the services, the characteristic has the correct length, I mean 10 bytes but its value is not zero.
Also when reading (esp_ble_gatts_get_attr_value(...)) or writing (esp_ble_gatts_set_attr_value(...)) to this characteristic value despite I receive a ESP_OK response from the mentioned functions it seems the write doesn't work because after writing 10 bytes to '11' the value I get when reading is the same that I get at the beginning.
So is there any bug in these functions? Is there any example that shows how to set/get values to characteristics? Any help will be appreciated. Thanks in advance.
I am working on the gatt_server example. I have modified the code to define a 'propietary' (128bit UUID) with a characteristic.
When callin esp_ble_gatts_add_char function:
- Permisions: ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE
- Properties: ESP_GATT_CHAR_PROP_BIT_READ | ESP_GATT_CHAR_PROP_BIT_WRITE | ESP_GATT_CHAR_PROP_BIT_WRITE_NR
static uint8_t char_value[10] = {0};
esp_attr_value_t gatts_char_value =
{
.attr_max_len = sizeof(char_value),
.attr_len = sizeof(char_value),
.attr_value = char_value,
};
My problems are that once connected and discovered the services, the characteristic has the correct length, I mean 10 bytes but its value is not zero.
Also when reading (esp_ble_gatts_get_attr_value(...)) or writing (esp_ble_gatts_set_attr_value(...)) to this characteristic value despite I receive a ESP_OK response from the mentioned functions it seems the write doesn't work because after writing 10 bytes to '11' the value I get when reading is the same that I get at the beginning.
So is there any bug in these functions? Is there any example that shows how to set/get values to characteristics? Any help will be appreciated. Thanks in advance.