ble_spp_server read event error

tatsutaigu
Posts: 2
Joined: Tue Jan 28, 2020 9:06 am

ble_spp_server read event error

Postby tatsutaigu » Wed Jan 29, 2020 4:18 am

Hi,

I tried to add ESP_GATTS_READ_EVT process as below line.
https://github.com/espressif/esp-idf/bl ... emo.c#L499

Code: Select all

    	case ESP_GATTS_READ_EVT:
            ESP_LOGI(GATTS_TABLE_TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle);
            res = find_char_and_desr_index(p_data->read.handle);
            if(res == SPP_IDX_SPP_STATUS_VAL){
                //TODO:client read the status characteristic
            }
            else if(res == SPP_IDX_SPP_DATA_NTY_VAL){
                esp_gatt_rsp_t rsp;
                memset(&rsp, 0, sizeof(esp_gatt_rsp_t));
                rsp.attr_value.handle = param->read.handle;        
                rsp.attr_value.len = 4;
                rsp.attr_value.value[0] = 0xde;
                rsp.attr_value.value[1] = 0xed;
                rsp.attr_value.value[2] = 0xbe;
                rsp.attr_value.value[3] = 0xef;
                esp_ble_gatts_send_response(gatts_if, spp_conn_id, param->read.trans_id, ESP_GATT_OK, &rsp);
            }
       	 break;
However, I got below error message.
How do I resolve it?
I (708100) GATTS_SPP_DEMO: EVT 1, gatts if 3

I (708100) GATTS_SPP_DEMO: event = 1

I (708100) GATTS_SPP_DEMO: GATT_READ_EVT, conn_id 0, trans_id 7, handle 44

E (708120) BT_GATT: GATTS_SendRsp conn_id: 3 waiting for op_code = 00

E (708120) BT_APPL: Sending response failed

I (708130) GATTS_SPP_DEMO: EVT 21, gatts if 3

I (708130) GATTS_SPP_DEMO: event = 15

Who is online

Users browsing this forum: No registered users and 136 guests