This ensures that the peripheral notifies subscribed clients when the
characteristic is written to.
Signed-off-by: Stephen More <stephen.more@gmail.com>
Mostly small cleanups to put each top-level import on its own line. But
explicitly disable the lint for examples/tests which insert the current
directory into the path before importing.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Most of these look like they were used for print debugging and then kept in
when the print statements were removed or commented.
Some look like missing or incomplete functionality, these have been marked
with comments where possible.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Previously a BufferedCharacteristic could only be read by the client, where
it should have been writeable. This makes it support all ops (read / write
/ write-with-response, etc).
Adds a test to check the max_len and append functionality of
BufferedCharacteristic.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
In micropython/micropython#11239 we added support for passing data to
gatts_indicate (to make it match gatts_notify).
This adds the same to aioble.
Also update the documentation to mention this (and fix some mistakes and
add a few more examples).
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Removes the workaround for micropython/issues/6864.
Sets the default flags for discovered descriptors to be WRITE,
so that d.write() will implicitly set response=True.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Adds missing "duration_ms" argument to the example, and a second example
that shows the "interval_us" / "window_us" and also active scan.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
- `_FLAG_WRITE` was incorrectly `_FLAGS_WRITE`
- `response` should be defaulted to `None` rather than `False` in order
to detect that when it is unspecified.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaces the options that could be specified previously to include
and require.
The `aioble` package now provides everything. For a minimal install, the
individual components can now be installed or require()'ed explicitly.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaced the per-characteristic queues with a single shared queue,
which means that the characteristics will return from `written()` in the
exact order that the original writes arrived, even if the writes are
occuring across multiple different characteristics.
This work was funded by Planet Innovation.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The `bluetooth` module replaced the def_handle field with end_handle
in the characteristic result IRQ. Use this when querying for
descriptors.
In the case where this is not available (older versions of micropython)
continue the existing behavior of searching just past the value handle,
although decrease this to +2 to avoid finding other characteristic's
descriptors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Uses the new require()/package()/module() functions from manifestfile.py.
Add manifest.py for iperf3 and pyjwt.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2015-01-01 07:45:46.790 INFO Received OLCP_OP_FIRST
2015-01-01 07:45:46.979 ERROR Error in ble_write_listener
Traceback (most recent call last):
File "aioble/server.py", line 223, in indicate
NameError: name 'GattError' isn't defined
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>