What, exactly, is a BLE connected device on iOS?

2020-04-03 11:05发布

问题:

The CBCentralManager retrieveConnectedPeripherals method says it gets "the list of the peripherals currently connected to the system." The definition of system is a bit ambiguous here.

Does this mean I get a list of peripherals connected to my app, or a list of peripherals connected to any app?

If I can get peripherals connected to another app, does this also mean multiple apps can connect to the same peripheral?

Can this only happen if the app is in the foreground, or do I need to allow for the possibility that a background app is sending commands to a peripheral I think my app owns?

回答1:

BLE 4.0 enabled devices are usually connected with CBCentralManager unboundly. What is bounded and unbounded connection, you can know from this link. One BLE 4.0 enabled device can be connected with only one master device thus enhancing secured connectivity. You should follow this link. Whether in foreground of background, if the connection exists, the BLE slave device won't get connected with another app or device.