From dac572e657531a36bae1e7b307456cf19d320869 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Wed, 13 Oct 2021 12:02:21 +0200 Subject: [PATCH] avrcp_controller: sent interim notification only once, as initial value --- src/classic/avrcp.h | 2 ++ src/classic/avrcp_controller.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/classic/avrcp.h b/src/classic/avrcp.h index 2ce965588..38142f92c 100644 --- a/src/classic/avrcp.h +++ b/src/classic/avrcp.h @@ -553,6 +553,8 @@ typedef struct { bool press_and_hold_cmd_release; uint16_t notifications_enabled; + uint16_t initial_status_reported; + uint16_t notifications_to_register; uint16_t notifications_to_deregister; uint8_t notifications_transaction_label[AVRCP_NOTIFICATION_EVENT_MAX_VALUE+1]; diff --git a/src/classic/avrcp_controller.c b/src/classic/avrcp_controller.c index d0c0d5f52..17ee6ea11 100644 --- a/src/classic/avrcp_controller.c +++ b/src/classic/avrcp_controller.c @@ -664,10 +664,15 @@ avrcp_controller_handle_notification(avrcp_connection_t *connection, avrcp_comma avrcp_notification_event_id_t event_id = (avrcp_notification_event_id_t) payload[pos++]; uint16_t event_mask = (1 << event_id); uint16_t reset_event_mask = ~event_mask; + switch (ctype){ case AVRCP_CTYPE_RESPONSE_INTERIM: // register as enabled connection->notifications_enabled |= event_mask; + if ( (connection->initial_status_reported & event_mask) > 0 ){ + return; + } + connection->initial_status_reported |= event_mask; break; case AVRCP_CTYPE_RESPONSE_CHANGED_STABLE: // received change, event is considered deregistered