Posts

Post not yet marked as solved
1 Replies
1k Views
Hello, I'm working on a project where the iPhone is in a peripheral role. During some testing I encountered different behaviours between iOS 12 and iOS 13 in following testscenario: Start advertising Turn BLE off from control center Turn BLE on fron control center Tested with: iPhone 6+ (iOS 12.2) iPhone 8 (iOS 12.1) iPhone X (iOS 13.2.3) iOS 12: It seems like the stack automatically restarts the advertising when the BLE is turned on. When there is a BLE state change I check whether the peripheral is advertising. The call isAdvertising() returns false: 07-29 11:00:30.111 | BluetoothLink | D(💙) | [99] Peripheral isAdvertising: false When I then try to call start advertising I receive following error in the delegate: 07-29 11:00:30.136 | BluetoothLink | D(💙) | [514] Peripheral manager did start advertising with error: Optional(Error Domain=CBErrorDomain Code=9 "Advertising has already started." UserInfo={NSLocalizedDescription=Advertising has already started.}) iOS 13: When the BLE is turned back on, the advertising won't be restarted. When I call isAdvertising() it also returns false. Once I start the advertising again it calls the delegate didStartAdvertising without an error. Are there any changes in the OS which could explain such a behaviour? How should I handle the different behaviour? Is it inteded from the OS to automatically restart the advertising? Should I just call stopAdvertising everytime before starting the advertisement? Would this approach have negative side effects on the BLE stack? Thank you for the support. Regards, Sebastian P
Posted Last updated
.
Post not yet marked as solved
0 Replies
181 Views
Hello, I'm working on a project where the iPhone is acting as the peripheral device. During some testing I observed a strange behaviour where I wasn't able to find a solution. Testscenario: iPhone is connected and paired to the central Change the time on the iPhone (one day back) Go to the application and turn the BLE off from the control center Turn the BLE on from the control center When the PeripheralManager changes its state to poweredOff, the app doesn't call any method on the PeripheralManager (as stated in the Apple Developer Documentation). When the state changes back to poweredOn, the app will remove all services on the PeripheralManager, create new CBMutableCharacteristics, add those to the PeripheralManager and restart the advertising. Expected behaviour would be that the central starts a new connection. Unfortunately it doesn't trigger a new connection when the iPhone time is changed. From the System BLE settings it looks like the central is connected all the time, even when the service is removed. When I don't change the time on the iPhone I can see in the System BLE settings that once the BLE is turned on and the app does the above mentioned operations, the central will disconnect and start a new connection. From my point of view it looks like the OS is doing some timebased checks which causes this strange behaviour. Did anyone else experience an issue with the BLE connection/reconnection when changing the BLE state from the control center + changing the time on the iPhone? Is this a bug in the OS? Best regards, Sebastian
Posted Last updated
.