Question

Is there a recommended way for CBPeripheralManager to terminate a connection. The best way I have found so far is simply not to respond to dynamic value, then the BLE stack seems to close the connection, but that seems rather crude.

There must be a better way?

Was it helpful?

Solution

No, you can't forcefully close a connection in a clear way from the peripheral side. There is no API for it.

You can break the connection abruptly by not responding to a request, which results in disconnection at most after 30 seconds. This is the standard behavior defined by the Bluetooth specification Vol.3 Part F 3.3.3

A transaction not completed within 30 seconds shall time out. Such a transaction shall be considered to have failed and the local higher layers shall be informed of this failure. No more attribute protocol requests, commands, indica- tions or notifications shall be sent to the target device on this ATT Bearer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top