Wednesday, 15 May 2013

connection - Why, sometimes, do I need to restart the iOS Bluetooth (using the system button) to make my central manager able to connect successfully? -


I am developing an application on iOS and OS X Yosemite which is using CoreBluetooth on iOS and IOBluetooth on Mac . The iOS app plays the "central" role, while the Mac app is playing the "peripheral" role.

Actually, the iOS app (central) started a scan to find an external device and when Mac adware external data, central connects it and can search its services and features.

My problem is that sometimes, I do not know when the iOS app starts to scan the Mac ad and when it finds it (this step works all the time), it connects it Tries to do but never succeeds

To be able to successfully connect it again to peripherals, I have to close and then Bluetooth from the iOS button.

Another strange thing: imagine the center in the same situation (try to connect with success). If I click on the network icon (with the WiFi symbol) in the system status bar, it will display a list of all available WiFi networks, and when it adds the list as "personal hotspot", then on OS X. At this time the central (which is on the iPhone) manages to connect peripheral (MAC).

WiFi menu with available iPhone hotspot

Along with, app usage has been compromised because randomly the iPhone will not be able to connect to the Mac.

I spent many days on the internet (Google, Stackoverflow, ...) to find similar cases. I read a lot of articles and tried many things like stopping the scan and starting it again if the connection was not successful for example after 10 seconds.

Tell me if my question is not clear. I will update if necessary.

Thank you very much for your help. I really have to find a way to fix it.

I do not have any answer (and not enough representative to comment) but for months I I am experiencing a very similar problem. My iOS app, which is playing a central role, sometimes fails to search for services on peripherals (Linux), which can only be fixed by Bluetooth / Bluetooth on their IOS device via Bluetooth / Power Cycle. . After blurring Bluetooth radio, peripheral searching seems to work perfectly.

I have got two reproducible cases: (1) If I swap the service being fully advertised on my peripherals (i.e. changing the service UUID and all the features) then the IOS Peripheral During this scan, this new service will detect peripherals, but service discovery fails. I think peripheral: didDiscoverServices is applied, but the list of services is empty for this peripheral (2) If on my peripheral, I either modify the list of attributes (add a new one, remove one) The app absolutely does not care about this change. During the discovery of attributes, a list of attributes (first amendment) is presented. Then, Bluetooth radio power-cycling on the iOS device looks the only one that fixes it.

It seems as if IOS BTEL is caching peripheral services and features, which is a new peripheral and the only way to flush this cache is to bluetooth radio power cycle.


No comments:

Post a Comment