diff --git a/src/classic/avrcp.h b/src/classic/avrcp.h index 4954079f9..e3793ffe8 100644 --- a/src/classic/avrcp.h +++ b/src/classic/avrcp.h @@ -167,6 +167,7 @@ typedef enum { } avrcp_pdu_id_t; typedef enum { + AVRCP_NOTIFICATION_EVENT_FIRST_INDEX = 0x01, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED = 0x01, // Change in playback status of the current track. AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED = 0x02, // Change of current track AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END = 0x03, // Reached end of a track @@ -180,7 +181,8 @@ typedef enum { AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b, // The Addressed Player has been changed, see 6.9.2. AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c, // The UIDs have changed, see 6.10.3.3. AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d, // The volume has been changed locally on the TG, see 6.13.3. - AVRCP_NOTIFICATION_EVENT_MAX_VALUE = 0x0e + AVRCP_NOTIFICATION_EVENT_MAX_VALUE = 0x0e, + AVRCP_NOTIFICATION_EVENT_LAST_INDEX = 0x0e } avrcp_notification_event_id_t; diff --git a/src/classic/avrcp_controller.c b/src/classic/avrcp_controller.c index b6c75bc53..f38078c6c 100644 --- a/src/classic/avrcp_controller.c +++ b/src/classic/avrcp_controller.c @@ -110,7 +110,7 @@ static void avrcp_controller_emit_supported_events(avrcp_connection_t * connecti uint8_t ctype = (uint8_t) AVRCP_CTYPE_RESPONSE_CHANGED_STABLE; uint8_t event_id; - for (event_id = (uint8_t) AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED; event_id < (uint8_t) AVRCP_NOTIFICATION_EVENT_MAX_VALUE; event_id++){ + for (event_id = (uint8_t) AVRCP_NOTIFICATION_EVENT_FIRST_INDEX; event_id < (uint8_t) AVRCP_NOTIFICATION_EVENT_LAST_INDEX; event_id++){ if ( (connection->remote_supported_notifications & (1<state = AVCTP_CONNECTION_OPENED; #ifdef ENABLE_LOG_INFO - // page, extention code (1) + // page, extension code (1) pos++; uint8_t unit_type = packet[pos] >> 3; uint8_t max_subunit_ID = packet[pos] & 0x07; @@ -1179,7 +1179,7 @@ static void avrcp_controller_handle_can_send_now(avrcp_connection_t * connection // send register notification if queued if (connection->notifications_to_register != 0){ uint8_t event_id; - for (event_id = 1; event_id <= AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED; event_id++){ + for (event_id = (uint8_t)AVRCP_NOTIFICATION_EVENT_FIRST_INDEX; event_id < (uint8_t)AVRCP_NOTIFICATION_EVENT_LAST_INDEX; event_id++){ if (connection->notifications_to_register & (1<notifications_to_register &= ~ (1 << event_id); avrcp_send_register_notification(connection, event_id);