mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added delay between l2cap disconnection requests
This commit is contained in:
parent
c72c9a4578
commit
7ca5fcf048
1 changed files with 3 additions and 1 deletions
4
SPP.cpp
4
SPP.cpp
|
@ -72,9 +72,10 @@ void SPP::disconnect(){
|
||||||
// First the two L2CAP channels has to be disconencted and then the HCI connection
|
// First the two L2CAP channels has to be disconencted and then the HCI connection
|
||||||
if(RFCOMMConnected)
|
if(RFCOMMConnected)
|
||||||
pBtd->l2cap_disconnection_request(hci_handle,0x0A, rfcomm_scid, rfcomm_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle,0x0A, rfcomm_scid, rfcomm_dcid);
|
||||||
|
if(RFCOMMConnected && SDPConnected)
|
||||||
|
delay(1); // Add delay between commands
|
||||||
if(SDPConnected)
|
if(SDPConnected)
|
||||||
pBtd->l2cap_disconnection_request(hci_handle,0x0B, sdp_scid, sdp_dcid);
|
pBtd->l2cap_disconnection_request(hci_handle,0x0B, sdp_scid, sdp_dcid);
|
||||||
l2cap_event_flag = 0; // Reset flags
|
|
||||||
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
|
||||||
}
|
}
|
||||||
void SPP::ACLData(uint8_t* l2capinbuf) {
|
void SPP::ACLData(uint8_t* l2capinbuf) {
|
||||||
|
@ -430,6 +431,7 @@ void SPP::SDP_task() {
|
||||||
RFCOMMConnected = false;
|
RFCOMMConnected = false;
|
||||||
SDPConnected = false;
|
SDPConnected = false;
|
||||||
pBtd->hci_disconnect(hci_handle);
|
pBtd->hci_disconnect(hci_handle);
|
||||||
|
l2cap_event_flag = 0; // Reset flags
|
||||||
l2cap_sdp_state = L2CAP_SDP_WAIT;
|
l2cap_sdp_state = L2CAP_SDP_WAIT;
|
||||||
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
|
l2cap_rfcomm_state = L2CAP_RFCOMM_WAIT;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue