Exit if inquiry finished

This commit is contained in:
Kristian Lauszus 2012-10-08 15:32:42 +02:00
parent 9f20111d53
commit 091650d0a1
2 changed files with 13 additions and 2 deletions

12
BTD.cpp
View file

@ -354,7 +354,17 @@ void BTD::HCI_event_task() {
} }
break; break;
case EV_INQUIRY_COMPLETE: // We don't use this for anything case EV_INQUIRY_COMPLETE:
if(inquiry_counter >= 5) {
inquiry_counter = 0;
#ifdef DEBUG
Notify(PSTR("\r\nCouldn't find Wiimote"));
#endif
connectToWii = false;
pairWithWii = false;
hci_state = HCI_SCANNING_STATE;
}
inquiry_counter++;
break; break;
case EV_INQUIRY_RESULT: case EV_INQUIRY_RESULT:

1
BTD.h
View file

@ -244,6 +244,7 @@ private:
uint16_t hci_counter; // counter used for bluetooth hci reset loops uint16_t hci_counter; // counter used for bluetooth hci reset loops
uint8_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset uint8_t hci_num_reset_loops; // this value indicate how many times it should read before trying to reset
uint16_t hci_event_flag; // hci flags of received bluetooth events uint16_t hci_event_flag; // hci flags of received bluetooth events
uint8_t inquiry_counter;
uint8_t hcibuf[BULK_MAXPKTSIZE];//General purpose buffer for hci data uint8_t hcibuf[BULK_MAXPKTSIZE];//General purpose buffer for hci data
uint8_t l2capinbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap in data uint8_t l2capinbuf[BULK_MAXPKTSIZE];//General purpose buffer for l2cap in data