summaryrefslogtreecommitdiffstatshomepage
path: root/extmod/btstack
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-07-15 11:23:23 +1000
committerDamien George <damien@micropython.org>2022-07-20 17:01:37 +1000
commitbdad63eda2ddcf8cc6ac51bb463ecb695f12c86c (patch)
tree3073c8527289be890482961f54590044dc741d04 /extmod/btstack
parentb41cfea02ab9f566785da5e5e0863d009f3ac527 (diff)
downloadmicropython-bdad63eda2ddcf8cc6ac51bb463ecb695f12c86c.tar.gz
micropython-bdad63eda2ddcf8cc6ac51bb463ecb695f12c86c.zip
extmod/btstack: Fix descriptor discovery handle range and events.
This fixes two problems with the BTstack implementation of descriptor discovery: - The call to gatt_client_discover_characteristic_descriptors needs to have value_handle set to the starting handle (actually characteristic handle) to start the search from. - The BTstack event for a descriptor query result is GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT. With this change the test tests/multi_bluetooth/ble_subscribe.py now passes when BTstack is instance1 (for BTstack to pass as instance0 requires gatts_write to support sending an update on BTstack). Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/btstack')
-rw-r--r--extmod/btstack/modbluetooth_btstack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extmod/btstack/modbluetooth_btstack.c b/extmod/btstack/modbluetooth_btstack.c
index c07cc8c10c..d41c671d68 100644
--- a/extmod/btstack/modbluetooth_btstack.c
+++ b/extmod/btstack/modbluetooth_btstack.c
@@ -451,7 +451,7 @@ STATIC void btstack_packet_handler(uint8_t packet_type, uint8_t *packet, uint8_t
gatt_event_characteristic_query_result_get_characteristic(packet, &characteristic);
mp_obj_bluetooth_uuid_t characteristic_uuid = create_mp_uuid(characteristic.uuid16, characteristic.uuid128);
mp_bluetooth_gattc_on_characteristic_result(conn_handle, characteristic.start_handle, characteristic.value_handle, characteristic.properties, &characteristic_uuid);
- } else if (event_type == GATT_EVENT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT) {
+ } else if (event_type == GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT) {
DEBUG_printf(" --> gatt descriptor query result\n");
uint16_t conn_handle = gatt_event_all_characteristic_descriptors_query_result_get_handle(packet);
gatt_client_characteristic_descriptor_t descriptor;
@@ -1358,9 +1358,9 @@ int mp_bluetooth_gattc_discover_descriptors(uint16_t conn_handle, uint16_t start
}
gatt_client_characteristic_t characteristic = {
- // Only start/end handles needed for gatt_client_discover_characteristic_descriptors.
- .start_handle = start_handle,
- .value_handle = 0,
+ // Only value/end handles needed for gatt_client_discover_characteristic_descriptors.
+ .start_handle = 0,
+ .value_handle = start_handle,
.end_handle = end_handle,
.properties = 0,
.uuid16 = 0,