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