From 7ca5fcf0485a5734c702d286bb24f2ae06cb6c3a Mon Sep 17 00:00:00 2001 From: Kristian Lauszus Date: Fri, 10 Aug 2012 01:02:53 +0200 Subject: [PATCH] Added delay between l2cap disconnection requests --- SPP.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SPP.cpp b/SPP.cpp index 061a85de..d13e2621 100644 --- a/SPP.cpp +++ b/SPP.cpp @@ -72,9 +72,10 @@ void SPP::disconnect(){ // First the two L2CAP channels has to be disconencted and then the HCI connection if(RFCOMMConnected) pBtd->l2cap_disconnection_request(hci_handle,0x0A, rfcomm_scid, rfcomm_dcid); + if(RFCOMMConnected && SDPConnected) + delay(1); // Add delay between commands if(SDPConnected) pBtd->l2cap_disconnection_request(hci_handle,0x0B, sdp_scid, sdp_dcid); - l2cap_event_flag = 0; // Reset flags l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE; } void SPP::ACLData(uint8_t* l2capinbuf) { @@ -430,6 +431,7 @@ void SPP::SDP_task() { RFCOMMConnected = false; SDPConnected = false; pBtd->hci_disconnect(hci_handle); + l2cap_event_flag = 0; // Reset flags l2cap_sdp_state = L2CAP_SDP_WAIT; l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT; }