Check Bluetooth power state

Taken from http://cocoadev.com/wiki/FindingBluetoothAvailability

Conflicts:
	src/io_mac.m
This commit is contained in:
Brodie Blackburn
2012-10-06 10:22:45 +10:00
committed by Lysann Schlegel
parent f6bbdb199d
commit ae001a43b3

View File

@@ -68,11 +68,18 @@
- (id) initWithMemory:(wiimote**)wiimotes_ maxDevices:(int)maxDevices_ timeout:(int)timeout_ { - (id) initWithMemory:(wiimote**)wiimotes_ maxDevices:(int)maxDevices_ timeout:(int)timeout_ {
self = [super init]; self = [super init];
if(self) { if(self) {
wiimotes = wiimotes_; if (![IOBluetoothHostController defaultController] ||
maxDevices = maxDevices_; [IOBluetoothHostController defaultController].powerState == kBluetoothHCIPowerStateOFF)
timeout = timeout_; {
WIIUSE_DEBUG("Bluetooth hardware not available.");
_running = NO; [self release];
self = nil;
} else {
wiimotes = wiimotes_;
maxDevices = maxDevices_;
timeout = timeout_;
_running = NO;
}
} }
return self; return self;
} }