I have an OSX app that does the following:
- Start the central manager
[[CBCentralManager alloc] initWithDelegate:queue:]
and wait for it to initialize. - Connect to a Bluetooth LE peripheral using
[CBCentralManager connectPeripheral:options:]
- Start the peripheral manager
[[CBPeripheralManager alloc] initWithDelegate:queue:options:]
and wait for it to initialize. - Add services to the peripheral manager
[CBPeripheralManager addService:]
and wait for them to finish being added. - Start advertising
[CBPeripheralManager startAdvertising:]
and wait for the result.
Now, my callback [CBPeripheralManagerDelegate peripheralManagerDidStartAdvertising:error:]
gets an error: “Error Domain=CBErrorDomain Code=0 "Unknown error." UserInfo=0x7fb23bf7ba50 {NSLocalizedDescription=Unknown error.}”.
However, if I call [CBCentralManager cancelPeripheralConnection:]
immediately before startAdvertising:
, then the error goes away.
Is it impossible for a Mac to act in both Central Role and Peripheral Role at the same time? Does this limitation also exist on iOS? Is this a hardware-specific limitation, or is this inherent in Bluetooth LE?
I am testing this on a Mid 2011 Mac Mini running OSX 10.9 Mavericks.