Getting "GATTS_SendRsp conn_id: 3 waiting for op_code = 0a"
Posted: Wed May 24, 2023 8:50 am
Hello All,
I am traying to send more then 20byte in chunk using BLE GAP and GATTS profile but getting below error while doing,
ESPIDF: version 3.2
can anyone tell me that how i can send more then 20 char, i will be thank full if anyone can help me out from this issue.
Thanks.
I am traying to send more then 20byte in chunk using BLE GAP and GATTS profile but getting below error while doing,
ESPIDF: version 3.2
Sharing snippet codeE (24930) BT_GATT: GATTS_SendRsp conn_id: 3 waiting for op_code = 0a
E (24930) BT_APPL: Sending response failed
Code: Select all
case ESP_GATTS_READ_EVT: {
ESP_LOGI(GATTS_TAG,"<<<<<<<<<<<<<< Event: %d", event);
esp_gatt_rsp_t rsp;
memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
char ctest[30]={'a','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','b','c','c','c','c','c','c','c','c','c'};
int offset = 0;
int remaining_len = strlen(ctest);
ESP_LOGI(GATTS_TAG,"<<<<<<<<<<<<<< remaining_len: %d", remaining_len);
while (remaining_len > 0)
{
int chunk_len = remaining_len > 20 ? 20 : remaining_len;
ESP_LOGI(GATTS_TAG, "chunk_len:%d",chunk_len);
ESP_LOGI(GATTS_TAG, "offset:%d",offset);
ESP_LOGI(GATTS_TAG, "ctest:%s",ctest);
esp_ble_gatts_send_response(gatts_if, param->read.conn_id, ESP_GATT_OK, offset, (uint8_t *)&ctest[offset]);
offset += chunk_len;
remaining_len -= chunk_len;
vTaskDelay(pdMS_TO_TICKS(1000)); // Delay between sending chunks (adjust as needed)
}
Thanks.