Do not hardcode identifier when disconnecting

This commit is contained in:
Kristian Lauszus 2013-12-13 10:38:41 +01:00
parent 413e65a44f
commit 1ef78c3674
4 changed files with 8 additions and 8 deletions

View file

@ -53,7 +53,7 @@ void BTHID::Reset() {
void BTHID::disconnect() { // Use this void to disconnect any of the controllers
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
Reset();
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
}

View file

@ -218,14 +218,14 @@ void PS3BT::Reset() {
l2cap_event_flag = 0; // Reset flags
l2cap_state = L2CAP_WAIT;
// Needed for PS3 Dualshock Controller commands to work via bluetooth
// Needed for PS3 Dualshock Controller commands to work via Bluetooth
for (uint8_t i = 0; i < PS3_REPORT_BUFFER_SIZE; i++)
HIDBuffer[i + 2] = pgm_read_byte(&PS3_REPORT_BUFFER[i]); // First two bytes reserved for report type and ID
}
void PS3BT::disconnect() { // Use this void to disconnect any of the controllers
//First the HID interrupt channel has to be disconencted, then the HID control channel and finally the HCI connection
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
Reset();
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
}

View file

@ -73,13 +73,13 @@ void SPP::Reset() {
void SPP::disconnect() {
connected = false;
// First the two L2CAP channels has to be disconencted and then the HCI connection
// First the two L2CAP channels has to be disconnected and then the HCI connection
if (RFCOMMConnected)
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, rfcomm_scid, rfcomm_dcid);
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, 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);
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, sdp_scid, sdp_dcid);
l2cap_sdp_state = L2CAP_DISCONNECT_RESPONSE;
}

View file

@ -126,7 +126,7 @@ void WII::disconnect() { // Use this void to disconnect any of the controllers
} else
timer = millis(); // Don't wait
// First the HID interrupt channel has to be disconnected, then the HID control channel and finally the HCI connection
pBtd->l2cap_disconnection_request(hci_handle, 0x0A, interrupt_scid, interrupt_dcid);
pBtd->l2cap_disconnection_request(hci_handle, ++identifier, interrupt_scid, interrupt_dcid);
Reset();
l2cap_state = L2CAP_INTERRUPT_DISCONNECT;
}