diff --git a/src/btstack_defines.h b/src/btstack_defines.h index 9c2ece8cc..8fae33f80 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -2124,6 +2124,125 @@ typedef uint8_t sm_key_t[16]; /** AVRCP Subevent */ +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param play_status + */ +#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED 0x01 + +/** + * @format 121 + * @param subevent_code + * @param avrcp_cid + * @param command_type + */ +#define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED 0x02 + +/** + * @format 121 + * @param subevent_code + * @param avrcp_cid + * @param command_type + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_END 0x03 + +/** + * @format 121 + * @param subevent_code + * @param avrcp_cid + * @param command_type + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_START 0x04 + +/** + * @format 1214 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param playback_position If no track currently selected, then return 0xFFFFFFFF in the INTERIM response. + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED 0x05 + +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param battery_status see avrcp_battery_status_t + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED 0x06 + +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param system_status see avrcp_system_status_t + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED 0x07 + + +// Recquires 1 byte for num_attributes, followed by num_attributes tuples [attribute_id(1), value_id(1)], see avrcp_player_application_setting_attribute_id_t +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED 0x08 + +/** + * @format 121 + * @param subevent_code + * @param avrcp_cid + * @param command_type + */ +#define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED 0x09 + +/** + * @format 121 + * @param subevent_code + * @param avrcp_cid + * @param command_type + */ +#define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED 0x0A + +// AVRCP_SUBEVENT_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b, -- The Addressed Player has been changed, see 6.9.2. + +/** + * @format 1212 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param uid_counter of the currently browsed player + */ +#define AVRCP_SUBEVENT_NOTIFICATION_EVENT_UIDS_CHANGED 0x0C + +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param absolute_volume + */ +#define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED 0x0D + + +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param absolute_volume + */ +#define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE 0x10 + +/** + * @format 1211 + * @param subevent_code + * @param avrcp_cid + * @param command_type + * @param notification_id + */ +#define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE 0x11 + /** * @format 11B2 * @param subevent_code @@ -2131,14 +2250,14 @@ typedef uint8_t sm_key_t[16]; * @param bd_addr * @param avrcp_cid */ -#define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED 0x01 +#define AVRCP_SUBEVENT_CONNECTION_ESTABLISHED 0x12 /** * @format 12 * @param subevent_code * @param avrcp_cid */ -#define AVRCP_SUBEVENT_CONNECTION_RELEASED 0x02 +#define AVRCP_SUBEVENT_CONNECTION_RELEASED 0x13 /** * @format 12111 @@ -2148,7 +2267,7 @@ typedef uint8_t sm_key_t[16]; * @param repeat_mode * @param shuffle_mode */ -#define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE 0x03 +#define AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE 0x14 /** * @format 121441 @@ -2159,67 +2278,7 @@ typedef uint8_t sm_key_t[16]; * @param song_position * @param play_status */ - #define AVRCP_SUBEVENT_PLAY_STATUS 0x04 - -/** - * @format 1211 - * @param subevent_code - * @param avrcp_cid - * @param command_type - * @param play_status - */ -#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED 0x05 - -/** - * @format 121 - * @param subevent_code - * @param avrcp_cid - * @param command_type - */ -#define AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED 0x06 - -/** - * @format 121 - * @param subevent_code - * @param avrcp_cid - * @param command_type - */ -#define AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED 0x07 - -/** - * @format 121 - * @param subevent_code - * @param avrcp_cid - * @param command_type - */ -#define AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED 0x08 - -/** - * @format 1211 - * @param subevent_code - * @param avrcp_cid - * @param command_type - * @param absolute_volume - */ -#define AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED 0x09 - -/** - * @format 1211 - * @param subevent_code - * @param avrcp_cid - * @param command_type - * @param absolute_volume - */ -#define AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE 0x0A - -/** - * @format 1211 - * @param subevent_code - * @param avrcp_cid - * @param command_type - * @param notification_id - */ -#define AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE 0x0B + #define AVRCP_SUBEVENT_PLAY_STATUS 0x15 /** * @format 1211 @@ -2228,7 +2287,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param operation_id */ -#define AVRCP_SUBEVENT_OPERATION_START 0x0C +#define AVRCP_SUBEVENT_OPERATION_START 0x16 /** * @format 1211 @@ -2237,7 +2296,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param operation_id */ -#define AVRCP_SUBEVENT_OPERATION_COMPLETE 0x0D +#define AVRCP_SUBEVENT_OPERATION_COMPLETE 0x17 /** * @format 121 @@ -2245,28 +2304,28 @@ typedef uint8_t sm_key_t[16]; * @param avrcp_cid * @param command_type */ -#define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE 0x0E +#define AVRCP_SUBEVENT_PLAYER_APPLICATION_VALUE_RESPONSE 0x18 /** * @format 12 * @param subevent_code * @param avrcp_cid */ -#define AVRCP_SUBEVENT_COMPANY_IDS_QUERY 0x0F +#define AVRCP_SUBEVENT_COMPANY_IDS_QUERY 0x19 /** * @format 12 * @param subevent_code * @param avrcp_cid */ -#define AVRCP_SUBEVENT_EVENT_IDS_QUERY 0x10 +#define AVRCP_SUBEVENT_EVENT_IDS_QUERY 0x1A /** * @format 12 * @param subevent_code * @param avrcp_cid */ -#define AVRCP_SUBEVENT_PLAY_STATUS_QUERY 0x11 +#define AVRCP_SUBEVENT_PLAY_STATUS_QUERY 0x1B /** * @format 12111 @@ -2276,7 +2335,7 @@ typedef uint8_t sm_key_t[16]; * @param operands_length * @param operand */ -#define AVRCP_SUBEVENT_OPERATION 0x12 +#define AVRCP_SUBEVENT_OPERATION 0x1C /** * @format 1211 @@ -2285,7 +2344,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param track */ -#define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO 0x13 +#define AVRCP_SUBEVENT_NOW_PLAYING_TRACK_INFO 0x1D /** * @format 1211 @@ -2294,7 +2353,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param total_tracks */ -#define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO 0x14 +#define AVRCP_SUBEVENT_NOW_PLAYING_TOTAL_TRACKS_INFO 0x1E /** * @format 1214 @@ -2303,7 +2362,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param song_length in ms */ -#define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO 0x15 +#define AVRCP_SUBEVENT_NOW_PLAYING_SONG_LENGTH_MS_INFO 0x1F /** * @format 121JV @@ -2313,7 +2372,7 @@ typedef uint8_t sm_key_t[16]; * @param value_len * @param value */ -#define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO 0x16 +#define AVRCP_SUBEVENT_NOW_PLAYING_TITLE_INFO 0x20 /* * @format 121JV @@ -2323,7 +2382,7 @@ typedef uint8_t sm_key_t[16]; * @param value_len * @param value */ -#define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO 0x17 +#define AVRCP_SUBEVENT_NOW_PLAYING_ARTIST_INFO 0x21 /* * @format 121JV @@ -2333,7 +2392,7 @@ typedef uint8_t sm_key_t[16]; * @param value_len * @param value */ -#define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO 0x18 +#define AVRCP_SUBEVENT_NOW_PLAYING_ALBUM_INFO 0x22 /* * @format 121JV @@ -2343,7 +2402,7 @@ typedef uint8_t sm_key_t[16]; * @param value_len * @param value */ -#define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO 0x19 +#define AVRCP_SUBEVENT_NOW_PLAYING_GENRE_INFO 0x23 /* * @format 1211 @@ -2352,7 +2411,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param status */ -#define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE 0x1A +#define AVRCP_SUBEVENT_NOW_PLAYING_INFO_DONE 0x24 /** * @format 1B2 @@ -2360,7 +2419,7 @@ typedef uint8_t sm_key_t[16]; * @param bd_addr * @param browsing_cid */ -#define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION 0x1B +#define AVRCP_SUBEVENT_INCOMING_BROWSING_CONNECTION 0x25 /** * @format 11B2 @@ -2369,14 +2428,14 @@ typedef uint8_t sm_key_t[16]; * @param bd_addr * @param browsing_cid */ -#define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED 0x1C +#define AVRCP_SUBEVENT_BROWSING_CONNECTION_ESTABLISHED 0x26 /** * @format 12 * @param subevent_code * @param browsing_cid */ -#define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED 0x1D +#define AVRCP_SUBEVENT_BROWSING_CONNECTION_RELEASED 0x27 /** * @format 12211 @@ -2386,7 +2445,7 @@ typedef uint8_t sm_key_t[16]; * @param browsing_status * @param bluetooth_status */ -#define AVRCP_SUBEVENT_BROWSING_DONE 0x1E +#define AVRCP_SUBEVENT_BROWSING_DONE 0x28 /** * @format 1214 @@ -2395,7 +2454,7 @@ typedef uint8_t sm_key_t[16]; * @param scope * @param attr_bitmap */ -#define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS 0x1F +#define AVRCP_SUBEVENT_BROWSING_GET_FOLDER_ITEMS 0x29 /** * @format 121 @@ -2403,7 +2462,7 @@ typedef uint8_t sm_key_t[16]; * @param browsing_cid * @param scope */ -#define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS 0x20 +#define AVRCP_SUBEVENT_BROWSING_GET_TOTAL_NUM_ITEMS 0x2A /** * @format 1214 @@ -2412,7 +2471,7 @@ typedef uint8_t sm_key_t[16]; * @param command_type * @param playback_position_ms */ -#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED 0x21 +#define AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_POS_CHANGED 0x2B /** diff --git a/src/btstack_event.h b/src/btstack_event.h index 06eccf6e4..5d4af5995 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -5882,6 +5882,325 @@ static inline uint8_t a2dp_subevent_signaling_capabilities_done_get_remote_seid( return event[6]; } +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_playback_status_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_playback_status_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field play_status from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED + * @param event packet + * @return play_status + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_playback_status_changed_get_play_status(const uint8_t * event){ + return event[6]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_track_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_track_changed_get_command_type(const uint8_t * event){ + return event[5]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_END + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_track_reached_end_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_END + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_track_reached_end_get_command_type(const uint8_t * event){ + return event[5]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_START + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_track_reached_start_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_START + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_track_reached_start_get_command_type(const uint8_t * event){ + return event[5]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_playback_pos_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_playback_pos_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field playback_position from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED + * @param event packet + * @return playback_position + * @note: btstack_type 4 + */ +static inline uint32_t avrcp_subevent_notification_event_playback_pos_changed_get_playback_position(const uint8_t * event){ + return little_endian_read_32(event, 6); +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_batt_status_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_batt_status_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field battery_status from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED + * @param event packet + * @return battery_status + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_batt_status_changed_get_battery_status(const uint8_t * event){ + return event[6]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_system_status_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_system_status_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field system_status from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED + * @param event packet + * @return system_status + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_system_status_changed_get_system_status(const uint8_t * event){ + return event[6]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_now_playing_content_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_now_playing_content_changed_get_command_type(const uint8_t * event){ + return event[5]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_available_players_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_available_players_changed_get_command_type(const uint8_t * event){ + return event[5]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_UIDS_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_uids_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_UIDS_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_event_uids_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field uid_counter from event AVRCP_SUBEVENT_NOTIFICATION_EVENT_UIDS_CHANGED + * @param event packet + * @return uid_counter + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_event_uids_changed_get_uid_counter(const uint8_t * event){ + return little_endian_read_16(event, 6); +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_notification_volume_changed_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_volume_changed_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field absolute_volume from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED + * @param event packet + * @return absolute_volume + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_notification_volume_changed_get_absolute_volume(const uint8_t * event){ + return event[6]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_set_absolute_volume_response_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_set_absolute_volume_response_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field absolute_volume from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE + * @param event packet + * @return absolute_volume + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_set_absolute_volume_response_get_absolute_volume(const uint8_t * event){ + return event[6]; +} + +/** + * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE + * @param event packet + * @return avrcp_cid + * @note: btstack_type 2 + */ +static inline uint16_t avrcp_subevent_enable_notification_complete_get_avrcp_cid(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field command_type from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE + * @param event packet + * @return command_type + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_enable_notification_complete_get_command_type(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field notification_id from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE + * @param event packet + * @return notification_id + * @note: btstack_type 1 + */ +static inline uint8_t avrcp_subevent_enable_notification_complete_get_notification_id(const uint8_t * event){ + return event[6]; +} + /** * @brief Get field status from event AVRCP_SUBEVENT_CONNECTION_ESTABLISHED * @param event packet @@ -6003,175 +6322,6 @@ static inline uint8_t avrcp_subevent_play_status_get_play_status(const uint8_t * return event[14]; } -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_notification_playback_status_changed_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_playback_status_changed_get_command_type(const uint8_t * event){ - return event[5]; -} -/** - * @brief Get field play_status from event AVRCP_SUBEVENT_NOTIFICATION_PLAYBACK_STATUS_CHANGED - * @param event packet - * @return play_status - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_playback_status_changed_get_play_status(const uint8_t * event){ - return event[6]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_notification_track_changed_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_TRACK_CHANGED - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_track_changed_get_command_type(const uint8_t * event){ - return event[5]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_notification_now_playing_content_changed_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_NOW_PLAYING_CONTENT_CHANGED - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_now_playing_content_changed_get_command_type(const uint8_t * event){ - return event[5]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_notification_available_players_changed_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_AVAILABLE_PLAYERS_CHANGED - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_available_players_changed_get_command_type(const uint8_t * event){ - return event[5]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_notification_volume_changed_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_volume_changed_get_command_type(const uint8_t * event){ - return event[5]; -} -/** - * @brief Get field absolute_volume from event AVRCP_SUBEVENT_NOTIFICATION_VOLUME_CHANGED - * @param event packet - * @return absolute_volume - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_notification_volume_changed_get_absolute_volume(const uint8_t * event){ - return event[6]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_set_absolute_volume_response_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_set_absolute_volume_response_get_command_type(const uint8_t * event){ - return event[5]; -} -/** - * @brief Get field absolute_volume from event AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE - * @param event packet - * @return absolute_volume - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_set_absolute_volume_response_get_absolute_volume(const uint8_t * event){ - return event[6]; -} - -/** - * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE - * @param event packet - * @return avrcp_cid - * @note: btstack_type 2 - */ -static inline uint16_t avrcp_subevent_enable_notification_complete_get_avrcp_cid(const uint8_t * event){ - return little_endian_read_16(event, 3); -} -/** - * @brief Get field command_type from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE - * @param event packet - * @return command_type - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_enable_notification_complete_get_command_type(const uint8_t * event){ - return event[5]; -} -/** - * @brief Get field notification_id from event AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE - * @param event packet - * @return notification_id - * @note: btstack_type 1 - */ -static inline uint8_t avrcp_subevent_enable_notification_complete_get_notification_id(const uint8_t * event){ - return event[6]; -} - /** * @brief Get field avrcp_cid from event AVRCP_SUBEVENT_OPERATION_START * @param event packet diff --git a/src/classic/avrcp_controller.c b/src/classic/avrcp_controller.c index b3c5c5878..33ca665ae 100644 --- a/src/classic/avrcp_controller.c +++ b/src/classic/avrcp_controller.c @@ -718,19 +718,74 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec break; } case AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED:{ - uint8_t event[7]; + uint8_t event[8]; + uint16_t uuid = big_endian_read_16(packet, pos); int offset = 0; event[offset++] = HCI_EVENT_AVRCP_META; event[offset++] = sizeof(event) - 2; - event[offset++] = AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED; + event[offset++] = AVRCP_SUBEVENT_NOTIFICATION_EVENT_UIDS_CHANGED; little_endian_store_16(event, offset, connection->avrcp_cid); offset += 2; event[offset++] = ctype; - event[offset++] = packet[pos++] & 0x7F; + little_endian_store_16(event, offset, uuid); + offset += 2; (*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); break; } + case AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END:{ + uint8_t event[6]; + int offset = 0; + event[offset++] = HCI_EVENT_AVRCP_META; + event[offset++] = sizeof(event) - 2; + event[offset++] = AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_END; + little_endian_store_16(event, offset, connection->avrcp_cid); + offset += 2; + event[offset++] = ctype; + (*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); + break; + } + case AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START:{ + uint8_t event[6]; + int offset = 0; + event[offset++] = HCI_EVENT_AVRCP_META; + event[offset++] = sizeof(event) - 2; + event[offset++] = AVRCP_SUBEVENT_NOTIFICATION_EVENT_TRACK_REACHED_START; + little_endian_store_16(event, offset, connection->avrcp_cid); + offset += 2; + event[offset++] = ctype; + (*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); + break; + } + case AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED:{ + uint8_t event[7]; + int offset = 0; + event[offset++] = HCI_EVENT_AVRCP_META; + event[offset++] = sizeof(event) - 2; + event[offset++] = AVRCP_SUBEVENT_NOTIFICATION_EVENT_BATT_STATUS_CHANGED; + little_endian_store_16(event, offset, connection->avrcp_cid); + offset += 2; + event[offset++] = ctype; + event[offset++] = packet[pos++]; + (*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); + break; + } + + case AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED:{ + uint8_t event[7]; + int offset = 0; + event[offset++] = HCI_EVENT_AVRCP_META; + event[offset++] = sizeof(event) - 2; + event[offset++] = AVRCP_SUBEVENT_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED; + little_endian_store_16(event, offset, connection->avrcp_cid); + offset += 2; + event[offset++] = ctype; + event[offset++] = packet[pos]; + (*avrcp_controller_context.avrcp_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); + break; + } + + case AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED: default: log_info("avrcp: not implemented"); break;