BLE/GATT doesn't send response error
Posted: Mon Feb 12, 2018 8:25 pm
Can't seem to get my BLE app (ex. ble_spp_server) to send response errors. An "attribute not found" error response should be sent in response to a Read by Type request on handles 1-5 for GATT Include Declaration (0x2803). There are 5 bytes that should be sent.
01 - Error Response
08 - Op code in error
0001 - Handle in error
0A - Attribute not found
I see these 5 bytes all the way down to...
UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
Which returns with success. But I never see them on the "air". I.E. a packet sniffer sees the request from the client, but I never see the packet from ble_spp_server with the error response.
Here's a snippet of a trace log....
E (22778) BT: gatt_send_error_rsp, err_code:0xa, op_code:8, handle:0x1
E (22788) BT: gatt_send_error_rsp, event:0xd050, len:5, ofs:13
E (22788) BT: attp_send_sr_msg, event:0xd050, len:5, ofs:13
E (22798) BT: attp_send_msg_to_l2cap, event:0xd050, len:5, ofs:13
E (22808) BT: [01 08 01 00 0a] //!!!!!!!! these are the five correct bytes to send !!!!!!!
E (22808) BT: L2CA_SendFixedChnlData() CID: 0x0004 BDA: 842e27662c94
E (22818) BT: l2c_link_check_send_pkts
E (22818) BT: partial_segment_being_sent=0,link_state=4,power_mode=0
E (22828) BT: l2c_link_send_to_lower
E (22828) BT: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0
E (22838) BT: L2CA_SendFixedChnlData() L2CAP_DW_SUCCESS
I'm getting near the end of my figuring this out. But I suspect it accounts for the reason I've been struggling to get the ESP32 to connect to any BLE app on the phone. The ESP BLE server connects, but it appears to disconnect when it goes to send the error response.
01 - Error Response
08 - Op code in error
0001 - Handle in error
0A - Attribute not found
I see these 5 bytes all the way down to...
UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf)
Which returns with success. But I never see them on the "air". I.E. a packet sniffer sees the request from the client, but I never see the packet from ble_spp_server with the error response.
Here's a snippet of a trace log....
E (22778) BT: gatt_send_error_rsp, err_code:0xa, op_code:8, handle:0x1
E (22788) BT: gatt_send_error_rsp, event:0xd050, len:5, ofs:13
E (22788) BT: attp_send_sr_msg, event:0xd050, len:5, ofs:13
E (22798) BT: attp_send_msg_to_l2cap, event:0xd050, len:5, ofs:13
E (22808) BT: [01 08 01 00 0a] //!!!!!!!! these are the five correct bytes to send !!!!!!!
E (22808) BT: L2CA_SendFixedChnlData() CID: 0x0004 BDA: 842e27662c94
E (22818) BT: l2c_link_check_send_pkts
E (22818) BT: partial_segment_being_sent=0,link_state=4,power_mode=0
E (22828) BT: l2c_link_send_to_lower
E (22828) BT: TotalWin=9,Hndl=0x0,Quota=10,Unack=1,RRQuota=0,RRUnack=0
E (22838) BT: L2CA_SendFixedChnlData() L2CAP_DW_SUCCESS
I'm getting near the end of my figuring this out. But I suspect it accounts for the reason I've been struggling to get the ESP32 to connect to any BLE app on the phone. The ESP BLE server connects, but it appears to disconnect when it goes to send the error response.