mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Merge branch 'paring'
This commit is contained in:
commit
85a6c43d4e
1 changed files with 15 additions and 6 deletions
21
BTD.cpp
21
BTD.cpp
|
@ -589,16 +589,25 @@ void BTD::HCI_event_task() {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EV_AUTHENTICATION_COMPLETE:
|
case EV_AUTHENTICATION_COMPLETE:
|
||||||
if(pairWithWii && !connectToWii) {
|
if(!hcibuf[2]) { // Check if paring was successful
|
||||||
|
if(pairWithWii && !connectToWii) {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nPairing successful with Wiimote"), 0x80);
|
Notify(PSTR("\r\nPairing successful with Wiimote"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
connectToWii = true; // Used to indicate to the Wii service, that it should connect to this device
|
connectToWii = true; // Used to indicate to the Wii service, that it should connect to this device
|
||||||
} else if(pairWithHIDDevice && !connectToHIDDevice) {
|
} else if(pairWithHIDDevice && !connectToHIDDevice) {
|
||||||
#ifdef DEBUG_USB_HOST
|
#ifdef DEBUG_USB_HOST
|
||||||
Notify(PSTR("\r\nPairing successful with HID device"), 0x80);
|
Notify(PSTR("\r\nPairing successful with HID device"), 0x80);
|
||||||
#endif
|
#endif
|
||||||
connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
|
connectToHIDDevice = true; // Used to indicate to the BTHID service, that it should connect to this device
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#ifdef DEBUG_USB_HOST
|
||||||
|
Notify(PSTR("\r\nParing Failed: "), 0x80);
|
||||||
|
D_PrintHex<uint8_t > (hcibuf[2], 0x80);
|
||||||
|
#endif
|
||||||
|
hci_disconnect(hci_handle);
|
||||||
|
hci_state = HCI_DISCONNECT_STATE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* We will just ignore the following events */
|
/* We will just ignore the following events */
|
||||||
|
|
Loading…
Reference in a new issue