-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
extmod/modbluetooth: Fixes for bluekitchen/btstack. #11239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Code size report:
|
This is important to support aioble, which requires this to work (which is why aioble only previously worked on NimBLE). See also micropython/micropython-lib#643 for a corresponding update to aioble related to other fixes. |
514950c
to
8bfc9a8
Compare
I reverted the commit that changed |
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #11239 +/- ##
=======================================
Coverage 98.50% 98.50%
=======================================
Files 155 155
Lines 20549 20549
=======================================
Hits 20241 20241
Misses 308 308
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
I also pushed a commit to tidy up a comment. |
Makes gatts_notify and gatts_indicate work in the same way: by default they send the DB value, but you can manually override the payload. In other words, makes gatts_indicate work the same as gatts_notify. Note: This removes support for queuing notifications and indications on btstack when the ACL buffer is full. This functionality will be reimplemented in a future commit. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This adds a mechanism to track a pending notify/indicate operation that is deferred due to the send buffer being full. This uses a tracked alloc that is passed as the content arg to the callback. This replaces the previous mechanism that did this via the global pending op queue, shared with client read/write ops. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaces the previous pending operation queue (that used to also be shared with pending server notify/indicate ops) with a single pending operation per connection. This allows the value handle to be correctly passed to the Python-level events. Also re-structure GATT client event handling to simplify the packet handler functions. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
On unix, time.sleep is implemented as select(timeout=<time>) which means that it does not run the poll hook during sleeping. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
btstack only supports central-initiated, so this allows us to have a test that works on both (ble_mtu.py), and then another one for just the NimBLE supported behavior (ble_mtu_peripheral.py). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There was no event handler for central-initiated MTU exchange. Fix truncation of notify/indicate to match NimBLE. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Obtaining the end_handle was added in cacc96d. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows gatts_write(..., send_update=True) to work, which will send notifications/indications to subscribed clients. btstack already created the CCCD but writes to it were ignored. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The att_flags for descriptors does not use the same bitfield as for characteristics. This was leading to NimBLE descriptors getting the wrong flags set. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This is unused in the client, only needed in the server. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
- Use HCI_TRACE macro consistently. - Use the same colour formatting. - Add a tool to convert to .pcap for Wireshark. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Even if the user doesn't call ble.gatts_register_services, always provide the default services. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
OK. I've squashed out the commit and the revert. Also rebased the other changes. |
OK, thanks for updating, looks good now! |
Merged! |
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>
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>
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>
This PR brings btstack functionality up to match NimBLE (excluding L2CAP channels). This needed to be done anyway, but is high priority for BLE on the Pico W (see #10739).
The three main fixes are:
Also
TODO: More testing of btstack pairing/bonding.
This work was funded through GitHub Sponsors.