avrcp: move definitions

This commit is contained in:
Milanka Ringwald 2024-11-12 08:46:10 +01:00 committed by Matthias Ringwald
parent 19c436db87
commit 8331cf7f12
2 changed files with 109 additions and 57 deletions

View File

@ -58,7 +58,9 @@ extern "C" {
#define AVRCP_BROWSING_ITEM_HEADER_LEN 3
#define AVRCP_BROWSING_MAX_NUM_ATTR_IDS 8
#define AVRCP_DISPLAYABLE_NAME_MAX_LENGTH 15
#define AVRCP_ATTRIBUTES_MAX_NUM 10
#define AVRCP_MAX_AV_C_MESSAGE_FRAME_SIZE 512
#define AVRCP_MAX_COMMAND_PARAMETER_LENGTH 11
@ -79,6 +81,14 @@ extern "C" {
#define AVRCP_FEATURE_MASK_BROWSING 0x0040u
#define AVRCP_FEATURE_MASK_MULTIPLE_MEDIA_PLAYE_APPLICATIONS 0x0080u
#define AVRCP_MAJOR_PLAYER_TYPE_FEATURE_MASK_AUDIO 0x01u
#define AVRCP_MAJOR_PLAYER_TYPE_FEATURE_MASK_VIDEO 0x02u
#define AVRCP_MAJOR_PLAYER_TYPE_FEATURE_MASK_BROADCASTING_AUDIO 0x04u
#define AVRCP_MAJOR_PLAYER_TYPE_FEATURE_MASK_BROADCASTING_VIDEO 0x08u
#define AVRCP_PLAYER_SUBTYPE_FEATURE_MASK_AUDIO_BOOK 0x01u
#define AVRCP_PLAYER_SUBTYPE_FEATURE_MASK_PODCAST 0x02u
typedef enum {
AVRCP_STATUS_INVALID_COMMAND = 0, // sent if TG received a PDU that it did not understand.
AVRCP_STATUS_INVALID_PARAMETER, // Sent if the TG received a PDU with a parameter ID that it did not understand, or, if there is only one parameter ID in the PDU.
@ -394,17 +404,6 @@ typedef struct {
uint8_t * value;
} avrcp_now_playing_info_item_t;
typedef struct {
uint8_t track_id[8];
uint16_t track_nr;
char * title;
char * artist;
char * album;
char * genre;
uint32_t song_length_ms;
uint32_t song_position_ms;
} avrcp_track_t;
typedef enum {
AVRCP_PARSER_GET_ATTRIBUTE_HEADER = 0, // 8 bytes
AVRCP_PARSER_GET_ATTRIBUTE_VALUE,
@ -442,12 +441,108 @@ typedef enum {
AVRCP_BROWSING_NOW_PLAYING
} avrcp_browsing_scope_t;
typedef enum {
AVRCP_REMOTE_CAPABILITIES_NONE = 0,
AVRCP_REMOTE_CAPABILITIES_W4_QUERY_RESULT,
AVRCP_REMOTE_CAPABILITIES_KNOWN
} avrcp_remote_capabilities_state_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_ITEM = 0x01,
AVRCP_BROWSING_FOLDER_ITEM,
AVRCP_BROWSING_MEDIA_ELEMENT_ITEM,
AVRCP_BROWSING_MEDIA_ROOT_FOLDER,
AVRCP_BROWSING_MEDIA_ELEMENT_ITEM_ATTRIBUTE
} avrcp_browsing_item_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_AUDIO = 1,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_VIDEO = 2,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_AUDIO = 4,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_VIDEO = 8
} avrcp_browsing_media_player_major_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_AUDIO_BOOK = 1,
AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_POADCAST = 2
} avrcp_browsing_media_player_subtype_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_STOPPED = 0,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PLAYING,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PAUSED,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_FWD_SEEK,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_REV_SEEK,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_ERROR = 0xFF
} avrcp_browsing_media_player_status_t;
typedef enum {
AVRCP_BROWSING_FOLDER_TYPE_MIXED = 0x00,
AVRCP_BROWSING_FOLDER_TYPE_TITLES,
AVRCP_BROWSING_FOLDER_TYPE_ALBUMS,
AVRCP_BROWSING_FOLDER_TYPE_ARTISTS,
AVRCP_BROWSING_FOLDER_TYPE_GENRES,
AVRCP_BROWSING_FOLDER_TYPE_PLAYLISTS,
AVRCP_BROWSING_FOLDER_TYPE_YEARS
} avrcp_browsing_folder_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_TYPE_AUDIO = 0x00,
AVRCP_BROWSING_MEDIA_TYPE_VIDEO
} avrcp_browsing_media_type_t;
typedef struct {
avrcp_media_attribute_id_t attribute_id; // 4B
uint16_t characterset; // RFC2978_CHARSET_MIB_UTF8
uint16_t displayable_name_len;
char displayable_name[AVRCP_DISPLAYABLE_NAME_MAX_LENGTH];
} avrcp_browsing_attribute_t ;
typedef struct {
uint16_t player_id;
uint8_t major_player_type_bitmap;
uint32_t player_subtype_bitmap;
avrcp_playback_status_t play_status;
uint8_t feature_bitmap[16];
uint16_t characterset; // RFC2978_CHARSET_MIB_UTF8
uint16_t displayable_name_len;
char displayable_name[AVRCP_DISPLAYABLE_NAME_MAX_LENGTH];
} avrcp_browsing_media_player_t;
typedef struct {
// avrcp_browsing_item_type_t item_type = AVRCP_BROWSING_Item_type_Media_Player;
// uint16_t item_length = 28 + displayable_name_len;
uint8_t id[8];
avrcp_browsing_folder_type_t type;
uint8_t is_playable;
uint16_t characterset; // RFC2978_CHARSET_MIB_UTF8
uint16_t displayable_name_len;
char displayable_name[AVRCP_DISPLAYABLE_NAME_MAX_LENGTH];
} avrcp_browsing_folder_item_t;
typedef struct {
// avrcp_browsing_item_type_t item_type = AVRCP_BROWSING_Item_type_Media_Player;
// uint16_t item_length = 28 + displayable_name_len;
uint8_t id[8];
avrcp_browsing_media_type_t type;
uint16_t characterset; // RFC2978_CHARSET_MIB_UTF8
uint16_t displayable_name_len;
char displayable_name[AVRCP_DISPLAYABLE_NAME_MAX_LENGTH];
uint8_t num_attributes;
avrcp_browsing_attribute_t attributes[AVRCP_ATTRIBUTES_MAX_NUM];
} avrcp_browsing_media_element_item_t;
typedef struct {
uint8_t track_id[8];
uint16_t track_nr;
char * title;
char * artist;
char * album;
char * genre;
uint32_t song_length_ms;
uint32_t song_position_ms;
} avrcp_track_t;
// BROWSING
typedef struct {
@ -516,8 +611,8 @@ typedef struct {
avrcp_subunit_type_t subunit_type;
avrcp_subunit_id_t subunit_id;
avrcp_packet_type_t packet_type;
uint8_t cmd_operands[200];
uint8_t cmd_operands_length;
uint8_t cmd_operands[400];
uint16_t cmd_operands_length;
bool incoming_declined;
} avrcp_browsing_connection_t;

View File

@ -52,49 +52,6 @@ extern "C" {
/* API_START */
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_ITEM = 0x01,
AVRCP_BROWSING_FOLDER_ITEM,
AVRCP_BROWSING_MEDIA_ELEMENT_ITEM,
AVRCP_BROWSING_MEDIA_ROOT_FOLDER,
AVRCP_BROWSING_MEDIA_ELEMENT_ITEM_ATTRIBUTE
} avrcp_browsing_item_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_AUDIO = 1,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_VIDEO = 2,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_AUDIO = 4,
AVRCP_BROWSING_MEDIA_PLAYER_MAJOR_TYPE_BROADCASTING_VIDEO = 8
} avrcp_browsing_media_player_major_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_AUDIO_BOOK = 1,
AVRCP_BROWSING_MEDIA_PLAYER_SUBTYPE_POADCAST = 2
} avrcp_browsing_media_player_subtype_t;
typedef enum {
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_STOPPED = 0,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PLAYING,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_PAUSED,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_FWD_SEEK,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_REV_SEEK,
AVRCP_BROWSING_MEDIA_PLAYER_STATUS_ERROR = 0xFF
} avrcp_browsing_media_player_status_t;
typedef enum {
AVRCP_BROWSING_FOLDER_TYPE_MIXED = 0x00,
AVRCP_BROWSING_FOLDER_TYPE_TITLES,
AVRCP_BROWSING_FOLDER_TYPE_ALBUMS,
AVRCP_BROWSING_FOLDER_TYPE_ARTISTS,
AVRCP_BROWSING_FOLDER_TYPE_GENRES,
AVRCP_BROWSING_FOLDER_TYPE_PLAYLISTS,
AVRCP_BROWSING_FOLDER_TYPE_YEARS
} avrcp_browsing_folder_type_t;
typedef enum {
AVRCP_BROWSING_MEDIA_TYPE_AUDIO = 0x00,
AVRCP_BROWSING_MEDIA_TYPE_VIDEO
} avrcp_browsing_media_type_t;
/**
* @brief Set up AVRCP Browsing Controller device.