Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2006-2016 Broadcom Corporation
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 
     19 /******************************************************************************
     20  *
     21  *  AVRCP definition and data types
     22  *
     23  ******************************************************************************/
     24 #ifndef _AVRC_DEFS_H
     25 #define _AVRC_DEFS_H
     26 
     27 #include "stack/include/bt_types.h"
     28 
     29 /*****************************************************************************
     30  *  constants
     31  ****************************************************************************/
     32 
     33 /* Profile revision numbers */
     34 #define AVRC_REV_1_0 0x0100
     35 #define AVRC_REV_1_3 0x0103
     36 #define AVRC_REV_1_4 0x0104
     37 #define AVRC_REV_1_5 0x0105
     38 #define AVRC_REV_1_6 0x0106
     39 
     40 /* defines from the spec */
     41 #define AVRC_PACKET_LEN 512 /* You must support 512 byte RC packets */
     42 
     43 #define AVRC_MIN_CONTROL_MTU 48 /* Minimum MTU for the control channel */
     44 #define AVRC_MIN_BROWSE_MTU 335 /* Minimum MTU for the browsing channel */
     45 
     46 #define AVRC_META_PDU_OFFSET 4
     47 #define AVRC_SUB_TYPE_LEN 4
     48 #define AVRC_UID_SIZE 8
     49 #define AVRC_FEATURE_MASK_SIZE 16
     50 
     51 /* command type codes */
     52 #define AVRC_CMD_CTRL 0   /* Instruct a target to perform an operation */
     53 #define AVRC_CMD_STATUS 1 /* Check a device's current status */
     54 #define AVRC_CMD_SPEC_INQ                                                \
     55   2                      /* Check whether a target supports a particular \
     56                             control command; all operands are included */
     57 #define AVRC_CMD_NOTIF 3 /* Notification of a change in a device's state */
     58 #define AVRC_CMD_GEN_INQ                            \
     59   4 /* Check whether a target supports a particular \
     60        control command; operands are not included */
     61 
     62 /* response type codes */
     63 #define AVRC_RSP_NOT_IMPL                                  \
     64   8 /* The target does not implement the command specified \
     65        by the opcode and operand,                          \
     66        or doesn't implement the specified subunit */
     67 #define AVRC_RSP_ACCEPT                                \
     68   9 /* The target executed or is executing the command \
     69        */
     70 #define AVRC_RSP_REJ                                        \
     71   10 /* The target implements the command specified by the  \
     72         opcode but cannot respond because the current state \
     73         of the target doesn't allow it */
     74 #define AVRC_RSP_IN_TRANS                                  \
     75   11 /* The target implements the status command but it is \
     76         in a state of transition; the status command may   \
     77         be retried at a future time */
     78 #define AVRC_RSP_IMPL_STBL                               \
     79   12 /* For specific inquiry or general inquiy commands, \
     80         the target implements the command; for status    \
     81         commands, the target returns stable and includes \
     82         the status results */
     83 #define AVRC_RSP_CHANGED                                    \
     84   13 /* The response frame contains a notification that the \
     85         target device's state has changed */
     86 #define AVRC_RSP_INTERIM                                        \
     87   15 /* For control commands, the target has accepted the       \
     88         request but cannot return information within 100        \
     89         milliseconds; for notify commands, the target accepted  \
     90         the command, and will notify the controller of a change \
     91         of target state at a future time */
     92 
     93 /* subunit type */
     94 #define AVRC_SUB_MONITOR 0x00  /* Monitor */
     95 #define AVRC_SUB_AUDIO 0x01    /* Audio */
     96 #define AVRC_SUB_PRINTER 0x02  /* Printer */
     97 #define AVRC_SUB_DISC 0x03     /* Disc */
     98 #define AVRC_SUB_TAPE 0x04     /* Tape recorder/player */
     99 #define AVRC_SUB_TUNER 0x05    /* Tuner */
    100 #define AVRC_SUB_CA 0x06       /* CA */
    101 #define AVRC_SUB_CAMERA 0x07   /* Camera */
    102 #define AVRC_SUB_PANEL 0x09    /* Panel */
    103 #define AVRC_SUB_BB 0x0A       /* Bulletin Board */
    104 #define AVRC_SUB_CAM_STOR 0x0B /* Camera Storage */
    105 #define AVRC_SUB_VENDOR 0x1C   /* Vendor unique */
    106 #define AVRC_SUB_EXT 0x1E      /* Subunit type extended to next byte */
    107 #define AVRC_SUB_UNIT 0x1F     /* Unit */
    108 
    109 /* opcodes - defined by 1394ta */
    110 #define AVRC_OP_UNIT_INFO 0x30 /* Report unit information */
    111 #define AVRC_OP_SUB_INFO 0x31  /* Report subunit information */
    112 #define AVRC_OP_VENDOR 0x00    /* Vendor-dependent commands */
    113 #define AVRC_OP_PASS_THRU 0x7C /* panel subunit opcode */
    114 /* opcodes 80-9F and E0-FF are not used by 1394ta.  Sneak one for browsing */
    115 #define AVRC_OP_BROWSE 0xFF  /* Browsing */
    116 #define AVRC_OP_INVALID 0xFE /* invalid one */
    117 
    118 /* Company ID's
    119 */
    120 #define AVRC_CO_BLUETOOTH_SIG 0x00FFFFFF
    121 #define AVRC_CO_WIDCOMM 0x00000361
    122 #define AVRC_CO_BROADCOM 0x00001018
    123 #define AVRC_CO_GOOGLE 0x00DAA119
    124 #define AVRC_CO_METADATA \
    125   0x00001958 /* Unique COMPANY ID for Metadata messages */
    126 
    127 /* State flag for Passthrough commands
    128 */
    129 #define AVRC_STATE_PRESS 0
    130 #define AVRC_STATE_RELEASE 1
    131 
    132 /* Operation ID list for Passthrough commands
    133 */
    134 #define AVRC_ID_SELECT 0x00     /* select */
    135 #define AVRC_ID_UP 0x01         /* up */
    136 #define AVRC_ID_DOWN 0x02       /* down */
    137 #define AVRC_ID_LEFT 0x03       /* left */
    138 #define AVRC_ID_RIGHT 0x04      /* right */
    139 #define AVRC_ID_RIGHT_UP 0x05   /* right-up */
    140 #define AVRC_ID_RIGHT_DOWN 0x06 /* right-down */
    141 #define AVRC_ID_LEFT_UP 0x07    /* left-up */
    142 #define AVRC_ID_LEFT_DOWN 0x08  /* left-down */
    143 #define AVRC_ID_ROOT_MENU 0x09  /* root menu */
    144 #define AVRC_ID_SETUP_MENU 0x0A /* setup menu */
    145 #define AVRC_ID_CONT_MENU 0x0B  /* contents menu */
    146 #define AVRC_ID_FAV_MENU 0x0C   /* favorite menu */
    147 #define AVRC_ID_EXIT 0x0D       /* exit */
    148 #define AVRC_ID_0 0x20          /* 0 */
    149 #define AVRC_ID_1 0x21          /* 1 */
    150 #define AVRC_ID_2 0x22          /* 2 */
    151 #define AVRC_ID_3 0x23          /* 3 */
    152 #define AVRC_ID_4 0x24          /* 4 */
    153 #define AVRC_ID_5 0x25          /* 5 */
    154 #define AVRC_ID_6 0x26          /* 6 */
    155 #define AVRC_ID_7 0x27          /* 7 */
    156 #define AVRC_ID_8 0x28          /* 8 */
    157 #define AVRC_ID_9 0x29          /* 9 */
    158 #define AVRC_ID_DOT 0x2A        /* dot */
    159 #define AVRC_ID_ENTER 0x2B      /* enter */
    160 #define AVRC_ID_CLEAR 0x2C      /* clear */
    161 #define AVRC_ID_CHAN_UP 0x30    /* channel up */
    162 #define AVRC_ID_CHAN_DOWN 0x31  /* channel down */
    163 #define AVRC_ID_PREV_CHAN 0x32  /* previous channel */
    164 #define AVRC_ID_SOUND_SEL 0x33  /* sound select */
    165 #define AVRC_ID_INPUT_SEL 0x34  /* input select */
    166 #define AVRC_ID_DISP_INFO 0x35  /* display information */
    167 #define AVRC_ID_HELP 0x36       /* help */
    168 #define AVRC_ID_PAGE_UP 0x37    /* page up */
    169 #define AVRC_ID_PAGE_DOWN 0x38  /* page down */
    170 #define AVRC_ID_POWER 0x40      /* power */
    171 #define AVRC_ID_VOL_UP 0x41     /* volume up */
    172 #define AVRC_ID_VOL_DOWN 0x42   /* volume down */
    173 #define AVRC_ID_MUTE 0x43       /* mute */
    174 #define AVRC_ID_PLAY 0x44       /* play */
    175 #define AVRC_ID_STOP 0x45       /* stop */
    176 #define AVRC_ID_PAUSE 0x46      /* pause */
    177 #define AVRC_ID_RECORD 0x47     /* record */
    178 #define AVRC_ID_REWIND 0x48     /* rewind */
    179 #define AVRC_ID_FAST_FOR 0x49   /* fast forward */
    180 #define AVRC_ID_EJECT 0x4A      /* eject */
    181 #define AVRC_ID_FORWARD 0x4B    /* forward */
    182 #define AVRC_ID_BACKWARD 0x4C   /* backward */
    183 #define AVRC_ID_ANGLE 0x50      /* angle */
    184 #define AVRC_ID_SUBPICT 0x51    /* subpicture */
    185 #define AVRC_ID_F1 0x71         /* F1 */
    186 #define AVRC_ID_F2 0x72         /* F2 */
    187 #define AVRC_ID_F3 0x73         /* F3 */
    188 #define AVRC_ID_F4 0x74         /* F4 */
    189 #define AVRC_ID_F5 0x75         /* F5 */
    190 #define AVRC_ID_VENDOR 0x7E     /* vendor unique */
    191 #define AVRC_KEYPRESSED_RELEASE 0x80
    192 
    193 /*****************************************************************************
    194  *  Metadata transfer definitions
    195  ****************************************************************************/
    196 
    197 /* Define the Metadata Packet types
    198 */
    199 #define AVRC_PKT_SINGLE 0
    200 #define AVRC_PKT_START 1
    201 #define AVRC_PKT_CONTINUE 2
    202 #define AVRC_PKT_END 3
    203 #define AVRC_PKT_TYPE_MASK 3
    204 
    205 /* Define the PDUs carried in the vendor dependant data
    206 */
    207 #define AVRC_PDU_GET_CAPABILITIES 0x10
    208 #define AVRC_PDU_LIST_PLAYER_APP_ATTR 0x11
    209 #define AVRC_PDU_LIST_PLAYER_APP_VALUES 0x12
    210 #define AVRC_PDU_GET_CUR_PLAYER_APP_VALUE 0x13
    211 #define AVRC_PDU_SET_PLAYER_APP_VALUE 0x14
    212 #define AVRC_PDU_GET_PLAYER_APP_ATTR_TEXT 0x15
    213 #define AVRC_PDU_GET_PLAYER_APP_VALUE_TEXT 0x16
    214 #define AVRC_PDU_INFORM_DISPLAY_CHARSET 0x17
    215 #define AVRC_PDU_INFORM_BATTERY_STAT_OF_CT 0x18
    216 #define AVRC_PDU_GET_ELEMENT_ATTR 0x20
    217 #define AVRC_PDU_GET_PLAY_STATUS 0x30
    218 #define AVRC_PDU_REGISTER_NOTIFICATION 0x31
    219 #define AVRC_PDU_REQUEST_CONTINUATION_RSP 0x40
    220 #define AVRC_PDU_ABORT_CONTINUATION_RSP 0x41
    221 /* added in 1.4 */
    222 #define AVRC_PDU_SET_ABSOLUTE_VOLUME 0x50
    223 #define AVRC_PDU_SET_ADDRESSED_PLAYER 0x60
    224 #define AVRC_PDU_SET_BROWSED_PLAYER 0x70
    225 #define AVRC_PDU_GET_FOLDER_ITEMS 0x71
    226 #define AVRC_PDU_CHANGE_PATH 0x72
    227 #define AVRC_PDU_GET_ITEM_ATTRIBUTES 0x73
    228 #define AVRC_PDU_PLAY_ITEM 0x74
    229 /* Added in post 1.5 */
    230 #define AVRC_PDU_GET_TOTAL_NUM_OF_ITEMS 0x75
    231 #define AVRC_PDU_SEARCH 0x80
    232 #define AVRC_PDU_ADD_TO_NOW_PLAYING 0x90
    233 #define AVRC_PDU_GENERAL_REJECT 0xA0
    234 
    235 /* Define the vendor unique id carried in the pass through data
    236 */
    237 #define AVRC_PDU_NEXT_GROUP 0x00
    238 #define AVRC_PDU_PREV_GROUP 0x01
    239 /* The only pass through vendor unique commands defined by AVRC are the group
    240  *  navigation commands.
    241  * The len for vendor unique data is 5
    242  */
    243 #define AVRC_PASS_THRU_GROUP_LEN 5
    244 
    245 #define AVRC_PDU_INVALID 0xff
    246 /* 6.15.3 error status code for general reject */
    247 /* Invalid command, sent if TG received a PDU that it did not understand. */
    248 #define AVRC_STS_BAD_CMD 0x00
    249 /* Invalid parameter, sent if the TG received a PDU with a parameter ID that it
    250  * did not understand. Sent if there is only one parameter ID in the PDU. */
    251 #define AVRC_STS_BAD_PARAM 0x01
    252 /* Specified parameter not found., sent if the parameter ID is understood, but
    253  * content is wrong or corrupted. */
    254 #define AVRC_STS_NOT_FOUND 0x02
    255 /* Internal Error, sent if there are error conditions not covered by a more
    256  * specific error code. */
    257 #define AVRC_STS_INTERNAL_ERR 0x03
    258 /* Operation completed without error.  This is the status that should be
    259  * returned if the operation was successful. */
    260 #define AVRC_STS_NO_ERROR 0x04
    261 /* UID Changed - The UIDs on the device have changed */
    262 #define AVRC_STS_UID_CHANGED 0x05
    263 /* #define AVRC_STS_GEN_ERROR   0x06    Unknown Error - now "reserved" */
    264 /* Invalid Direction - The Direction parameter is invalid - Change Path*/
    265 #define AVRC_STS_BAD_DIR 0x07
    266 /* Not a Directory - The UID provided does not refer to a folder item -
    267  *      Change Path */
    268 #define AVRC_STS_NOT_DIR 0x08
    269 /* Does Not Exist - The UID provided does not refer to any item - Change Path,
    270  *      PlayItem, AddToNowPlaying, GetItemAttributes */
    271 #define AVRC_STS_NOT_EXIST 0x09
    272 /* Invalid Scope - The scope parameter is invalid - GetFolderItems, PlayItem,
    273  *      AddToNowPlayer, GetItemAttributes */
    274 #define AVRC_STS_BAD_SCOPE 0x0a
    275 /* Range Out of Bounds - The start of range provided is not valid
    276  *      GetFolderItems*/
    277 #define AVRC_STS_BAD_RANGE 0x0b
    278 /* UID is a Directory - The UID provided refers to a directory, which cannot be
    279  * handled by this media player -  PlayItem, AddToNowPlaying */
    280 #define AVRC_STS_UID_IS_DIR 0x0c
    281 /* Media in Use - The media is not able to be used for this operation at this
    282  * time - PlayItem, AddToNowPlaying */
    283 #define AVRC_STS_IN_USE 0x0d
    284 /* Now Playing List Full - No more items can be added to the Now Playing List -
    285  * AddToNowPlaying*/
    286 #define AVRC_STS_NOW_LIST_FULL 0x0e
    287 /* Search Not Supported - The Browsed Media Player does not support search -
    288  * Search */
    289 #define AVRC_STS_SEARCH_NOT_SUP 0x0f
    290 /* Search in Progress - A search operation is already in progress - Search*/
    291 #define AVRC_STS_SEARCH_BUSY 0x10
    292 /* Invalid Player Id - The specified Player Id does not refer to a valid player
    293  * - SetAddressedPlayer, SetBrowsedPlayer*/
    294 #define AVRC_STS_BAD_PLAYER_ID 0x11
    295 /* Player Not Browsable - The Player Id supplied refers to a Media Player which
    296  * does not support browsing - SetBrowsedPlayer */
    297 #define AVRC_STS_PLAYER_N_BR 0x12
    298 /* Player Not Addressed.  The Player Id supplied refers to a player which is not
    299  * currently addressed, and the command is not able to be performed if the
    300  * player is not set as addressed - Search, SetBrowsedPlayer*/
    301 #define AVRC_STS_PLAYER_N_ADDR 0x13
    302 /* No valid Search Results - The Search result list does not contain valid
    303  * entries, e.g. after being invalidated due to change of browsed player -
    304  * GetFolderItems */
    305 #define AVRC_STS_BAD_SEARCH_RES 0x14
    306 /* No available players ALL */
    307 #define AVRC_STS_NO_AVAL_PLAYER 0x15
    308 /* Addressed Player Changed - Register Notification */
    309 #define AVRC_STS_ADDR_PLAYER_CHG 0x16
    310 typedef uint8_t tAVRC_STS;
    311 
    312 /* Define the Capability IDs
    313 */
    314 #define AVRC_CAP_COMPANY_ID 0x02
    315 #define AVRC_CAP_EVENTS_SUPPORTED 0x03
    316 #define AVRC_COMPANY_ID_LEN 3
    317 #define AVRC_CAPABILITY_OFFSET 2
    318 
    319 /* Define the Player Application Settings IDs
    320 */
    321 #define AVRC_PLAYER_SETTING_EQUALIZER 0x01
    322 #define AVRC_PLAYER_SETTING_REPEAT 0x02
    323 #define AVRC_PLAYER_SETTING_SHUFFLE 0x03
    324 #define AVRC_PLAYER_SETTING_SCAN 0x04
    325 #define AVRC_PLAYER_SETTING_LOW_MENU_EXT 0x80
    326 #define AVRC_PLAYER_SETTING_HIGH_MENU_EXT 0xff
    327 
    328 /* Define the possible values of the Player Application Settings
    329 */
    330 #define AVRC_PLAYER_VAL_OFF 0x01
    331 #define AVRC_PLAYER_VAL_ON 0x02
    332 #define AVRC_PLAYER_VAL_SINGLE_REPEAT 0x02
    333 #define AVRC_PLAYER_VAL_ALL_REPEAT 0x03
    334 #define AVRC_PLAYER_VAL_GROUP_REPEAT 0x04
    335 #define AVRC_PLAYER_VAL_ALL_SHUFFLE 0x02
    336 #define AVRC_PLAYER_VAL_GROUP_SHUFFLE 0x03
    337 #define AVRC_PLAYER_VAL_ALL_SCAN 0x02
    338 #define AVRC_PLAYER_VAL_GROUP_SCAN 0x03
    339 
    340 /* Define the possible values of Battery Status PDU
    341 */
    342 #define AVRC_BATTERY_STATUS_NORMAL 0x00
    343 #define AVRC_BATTERY_STATUS_WARNING 0x01
    344 #define AVRC_BATTERY_STATUS_CRITICAL 0x02
    345 #define AVRC_BATTERY_STATUS_EXTERNAL 0x03
    346 #define AVRC_BATTERY_STATUS_FULL_CHARGE 0x04
    347 typedef uint8_t tAVRC_BATTERY_STATUS;
    348 
    349 /* Define character set */
    350 #define AVRC_CHAR_SET_SIZE 2
    351 
    352 /* Define the Media Attribute IDs
    353 */
    354 #define AVRC_MEDIA_ATTR_ID_TITLE 0x00000001
    355 #define AVRC_MEDIA_ATTR_ID_ARTIST 0x00000002
    356 #define AVRC_MEDIA_ATTR_ID_ALBUM 0x00000003
    357 #define AVRC_MEDIA_ATTR_ID_TRACK_NUM 0x00000004
    358 #define AVRC_MEDIA_ATTR_ID_NUM_TRACKS 0x00000005
    359 #define AVRC_MEDIA_ATTR_ID_GENRE 0x00000006
    360 #define AVRC_MEDIA_ATTR_ID_PLAYING_TIME 0x00000007 /* in miliseconds */
    361 #define AVRC_MAX_NUM_MEDIA_ATTR_ID 7
    362 
    363 /* Define the possible values of play state
    364 */
    365 #define AVRC_PLAYSTATE_RESP_MSG_SIZE 9
    366 #define AVRC_PLAYSTATE_STOPPED 0x00  /* Stopped */
    367 #define AVRC_PLAYSTATE_PLAYING 0x01  /* Playing */
    368 #define AVRC_PLAYSTATE_PAUSED 0x02   /* Paused  */
    369 #define AVRC_PLAYSTATE_FWD_SEEK 0x03 /* Fwd Seek*/
    370 #define AVRC_PLAYSTATE_REV_SEEK 0x04 /* Rev Seek*/
    371 #define AVRC_PLAYSTATE_ERROR 0xFF    /* Error   */
    372 typedef uint8_t tAVRC_PLAYSTATE;
    373 
    374 /* Define the events that can be registered for notifications
    375 */
    376 #define AVRC_EVT_PLAY_STATUS_CHANGE 0x01
    377 #define AVRC_EVT_TRACK_CHANGE 0x02
    378 #define AVRC_EVT_TRACK_REACHED_END 0x03
    379 #define AVRC_EVT_TRACK_REACHED_START 0x04
    380 #define AVRC_EVT_PLAY_POS_CHANGED 0x05
    381 #define AVRC_EVT_BATTERY_STATUS_CHANGE 0x06
    382 #define AVRC_EVT_SYSTEM_STATUS_CHANGE 0x07
    383 #define AVRC_EVT_APP_SETTING_CHANGE 0x08
    384 /* added in AVRCP 1.4 */
    385 #define AVRC_EVT_NOW_PLAYING_CHANGE 0x09
    386 #define AVRC_EVT_AVAL_PLAYERS_CHANGE 0x0a
    387 #define AVRC_EVT_ADDR_PLAYER_CHANGE 0x0b
    388 #define AVRC_EVT_UIDS_CHANGE 0x0c
    389 #define AVRC_EVT_VOLUME_CHANGE 0x0d
    390 
    391 /* the number of events that can be registered for notifications */
    392 #define AVRC_NUM_NOTIF_EVENTS 0x0d
    393 
    394 #define AVRC_EVT_MSG_LEN_1 0x01
    395 #define AVRC_EVT_MSG_LEN_2 0x02
    396 #define AVRC_EVT_MSG_LEN_5 0x05
    397 #define AVRC_EVT_MSG_LEN_9 0x09
    398 
    399 #define AVRC_MAX_VOLUME 0x7F
    400 
    401 /* Define the possible values of system status
    402 */
    403 #define AVRC_SYSTEMSTATE_PWR_ON 0x00
    404 #define AVRC_SYSTEMSTATE_PWR_OFF 0x01
    405 #define AVRC_SYSTEMSTATE_PWR_UNPLUGGED 0x02
    406 typedef uint8_t tAVRC_SYSTEMSTATE;
    407 
    408 /* the frequently used character set ids */
    409 #define AVRC_CHARSET_ID_ASCII ((uint16_t)0x0003) /* ASCII */
    410 #define AVRC_CHARSET_ID_UTF8 ((uint16_t)0x006a)  /* UTF-8 */
    411 #define AVRC_CHARSET_ID_UTF16 ((uint16_t)0x03f7) /* 1015 */
    412 #define AVRC_CHARSET_ID_UTF32 ((uint16_t)0x03f9) /* 1017 */
    413 
    414 /*****************************************************************************
    415  *  Advanced Control
    416  ****************************************************************************/
    417 #define AVRC_ITEM_PLAYER 0x01
    418 #define AVRC_ITEM_FOLDER 0x02
    419 #define AVRC_ITEM_MEDIA 0x03
    420 
    421 /* Media Player Item - Contains all available media players */
    422 #define AVRC_SCOPE_PLAYER_LIST 0x00
    423 /* Folder Item, Media Element Item - The virtual filesystem containing the media
    424  * content of the browsed player */
    425 #define AVRC_SCOPE_FILE_SYSTEM 0x01
    426 /* Media Element Item  The results of a search operation on the browsed player
    427  */
    428 #define AVRC_SCOPE_SEARCH 0x02
    429 /* Media Element Item  The Now Playing list (or queue) of the addressed player
    430  */
    431 #define AVRC_SCOPE_NOW_PLAYING 0x03
    432 
    433 #define AVRC_FOLDER_ITEM_COUNT_NONE 0xFF
    434 
    435 /* folder type */
    436 #define AVRC_FOLDER_TYPE_MIXED 0x00
    437 #define AVRC_FOLDER_TYPE_TITLES 0x01
    438 #define AVRC_FOLDER_TYPE_ALNUMS 0x02
    439 #define AVRC_FOLDER_TYPE_ARTISTS 0x03
    440 #define AVRC_FOLDER_TYPE_GENRES 0x04
    441 #define AVRC_FOLDER_TYPE_PLAYLISTS 0x05
    442 #define AVRC_FOLDER_TYPE_YEARS 0x06
    443 
    444 /* major player type */
    445 #define AVRC_MJ_TYPE_AUDIO 0x01    /* Audio */
    446 #define AVRC_MJ_TYPE_VIDEO 0x02    /* Video */
    447 #define AVRC_MJ_TYPE_BC_AUDIO 0x04 /* Broadcasting Audio */
    448 #define AVRC_MJ_TYPE_BC_VIDEO 0x08 /* Broadcasting Video */
    449 #define AVRC_MJ_TYPE_INVALID 0xF0
    450 
    451 /* player sub type */
    452 #define AVRC_SUB_TYPE_NONE 0x00
    453 #define AVRC_SUB_TYPE_AUDIO_BOOK 0x01 /* Audio Book */
    454 #define AVRC_SUB_TYPE_PODCAST 0x02    /* Podcast */
    455 #define AVRC_SUB_TYPE_INVALID 0xFC
    456 
    457 /* media item - media type */
    458 #define AVRC_MEDIA_TYPE_AUDIO 0x00
    459 #define AVRC_MEDIA_TYPE_VIDEO 0x01
    460 
    461 #define AVRC_DIR_UP 0x00   /* Folder Up */
    462 #define AVRC_DIR_DOWN 0x01 /* Folder Down */
    463 
    464 #define AVRC_UID_SIZE 8
    465 typedef uint8_t tAVRC_UID[AVRC_UID_SIZE];
    466 
    467 /*****************************************************************************
    468  *  player attribute - supported features
    469  ****************************************************************************/
    470 #define AVRC_PF_SELECT_BIT_NO 0
    471 #define AVRC_PF_SELECT_MASK 0x01
    472 #define AVRC_PF_SELECT_OFF 0
    473 #define AVRC_PF_SELECT_SUPPORTED(x) \
    474   ((x)[AVRC_PF_SELECT_OFF] & AVRC_PF_SELECT_MASK)
    475 
    476 #define AVRC_PF_UP_BIT_NO 1
    477 #define AVRC_PF_UP_MASK 0x02
    478 #define AVRC_PF_UP_OFF 0
    479 #define AVRC_PF_UP_SUPPORTED(x) ((x)[AVRC_PF_UP_OFF] & AVRC_PF_UP_MASK)
    480 
    481 #define AVRC_PF_DOWN_BIT_NO 2
    482 #define AVRC_PF_DOWN_MASK 0x04
    483 #define AVRC_PF_DOWN_OFF 0
    484 #define AVRC_PF_DOWN_SUPPORTED(x) ((x)[AVRC_PF_DOWN_OFF] & AVRC_PF_DOWN_MASK)
    485 
    486 #define AVRC_PF_LEFT_BIT_NO 3
    487 #define AVRC_PF_LEFT_MASK 0x08
    488 #define AVRC_PF_LEFT_OFF 0
    489 #define AVRC_PF_LEFT_SUPPORTED(x) ((x)[AVRC_PF_LEFT_OFF] & AVRC_PF_LEFT_MASK)
    490 
    491 #define AVRC_PF_RIGHT_BIT_NO 4
    492 #define AVRC_PF_RIGHT_MASK 0x10
    493 #define AVRC_PF_RIGHT_OFF 0
    494 #define AVRC_PF_RIGHT_SUPPORTED(x) ((x)[AVRC_PF_RIGHT_OFF] & AVRC_PF_RIGHT_MASK)
    495 
    496 #define AVRC_PF_RIGHTUP_BIT_NO 5
    497 #define AVRC_PF_RIGHTUP_MASK 0x20
    498 #define AVRC_PF_RIGHTUP_OFF 0
    499 #define AVRC_PF_RIGHTUP_SUPPORTED(x) \
    500   ((x)[AVRC_PF_RIGHTUP_OFF] & AVRC_PF_RIGHTUP_MASK)
    501 
    502 #define AVRC_PF_RIGHTDOWN_BIT_NO 6
    503 #define AVRC_PF_RIGHTDOWN_MASK 0x40
    504 #define AVRC_PF_RIGHTDOWN_OFF 0
    505 #define AVRC_PF_RIGHTDOWN_SUPPORTED(x) \
    506   ((x)[AVRC_PF_RIGHTDOWN_OFF] & AVRC_PF_RIGHTDOWN_MASK)
    507 
    508 #define AVRC_PF_LEFTUP_BIT_NO 7
    509 #define AVRC_PF_LEFTUP_MASK 0x80
    510 #define AVRC_PF_LEFTUP_OFF 0
    511 #define AVRC_PF_LEFTUP_SUPPORTED(x) \
    512   ((x)[AVRC_PF_LEFTUP_OFF] & AVRC_PF_LEFTUP_MASK)
    513 
    514 #define AVRC_PF_LEFTDOWN_BIT_NO 8
    515 #define AVRC_PF_LEFTDOWN_MASK 0x01
    516 #define AVRC_PF_LEFTDOWN_OFF 1
    517 #define AVRC_PF_LEFTDOWN_SUPPORTED(x) \
    518   ((x)[AVRC_PF_LEFTDOWN_OFF] & AVRC_PF_LEFTDOWN_MASK)
    519 
    520 #define AVRC_PF_ROOT_MENU_BIT_NO 9
    521 #define AVRC_PF_ROOT_MENU_MASK 0x02
    522 #define AVRC_PF_ROOT_MENU_OFF 1
    523 #define AVRC_PF_ROOT_MENU_SUPPORTED(x) \
    524   ((x)[AVRC_PF_ROOT_MENU_OFF] & AVRC_PF_ROOT_MENU_MASK)
    525 
    526 #define AVRC_PF_SETUP_MENU_BIT_NO 10
    527 #define AVRC_PF_SETUP_MENU_MASK 0x04
    528 #define AVRC_PF_SETUP_MENU_OFF 1
    529 #define AVRC_PF_SETUP_MENU_SUPPORTED(x) \
    530   ((x)[AVRC_PF_SETUP_MENU_OFF] & AVRC_PF_SETUP_MENU_MASK)
    531 
    532 #define AVRC_PF_CONTENTS_MENU_BIT_NO 11
    533 #define AVRC_PF_CONTENTS_MENU_MASK 0x08
    534 #define AVRC_PF_CONTENTS_MENU_OFF 1
    535 #define AVRC_PF_CONTENTS_MENU_SUPPORTED(x) \
    536   ((x)[AVRC_PF_CONTENTS_MENU_OFF] & AVRC_PF_CONTENTS_MENU_MASK)
    537 
    538 #define AVRC_PF_FAVORITE_MENU_BIT_NO 12
    539 #define AVRC_PF_FAVORITE_MENU_MASK 0x10
    540 #define AVRC_PF_FAVORITE_MENU_OFF 1
    541 #define AVRC_PF_FAVORITE_MENU_SUPPORTED(x) \
    542   ((x)[AVRC_PF_FAVORITE_MENU_OFF] & AVRC_PF_FAVORITE_MENU_MASK)
    543 
    544 #define AVRC_PF_EXIT_BIT_NO 13
    545 #define AVRC_PF_EXIT_MASK 0x20
    546 #define AVRC_PF_EXIT_OFF 1
    547 #define AVRC_PF_EXIT_SUPPORTED(x) ((x)[AVRC_PF_EXIT_OFF] & AVRC_PF_EXIT_MASK)
    548 
    549 #define AVRC_PF_0_BIT_NO 14
    550 #define AVRC_PF_0_MASK 0x40
    551 #define AVRC_PF_0_OFF 1
    552 #define AVRC_PF_0_SUPPORTED(x) ((x)[AVRC_PF_0_OFF] & AVRC_PF_0_MASK)
    553 
    554 #define AVRC_PF_1_BIT_NO 15
    555 #define AVRC_PF_1_MASK 0x80
    556 #define AVRC_PF_1_OFF 1
    557 #define AVRC_PF_1_SUPPORTED(x) ((x)[AVRC_PF_1_OFF] & AVRC_PF_1_MASK)
    558 
    559 #define AVRC_PF_2_BIT_NO 16
    560 #define AVRC_PF_2_MASK 0x01
    561 #define AVRC_PF_2_OFF 2
    562 #define AVRC_PF_2_SUPPORTED(x) ((x)[AVRC_PF_2_OFF] & AVRC_PF_2_MASK)
    563 
    564 #define AVRC_PF_3_BIT_NO 17
    565 #define AVRC_PF_3_MASK 0x02
    566 #define AVRC_PF_3_OFF 2
    567 #define AVRC_PF_3_SUPPORTED(x) ((x)[AVRC_PF_3_OFF] & AVRC_PF_3_MASK)
    568 
    569 #define AVRC_PF_4_BIT_NO 18
    570 #define AVRC_PF_4_MASK 0x04
    571 #define AVRC_PF_4_OFF 2
    572 #define AVRC_PF_4_SUPPORTED(x) ((x)[AVRC_PF_4_OFF] & AVRC_PF_4_MASK)
    573 
    574 #define AVRC_PF_5_BIT_NO 19
    575 #define AVRC_PF_5_MASK 0x08
    576 #define AVRC_PF_5_OFF 2
    577 #define AVRC_PF_5_SUPPORTED(x) ((x)[AVRC_PF_5_OFF] & AVRC_PF_5_MASK)
    578 
    579 #define AVRC_PF_6_BIT_NO 20
    580 #define AVRC_PF_6_MASK 0x10
    581 #define AVRC_PF_6_OFF 2
    582 #define AVRC_PF_6_SUPPORTED(x) ((x)[AVRC_PF_6_OFF] & AVRC_PF_6_MASK)
    583 
    584 #define AVRC_PF_7_BIT_NO 21
    585 #define AVRC_PF_7_MASK 0x20
    586 #define AVRC_PF_7_OFF 2
    587 #define AVRC_PF_7_SUPPORTED(x) ((x)[AVRC_PF_7_OFF] & AVRC_PF_7_MASK)
    588 
    589 #define AVRC_PF_8_BIT_NO 22
    590 #define AVRC_PF_8_MASK 0x40
    591 #define AVRC_PF_8_OFF 2
    592 #define AVRC_PF_8_SUPPORTED(x) ((x)[AVRC_PF_8_OFF] & AVRC_PF_8_MASK)
    593 
    594 #define AVRC_PF_9_BIT_NO 23
    595 #define AVRC_PF_9_MASK 0x80
    596 #define AVRC_PF_9_OFF 2
    597 #define AVRC_PF_9_SUPPORTED(x) ((x)[AVRC_PF_9_OFF] & AVRC_PF_9_MASK)
    598 
    599 #define AVRC_PF_DOT_BIT_NO 24
    600 #define AVRC_PF_DOT_MASK 0x01
    601 #define AVRC_PF_DOT_OFF 3
    602 #define AVRC_PF_DOT_SUPPORTED(x) ((x)[AVRC_PF_DOT_OFF] & AVRC_PF_DOT_MASK)
    603 
    604 #define AVRC_PF_ENTER_BIT_NO 25
    605 #define AVRC_PF_ENTER_MASK 0x02
    606 #define AVRC_PF_ENTER_OFF 3
    607 #define AVRC_PF_ENTER_SUPPORTED(x) ((x)[AVRC_PF_ENTER_OFF] & AVRC_PF_ENTER_MASK)
    608 
    609 #define AVRC_PF_CLEAR_BIT_NO 26
    610 #define AVRC_PF_CLEAR_MASK 0x04
    611 #define AVRC_PF_CLEAR_OFF 3
    612 #define AVRC_PF_CLEAR_SUPPORTED(x) ((x)[AVRC_PF_CLEAR_OFF] & AVRC_PF_CLEAR_MASK)
    613 
    614 #define AVRC_PF_CHNL_UP_BIT_NO 27
    615 #define AVRC_PF_CHNL_UP_MASK 0x08
    616 #define AVRC_PF_CHNL_UP_OFF 3
    617 #define AVRC_PF_CHNL_UP_SUPPORTED(x) \
    618   ((x)[AVRC_PF_CHNL_UP_OFF] & AVRC_PF_CHNL_UP_MASK)
    619 
    620 #define AVRC_PF_CHNL_DOWN_BIT_NO 28
    621 #define AVRC_PF_CHNL_DOWN_MASK 0x10
    622 #define AVRC_PF_CHNL_DOWN_OFF 3
    623 #define AVRC_PF_CHNL_DOWN_SUPPORTED(x) \
    624   ((x)[AVRC_PF_CHNL_DOWN_OFF] & AVRC_PF_CHNL_DOWN_MASK)
    625 
    626 #define AVRC_PF_PREV_CHNL_BIT_NO 29
    627 #define AVRC_PF_PREV_CHNL_MASK 0x20
    628 #define AVRC_PF_PREV_CHNL_OFF 3
    629 #define AVRC_PF_PREV_CHNL_SUPPORTED(x) \
    630   ((x)[AVRC_PF_PREV_CHNL_OFF] & AVRC_PF_PREV_CHNL_MASK)
    631 
    632 #define AVRC_PF_SOUND_SEL_BIT_NO 30
    633 #define AVRC_PF_SOUND_SEL_MASK 0x40
    634 #define AVRC_PF_SOUND_SEL_OFF 3
    635 #define AVRC_PF_SOUND_SEL_SUPPORTED(x) \
    636   ((x)[AVRC_PF_SOUND_SEL_OFF] & AVRC_PF_SOUND_SEL_MASK)
    637 
    638 #define AVRC_PF_INPUT_SEL_BIT_NO 31
    639 #define AVRC_PF_INPUT_SEL_MASK 0x80
    640 #define AVRC_PF_INPUT_SEL_OFF 3
    641 #define AVRC_PF_INPUT_SEL_SUPPORTED(x) \
    642   ((x)[AVRC_PF_INPUT_SEL_OFF] & AVRC_PF_INPUT_SEL_MASK)
    643 
    644 #define AVRC_PF_DISP_INFO_BIT_NO 32
    645 #define AVRC_PF_DISP_INFO_MASK 0x01
    646 #define AVRC_PF_DISP_INFO_OFF 4
    647 #define AVRC_PF_DISP_INFO_SUPPORTED(x) \
    648   ((x)[AVRC_PF_DISP_INFO_OFF] & AVRC_PF_DISP_INFO_MASK)
    649 
    650 #define AVRC_PF_HELP_BIT_NO 33
    651 #define AVRC_PF_HELP_MASK 0x02
    652 #define AVRC_PF_HELP_OFF 4
    653 #define AVRC_PF_HELP_SUPPORTED(x) ((x)[AVRC_PF_HELP_OFF] & AVRC_PF_HELP_MASK)
    654 
    655 #define AVRC_PF_PAGE_UP_BIT_NO 34
    656 #define AVRC_PF_PAGE_UP_MASK 0x04
    657 #define AVRC_PF_PAGE_UP_OFF 4
    658 #define AVRC_PF_PAGE_UP_SUPPORTED(x) \
    659   ((x)[AVRC_PF_PAGE_UP_OFF] & AVRC_PF_PAGE_UP_MASK)
    660 
    661 #define AVRC_PF_PAGE_DOWN_BIT_NO 35
    662 #define AVRC_PF_PAGE_DOWN_MASK 0x08
    663 #define AVRC_PF_PAGE_DOWN_OFF 4
    664 #define AVRC_PF_PAGE_DOWN_SUPPORTED(x) \
    665   ((x)[AVRC_PF_PAGE_DOWN_OFF] & AVRC_PF_PAGE_DOWN_MASK)
    666 
    667 #define AVRC_PF_POWER_BIT_NO 36
    668 #define AVRC_PF_POWER_MASK 0x10
    669 #define AVRC_PF_POWER_OFF 4
    670 #define AVRC_PF_POWER_SUPPORTED(x) ((x)[AVRC_PF_POWER_OFF] & AVRC_PF_POWER_MASK)
    671 
    672 #define AVRC_PF_VOL_UP_BIT_NO 37
    673 #define AVRC_PF_VOL_UP_MASK 0x20
    674 #define AVRC_PF_VOL_UP_OFF 4
    675 #define AVRC_PF_VOL_UP_SUPPORTED(x) \
    676   ((x)[AVRC_PF_VOL_UP_OFF] & AVRC_PF_VOL_UP_MASK)
    677 
    678 #define AVRC_PF_VOL_DOWN_BIT_NO 38
    679 #define AVRC_PF_VOL_DOWN_MASK 0x40
    680 #define AVRC_PF_VOL_DOWN_OFF 4
    681 #define AVRC_PF_VOL_DOWN_SUPPORTED(x) \
    682   ((x)[AVRC_PF_VOL_DOWN_OFF] & AVRC_PF_VOL_DOWN_MASK)
    683 
    684 #define AVRC_PF_MUTE_BIT_NO 39
    685 #define AVRC_PF_MUTE_MASK 0x80
    686 #define AVRC_PF_MUTE_OFF 4
    687 #define AVRC_PF_MUTE_SUPPORTED(x) ((x)[AVRC_PF_MUTE_OFF] & AVRC_PF_MUTE_MASK)
    688 
    689 #define AVRC_PF_PLAY_BIT_NO 40
    690 #define AVRC_PF_PLAY_MASK 0x01
    691 #define AVRC_PF_PLAY_OFF 5
    692 #define AVRC_PF_PLAY_SUPPORTED(x) ((x)[AVRC_PF_PLAY_OFF] & AVRC_PF_PLAY_MASK)
    693 
    694 #define AVRC_PF_STOP_BIT_NO 41
    695 #define AVRC_PF_STOP_MASK 0x02
    696 #define AVRC_PF_STOP_OFF 5
    697 #define AVRC_PF_STOP_SUPPORTED(x) ((x)[AVRC_PF_STOP_OFF] & AVRC_PF_STOP_MASK)
    698 
    699 #define AVRC_PF_PAUSE_BIT_NO 42
    700 #define AVRC_PF_PAUSE_MASK 0x04
    701 #define AVRC_PF_PAUSE_OFF 5
    702 #define AVRC_PF_PAUSE_SUPPORTED(x) ((x)[AVRC_PF_PAUSE_OFF] & AVRC_PF_PAUSE_MASK)
    703 
    704 #define AVRC_PF_RECORD_BIT_NO 43
    705 #define AVRC_PF_RECORD_MASK 0x08
    706 #define AVRC_PF_RECORD_OFF 5
    707 #define AVRC_PF_RECORD_SUPPORTED(x) \
    708   ((x)[AVRC_PF_RECORD_OFF] & AVRC_PF_RECORD_MASK)
    709 
    710 #define AVRC_PF_REWIND_BIT_NO 44
    711 #define AVRC_PF_REWIND_MASK 0x10
    712 #define AVRC_PF_REWIND_OFF 5
    713 #define AVRC_PF_REWIND_SUPPORTED(x) \
    714   ((x)[AVRC_PF_REWIND_OFF] & AVRC_PF_REWIND_MASK)
    715 
    716 #define AVRC_PF_FAST_FWD_BIT_NO 45
    717 #define AVRC_PF_FAST_FWD_MASK 0x20
    718 #define AVRC_PF_FAST_FWD_OFF 5
    719 #define AVRC_PF_FAST_FWD_SUPPORTED(x) \
    720   ((x)[AVRC_PF_FAST_FWD_OFF] & AVRC_PF_FAST_FWD_MASK)
    721 
    722 #define AVRC_PF_EJECT_BIT_NO 46
    723 #define AVRC_PF_EJECT_MASK 0x40
    724 #define AVRC_PF_EJECT_OFF 5
    725 #define AVRC_PF_EJECT_SUPPORTED(x) ((x)[AVRC_PF_EJECT_OFF] & AVRC_PF_EJECT_MASK)
    726 
    727 #define AVRC_PF_FORWARD_BIT_NO 47
    728 #define AVRC_PF_FORWARD_MASK 0x80
    729 #define AVRC_PF_FORWARD_OFF 5
    730 #define AVRC_PF_FORWARD_SUPPORTED(x) \
    731   ((x)[AVRC_PF_FORWARD_OFF] & AVRC_PF_FORWARD_MASK)
    732 
    733 #define AVRC_PF_BACKWARD_BIT_NO 48
    734 #define AVRC_PF_BACKWARD_MASK 0x01
    735 #define AVRC_PF_BACKWARD_OFF 6
    736 #define AVRC_PF_BACKWARD_SUPPORTED(x) \
    737   ((x)[AVRC_PF_BACKWARD_OFF] & AVRC_PF_BACKWARD_MASK)
    738 
    739 #define AVRC_PF_ANGLE_BIT_NO 49
    740 #define AVRC_PF_ANGLE_MASK 0x02
    741 #define AVRC_PF_ANGLE_OFF 6
    742 #define AVRC_PF_ANGLE_SUPPORTED(x) ((x)[AVRC_PF_ANGLE_OFF] & AVRC_PF_ANGLE_MASK)
    743 
    744 #define AVRC_PF_SUBPICTURE_BIT_NO 50
    745 #define AVRC_PF_SUBPICTURE_MASK 0x04
    746 #define AVRC_PF_SUBPICTURE_OFF 6
    747 #define AVRC_PF_SUBPICTURE_SUPPORTED(x) \
    748   ((x)[AVRC_PF_SUBPICTURE_OFF] & AVRC_PF_SUBPICTURE_MASK)
    749 
    750 #define AVRC_PF_F1_BIT_NO 51
    751 #define AVRC_PF_F1_MASK 0x08
    752 #define AVRC_PF_F1_OFF 6
    753 #define AVRC_PF_F1_SUPPORTED(x) ((x)[AVRC_PF_F1_OFF] & AVRC_PF_F1_MASK)
    754 
    755 #define AVRC_PF_F2_BIT_NO 52
    756 #define AVRC_PF_F2_MASK 0x10
    757 #define AVRC_PF_F2_OFF 6
    758 #define AVRC_PF_F2_SUPPORTED(x) ((x)[AVRC_PF_F2_OFF] & AVRC_PF_F2_MASK)
    759 
    760 #define AVRC_PF_F3_BIT_NO 53
    761 #define AVRC_PF_F3_MASK 0x20
    762 #define AVRC_PF_F3_OFF 6
    763 #define AVRC_PF_F3_SUPPORTED(x) ((x)[AVRC_PF_F3_OFF] & AVRC_PF_F3_MASK)
    764 
    765 #define AVRC_PF_F4_BIT_NO 54
    766 #define AVRC_PF_F4_MASK 0x40
    767 #define AVRC_PF_F4_OFF 6
    768 #define AVRC_PF_F4_SUPPORTED(x) ((x)[AVRC_PF_F4_OFF] & AVRC_PF_F4_MASK)
    769 
    770 #define AVRC_PF_F5_BIT_NO 55
    771 #define AVRC_PF_F5_MASK 0x80
    772 #define AVRC_PF_F5_OFF 6
    773 #define AVRC_PF_F5_SUPPORTED(x) ((x)[AVRC_PF_F5_OFF] & AVRC_PF_F5_MASK)
    774 
    775 /* Vendor unique. This PASSTHROUGH command is supported. */
    776 #define AVRC_PF_VENDOR_BIT_NO 56
    777 #define AVRC_PF_VENDOR_MASK 0x01
    778 #define AVRC_PF_VENDOR_OFF 7
    779 #define AVRC_PF_VENDOR_SUPPORTED(x) \
    780   ((x)[AVRC_PF_VENDOR_OFF] & AVRC_PF_VENDOR_MASK)
    781 
    782 /* Basic Group Navigation.  This overrules the SDP entry as it is set per
    783  * player.7 */
    784 #define AVRC_PF_GROUP_NAVI_BIT_NO 57
    785 #define AVRC_PF_GROUP_NAVI_MASK 0x02
    786 #define AVRC_PF_GROUP_NAVI_OFF 7
    787 #define AVRC_PF_GROUP_NAVI_SUPPORTED(x) \
    788   ((x)[AVRC_PF_GROUP_NAVI_OFF] & AVRC_PF_GROUP_NAVI_MASK)
    789 
    790 /* Advanced Control Player.  This bit is set if the player supports at least
    791  * AVRCP 1.4. */
    792 #define AVRC_PF_ADV_CTRL_BIT_NO 58
    793 #define AVRC_PF_ADV_CTRL_MASK 0x04
    794 #define AVRC_PF_ADV_CTRL_OFF 7
    795 #define AVRC_PF_ADV_CTRL_SUPPORTED(x) \
    796   ((x)[AVRC_PF_ADV_CTRL_OFF] & AVRC_PF_ADV_CTRL_MASK)
    797 
    798 /* Browsing.  This bit is set if the player supports browsing. */
    799 #define AVRC_PF_BROWSE_BIT_NO 59
    800 #define AVRC_PF_BROWSE_MASK 0x08
    801 #define AVRC_PF_BROWSE_OFF 7
    802 #define AVRC_PF_BROWSE_SUPPORTED(x) \
    803   ((x)[AVRC_PF_BROWSE_OFF] & AVRC_PF_BROWSE_MASK)
    804 
    805 /* Searching. This bit is set if the player supports searching. */
    806 #define AVRC_PF_SEARCH_BIT_NO 60
    807 #define AVRC_PF_SEARCH_MASK 0x10
    808 #define AVRC_PF_SEARCH_OFF 7
    809 #define AVRC_PF_SEARCH_SUPPORTED(x) \
    810   ((x)[AVRC_PF_SEARCH_OFF] & AVRC_PF_SEARCH_MASK)
    811 
    812 /* AddToNowPlaying.  This bit is set if the player supports the AddToNowPlaying
    813  * command. */
    814 #define AVRC_PF_ADD2NOWPLAY_BIT_NO 61
    815 #define AVRC_PF_ADD2NOWPLAY_MASK 0x20
    816 #define AVRC_PF_ADD2NOWPLAY_OFF 7
    817 #define AVRC_PF_ADD2NOWPLAY_SUPPORTED(x) \
    818   ((x)[AVRC_PF_ADD2NOWPLAY_OFF] & AVRC_PF_ADD2NOWPLAY_MASK)
    819 
    820 /* UIDs unique in player browse tree.  This bit is set if the player is able to
    821  * maintain unique UIDs across the player browse tree. */
    822 #define AVRC_PF_UID_UNIQUE_BIT_NO 62
    823 #define AVRC_PF_UID_UNIQUE_MASK 0x40
    824 #define AVRC_PF_UID_UNIQUE_OFF 7
    825 #define AVRC_PF_UID_UNIQUE_SUPPORTED(x) \
    826   ((x)[AVRC_PF_UID_UNIQUE_OFF] & AVRC_PF_UID_UNIQUE_MASK)
    827 
    828 /* OnlyBrowsableWhenAddressed.  This bit is set if the player is only able to be
    829  * browsed when it is set as the Addressed Player. */
    830 #define AVRC_PF_BR_WH_ADDR_BIT_NO 63
    831 #define AVRC_PF_BR_WH_ADDR_MASK 0x80
    832 #define AVRC_PF_BR_WH_ADDR_OFF 7
    833 #define AVRC_PF_BR_WH_ADDR_SUPPORTED(x) \
    834   ((x)[AVRC_PF_BR_WH_ADDR_OFF] & AVRC_PF_BR_WH_ADDR_MASK)
    835 
    836 /* OnlySearchableWhenAddressed.  This bit is set if the player is only able to
    837  * be searched when it is set as the Addressed player. */
    838 #define AVRC_PF_SEARCH_WH_ADDR_BIT_NO 64
    839 #define AVRC_PF_SEARCH_WH_ADDR_MASK 0x01
    840 #define AVRC_PF_SEARCH_WH_ADDR_OFF 8
    841 #define AVRC_PF_SEARCH_WH_ADDR_SUPPORTED(x) \
    842   ((x)[AVRC_PF_SEARCH_WH_ADDR_OFF] & AVRC_PF_SEARCH_WH_ADDR_MASK)
    843 
    844 /* NowPlaying.  This bit is set if the player supports the NowPlaying folder.
    845  * Note that for all players that support browsing this bit shall be set */
    846 #define AVRC_PF_NOW_PLAY_BIT_NO 65
    847 #define AVRC_PF_NOW_PLAY_MASK 0x02
    848 #define AVRC_PF_NOW_PLAY_OFF 8
    849 #define AVRC_PF_NOW_PLAY_SUPPORTED(x) \
    850   ((x)[AVRC_PF_NOW_PLAY_OFF] & AVRC_PF_NOW_PLAY_MASK)
    851 
    852 /* UIDPersistency.  This bit is set if the Player is able to persist UID values
    853  * between AVRCP Browse Reconnect */
    854 #define AVRC_PF_UID_PERSIST_BIT_NO 66
    855 #define AVRC_PF_UID_PERSIST_MASK 0x04
    856 #define AVRC_PF_UID_PERSIST_OFF 8
    857 #define AVRC_PF_UID_PERSIST_SUPPORTED(x) \
    858   ((x)[AVRC_PF_UID_PERSIST_OFF] & AVRC_PF_UID_PERSIST_MASK)
    859 
    860 /* NumberOfItems. This bit is set if player supports the GetTotalNumberOfItems
    861  * browsing command. */
    862 #define AVRC_PF_GET_NUM_OF_ITEMS_BIT_NO 67
    863 #define AVRC_PF_GET_NUM_OF_ITEMS_MASK 0x08
    864 #define AVRC_PF_GET_NUM_OF_ITEMS_OFF 8
    865 #define AVRC_PF_GET_NUM_OF_ITEMS_SUPPORTED(x) \
    866   ((x)[AVRC_PF_GET_NUM_OF_ITEMS_OFF] & AVRC_PF_GET_NUM_OF_ITEMS_MASK)
    867 
    868 /*****************************************************************************
    869  *  data type definitions
    870  ****************************************************************************/
    871 
    872 /*
    873 This structure contains the header parameters of an AV/C message.
    874 */
    875 typedef struct {
    876   uint8_t ctype;        /* Command type.  */
    877   uint8_t subunit_type; /* Subunit type. */
    878   uint8_t subunit_id; /* Subunit ID.  This value is typically ignored in AVRCP,
    879                        * except for VENDOR DEPENDENT messages when the value is
    880                        * vendor-dependent.  Value range is 0-7. */
    881   uint8_t opcode;     /* Op Code (passthrough, vendor, etc) */
    882 } tAVRC_HDR;
    883 
    884 /* This structure contains a UNIT INFO message. */
    885 typedef struct {
    886   tAVRC_HDR hdr;       /* Message header. */
    887   uint32_t company_id; /* Company identifier. */
    888   uint8_t unit_type;   /* Unit type.  Uses the same values as subunit type. */
    889   uint8_t unit;        /* This value is vendor dependent and typically zero.  */
    890 } tAVRC_MSG_UNIT;
    891 
    892 /* This structure contains a SUBUNIT INFO message. */
    893 typedef struct {
    894   tAVRC_HDR hdr; /* Message header. */
    895   uint8_t subunit_type[AVRC_SUB_TYPE_LEN];
    896   /* Array containing subunit type values.  */
    897   bool panel;   /* true if the panel subunit type is in the
    898                  * subunit_type array, false otherwise. */
    899   uint8_t page; /* Specifies which part of the subunit type table is
    900                  * returned.  For AVRCP it is typically zero.
    901                  * Value range is 0-7. */
    902 } tAVRC_MSG_SUB;
    903 
    904 /* This structure contains a VENDOR DEPENDENT message. */
    905 typedef struct {
    906   tAVRC_HDR hdr;          /* Message header. */
    907   uint32_t company_id;    /* Company identifier. */
    908   uint8_t* p_vendor_data; /* Pointer to vendor dependent data. */
    909   uint16_t vendor_len;    /* Length in bytes of vendor dependent data. */
    910 } tAVRC_MSG_VENDOR;
    911 
    912 /* PASS THROUGH message structure */
    913 typedef struct {
    914   tAVRC_HDR hdr;        /* hdr.ctype Unused.
    915                          * hdr.subunit_type Unused.
    916                          * hdr.subunit_id Unused. */
    917   uint8_t op_id;        /* Operation ID.  */
    918   uint8_t state;        /* Keypress state.  */
    919   uint8_t* p_pass_data; /* Pointer to data.  This parameter is only valid
    920                          * when the op_id is AVRC_ID_VENDOR.*/
    921   uint8_t pass_len;     /* Length in bytes of data. This parameter is only
    922                          * valid when the op_id is AVRC_ID_VENDOR.*/
    923 } tAVRC_MSG_PASS;
    924 
    925 /* Command/Response indicator. */
    926 #define AVRC_CMD AVCT_CMD /* Command message */
    927 #define AVRC_RSP AVCT_RSP /* Response message */
    928 
    929 /* Browsing channel message structure */
    930 typedef struct {
    931   tAVRC_HDR hdr;          /* hdr.ctype AVRC_CMD or AVRC_RSP.
    932                            * hdr.subunit_type Unused.
    933                            * hdr.subunit_id Unused. */
    934   uint8_t* p_browse_data; /* Pointer to data.  */
    935   uint16_t browse_len;    /* Length in bytes of data. */
    936   BT_HDR* p_browse_pkt; /* The GKI buffer received. Set to NULL, if the callback
    937                            function wants to keep the buffer */
    938 } tAVRC_MSG_BROWSE;
    939 
    940 /* This is a union of all message type structures. */
    941 typedef union {
    942   tAVRC_HDR hdr;           /* Message header. */
    943   tAVRC_MSG_UNIT unit;     /* UNIT INFO message. */
    944   tAVRC_MSG_SUB sub;       /* SUBUNIT INFO message. */
    945   tAVRC_MSG_VENDOR vendor; /* VENDOR DEPENDENT message. */
    946   tAVRC_MSG_PASS pass;     /* PASS THROUGH message. */
    947   tAVRC_MSG_BROWSE browse; /* messages thru browsing channel */
    948 } tAVRC_MSG;
    949 
    950 /* macros */
    951 #define AVRC_IS_VALID_CAP_ID(a)                                         \
    952   ((((a) == AVRC_CAP_COMPANY_ID) || ((a) == AVRC_CAP_EVENTS_SUPPORTED)) \
    953        ? true                                                           \
    954        : false)
    955 
    956 #define AVRC_IS_VALID_EVENT_ID(a)                                            \
    957   ((((a) >= AVRC_EVT_PLAY_STATUS_CHANGE) && ((a) <= AVRC_EVT_VOLUME_CHANGE)) \
    958        ? true                                                                \
    959        : false)
    960 
    961 #define AVRC_IS_VALID_ATTRIBUTE(a)                      \
    962   ((((((a) > 0) && (a) <= AVRC_PLAYER_SETTING_SCAN)) || \
    963     ((a) >= AVRC_PLAYER_SETTING_LOW_MENU_EXT))          \
    964        ? true                                           \
    965        : false)
    966 
    967 #define AVRC_IS_VALID_MEDIA_ATTRIBUTE(a)            \
    968   (((a) >= AVRC_MEDIA_ATTR_ID_TITLE) &&             \
    969            ((a) <= AVRC_MEDIA_ATTR_ID_PLAYING_TIME) \
    970        ? true                                       \
    971        : false)
    972 
    973 #define AVRC_IS_VALID_BATTERY_STATUS(a) \
    974   (((a) <= AVRC_BATTERY_STATUS_FULL_CHARGE) ? true : false)
    975 
    976 #define AVRC_IS_VALID_SYSTEM_STATUS(a) \
    977   (((a) <= AVRC_SYSTEMSTATE_PWR_UNPLUGGED) ? true : false)
    978 
    979 #define AVRC_IS_VALID_GROUP(a) (((a) <= AVRC_PDU_PREV_GROUP) ? true : false)
    980 
    981 /* Company ID is 24-bit integer We can not use the macros in bt_types.h */
    982 #define AVRC_CO_ID_TO_BE_STREAM(p, u32) \
    983   {                                     \
    984     *(p)++ = (uint8_t)((u32) >> 16);    \
    985     *(p)++ = (uint8_t)((u32) >> 8);     \
    986     *(p)++ = (uint8_t)(u32);            \
    987   }
    988 #define AVRC_BE_STREAM_TO_CO_ID(u32, p)                                   \
    989   {                                                                       \
    990     (u32) = (((uint32_t)(*((p) + 2))) + (((uint32_t)(*((p) + 1))) << 8) + \
    991              (((uint32_t)(*(p))) << 16));                                 \
    992     (p) += 3;                                                             \
    993   }
    994 
    995 /*****************************************************************************
    996  *  data type definitions
    997  ****************************************************************************/
    998 #define AVRC_MAX_APP_ATTR_SIZE 16
    999 #define AVRC_MAX_CHARSET_SIZE 16
   1000 #define AVRC_MAX_ELEM_ATTR_SIZE 8
   1001 
   1002 /*****************************************************************************
   1003  *  Metadata transfer Building/Parsing definitions
   1004  ****************************************************************************/
   1005 
   1006 typedef struct {
   1007   uint16_t charset_id;
   1008   uint16_t str_len;
   1009   uint8_t* p_str;
   1010 } tAVRC_FULL_NAME;
   1011 
   1012 typedef struct {
   1013   uint16_t str_len;
   1014   uint8_t* p_str;
   1015 } tAVRC_NAME;
   1016 
   1017 #ifndef AVRC_CAP_MAX_NUM_COMP_ID
   1018 #define AVRC_CAP_MAX_NUM_COMP_ID 4
   1019 #endif
   1020 
   1021 #ifndef AVRC_CAP_MAX_NUM_EVT_ID
   1022 #define AVRC_CAP_MAX_NUM_EVT_ID 16
   1023 #endif
   1024 
   1025 typedef union {
   1026   uint32_t company_id[AVRC_CAP_MAX_NUM_COMP_ID];
   1027   uint8_t event_id[AVRC_CAP_MAX_NUM_EVT_ID];
   1028 } tAVRC_CAPS_PARAM;
   1029 
   1030 typedef struct {
   1031   uint8_t attr_id;
   1032   uint8_t attr_val;
   1033 } tAVRC_APP_SETTING;
   1034 
   1035 typedef struct {
   1036   uint8_t attr_id;
   1037   uint16_t charset_id;
   1038   uint8_t str_len;
   1039   uint8_t* p_str;
   1040 } tAVRC_APP_SETTING_TEXT;
   1041 
   1042 typedef uint8_t tAVRC_FEATURE_MASK[AVRC_FEATURE_MASK_SIZE];
   1043 
   1044 typedef struct {
   1045   uint16_t player_id;  /* A unique identifier for this media player.*/
   1046   uint8_t major_type;  /* Use AVRC_MJ_TYPE_AUDIO, AVRC_MJ_TYPE_VIDEO,
   1047                           AVRC_MJ_TYPE_BC_AUDIO, or AVRC_MJ_TYPE_BC_VIDEO.*/
   1048   uint32_t sub_type;   /* Use AVRC_SUB_TYPE_NONE, AVRC_SUB_TYPE_AUDIO_BOOK, or
   1049                           AVRC_SUB_TYPE_PODCAST*/
   1050   uint8_t play_status; /* Use AVRC_PLAYSTATE_STOPPED, AVRC_PLAYSTATE_PLAYING,
   1051                           AVRC_PLAYSTATE_PAUSED, AVRC_PLAYSTATE_FWD_SEEK,
   1052                            AVRC_PLAYSTATE_REV_SEEK, or AVRC_PLAYSTATE_ERROR*/
   1053   tAVRC_FEATURE_MASK features; /* Supported feature bit mask*/
   1054   tAVRC_FULL_NAME name; /* The player name, name length and character set id.*/
   1055 } tAVRC_ITEM_PLAYER;
   1056 
   1057 typedef struct {
   1058   tAVRC_UID uid;        /* The uid of this folder */
   1059   uint8_t type;         /* Use AVRC_FOLDER_TYPE_MIXED, AVRC_FOLDER_TYPE_TITLES,
   1060                            AVRC_FOLDER_TYPE_ALNUMS, AVRC_FOLDER_TYPE_ARTISTS,
   1061                            AVRC_FOLDER_TYPE_GENRES,
   1062                            AVRC_FOLDER_TYPE_PLAYLISTS, or AVRC_FOLDER_TYPE_YEARS.*/
   1063   bool playable;        /* true, if the folder can be played. */
   1064   tAVRC_FULL_NAME name; /* The folder name, name length and character set id. */
   1065 } tAVRC_ITEM_FOLDER;
   1066 
   1067 typedef struct {
   1068   uint32_t
   1069       attr_id; /* Use AVRC_MEDIA_ATTR_ID_TITLE, AVRC_MEDIA_ATTR_ID_ARTIST,
   1070                   AVRC_MEDIA_ATTR_ID_ALBUM,
   1071                   AVRC_MEDIA_ATTR_ID_TRACK_NUM, AVRC_MEDIA_ATTR_ID_NUM_TRACKS,
   1072                   AVRC_MEDIA_ATTR_ID_GENRE, AVRC_MEDIA_ATTR_ID_PLAYING_TIME */
   1073   tAVRC_FULL_NAME
   1074       name; /* The attribute value, value length and character set id. */
   1075 } tAVRC_ATTR_ENTRY;
   1076 
   1077 typedef struct {
   1078   tAVRC_UID uid; /* The uid of this media element item */
   1079   uint8_t type;  /* Use AVRC_MEDIA_TYPE_AUDIO or AVRC_MEDIA_TYPE_VIDEO. */
   1080   tAVRC_FULL_NAME name; /* The media name, name length and character set id. */
   1081   uint8_t attr_count;   /* The number of attributes in p_attr_list */
   1082   tAVRC_ATTR_ENTRY* p_attr_list; /* Attribute entry list. */
   1083 } tAVRC_ITEM_MEDIA;
   1084 
   1085 typedef struct {
   1086   uint8_t
   1087       item_type; /* AVRC_ITEM_PLAYER, AVRC_ITEM_FOLDER, or AVRC_ITEM_MEDIA */
   1088   union {
   1089     tAVRC_ITEM_PLAYER player; /* The properties of a media player item.*/
   1090     tAVRC_ITEM_FOLDER folder; /* The properties of a folder item.*/
   1091     tAVRC_ITEM_MEDIA media;   /* The properties of a media item.*/
   1092   } u;
   1093 } tAVRC_ITEM;
   1094 
   1095 /* GetCapability */
   1096 typedef struct {
   1097   uint8_t pdu;
   1098   tAVRC_STS status;
   1099   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1100   uint8_t capability_id;
   1101 } tAVRC_GET_CAPS_CMD;
   1102 
   1103 /* ListPlayerAppValues */
   1104 typedef struct {
   1105   uint8_t pdu;
   1106   tAVRC_STS status;
   1107   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1108   uint8_t attr_id;
   1109 } tAVRC_LIST_APP_VALUES_CMD;
   1110 
   1111 /* GetCurAppValue */
   1112 typedef struct {
   1113   uint8_t pdu;
   1114   tAVRC_STS status;
   1115   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1116   uint8_t num_attr;
   1117   uint8_t attrs[AVRC_MAX_APP_ATTR_SIZE];
   1118 } tAVRC_GET_CUR_APP_VALUE_CMD;
   1119 
   1120 /* SetAppValue */
   1121 typedef struct {
   1122   uint8_t pdu;
   1123   tAVRC_STS status;
   1124   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1125   uint8_t num_val;
   1126   tAVRC_APP_SETTING* p_vals;
   1127 } tAVRC_SET_APP_VALUE_CMD;
   1128 
   1129 /* GetAppAttrTxt */
   1130 typedef struct {
   1131   uint8_t pdu;
   1132   tAVRC_STS status;
   1133   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1134   uint8_t num_attr;
   1135   uint8_t attrs[AVRC_MAX_APP_ATTR_SIZE];
   1136 } tAVRC_GET_APP_ATTR_TXT_CMD;
   1137 
   1138 /* GetAppValueTxt */
   1139 typedef struct {
   1140   uint8_t pdu;
   1141   tAVRC_STS status;
   1142   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1143   uint8_t attr_id;
   1144   uint8_t num_val;
   1145   uint8_t vals[AVRC_MAX_APP_ATTR_SIZE];
   1146 } tAVRC_GET_APP_VAL_TXT_CMD;
   1147 
   1148 /* InformCharset */
   1149 typedef struct {
   1150   uint8_t pdu;
   1151   tAVRC_STS status;
   1152   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1153   uint8_t num_id;
   1154   uint16_t charsets[AVRC_MAX_CHARSET_SIZE];
   1155 } tAVRC_INFORM_CHARSET_CMD;
   1156 
   1157 /* InformBatteryStatus */
   1158 typedef struct {
   1159   uint8_t pdu;
   1160   tAVRC_STS status;
   1161   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1162   uint8_t battery_status;
   1163 } tAVRC_BATTERY_STATUS_CMD;
   1164 
   1165 /* GetElemAttrs */
   1166 typedef struct {
   1167   uint8_t pdu;
   1168   tAVRC_STS status;
   1169   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1170   uint8_t num_attr;
   1171   uint32_t attrs[AVRC_MAX_ELEM_ATTR_SIZE];
   1172 } tAVRC_GET_ELEM_ATTRS_CMD;
   1173 
   1174 /* RegNotify */
   1175 typedef struct {
   1176   uint8_t pdu;
   1177   tAVRC_STS status;
   1178   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1179   uint8_t event_id;
   1180   uint32_t param;
   1181 } tAVRC_REG_NOTIF_CMD;
   1182 
   1183 /* SetAddrPlayer */
   1184 typedef struct {
   1185   uint8_t pdu;
   1186   tAVRC_STS status;
   1187   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1188   uint16_t player_id;
   1189 } tAVRC_SET_ADDR_PLAYER_CMD;
   1190 
   1191 /* SetBrowsedPlayer */
   1192 typedef struct {
   1193   uint8_t pdu;
   1194   tAVRC_STS status;
   1195   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1196   uint16_t player_id;
   1197 } tAVRC_SET_BR_PLAYER_CMD;
   1198 
   1199 /* SetAbsVolume */
   1200 typedef struct {
   1201   uint8_t pdu;
   1202   tAVRC_STS status;
   1203   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1204   uint8_t volume;
   1205 } tAVRC_SET_VOLUME_CMD;
   1206 
   1207 /* GetFolderItems */
   1208 typedef struct {
   1209   uint8_t pdu;
   1210   tAVRC_STS status;
   1211   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1212   uint8_t scope;
   1213   uint32_t start_item;
   1214   uint32_t end_item;
   1215   uint8_t attr_count;
   1216   uint32_t* p_attr_list;
   1217 } tAVRC_GET_ITEMS_CMD;
   1218 
   1219 /* ChangePath */
   1220 typedef struct {
   1221   uint8_t pdu;
   1222   tAVRC_STS status;
   1223   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1224   uint16_t uid_counter;
   1225   uint8_t direction;
   1226   tAVRC_UID folder_uid;
   1227 } tAVRC_CHG_PATH_CMD;
   1228 
   1229 /* GetItemAttrs */
   1230 typedef struct {
   1231   uint8_t pdu;
   1232   tAVRC_STS status;
   1233   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1234   uint8_t scope;
   1235   tAVRC_UID uid;
   1236   uint16_t uid_counter;
   1237   uint8_t attr_count;
   1238   uint32_t* p_attr_list;
   1239 } tAVRC_GET_ATTRS_CMD;
   1240 
   1241 /* Search */
   1242 typedef struct {
   1243   uint8_t pdu;
   1244   tAVRC_STS status;
   1245   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1246   tAVRC_FULL_NAME string;
   1247 } tAVRC_SEARCH_CMD;
   1248 
   1249 /* PlayItem */
   1250 typedef struct {
   1251   uint8_t pdu;
   1252   tAVRC_STS status;
   1253   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1254   uint8_t scope;
   1255   tAVRC_UID uid;
   1256   uint16_t uid_counter;
   1257 } tAVRC_PLAY_ITEM_CMD;
   1258 
   1259 /* AddToNowPlaying */
   1260 typedef struct {
   1261   uint8_t pdu;
   1262   tAVRC_STS status;
   1263   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1264   uint8_t scope;
   1265   tAVRC_UID uid;
   1266   uint16_t uid_counter;
   1267 } tAVRC_ADD_TO_PLAY_CMD;
   1268 
   1269 /* GetTotalNumOfItems */
   1270 typedef struct {
   1271   uint8_t pdu;
   1272   tAVRC_STS status;
   1273   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1274   uint8_t scope;
   1275 } tAVRC_GET_NUM_OF_ITEMS_CMD;
   1276 
   1277 typedef struct {
   1278   uint8_t pdu;
   1279   tAVRC_STS status;
   1280   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1281 } tAVRC_CMD;
   1282 
   1283 /* Continue and Abort */
   1284 typedef struct {
   1285   uint8_t pdu;
   1286   tAVRC_STS status;
   1287   uint8_t opcode; /* Op Code (assigned by AVRC_BldCommand according to pdu) */
   1288   uint8_t target_pdu;
   1289 } tAVRC_NEXT_CMD;
   1290 
   1291 typedef union {
   1292   uint8_t pdu;
   1293   tAVRC_CMD cmd;
   1294   tAVRC_GET_CAPS_CMD get_caps;                    /* GetCapability */
   1295   tAVRC_CMD list_app_attr;                        /* ListPlayerAppAttr */
   1296   tAVRC_LIST_APP_VALUES_CMD list_app_values;      /* ListPlayerAppValues */
   1297   tAVRC_GET_CUR_APP_VALUE_CMD get_cur_app_val;    /* GetCurAppValue */
   1298   tAVRC_SET_APP_VALUE_CMD set_app_val;            /* SetAppValue */
   1299   tAVRC_GET_APP_ATTR_TXT_CMD get_app_attr_txt;    /* GetAppAttrTxt */
   1300   tAVRC_GET_APP_VAL_TXT_CMD get_app_val_txt;      /* GetAppValueTxt */
   1301   tAVRC_INFORM_CHARSET_CMD inform_charset;        /* InformCharset */
   1302   tAVRC_BATTERY_STATUS_CMD inform_battery_status; /* InformBatteryStatus */
   1303   tAVRC_GET_ELEM_ATTRS_CMD get_elem_attrs;        /* GetElemAttrs */
   1304   tAVRC_CMD get_play_status;                      /* GetPlayStatus */
   1305   tAVRC_REG_NOTIF_CMD reg_notif;                  /* RegNotify */
   1306   tAVRC_NEXT_CMD continu;                         /* Continue */
   1307   tAVRC_NEXT_CMD abort;                           /* Abort */
   1308 
   1309   tAVRC_SET_ADDR_PLAYER_CMD addr_player;       /* SetAddrPlayer */
   1310   tAVRC_SET_VOLUME_CMD volume;                 /* SetAbsVolume */
   1311   tAVRC_SET_BR_PLAYER_CMD br_player;           /* SetBrowsedPlayer */
   1312   tAVRC_GET_ITEMS_CMD get_items;               /* GetFolderItems */
   1313   tAVRC_CHG_PATH_CMD chg_path;                 /* ChangePath */
   1314   tAVRC_GET_ATTRS_CMD get_attrs;               /* GetItemAttrs */
   1315   tAVRC_SEARCH_CMD search;                     /* Search */
   1316   tAVRC_PLAY_ITEM_CMD play_item;               /* PlayItem */
   1317   tAVRC_ADD_TO_PLAY_CMD add_to_play;           /* AddToNowPlaying */
   1318   tAVRC_GET_NUM_OF_ITEMS_CMD get_num_of_items; /* GetTotalNumOfItems */
   1319 } tAVRC_COMMAND;
   1320 
   1321 /* GetCapability */
   1322 typedef struct {
   1323   uint8_t pdu;
   1324   tAVRC_STS status;
   1325   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1326                      user. invalid one to generate according to pdu) */
   1327   uint8_t capability_id;
   1328   uint8_t count;
   1329   tAVRC_CAPS_PARAM param;
   1330 } tAVRC_GET_CAPS_RSP;
   1331 
   1332 /* ListPlayerAppAttr */
   1333 typedef struct {
   1334   uint8_t pdu;
   1335   tAVRC_STS status;
   1336   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1337                      user. invalid one to generate according to pdu) */
   1338   uint8_t num_attr;
   1339   uint8_t attrs[AVRC_MAX_APP_ATTR_SIZE];
   1340 } tAVRC_LIST_APP_ATTR_RSP;
   1341 
   1342 /* ListPlayerAppValues */
   1343 typedef struct {
   1344   uint8_t pdu;
   1345   tAVRC_STS status;
   1346   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1347                      user. invalid one to generate according to pdu) */
   1348   uint8_t num_val;
   1349   uint8_t vals[AVRC_MAX_APP_ATTR_SIZE];
   1350 } tAVRC_LIST_APP_VALUES_RSP;
   1351 
   1352 /* GetCurAppValue */
   1353 typedef struct {
   1354   uint8_t pdu;
   1355   tAVRC_STS status;
   1356   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1357                      user. invalid one to generate according to pdu) */
   1358   uint8_t num_val;
   1359   tAVRC_APP_SETTING* p_vals;
   1360 } tAVRC_GET_CUR_APP_VALUE_RSP;
   1361 
   1362 /* GetAppAttrTxt */
   1363 typedef struct {
   1364   uint8_t pdu;
   1365   tAVRC_STS status;
   1366   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1367                      user. invalid one to generate according to pdu) */
   1368   uint8_t num_attr;
   1369   tAVRC_APP_SETTING_TEXT* p_attrs;
   1370 } tAVRC_GET_APP_ATTR_TXT_RSP;
   1371 
   1372 /* GetPlayStatus */
   1373 typedef struct {
   1374   uint8_t pdu;
   1375   tAVRC_STS status;
   1376   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1377                      user. invalid one to generate according to pdu) */
   1378   uint32_t song_len;
   1379   uint32_t song_pos;
   1380   uint8_t play_status;
   1381 } tAVRC_GET_PLAY_STATUS_RSP;
   1382 
   1383 /* notification event parameter for AddressedPlayer change */
   1384 typedef struct {
   1385   uint16_t player_id;
   1386   uint16_t uid_counter;
   1387 } tAVRC_ADDR_PLAYER_PARAM;
   1388 
   1389 #ifndef AVRC_MAX_APP_SETTINGS
   1390 #define AVRC_MAX_APP_SETTINGS 8
   1391 #endif
   1392 
   1393 /* notification event parameter for Player Application setting change */
   1394 typedef struct {
   1395   uint8_t num_attr;
   1396   uint8_t attr_id[AVRC_MAX_APP_SETTINGS];
   1397   uint8_t attr_value[AVRC_MAX_APP_SETTINGS];
   1398 } tAVRC_PLAYER_APP_PARAM;
   1399 
   1400 typedef union {
   1401   tAVRC_PLAYSTATE play_status;
   1402   tAVRC_UID track;
   1403   uint32_t play_pos;
   1404   tAVRC_BATTERY_STATUS battery_status;
   1405   tAVRC_SYSTEMSTATE system_status;
   1406   tAVRC_PLAYER_APP_PARAM player_setting;
   1407   tAVRC_ADDR_PLAYER_PARAM addr_player;
   1408   uint16_t uid_counter;
   1409   uint8_t volume;
   1410 } tAVRC_NOTIF_RSP_PARAM;
   1411 
   1412 /* RegNotify */
   1413 typedef struct {
   1414   uint8_t pdu;
   1415   tAVRC_STS status;
   1416   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1417                      user. invalid one to generate according to pdu) */
   1418   uint8_t event_id;
   1419   tAVRC_NOTIF_RSP_PARAM param;
   1420 } tAVRC_REG_NOTIF_RSP;
   1421 
   1422 /* SetAbsVolume */
   1423 typedef struct {
   1424   uint8_t pdu;
   1425   tAVRC_STS status;
   1426   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1427                      user. invalid one to generate according to pdu) */
   1428   uint8_t volume;
   1429 } tAVRC_SET_VOLUME_RSP;
   1430 
   1431 /* SetBrowsedPlayer */
   1432 typedef struct {
   1433   uint8_t pdu;
   1434   tAVRC_STS status;
   1435   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1436                      user. invalid one to generate according to pdu) */
   1437   uint16_t uid_counter;
   1438   uint32_t num_items;
   1439   uint16_t charset_id;
   1440   uint8_t folder_depth;
   1441   tAVRC_NAME* p_folders;
   1442 } tAVRC_SET_BR_PLAYER_RSP;
   1443 
   1444 /* GetFolderItems */
   1445 typedef struct {
   1446   uint8_t pdu;
   1447   tAVRC_STS status;
   1448   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1449                      user. invalid one to generate according to pdu) */
   1450   uint16_t uid_counter;
   1451   uint16_t item_count;
   1452   tAVRC_ITEM* p_item_list;
   1453 } tAVRC_GET_ITEMS_RSP;
   1454 
   1455 /* ChangePath */
   1456 typedef struct {
   1457   uint8_t pdu;
   1458   tAVRC_STS status;
   1459   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1460                      user. invalid one to generate according to pdu) */
   1461   uint32_t num_items;
   1462 } tAVRC_CHG_PATH_RSP;
   1463 
   1464 /* GetItemAttrs, GetElemAttrs */
   1465 typedef struct {
   1466   uint8_t pdu;
   1467   tAVRC_STS status;
   1468   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1469                      user. invalid one to generate according to pdu) */
   1470   uint8_t num_attrs;
   1471   tAVRC_ATTR_ENTRY* p_attrs;
   1472 } tAVRC_GET_ATTRS_RSP;
   1473 
   1474 /* Get Total Number of Items */
   1475 typedef struct {
   1476   uint8_t pdu;
   1477   tAVRC_STS status;
   1478   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1479                      user. invalid one to generate according to pdu) */
   1480   uint16_t uid_counter;
   1481   uint32_t num_items;
   1482 } tAVRC_GET_NUM_OF_ITEMS_RSP;
   1483 
   1484 /* Search */
   1485 typedef struct {
   1486   uint8_t pdu;
   1487   tAVRC_STS status;
   1488   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1489                      user. invalid one to generate according to pdu) */
   1490   uint16_t uid_counter;
   1491   uint32_t num_items;
   1492 } tAVRC_SEARCH_RSP;
   1493 
   1494 typedef struct {
   1495   uint8_t pdu;
   1496   tAVRC_STS status;
   1497   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1498                      user. invalid one to generate according to pdu) */
   1499   uint8_t target_pdu;
   1500 } tAVRC_NEXT_RSP;
   1501 
   1502 typedef struct {
   1503   uint8_t pdu;
   1504   tAVRC_STS status;
   1505   uint8_t opcode; /* Op Code (copied from avrc_cmd.opcode by AVRC_BldResponse
   1506                      user. invalid one to generate according to pdu) */
   1507 } tAVRC_RSP;
   1508 
   1509 typedef union {
   1510   uint8_t pdu;
   1511   tAVRC_RSP rsp;
   1512   tAVRC_GET_CAPS_RSP get_caps;                 /* GetCapability */
   1513   tAVRC_LIST_APP_ATTR_RSP list_app_attr;       /* ListPlayerAppAttr */
   1514   tAVRC_LIST_APP_VALUES_RSP list_app_values;   /* ListPlayerAppValues */
   1515   tAVRC_GET_CUR_APP_VALUE_RSP get_cur_app_val; /* GetCurAppValue */
   1516   tAVRC_RSP set_app_val;                       /* SetAppValue */
   1517   tAVRC_GET_APP_ATTR_TXT_RSP get_app_attr_txt; /* GetAppAttrTxt */
   1518   tAVRC_GET_APP_ATTR_TXT_RSP get_app_val_txt;  /* GetAppValueTxt */
   1519   tAVRC_RSP inform_charset;                    /* InformCharset */
   1520   tAVRC_RSP inform_battery_status;             /* InformBatteryStatus */
   1521   tAVRC_GET_PLAY_STATUS_RSP get_play_status;   /* GetPlayStatus */
   1522   tAVRC_REG_NOTIF_RSP reg_notif;               /* RegNotify */
   1523   tAVRC_NEXT_RSP continu;                      /* Continue */
   1524   tAVRC_NEXT_RSP abort;                        /* Abort */
   1525   tAVRC_RSP addr_player;                       /* SetAddrPlayer */
   1526   tAVRC_SET_VOLUME_RSP volume;                 /* SetAbsVolume */
   1527   tAVRC_SET_BR_PLAYER_RSP br_player;           /* SetBrowsedPlayer */
   1528   tAVRC_GET_ITEMS_RSP get_items;               /* GetFolderItems */
   1529   tAVRC_CHG_PATH_RSP chg_path;                 /* ChangePath */
   1530   tAVRC_GET_ATTRS_RSP get_attrs;               /* GetItemAttrs, GetElemAttrs */
   1531   tAVRC_GET_NUM_OF_ITEMS_RSP get_num_of_items; /* GetTotalNumberOfItems */
   1532   tAVRC_SEARCH_RSP search;                     /* Search */
   1533   tAVRC_RSP play_item;                         /* PlayItem */
   1534   tAVRC_RSP add_to_play;                       /* AddToNowPlaying */
   1535 } tAVRC_RESPONSE;
   1536 
   1537 #endif
   1538