- [2018-11-27_21:06:56][0;33mW (180130) BT_GATT: attribute value too long, to be truncated to 22[0m
- [2018-11-27_21:06:56][0;32mI (180181) BLE: ESP_GATTS_READ_EVT[0m
- [2018-11-27_21:06:56]param->reg.app_id:30
- [2018-11-27_21:06:56]param->read.trans_id:30
- [2018-11-27_21:06:56]param->read.conn_id:0
- [2018-11-27_21:06:56]param->read.handle:30
- [2018-11-27_21:06:56]IDX_CHAR_VAL_C
- [2018-11-27_21:06:56]rsp.attr_value.value: [my_data_less_150_length]
- [2018-11-27_21:06:56][0;33mW (180197) BT_GATT: attribute value too long, to be truncated to 22[0m
- [2018-11-27_21:06:56][0;32mI (180248) BLE: ESP_GATTS_READ_EVT[0m
- [2018-11-27_21:06:56]param->reg.app_id:31
- [2018-11-27_21:06:56]param->read.trans_id:31
- [2018-11-27_21:06:56]param->read.conn_id:0
- [2018-11-27_21:06:56]param->read.handle:30
- [2018-11-27_21:06:56]IDX_CHAR_VAL_C
- [2018-11-27_21:06:56]rsp.attr_value.value: [my_data_less_150_length]
- [2018-11-27_21:06:56][0;33mW (180265) BT_GATT: attribute value too long, to be truncated to 22[0m
- [2018-11-27_21:06:56][0;32mI (180316) BLE: ESP_GATTS_READ_EVT[0m
- [2018-11-27_21:06:56]param->reg.app_id:32
- [2018-11-27_21:06:56]param->read.trans_id:32
- [2018-11-27_21:06:56]param->read.conn_id:0
- [2018-11-27_21:06:56]param->read.handle:30
- [2018-11-27_21:06:56]IDX_CHAR_VAL_C
- [2018-11-27_21:06:56]rsp.attr_value.value: [my_data_less_150_length]
- [2018-11-27_21:06:56][0;33mW (180332) BT_GATT: attribute value too long, to be truncated to 22[0m
- [2018-11-27_21:06:56][0;32mI (180383) BLE: ESP_GATTS_READ_EVT[0m
- [2018-11-27_21:06:56]param->reg.app_id:33
- [2018-11-27_21:06:56]param->read.trans_id:33
- [2018-11-27_21:06:56]param->read.conn_id:0
- [2018-11-27_21:06:56]param->read.handle:30
- [2018-11-27_21:06:56]IDX_CHAR_VAL_C
- [2018-11-27_21:06:56]rsp.attr_value.value: [my_data_less_150_length]
- [2018-11-27_21:06:56][0;33mW (180400) BT_GATT: attribute value too long, to be truncated to 22[0m
- [2018-11-27_21:06:56][0;32mI (180451) BLE: ESP_GATTS_READ_EVT[0m
- [2018-11-27_21:06:56]param->reg.app_id:34
- [2018-11-27_21:06:56]param->read.trans_id:34
- [2018-11-27_21:06:56]param->read.conn_id:0
- [2018-11-27_21:06:56]param->read.handle:30
- [2018-11-27_21:06:56]IDX_CHAR_VAL_C
- [2018-11-27_21:06:56]rsp.attr_value.value: [my_data_less_150_length]
- [2018-11-27_21:06:57][0;33mW (180467) BT_GATT: attribute value too long, to be truncated to 22[0m
I'm trying to establish manual responding on ESP_GATTS_READ_EVT .
Problem: I got infinite loop when trying read characteristic value.
my characteristic configuration:
- static uint8_t my_char_uuid[16] = {
- /* LSB <--------------------------------------------------------------------------------> MSB */
- 0x32, 0xd1, 0xb0, 0x53, 0x68, 0x8c, 0x9a, 0x81, 0x83, 0x49, 0x0c, 0x88, 0x75, 0xf2, 0x2f, 0xe3
- };
- static uint8_t my_data[150] = { 0x00};
- /* Characteristic Declaration */
- [IDX_CHAR_C] =
- {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_declaration_uuid, ESP_GATT_PERM_READ,
- CHAR_DECLARATION_SIZE, CHAR_DECLARATION_SIZE, (uint8_t *)&char_prop_read}},
- /* Characteristic Value */ //MEASUREMENTS
- [IDX_CHAR_VAL_C] = // ESP_GATT_RSP_BY_APP
- {{ESP_GATT_RSP_BY_APP}, {ESP_UUID_LEN_128, (uint8_t *)&my_char_uuid, ESP_GATT_PERM_READ,
- GATTS_DEMO_CHAR_VAL_LEN_MAX, sizeof(my_data), (uint8_t *)my_data}},
- /* Client Characteristic Configuration Descriptor */
- [IDX_CHAR_CFG_C] =
- {{ESP_GATT_AUTO_RSP}, {ESP_UUID_LEN_16, (uint8_t *)&character_client_config_uuid, ESP_GATT_PERM_READ | ESP_GATT_PERM_WRITE,
- sizeof(uint16_t), sizeof(charact_3_descr), (uint8_t *)charact_3_descr}},
part from gatts_profile_event_handler:
- case ESP_GATTS_READ_EVT:
- ESP_LOGI(BLE_TAG, "ESP_GATTS_READ_EVT");
- printf("param->reg.app_id:%x\n", param->reg.app_id);
- printf("param->read.trans_id:%x\n", param->read.trans_id);
- printf("param->read.conn_id:%x\n", param->read.conn_id);
- printf("param->read.handle:%X\n", param->read.handle);
- if(handle_table[IDX_CHAR_VAL_C] == param->read.handle)
- {
- printf("IDX_CHAR_VAL_C\n");
- uint8_t buf[] = "[my_data_less_150_length]";
- esp_gatt_rsp_t rsp;
- memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
- rsp.attr_value.handle = param->read.handle;
- rsp.attr_value.len = sizeof(buf);
- memcpy(rsp.attr_value.value, buf, sizeof(buf));
- printf("rsp.attr_value.value: %s\n",rsp.attr_value.value);
- esp_ble_gatts_send_response(gatts_if, param->read.conn_id, param->read.trans_id,
- ESP_GATT_OK, &rsp);
- }
- else if(avocado_handle_table[IDX_CHAR_CFG_C] == param->read.handle)
- {
- printf("IDX_CHAR_CFG_C\n");
- }
- break;
Here is what I got in output when trying read characteristic value: