Device disconnected but not reporting by bleConnectionStatusHandler
doraemondavidlai opened this issue · 5 comments
Hi @doraemondavidlai, In order to get status for BLE connection you need to use the bleDelegate property of the ESPDevice object. First, create a class that conforms to the ESPBleDelegate
as shown below:
Then assign the instance of the above class to espDevice.bleDelegate
property before calling connect
. Make sure your BLEDelegate object remains in scope for the entire duration of provisioning in order to receive the callbacks.
@vikas-chandra-mnnit
Thanks for your reply. I do use this method to achieve what I need right now.
I mean... isn't espDevice.connectionStatus
status being update to .disconnected
when peripheral is disconnected? Or .disconnected
is only use to initialize the variable connectionStatus
?
@vikas-chandra-mnnit Thanks for your reply. I do use this method to achieve what I need right now. I mean... isn't
espDevice.connectionStatus
status being update to.disconnected
when peripheral is disconnected? Or.disconnected
is only use to initialize the variableconnectionStatus
?
We use the connectionStatus
variable to track the status internally while the user is trying to connect with ESP device. After connection also there are certain steps involved like reading the version information of the device. If the device is disconnected during this stage the espDevice.connect
completion handler will return the .disconnected state. However once espDevice.connect
returns with any status, it can no longer be used to track the connection status of the ESP device.
Ok, got it.
Thank you.