BLE Server attribute value response truncation issue
Posted: Thu Jul 28, 2022 6:45 am
Hello
I am using ESP32 S3 with GATT server example. When I am sending read characteristic request from BLE client (ESP32 S3) then I am getting proper response as shown But same request is sent form mobile app then I am getting same hex value dumped over 4-5 times and getting warning in the logs of my ESP32 S3 GATT SERVER BLE server code snippet :
Response observed on app
I am using ESP32 S3 with GATT server example. When I am sending read characteristic request from BLE client (ESP32 S3) then I am getting proper response as shown But same request is sent form mobile app then I am getting same hex value dumped over 4-5 times and getting warning in the logs of my ESP32 S3 GATT SERVER BLE server code snippet :
Code: Select all
#define GATTS_DEMO_CHAR_VAL_LEN_MAX 0xf0
static uint8_t BLE_payload[60] = { 46, 197, 213, 196, 245, 22, 22, 98,130, 180, 185, 27, 212, 55, 243, 215, 135, 12, 2, 75, 16, 54, 218, 125, 183, 159, 35, 161, 215, 221, 97, 26, 110, 105, 64, 145, 228, 242, 80, 70, 156, 34, 121, 213, 49, 229, 199, 148, 134, 73};
static uint8_t BLE_buffer[22] = { 46, 197, 213, 196, 245, 22, 22, 98, 130, 180, 185, 27, 212, 55, 243, 215, 135, 12, 2, 75, 16 };
static esp_attr_value_t gatts_demo_char1_val =
{
.attr_max_len = GATTS_DEMO_CHAR_VAL_LEN_MAX,
.attr_len = 60,
.attr_value = BLE_payload,
};
Code: Select all
case ESP_GATTS_READ_EVT: {
ESP_LOGI(GATTS_TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
esp_gatt_rsp_t rsp;
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
rsp.attr_value.handle = param->read.handle;
rsp.attr_value.len = 32;
rsp.attr_value.value[0] = 0xde;
rsp.attr_value.value[1] = 0xed;
rsp.attr_value.value[2] = 0xbe;
rsp.attr_value.value[3] = 0xef;
memcpy(rsp.attr_value.value, BLE_payload, 32);
esp_ble_gatts_send_response(gatts_if, param->read.conn_id, param->read.trans_id,
ESP_GATT_OK, &rsp);
break;
Response observed on app