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