A number of fields (services, appearance, manufacturer, name) can appear
when a scan is requested. However there is only so much space in the
header so, if a user has configured multiple fields, some may be 'pushed'
into the active scan response which requires additional communication.
When iOS scans for BLE devices it can filter by services, and so services
must be in the advertising (as opposed to scan response) payload.
Allows `await channel.disconnected()`.
This also fixes a bug where connection._l2cap_channel wasn't being set to
None on disconnect.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replicates the failure described in #453 (which is fixed by #459.
Also adds a test for subscription.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows a server to write a characteristic and automatically
notify/indicate all subscribed clients.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
After a client does a successful `await char.notified()`, then before the
next call to `notified()` a notification arrives, then they call
`notified()` twice before the _next_ notification, the second call will
return None rather than waiting.
This applies the same fix as in 5a86aa5866
which solved a similar problem for server-side `char.written()`. Using
a deque is slightly overkill here, but it's consistent with the server
side, and also makes it very easy to support having a notification queue
in the future.
Also makes the client characteristic properly flags/properties-aware (i.e.
explicitly fail operations that aren't supported).
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This fixes a bug where an incoming write before `written` is awaited causes
`written` to return None. It also introduces a mechanism for a server to
"capture" all incoming written values (instead of only having access to the
most recent value).
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>