diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index d870b01a8..677d83a8b 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -470,6 +470,10 @@ void gatt_client_listen_for_characteristic_value_updates(gatt_client_notificatio btstack_linked_list_add(&gatt_client_value_listeners, (btstack_linked_item_t*) notification); } +void gatt_client_stop_listening_for_characteristic_value_updates(gatt_client_notification_t * notification){ + btstack_linked_list_remove(&gatt_client_value_listeners, (btstack_linked_item_t*) notification); +} + static void emit_event_to_registered_listeners(hci_con_handle_t con_handle, uint16_t attribute_handle, uint8_t * packet, uint16_t size){ btstack_linked_list_iterator_t it; btstack_linked_list_iterator_init(&it, &gatt_client_value_listeners); diff --git a/src/ble/gatt_client.h b/src/ble/gatt_client.h index a1f6f3fc8..5c59f191f 100644 --- a/src/ble/gatt_client.h +++ b/src/ble/gatt_client.h @@ -341,6 +341,12 @@ uint8_t gatt_client_write_client_characteristic_configuration(btstack_packet_han */ void gatt_client_listen_for_characteristic_value_updates(gatt_client_notification_t * notification, btstack_packet_handler_t packet_handler, hci_con_handle_t con_handle, gatt_client_characteristic_t * characteristic); +/** + * @brief Stop listening to characteristic value updates registered with gatt_client_listen_for_characteristic_value_updates + * @param notification struct used in gatt_client_listen_for_characteristic_value_updates + */ +void gatt_client_stop_listening_for_characteristic_value_updates(gatt_client_notification_t * notification); + /** * @brief -> gatt complete event */