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_ {
self = [super init];
if(self) {
wiimotes = wiimotes_;
maxDevices = maxDevices_;
timeout = timeout_;
_running = NO;
if (![IOBluetoothHostController defaultController] ||
[IOBluetoothHostController defaultController].powerState == kBluetoothHCIPowerStateOFF)
{
WIIUSE_DEBUG("Bluetooth hardware not available.");
[self release];
self = nil;
} else {
wiimotes = wiimotes_;
maxDevices = maxDevices_;
timeout = timeout_;
_running = NO;
}
}
return self;
}