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