// if we don't have a Wiimote yet, try to discover it; if that
// fails, wait for a short period of time and try again
// if we don't have a Wiimote yet, try to discover it; if that
// fails, wait for a short period of time and try again
cerr << "Wiimote: Not discovered yet, press 1+2 to connect" << endl;
bdaddr_t bdaddr = {{ 0, 0, 0, 0, 0, 0 }};
wiimote = cwiid_open (&bdaddr, 0);
callback_thread_registered = false;
cerr << "Wiimote: Not discovered yet, press 1+2 to connect" << endl;
bdaddr_t bdaddr = {{ 0, 0, 0, 0, 0, 0 }};
wiimote = cwiid_open (&bdaddr, 0);
callback_thread_registered = false;
// a Wiimote was discovered
cerr << "Wiimote: Connected successfully" << endl;
// attach the WiimoteControlProtocol object to the Wiimote handle
if (cwiid_set_data (wiimote, this)) {
cerr << "Wiimote: Failed to attach control protocol" << endl;
// a Wiimote was discovered
cerr << "Wiimote: Connected successfully" << endl;
// attach the WiimoteControlProtocol object to the Wiimote handle
if (cwiid_set_data (wiimote, this)) {
cerr << "Wiimote: Failed to attach control protocol" << endl;