Connecting to a Bluetooth Peripheral on the application level only.

Hi there!

My team and I are currently working on developing an iOS application that connects to our proprietary hardware using Bluetooth technology. During our development process, we encountered an issue related to the central manager's behavior. Specifically, the central manager only disconnects the peripheral device from the app level, leaving the connection active at the system level.

In the context of the cancelPeripheralConnection discussion, one of the reasons cited for not allowing the app to disconnect the peripheral from the system is as follows:

Because other apps may still have a connection to the peripheral, canceling a local connection doesn’t guarantee that the underlying physical link is immediately disconnected (source)

For our situation, the challenge lies in the fact that no other application should have access to this specific peripheral. It is designed exclusively for our system's use. To address this, our current workaround involves sending a custom disconnect command to our device via a designated characteristic. However, we are keen to explore if there's a way to establish the initial connection to the peripheral in a manner that avoids creating a system-level connection altogether.

Thank you for your assistance!

Liz

If the main concern is that after your app "disconnects" from the peripheral it will stay connected to the iOS device, and during that time another app can access that connection, that specific worry is not warranted. Even if the physical link is still established, even if your app is no longer running, the specific connection that was between your app and the peripheral is going to be pinned to your app and the specific process id which was used to establish that connection. So, it should not be possible for another app to grab that connection (any unknown as of yet security exploits notwithstanding).

A more realistic concern would be that the peripheral is not available for reconnection until the physical link is dropped.

But to send a "disconnect" command like you are doing is not wrong, and is the only way you can ensure the physical link is dropped first.

The concern is for the latter reason - we need the device to start advertising again after we send some reads & writes via the iOS app x peripheral connection. We'll stick with the sending a disconnect approach for now, but it would be great if there was a more formalized approach from Apple.

Connecting to a Bluetooth Peripheral on the application level only.
 
 
Q