Skip to content

Need to check that disconnected BLEClient doesn't try and use connection #228

Open
@nkolban

Description

@nkolban

Imagine the ESP32 is running as a BLE Client. It connects to the target BLE Server and reads and writes characteristics. All is well. Now imagine that the client is "disconnected" from the BLE Server. We will be notified that we have been disconnected. All good. However, what if the programmer then attempts to continue to read/write to the BLE Server now the connection is gone? We don't handle that at all.

Today, we interact with a BLE Server by getting a BLERemoteCharacteristic object and then calling its readValue() and writeValue() methods. Since we can't get a BLERemoteCharacteristic object without first connecting to the server, we don't have to worry about attempting to interact with the server without first having formed a connection. What we failed to appreciate is that having a BLERemoteCharacteristic NOW doesn't mean that this object will be good into the future. Specifically, it is no longer good once we have lost the connection. We need to maintain state in the client such that if the connection is lost, an attempt (mistakenly) by the programmer to use the connection is rejected.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions