Allan, I experimented a bit further with the CoreBluetooth peripheral part of iOS 6. On iOS 6, indications did not work for me at all (the call returns yes, but the value is not received by the remote device). On iOS 6.1 beta 4, indications did work to some extent, but again got lost after sending too many of them What I do: - set up: 4 characteristics, 1 central connected and subscribed to all four characteristics, default connection parameters - updateValue:forCharacteristic:onSubscribedCentrals: on all of the characteristics - updateValue:forCharacteristic:onSubscribedCentrals: returns NO at some point - Delegate peripheralManagerIsReadyToUpdateSubscribers: is called - I perform the update that failed again, it returns YES now. - Central still does not receive the update. Workaround: - Add delays to all sending code, so that one indication is only sent every ~0.1 s. Of course, this is a workaround and won't guarantee success. What makes testing worse, is that the [XPC] Connection interrupted bug still exists, where the Bluetooth stack may suddenly reset (going through the Resetting => Offline => Online state cycle). Symptoms of the bug are that indications don't get through at all, but writes still seem to work to some extent. On the central side, the bug became quite rare, though, with iOS 6. Disconnecting from the peripheral side is still not possible (is there a workaround for it, like returning a certain error code in a write response, or deallocating the peripheral manager while it is still running?). I could not yet reproduce your "addService" problematic, but I suggest that it falls into the same category: buggy implementation of the CoreBluetooth framework. Etan On 11.01.2013, at 22:17, Allan Young <allany@adobe.com> wrote:
Etan,
Just to check, you're referring to peripheralManagerDidUpdateState, correct?
When my test app is running in Peripheral mode, and I switch that mode off (calling the "stopPeripheral" method I included below), I do not get a call to CBPeripheralManagerStatePoweredOff. Should I be?
peripheralManager:didAddService:error: is where I'm currently calling [startAdvertising]
I'm currently performing the setup of the service and the [addService] call in the CBPeripheralManagerStatePoweredOn state change.
-Allan
On 1/11/13 1:08 PM, "Etan Kissling" <kissling@oberon.ch> wrote:
Allan,
regarding the peripheralManagerIsReadyToUpdateSubscribers: delegate call: it is only called after updateValue:forCharacteristic:onSubscribedCentrals: returned NO. This could explain why this delegate method is not invoked for you. I previously thought that it is always called.
What happens if you
- put the [removeAllServices] into the peripheralManagerHasUpdateState: delegate method when the state is CBPeripheralManagerStatePoweredOff?,
- and the [startAdvertising] into the peripheralManager:didAddService:error: method?
- Also add the [addService] call into the peripheralManagerHasUpdatedState: delegate when the state is CBPeripheralManagerStatePoweredOn.
Etan
On 11.01.2013, at 21:49, Allan Young <allany@adobe.com> wrote:
I tried using the LightBlue app (BLExplr wasn't able to discover my service).
LightBlue reported the service the first three times that I added the service (I tore down my peripheral and then re-created the service in between each check).
After that, no more service detected.
To tear down the service, I call:
- (void) stopPeripheral { if ( self.peripheralManager ) {
if ( self.peripheralManager.isAdvertising ) [ self.peripheralManager stopAdvertising ];
[ self.peripheralManager removeAllServices ]; // Seems to have no effect on this issue self.peripheralManager = NULL; } }
... look correct?
Allan
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com