summaryrefslogtreecommitdiff
path: root/extmod/nimble/modbluetooth_nimble.h
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-08-09 16:50:58 +1000
committerDamien George <damien@micropython.org>2022-09-09 11:24:24 +1000
commitcacc96d98c2a70dc7e5194331ea70746c39746ec (patch)
tree08e45e414002f694d5510e4f7f00540df799fd04 /extmod/nimble/modbluetooth_nimble.h
parent82fc16f2982b38f6dfd0145b8012b34308d13605 (diff)
extmod/modbluetooth: Replace def_handle with end_handle in char IRQ.
This is technically a breaking change, but: a) We need the end handle to do descriptor discovery properly. b) We have no possible use for the existing definition handle in the characteristic result IRQ. None of the methods can use it, and therefore no existing code should be using it in a way that changing it to a different integer value should break. Unfortunately NimBLE doesn't make it easy to get the end handle, so also implement a mechanism to use the following characteristic to calculate the previous characteristic's end handle. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'extmod/nimble/modbluetooth_nimble.h')
-rw-r--r--extmod/nimble/modbluetooth_nimble.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/extmod/nimble/modbluetooth_nimble.h b/extmod/nimble/modbluetooth_nimble.h
index 15648a995..d9bef6492 100644
--- a/extmod/nimble/modbluetooth_nimble.h
+++ b/extmod/nimble/modbluetooth_nimble.h
@@ -31,6 +31,13 @@
#define MP_BLUETOOTH_NIMBLE_MAX_SERVICES (8)
+typedef struct _mp_bluetooth_nimble_pending_characteristic_t {
+ uint16_t value_handle;
+ uint8_t properties;
+ mp_obj_bluetooth_uuid_t uuid;
+ uint8_t ready;
+} mp_bluetooth_nimble_pending_characteristic_t;
+
typedef struct _mp_bluetooth_nimble_root_pointers_t {
// Characteristic (and descriptor) value storage.
mp_gatts_db_t gatts_db;
@@ -44,6 +51,14 @@ typedef struct _mp_bluetooth_nimble_root_pointers_t {
struct _mp_bluetooth_nimble_l2cap_channel_t *l2cap_chan;
bool l2cap_listening;
#endif
+
+ #if MICROPY_PY_BLUETOOTH_ENABLE_GATT_CLIENT
+ // Workaround to allow us to get the end_handle of each characteristic
+ // during discovery. See mp_bluetooth_gattc_discover_characteristics().
+ uint16_t char_disc_end_handle;
+ const mp_obj_bluetooth_uuid_t *char_filter_uuid;
+ mp_bluetooth_nimble_pending_characteristic_t pending_char_result;
+ #endif
} mp_bluetooth_nimble_root_pointers_t;
enum {