currantlabs / ble

BSD 3-Clause "New" or "Revised" License
210 stars 177 forks source link

Peripheral Disconnect in General (but also does not get picked up by blesh) #14

Open szyglowicz opened 8 years ago

szyglowicz commented 8 years ago

As a client, Is there a way to get the disconnect notification when a peripheral disconnects. I used blesh and it does not see the device go away. In all other libraries, there is a way to know if the device goes away via a callback notification. I assume there is one here as well. And there may be other notifications as well that may be of interest.

szyglowicz commented 8 years ago

Has there been any thought on surfacing an event for a disconnected peripheral when acting as the central?

roylee17 commented 8 years ago

Since we've turned most of the GATT level API synchronous, the only asynchronous event is disconnected by remote peripheral, or the signal breaks up.

Let me know if the following API works in your use case.

// Disconnected returns a channel, which is closed when the client disconnects.
ble.Client.Disconnected() <-chan struct {}
szyglowicz commented 8 years ago

Anything that fits your pattern should be fine

Steve

On Sep 26, 2016, at 4:41 AM, Tzu-Jung Lee notifications@github.com wrote:

Since we've turned most of the GATT level API synchronous, the only asynchronous event is disconnected by remote peripheral, or the signal breaks up.

Let me know if the following API works in your use case.

// Disconnected returns a channel, which is closed when the client disconnects. ble.Client.Disconnected() <-chan struct {} — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.