When using CBCentralManager.cancelPeripheralConnection(peripheral) , disconnection is only for the application level. So can't connect again to the same device without turn off and on bluetooth.
I know that CBCentralManager?.retrieveConnectedPeripherals(withServices: ) function is there, but I need to connect to the exact same device( based on MAC address [ This I'm getting from advertising data ] ) not to any device with the specific service.
Is there any way to disconnect completely?
You don't need to disconnect completely.
You can just call connect(_:options:)
within centralManager:didDisconnectPeripheral:error:
. The device will be reconnected once it is visible again.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.