问题描述
CBPeripheralManager
是否有终止连接的推荐方法。到目前为止,我发现的最好方法就是不响应动态值,然后BLE堆栈似乎关闭了连接,但这似乎很粗糙。
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.
更好的方法?
推荐答案
不,您不能从外围设备强制以清晰的方式强制关闭连接。没有API。
No, you can't forcefully close a connection in a clear way from the peripheral side. There is no API for it.
您可以通过不响应请求来突然断开连接,这最多会在30秒后断开连接。这是蓝牙规范第3卷F部分3.3.3定义的标准行为。
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
这篇关于终止连接CBPeripheralManager端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!