1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef _AVRCP_API_H
5 #define _AVRCP_API_H
6 #include "me_api.h"
7 #include "avctp_api.h"
8 #include "bluetooth.h"
9 #include "plat_types.h"
10 #include "cqueue.h"
11 
12 #define BTIF_AVRCP_MAX_CHAR_SETS                 10
13 
14 #define BTIF_AVTP_HEADER_LEN 10
15 
16 #define BTIF_AVRCP_RX_FRAG_BUFF_SIZE             672 //L2CAP_DEFAULT_MTU
17 
18 typedef btif_avctp_event_t btif_avrcp_event_t;
19 typedef void *btif_avrcp_chnl_handle_t;
20 
21 /** The transport layer is connected and commands/responses can now
22  *  be exchanged.
23  */
24 #define BTIF_AVRCP_EVENT_CONNECT             BTIF_AVCTP_CONNECT_EVENT
25 
26 /** The application will receive this event when a lower layer connection
27  *  (L2CAP) has been disconnected.  Both the target and controller of the
28  *  connection are notified.
29  *
30  *  During this callback, the 'p.remDev' parameter is valid.
31  */
32 #define BTIF_AVRCP_EVENT_DISCONNECT           BTIF_AVCTP_DISCONNECT_EVENT
33 
34 /** A remote device is attempting to connect the transport layer.
35  *  Only the acceptor of the connection is notified.
36  */
37 #define BTIF_AVRCP_EVENT_CONNECT_IND          BTIF_AVCTP_CONNECT_IND_EVENT
38 
39 /* Group: Events for the exchange of basic AV/C commands that are not routed
40  * to the panel subunit.
41  */
42 #define BTIF_AVRCP_EVENT_COMMAND             BTIF_AVCTP_COMMAND_EVENT
43 
44 /** A AV/C response was received from the remote device (target). This event
45  *  is received for responses not routed to the panel subunit.
46  */
47 #define BTIF_AVRCP_EVENT_RESPONSE            BTIF_AVCTP_RESPONSE_EVENT
48 
49 /** The remote device (target) rejected the AV/C command.  This event is
50  *  received for responses not routed to the panel subunit.
51  */
52 #define BTIF_AVRCP_EVENT_REJECT               BTIF_AVCTP_REJECT_EVENT
53 
54 /** A command (see AVRCP_SendCommand) or response (see AVRCP_SendResponse)
55  * has been sent.
56  */
57 #define BTIF_AVRCP_EVENT_TX_DONE             BTIF_AVCTP_TX_DONE_EVENT
58 
59 /** Additional operand data has been received for the previous
60  *  AVRCP_EVENT_COMMAND or AVRCP_EVENT_RESPONSE.
61  */
62 #define BTIF_AVRCP_EVENT_OPERANDS             BTIF_AVCTP_OPERANDS_EVENT
63 
64 /** An AV/C command has timed out.
65  */
66 #define BTIF_AVRCP_EVENT_CMD_TIMEOUT         ( BTIF_AVCTP_LAST_EVENT + 1)
67 
68 /* Group: Events for the exchange of standard AV/C panel subunit commands.
69  */
70 
71 #define BTIF_AVRCP_EVENT_PANEL_PRESS        ( BTIF_AVCTP_LAST_EVENT + 2)
72 
73 /** The key corresponding to a panel operation has been held down on the
74  * remote controller device for at least AVRCP_PANEL_PRESSHOLD_TIME.
75  */
76 #define BTIF_AVRCP_EVENT_PANEL_HOLD       ( BTIF_AVCTP_LAST_EVENT + 3)
77 
78 /** The key corresponding to a panel operation has been released on the
79  * remote controller device.
80  */
81 #define BTIF_AVRCP_EVENT_PANEL_RELEASE      ( BTIF_AVCTP_LAST_EVENT + 4)
82 
83 /** A panel response has been received from the remote target device.
84  * All fields of "p.panelCnf" are valid.
85  */
86 #define BTIF_AVRCP_EVENT_PANEL_CNF          ( BTIF_AVCTP_LAST_EVENT + 5)
87 
88 /* Group: Events for the exchange of Bluetooth specific advanced AV/C
89  * commands routed through the panel subunit.
90  */
91 
92 /** Advanced status information has been received from the controller.
93  */
94 #define BTIF_AVRCP_EVENT_ADV_INFO          ( BTIF_AVCTP_LAST_EVENT + 6)
95 
96 /** An advanced request was received and requires a response by the
97  *  application.
98  */
99 #define BTIF_AVRCP_EVENT_ADV_REQ            ( BTIF_AVCTP_LAST_EVENT + 7)
100 
101 /** The notification of a registered event has been received.
102  */
103 #define BTIF_AVRCP_EVENT_ADV_NOTIFY        ( BTIF_AVCTP_LAST_EVENT + 8)
104 
105 /** An Advanced command was sent successfully to the target and a response
106  *  was received.
107  */
108 #define BTIF_AVRCP_EVENT_ADV_RESPONSE      ( BTIF_AVCTP_LAST_EVENT + 9)
109 
110 /** No response was received for an Advanced command and it has timed out.
111  *  This event is received for advanced commands routed to the panel subunit.
112  */
113 #define BTIF_AVRCP_EVENT_ADV_CMD_TIMEOUT    ( BTIF_AVCTP_LAST_EVENT + 10)
114 
115 /** An Advanced PDU was sent successfully.
116  */
117 #define BTIF_AVRCP_EVENT_ADV_TX_DONE        ( BTIF_AVCTP_LAST_EVENT + 11)
118 
119 /* Group: Connection events for establishing and releasing the AVRCP browsing
120  * channel.  The browsing channel is used for the exchange of AVCTP-based
121  * commands/responses which contain Bluetooth specific media
122  * operations.
123  */
124 #define BTIF_AVRCP_EVENT_BROWSE_CONNECT     ( BTIF_AVCTP_LAST_EVENT + 12)
125 
126 /** The application will receive this event when a lower layer connection
127  *  (L2CAP) has been disconnected.  Both the target and controller of the
128  *  connection are notified.
129  */
130 #define BTIF_AVRCP_EVENT_BROWSE_DISCONNECT  ( BTIF_AVCTP_LAST_EVENT + 13)
131 
132 /**  remote device is attempting to connect the browsing channel.
133  */
134 #define BTIF_AVRCP_EVENT_BROWSE_CONNECT_IND ( BTIF_AVCTP_LAST_EVENT + 14)
135 
136 /* Group: Events for the exchange of browsing channel commands.
137  */
138 #define BTIF_AVRCP_EVENT_BROWSE_REQ        ( BTIF_AVCTP_LAST_EVENT + 15)
139 
140 #define BTIF_AVRCP_EVENT_BROWSE_INFO       ( BTIF_AVCTP_LAST_EVENT + 16)
141 
142 #define BTIF_AVRCP_EVENT_BROWSE_RESPONSE    ( BTIF_AVCTP_LAST_EVENT + 17)
143 
144 #define BTIF_AVRCP_EVENT_BROWSE_CMD_TIMEOUT ( BTIF_AVCTP_LAST_EVENT + 18)
145 
146 #define BTIF_AVRCP_EVENT_BROWSE_TX_DONE     ( BTIF_AVCTP_LAST_EVENT + 19)
147 
148 #define BTIF_AVRCP_EVENT_LAST               ( BTIF_AVCTP_LAST_EVENT + 19)
149 
150 typedef uint16_t avrcp_role_t;
151 
152 /* Controller: Player/recorder features supported ("play" and "stop") */
153 #define BTIF_AVRCP_CT_CATEGORY_1       0x0001
154 
155 /* Controller: Monitor/amplifier features supported ("volume up" and "volume down") */
156 #define BTIF_AVRCP_CT_CATEGORY_2       0x0002
157 
158 /* Controller: Tuner features supported ("channel up" and "channel down") */
159 #define BTIF_AVRCP_CT_CATEGORY_3       0x0004
160 
161 /* Controller: Menu features supported ("root menu", "up", "down", "left",
162  * "right", and "select")
163  */
164 #define BTIF_AVRCP_CT_CATEGORY_4       0x0008
165 
166 /* Target: Player/recorder features supported ("play" and "stop") */
167 #define BTIF_AVRCP_TG_CATEGORY_1       0x0100
168 
169 /* Target: Monitor/amplifier features supported ("volume up" and "volume down") */
170 #define BTIF_AVRCP_TG_CATEGORY_2       0x0200
171 
172 /* Target: Tuner features supported ("channel up" and "channel down") */
173 #define BTIF_AVRCP_TG_CATEGORY_3       0x0400
174 
175 /* Target: Menu features supported ("root menu", "up", "down", "left",
176  * "right", and "select")
177  */
178 #define BTIF_AVRCP_TG_CATEGORY_4       0x0800
179 
180 /* Target: Player settings supported */
181 #define BTIF_AVRCP_TG_PLAYER_SETTINGS  0x1000
182 
183 /* Target: Group navigation supported */
184 #define BTIF_AVRCP_TG_GROUP_NAV        0x2000
185 
186 /* Target: Media browsing is supported */
187 #define BTIF_AVRCP_TG_BROWSING         0x4000
188 
189 /* Target: Multiple media players */
190 #define BTIF_AVRCP_TG_MULTIPLE_PLAYERS 0x8000
191 
192 typedef uint8_t avrcp_ctype_t;
193 
194 #define BTIF_AVRCP_CTYPE_CONTROL              BTIF_ AVCTP_CTYPE_CONTROL
195 #define BTIF_AVRCP_CTYPE_STATUS                 BTIF_AVCTP_CTYPE_STATUS
196 #define BTIF_AVRCP_CTYPE_SPECIFIC_INQUIRY     BTIF_ AVCTP_CTYPE_SPECIFIC_INQUIRY
197 #define BTIF_AVRCP_CTYPE_NOTIFY                BTIF_AVCTP_CTYPE_NOTIFY
198 #define BTIF_AVRCP_CTYPE_GENERAL_INQUIRY       BTIF_AVCTP_CTYPE_GENERAL_INQUIRY
199 
200 #define BTIF_AVRCP_CTYPE_BROWSING              BTIF_AVCTP_CTYPE_BROWSING
201 
202 typedef avctp_response_t avrcp_response_t;
203 
204 #define BTIF_AVRCP_RESPONSE_NOT_IMPLEMENTED    BTIF_AVCTP_RESPONSE_NOT_IMPLEMENTED
205 #define BTIF_AVRCP_RESPONSE_ACCEPTED           AVCTP_RESPONSE_ACCEPTED
206 #define BTIF_AVRCP_RESPONSE_REJECTED           AVCTP_RESPONSE_REJECTED
207 #define BTIF_AVRCP_RESPONSE_IN_TRANSITION      AVCTP_RESPONSE_IN_TRANSITION
208 #define BTIF_AVRCP_RESPONSE_IMPLEMENTED_STABLE AVCTP_RESPONSE_IMPLEMENTED_STABLE
209 #define BTIF_AVRCP_RESPONSE_CHANGED            AVRCP_RESP_CHANGED
210 #define BTIF_AVRCP_RESPONSE_INTERIM            AVCTP_RESPONSE_INTERIM
211 
212 #define BTIF_AVRCP_RESPONSE_BROWSING           AVCTP_RESPONSE_BROWSING
213 
214 #define BTIF_AVRCP_RESPONSE_SKIPPED            0xF0
215 
216 #define BTIF_AVRCP_RESPONSE_TIMEOUT            0xF1
217 
218 typedef uint8_t avrcp_opcode_t;
219 
220 #define BTIF_AVRCP_OPCODE_VENDOR_DEPENDENT     AVRCP_VENDOR_DEP_IND
221 #define BTIF_AVRCP_OPCODE_UNIT_INFO            AVRCP_UINT_INFO_IND
222 #define BTIF_AVRCP_OPCODE_SUBUNIT_INFO         AVRCP_SUBUNIT_INFO_IND
223 #define BTIF_AVRCP_OPCODE_PASS_THROUGH         AVRCP_PASSTHROUGH_IND
224 
225 typedef avctp_cmdframe_t avrcp_cmdframe_t;
226 typedef avctp_rspframe_t avrcp_rspframe_t;
227 
228 typedef uint8_t avrcp_subunit_type_t;
229 
230 #define BTIF_AVRCP_SUBUNIT_PANEL        0x09
231 #define BTIF_AVRCP_SUBUNIT_UNIT         0x1F
232 
233 typedef U16 avrcp_panel_operation_t;
234 
235 #define BTIF_AVRCP_POP_SELECT            0x0000
236 #define BTIF_AVRCP_POP_UP                0x0001
237 #define BTIF_AVRCP_POP_DOWN              0x0002
238 #define BTIF_AVRCP_POP_LEFT              0x0003
239 #define BTIF_AVRCP_POP_RIGHT             0x0004
240 #define BTIF_AVRCP_POP_RIGHT_UP          0x0005
241 #define BTIF_AVRCP_POP_RIGHT_DOWN        0x0006
242 #define BTIF_AVRCP_POP_LEFT_UP           0x0007
243 #define BTIF_AVRCP_POP_LEFT_DOWN         0x0008
244 #define BTIF_AVRCP_POP_ROOT_MENU         0x0009
245 #define BTIF_AVRCP_POP_SETUP_MENU        0x000A
246 #define BTIF_AVRCP_POP_CONTENTS_MENU     0x000B
247 #define BTIF_AVRCP_POP_FAVORITE_MENU     0x000C
248 #define BTIF_AVRCP_POP_EXIT              0x000D
249 
250 #define BTIF_AVRCP_POP_0                 0x0020
251 #define BTIF_AVRCP_POP_1                 0x0021
252 #define BTIF_AVRCP_POP_2                 0x0022
253 #define BTIF_AVRCP_POP_3                 0x0023
254 #define BTIF_AVRCP_POP_4                 0x0024
255 #define BTIF_AVRCP_POP_5                 0x0025
256 #define BTIF_AVRCP_POP_6                 0x0026
257 #define BTIF_AVRCP_POP_7                 0x0027
258 #define BTIF_AVRCP_POP_8                 0x0028
259 #define BTIF_AVRCP_POP_9                 0x0029
260 #define BTIF_AVRCP_POP_DOT               0x002A
261 #define BTIF_AVRCP_POP_ENTER             0x002B
262 #define BTIF_AVRCP_POP_CLEAR             0x002C
263 
264 #define BTIF_AVRCP_POP_CHANNEL_UP        0x0030
265 #define BTIF_AVRCP_POP_CHANNEL_DOWN      0x0031
266 #define BTIF_AVRCP_POP_PREVIOUS_CHANNEL  0x0032
267 #define BTIF_AVRCP_POP_SOUND_SELECT      0x0033
268 #define BTIF_AVRCP_POP_INPUT_SELECT      0x0034
269 #define BTIF_AVRCP_POP_DISPLAY_INFO      0x0035
270 #define BTIF_AVRCP_POP_HELP              0x0036
271 #define BTIF_AVRCP_POP_PAGE_UP           0x0037
272 #define BTIF_AVRCP_POP_PAGE_DOWN         0x0038
273 
274 #define BTIF_AVRCP_POP_POWER             0x0040
275 #define BTIF_AVRCP_POP_VOLUME_UP         0x0041
276 #define BTIF_AVRCP_POP_VOLUME_DOWN       0x0042
277 #define BTIF_AVRCP_POP_MUTE              0x0043
278 #define BTIF_AVRCP_POP_PLAY              0x0044
279 #define BTIF_AVRCP_POP_STOP              0x0045
280 #define BTIF_AVRCP_POP_PAUSE             0x0046
281 #define BTIF_AVRCP_POP_RECORD            0x0047
282 #define BTIF_AVRCP_POP_REWIND            0x0048
283 #define BTIF_AVRCP_POP_FAST_FORWARD      0x0049
284 #define BTIF_AVRCP_POP_EJECT             0x004A
285 #define BTIF_AVRCP_POP_FORWARD           0x004B
286 #define BTIF_AVRCP_POP_BACKWARD          0x004C
287 
288 #define BTIF_AVRCP_POP_ANGLE             0x0050
289 #define BTIF_AVRCP_POP_SUBPICTURE        0x0051
290 
291 #define BTIF_AVRCP_POP_F1                0x0071
292 #define BTIF_AVRCP_POP_F2                0x0072
293 #define BTIF_AVRCP_POP_F3                0x0073
294 #define BTIF_AVRCP_POP_F4                0x0074
295 #define BTIF_AVRCP_POP_F5                0x0075
296 
297 #define BTIF_AVRCP_POP_VENDOR_UNIQUE     0x007E
298 
299 #define BTIF_AVRCP_POP_NEXT_GROUP        0x017E
300 #define BTIF_AVRCP_POP_PREV_GROUP        0x027E
301 
302 #define BTIF_AVRCP_POP_RESERVED          0x007F
303 
304 #define BTIF_AVRCP_NUM_EVENTS                  13
305 #define BTIF_AVRCP_MAX_NOTIFICATIONS           15
306 
307 #define BTIF_AVRCP_SUBUNIT_OP_QUEUE_MAX  15
308 
309 /*---------------------------------------------------------------------------
310  * avrcp operation code
311  */
312 typedef U8 btif_avrcp_operation_t;
313 
314 #define BTIF_AVRCP_OP_GET_CAPABILITIES               0x10
315 
316 #define BTIF_AVRCP_OP_LIST_PLAYER_SETTING_ATTRIBS    0x11
317 
318 #define BTIF_AVRCP_OP_LIST_PLAYER_SETTING_VALUES     0x12
319 
320 #define BTIF_AVRCP_OP_GET_PLAYER_SETTING_VALUE       0x13
321 
322 #define BTIF_AVRCP_OP_SET_PLAYER_SETTING_VALUE       0x14
323 
324 #define BTIF_AVRCP_OP_GET_PLAYER_SETTING_ATTR_TEXT   0x15
325 
326 #define BTIF_AVRCP_OP_GET_PLAYER_SETTING_VALUE_TEXT  0x16
327 
328 #define BTIF_AVRCP_OP_INFORM_DISP_CHAR_SET           0x17
329 
330 #define BTIF_AVRCP_OP_INFORM_BATT_STATUS             0x18
331 
332 #define BTIF_AVRCP_OP_GET_MEDIA_INFO                 0x20
333 
334 #define BTIF_AVRCP_OP_GET_PLAY_STATUS                0x30
335 
336 #define BTIF_AVRCP_OP_REGISTER_NOTIFY                0x31
337 
338 #define BTIF_AVRCP_OP_REQUEST_CONT_RESP              0x40
339 
340 #define BTIF_AVRCP_OP_ABORT_CONT_RESP                0x41
341 
342 #define BTIF_AVRCP_OP_SET_ABSOLUTE_VOLUME            0x50
343 
344 #define BTIF_AVRCP_OP_SET_ADDRESSED_PLAYER           0x60
345 
346 #define BTIF_AVRCP_OP_SET_BROWSED_PLAYER             0x70
347 
348 #define BTIF_AVRCP_OP_GET_FOLDER_ITEMS               0x71
349 
350 #define BTIF_AVRCP_OP_CHANGE_PATH                    0x72
351 
352 #define BTIF_AVRCP_OP_GET_ITEM_ATTRIBUTES            0x73
353 
354 #define BTIF_AVRCP_OP_PLAY_ITEM                      0x74
355 
356 #define BTIF_AVRCP_OP_SEARCH                         0x80
357 
358 #define BTIF_AVRCP_OP_ADD_TO_NOW_PLAYING             0x90
359 
360 #define BTIF_AVRCP_OP_GENERAL_REJECT                 0xA0
361 
362 #define BTIF_AVRCP_OP_CUSTOM_CMD						0xF0
363 
364 typedef uint8_t avrcp_error_code_t;
365 
366 #define BTIF_AVRCP_INVALID_CMD_ERR         0x00
367 #define BTIF_AVRCP_INVALID_PARM_ERR        0x01
368 #define BTIF_AVRCP_PARM_NOT_FOUND_ERR      0x02
369 #define BTIF_AVRCP_INTERNAL_ERROR_ERR      0x03
370 #define BTIF_AVRCP_NO_ERROR_ERR            0x04
371 #define BTIF_AVRCP_UIDS_CHANGED_ERR        0x05
372 #define BTIF_AVRCP_ERR_UNKNOWN_ERROR       0x06
373 #define BTIF_AVRCP_ERR_INVALID_DIRECTION   0x07
374 #define BTIF_AVRCP_ERR_NON_DIRECTORY       0x08
375 #define BTIF_AVRCP_ERR_DOES_NOT_EXIST      0x09
376 #define BTIF_AVRCP_ERR_INVALID_SCOPE       0x0A
377 #define BTIF_AVRCP_ERR_OUT_OF_BOUNDS       0x0B
378 #define BTIF_AVRCP_ERR_IS_DIRECTORY        0x0C
379 #define BTIF_AVRCP_ERR_MEDIA_IN_USE        0x0D
380 #define BTIF_AVRCP_ERR_NOW_PLAYING_FULL    0x0E
381 #define BTIF_AVRCP_ERR_NO_SEARCH_SUPPORT   0x0F
382 #define BTIF_AVRCP_ERR_SEARCH_IN_PROGRESS  0x10
383 #define BTIF_AVRCP_ERR_INVALID_PLAYER_ID   0x11
384 #define BTIF_AVRCP_ERR_NOT_BROWSABLE       0x12
385 #define BTIF_AVRCP_ERR_NOT_ADDRESSED       0x13
386 #define BTIF_AVRCP_ERR_NO_SEARCH_RESULTS   0x14
387 #define BTIF_AVRCP_ERR_NO_AVAIL_PLAYERS    0x15
388 #define BTIF_AVRCP_ERR_ADDR_PLAYER_CHANGED 0x16
389 
390 /*---------------------------------------------------------------------------
391  *  event Id
392  */
393 typedef uint8_t avrcp_event_Id_t;
394 
395 #define BTIF_AVRCP_EID_MEDIA_STATUS_CHANGED        0x01 /* Change in media status */
396 
397 #define BTIF_AVRCP_EID_TRACK_CHANGED               0x02 /* Current track changed */
398 
399 #define BTIF_AVRCP_EID_TRACK_END                   0x03 /* Reached end of track */
400 
401 #define BTIF_AVRCP_EID_TRACK_START                 0x04 /* Reached track start */
402 
403 #define BTIF_AVRCP_EID_PLAY_POS_CHANGED            0x05 /* Change in playback position.
404                                                          * Returned after the specified
405                                                          * playback notification change
406                                                          * notification interval.
407                                                          */
408 
409 #define BTIF_AVRCP_EID_BATT_STATUS_CHANGED         0x06 /* Change in battery status   */
410 #define BTIF_AVRCP_EID_SYS_STATUS_CHANGED          0x07 /* Change in system status    */
411 #define BTIF_AVRCP_EID_APP_SETTING_CHANGED         0x08 /* Change in player
412                                                          * application setting
413                                                          */
414 
415 #define BTIF_AVRCP_EID_NOW_PLAYING_CONTENT_CHANGED 0x09 /* Contents of the now playing
416                                                          * list have changed
417                                                          */
418 
419 #define BTIF_AVRCP_EID_AVAILABLE_PLAYERS_CHANGED   0x0A /* The available players have
420                                                          * changed
421                                                          */
422 
423 #define BTIF_AVRCP_EID_ADDRESSED_PLAYER_CHANGED    0x0B /* The addressed player has
424                                                          * changed
425                                                          */
426 
427 #define BTIF_AVRCP_EID_UIDS_CHANGED                0x0C /* The UIDS have changed */
428 
429 #define BTIF_AVRCP_EID_VOLUME_CHANGED              0x0D /* The volume was changed */
430 
431 #define BTIF_AVRCP_EID_FLAG_INTERIM                0x80 /* Used Internally */
432 
433 /*---------------------------------------------------------------------------
434  * even mask
435  */
436 typedef uint16_t avrcp_event_mask_t;
437 
438 #define BTIF_AVRCP_ENABLE_PLAY_STATUS_CHANGED      0x0001   /* Change in playback
439                                                              * status
440                                                              */
441 #define BTIF_AVRCP_ENABLE_MEDIA_STATUS_CHANGED     0x0001   /* Alias */
442 #define BTIF_AVRCP_ENABLE_TRACK_CHANGED            0x0002   /* Current track changed */
443 #define BTIF_AVRCP_ENABLE_TRACK_END                0x0004   /* Reached end of track  */
444 #define BTIF_AVRCP_ENABLE_TRACK_START              0x0008   /* Reached track start   */
445 #define BTIF_AVRCP_ENABLE_PLAY_POS_CHANGED         0x0010   /* Change in playback
446                                                              * position
447                                                              */
448 #define BTIF_AVRCP_ENABLE_BATT_STATUS_CHANGED      0x0020   /* Change in battery
449                                                              * status
450                                                              */
451 #define BTIF_AVRCP_ENABLE_SYS_STATUS_CHANGED       0x0040   /* Change in system status */
452 #define BTIF_AVRCP_ENABLE_APP_SETTING_CHANGED      0x0080   /* Change in player
453                                                              * application setting
454                                                              */
455 
456 #define BTIF_AVRCP_ENABLE_NOW_PLAYING_CHANGED      0x0100   /* Change in the now
457                                                              * playing list
458                                                              */
459 #define BTIF_AVRCP_ENABLE_AVAIL_PLAYERS_CHANGED    0x0200   /* Available players
460                                                              * changed
461                                                              */
462 #define BTIF_AVRCP_ENABLE_ADDRESSED_PLAYER_CHANGED 0x0400   /* Addressed player changed */
463 #define BTIF_AVRCP_ENABLE_UIDS_CHANGED             0x0800   /* UIDS changed */
464 #define BTIF_AVRCP_ENABLE_VOLUME_CHANGED           0x1000   /* Volume Changed */
465 
466 typedef uint8_t btif_avrcp_capabilityId;
467 
468 #define BTIF_AVRCP_CAPABILITY_COMPANY_ID        2
469 #define BTIF_AVRCP_CAPABILITY_EVENTS_SUPPORTED  3
470 
471 /*---------------------------------------------------------------------------
472  * player attrId  type
473  */
474 typedef uint8_t avrcp_playerAttrId;
475 
476 #define BTIF_AVRCP_PLAYER_EQ_STATUS        1    /* Player equalizer status */
477 #define BTIF_AVRCP_PLAYER_REPEAT_STATUS    2    /* Player repeat status */
478 #define BTIF_AVRCP_PLAYER_SHUFFLE_STATUS   3    /* Player Shuffle status */
479 #define BTIF_AVRCP_PLAYER_SCAN_STATUS      4    /* Player scan status */
480 
481 /*---------------------------------------------------------------------------
482  *  playerattrId mask type
483  */
484 typedef uint16_t avrcp_player_attrId_mask_t;
485 
486 #define BTIF_AVRCP_ENABLE_PLAYER_EQ_STATUS       0x0001
487 #define BTIF_AVRCP_ENABLE_PLAYER_REPEAT_STATUS   0x0002
488 #define BTIF_AVRCP_ENABLE_PLAYER_SHUFFLE_STATUS  0x0004
489 #define BTIF_AVRCP_ENABLE_PLAYER_SCAN_STATUS     0x0008
490 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_5  0x0010
491 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_6  0x0020
492 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_7  0x0040
493 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_8  0x0080
494 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_9  0x0100
495 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_10 0x0200
496 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_11 0x0400
497 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_12 0x0800
498 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_13 0x1000
499 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_14 0x2000
500 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_15 0x4000
501 #define BTIF_AVRCP_ENABLE_PLAYER_EXTENSION_ID_16 0x8000
502 
503 #ifndef BTIF_AVRCP_MAX_FOLDER_DEPTH
504 #define BTIF_AVRCP_MAX_FOLDER_DEPTH 10
505 #endif
506 
507 typedef uint8_t avrcp_eq_value_t;
508 
509 #define BTIF_AVRCP_EQ_OFF  1
510 #define BTIF_AVRCP_EQ_ON   2
511 
512 typedef uint8_t avrcp_repeat_value_t;
513 
514 #define BTIF_AVRCP_REPEAT_OFF     1
515 #define BTIF_AVRCP_REPEAT_SINGLE  2
516 #define BTIF_AVRCP_REPEAT_ALL     3
517 #define BTIF_AVRCP_REPEAT_GROUP   4
518 
519 typedef uint8_t avrcp_shuffle_value_t;
520 
521 #define BTIF_AVRCP_SHUFFLE_OFF    1
522 #define BTIF_AVRCP_SHUFFLE_ALL    2
523 #define BTIF_AVRCP_SHUFFLE_GROUP  3
524 
525 typedef uint8_t avrcp_scan_value_t;
526 
527 #define BTIF_AVRCP_SCAN_OFF    1
528 #define BTIF_AVRCP_SCAN_ALL    2
529 #define BTIF_AVRCP_SCAN_GROUP  3
530 
531 typedef uint8_t avrcp_ext_value_t;
532 
533 typedef uint8_t avrcp_battery_status_t;
534 
535 #define BTIF_AVRCP_BATT_STATUS_NORMAL      0
536 #define BTIF_AVRCP_BATT_STATUS_WARNING     1
537 #define BTIF_AVRCP_BATT_STATUS_CRITICAL    2
538 #define BTIF_AVRCP_BATT_STATUS_EXTERNAL    3
539 #define BTIF_AVRCP_BATT_STATUS_FULL_CHARGE 4
540 
541 typedef uint8_t avrcp_system_status_t;
542 
543 #define BTIF_AVRCP_SYS_POWER_ON   0
544 #define BTIF_AVRCP_SYS_POWER_OFF  1
545 #define BTIF_AVRCP_SYS_UNPLUGGED  2
546 
547 typedef uint32_t avrcp_media_attrId_t;
548 
549 #define BTIF_AVRCP_MEDIA_ATTR_TITLE       0x00000001
550 #define BTIF_AVRCP_MEDIA_ATTR_ARTIST      0x00000002
551 #define BTIF_AVRCP_MEDIA_ATTR_ALBUM       0x00000003
552 #define BTIF_AVRCP_MEDIA_ATTR_TRACK       0x00000004
553 #define BTIF_AVRCP_MEDIA_ATTR_NUM_TRACKS  0x00000005
554 #define BTIF_AVRCP_MEDIA_ATTR_GENRE       0x00000006
555 #define BTIF_AVRCP_MEDIA_ATTR_DURATION    0x00000007
556 
557 typedef uint32_t avrcp_media_attrId_mask_t;
558 
559 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_TITLE       0x01
560 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_ARTIST      0x02
561 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_ALBUM       0x04
562 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_TRACK       0x08
563 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_NUM_TRACKS  0x10
564 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_GENRE       0x20
565 #define BTIF_AVRCP_ENABLE_MEDIA_ATTR_DURATION    0x40
566 
567 typedef uint8_t avrcp_media_status_t;
568 
569 #define BTIF_AVRCP_MEDIA_STOPPED       0x00
570 #define BTIF_AVRCP_MEDIA_PLAYING       0x01
571 #define BTIF_AVRCP_MEDIA_PAUSED        0x02
572 #define BTIF_AVRCP_MEDIA_FWD_SEEK      0x03
573 #define BTIF_AVRCP_MEDIA_REV_SEEK      0x04
574 #define BTIF_AVRCP_MEDIA_ERROR         0xFF
575 
576 typedef uint16_t avrcp_version_t;
577 
578 /* Unable to determine the Hands Free Profile version that is supported */
579 #define BTIF_AVRCP_VERSION_UNKNOWN 0x0000
580 
581 /* Supports Version 1.0 of the AVRCP Profile */
582 #define BTIF_AVRCP_VERSION_1_0     0x0100
583 
584 /* Supports Version 1.3 of the AVRCP Profile */
585 #define BTIF_AVRCP_VERSION_1_3     0x0103
586 
587 /* Supports Version 1.4 of the AVRCP Profile */
588 #define BTIF_AVRCP_VERSION_1_4     0x0104
589 
590 typedef uint16_t avrcp_features_t;
591 
592 /* Player/recorder features supported ("play" and "stop") */
593 #define BTIF_AVRCP_FEATURES_CATEGORY_1       0x0001
594 
595 /* Monitor/amplifier features supported ("volume up" and "volume down") */
596 #define BTIF_AVRCP_FEATURES_CATEGORY_2       0x0002
597 
598 /* Tuner features supported ("channel up" and "channel down") */
599 #define BTIF_AVRCP_FEATURES_CATEGORY_3       0x0004
600 
601 /* Menu features supported ("root menu", "up", "down", "left", "right", and
602  * "select")
603  */
604 #define BTIF_AVRCP_FEATURES_CATEGORY_4       0x0008
605 
606 /* Player settings supported */
607 #define BTIF_AVRCP_FEATURES_PLAYER_SETTINGS  0x0010
608 
609 /* Group navigation supported */
610 #define BTIF_AVRCP_FEATURES_GROUP_NAV        0x0020
611 
612 #define BTIF_AVRCP_FEATURES_BROWSING         0x0040
613 
614 #define BTIF_AVRCP_FEATURES_MULTIPLE_PLAYERS 0x0080
615 
616 typedef uint8_t avrcp_maj_player_type_t;
617 
618 #define BTIF_AVRCP_MAJ_PLAYER_AUDIO      0x01
619 #define BTIF_AVRCP_MAJ_PLAYER_VIDEO      0x02
620 #define BTIF_AVRCP_MAJ_PLAYER_AUD_BCAST  0x04
621 #define BTIF_AVRCP_MAJ_PLAYER_VID_BCAST  0x08
622 
623 typedef uint32_t avrcp_player_sub_type_t;
624 
625 #define BTIF_AVRCP_PLAYER_SUB_AUDIO_BOOK  0x00000001
626 #define BTIF_AVRCP_PLAYER_SUB_PODCAST     0x00000002
627 
628 typedef uint8_t avrcp_scope_t;
629 
630 #define BTIF_AVRCP_SCOPE_MEDIA_PLAYER_LIST  0x00
631 #define BTIF_AVRCP_SCOPE_VIRTUAL_FILESYS    0x01
632 #define BTIF_AVRCP_SCOPE_SEARCH             0x02
633 #define BTIF_AVRCP_SCOPE_NOW_PLAYING        0x03
634 
635 typedef uint8_t avrcp_chg_path_direction_t;
636 
637 #define BTIF_AVRCP_DIR_UP                   0x00
638 #define BTIF_AVRCP_DIR_DOWN                 0x01
639 
640 typedef uint8_t avrcp_plyr_featr_byte_t;
641 
642 /* Byte 0 */
643 
644 #define BTIF_AVRCP_BRWS_0_FEAT_SELECT              0x01
645 #define BTIF_AVRCP_BRWS_0_FEAT_UP                  0x02
646 #define BTIF_AVRCP_BRWS_0_FEAT_DOWN                0x04
647 #define BTIF_AVRCP_BRWS_0_FEAT_LEFT                0x08
648 #define BTIF_AVRCP_BRWS_0_FEAT_RIGHT               0x10
649 #define BTIF_AVRCP_BRWS_0_FEAT_RIGHT_UP            0x20
650 #define BTIF_AVRCP_BRWS_0_FEAT_RIGHT_DOWN          0x40
651 #define BTIF_AVRCP_BRWS_0_FEAT_LEFT_UP             0x80
652 
653 /* Byte 1 */
654 
655 #define BTIF_AVRCP_BRWS_1_FEAT_LEFT_DOWN           0x01
656 #define BTIF_AVRCP_BRWS_1_FEAT_ROOT_MENU           0x02
657 #define BTIF_AVRCP_BRWS_1_FEAT_SETUP_MENU          0x04
658 #define BTIF_AVRCP_BRWS_1_FEAT_CONTENTS_MENU       0x08
659 #define BTIF_AVRCP_BRWS_1_FEAT_FAVORITE_MENU       0x10
660 #define BTIF_AVRCP_BRWS_1_FEAT_EXIT                0x20
661 #define BTIF_AVRCP_BRWS_1_FEAT_0                   0x40
662 #define BTIF_AVRCP_BRWS_1_FEAT_1                   0x80
663 
664 /* Byte 2 */
665 
666 #define BTIF_AVRCP_BRWS_2_FEAT_2                   0x01
667 #define BTIF_AVRCP_BRWS_2_FEAT_3                   0x02
668 #define BTIF_AVRCP_BRWS_2_FEAT_4                   0x04
669 #define BTIF_AVRCP_BRWS_2_FEAT_5                   0x08
670 #define BTIF_AVRCP_BRWS_2_FEAT_6                   0x10
671 #define BTIF_AVRCP_BRWS_2_FEAT_7                   0x20
672 #define BTIF_AVRCP_BRWS_2_FEAT_8                   0x40
673 #define BTIF_AVRCP_BRWS_2_FEAT_9                   0x80
674 
675 /* Byte 3 */
676 
677 #define BTIF_AVRCP_BRWS_3_FEAT_DOT                 0x01
678 #define BTIF_AVRCP_BRWS_3_FEAT_ENTER               0x02
679 #define BTIF_AVRCP_BRWS_3_FEAT_CLEAR               0x04
680 #define BTIF_AVRCP_BRWS_3_FEAT_CHNL_UP             0x08
681 #define BTIF_AVRCP_BRWS_3_FEAT_CHNL_DOWN           0x10
682 #define BTIF_AVRCP_BRWS_3_FEAT_PREV_CHNL           0x20
683 #define BTIF_AVRCP_BRWS_3_FEAT_SOUND_SEL           0x40
684 #define BTIF_AVRCP_BRWS_3_FEAT_INPUT_SEL           0x80
685 
686 /* Byte 4 */
687 
688 #define BTIF_AVRCP_BRWS_3_FEAT_DISPLAY_INFO        0x01
689 #define BTIF_AVRCP_BRWS_4_FEAT_HELP                0x02
690 #define BTIF_AVRCP_BRWS_4_FEAT_PG_UP               0x04
691 #define BTIF_AVRCP_BRWS_4_FEAT_PG_DOWN             0x08
692 #define BTIF_AVRCP_BRWS_4_FEAT_POWER               0x10
693 #define BTIF_AVRCP_BRWS_4_FEAT_VOL_UP              0x20
694 #define BTIF_AVRCP_BRWS_4_FEAT_VOL_DOWN            0x40
695 #define BTIF_AVRCP_BRWS_4_FEAT_MUTE                0x80
696 
697 /* Byte 5 */
698 
699 #define BTIF_AVRCP_BRWS_5_FEAT_PLAY                0x01
700 #define BTIF_AVRCP_BRWS_5_FEAT_STOP                0x02
701 #define BTIF_AVRCP_BRWS_5_FEAT_PAUSE               0x04
702 #define BTIF_AVRCP_BRWS_5_FEAT_RECORD              0x08
703 #define BTIF_AVRCP_BRWS_5_FEAT_REWIND              0x10
704 #define BTIF_AVRCP_BRWS_5_FEAT_FF                  0x20
705 #define BTIF_AVRCP_BRWS_5_FEAT_EJECT               0x40
706 #define BTIF_AVRCP_BRWS_5_FEAT_FORWARD             0x80
707 
708 /* Byte 6 */
709 
710 #define BTIF_AVRCP_BRWS_6_FEAT_BACKWARD            0x01
711 #define BTIF_AVRCP_BRWS_6_FEAT_ANGLE               0x02
712 #define BTIF_AVRCP_BRWS_6_FEAT_SUBPIC              0x04
713 #define BTIF_AVRCP_BRWS_6_FEAT_F1                  0x08
714 #define BTIF_AVRCP_BRWS_6_FEAT_F2                  0x10
715 #define BTIF_AVRCP_BRWS_6_FEAT_F3                  0x20
716 #define BTIF_AVRCP_BRWS_6_FEAT_F4                  0x40
717 #define BTIF_AVRCP_BRWS_6_FEAT_F5                  0x80
718 
719 /* Byte 7 */
720 
721 #define BTIF_AVRCP_BRWS_7_FEAT_VENDOR_UNIQUE       0x01
722 #define BTIF_AVRCP_BRWS_7_FEAT_GROUP_NAV           0x02
723 #define BTIF_AVRCP_BRWS_7_FEAT_ADVANCED_CTRL       0x04
724 #define BTIF_AVRCP_BRWS_7_FEAT_BROWSING            0x08
725 #define BTIF_AVRCP_BRWS_7_FEAT_SEARCHING           0x10
726 #define BTIF_AVRCP_BRWS_7_FEAT_ADD_TO_PLAYING      0x20
727 #define BTIF_AVRCP_BRWS_7_FEAT_UIDS_UNIQUE         0x40
728 #define BTIF_AVRCP_BRWS_7_FEAT_BRWS_WHEN_ADDRESSED 0x80
729 
730 /* Byte 8 */
731 
732 #define BTIF_AVRCP_BRWS_8_SEARCH_WHEN_ADDRESSED    0x01
733 #define BTIF_AVRCP_BRWS_8_NOW_PLAYING              0x02
734 #define BTIF_AVRCP_BRWS_8_UID_PERSISTENT           0x04
735 
736 typedef uint8_t avrcp_item_type_t;
737 
738 #define BTIF_AVRCP_ITEM_MEDIA_PLAYER  0x01
739 #define BTIF_AVRCP_ITEM_FOLDER        0x02
740 #define BTIF_AVRCP_ITEM_MEDIA_ELEMENT 0x03
741 
742 typedef uint8_t avrcp_folder_type_t;
743 
744 #define BTIF_AVRCP_FOLDER_TYPE_MIXED     0x00
745 #define BTIF_AVRCP_FOLDER_TYPE_TITLES    0x01
746 #define BTIF_AVRCP_FOLDER_TYPE_ALBUMS    0x02
747 #define BTIF_AVRCP_FOLDER_TYPE_ARTISTS   0x03
748 #define BTIF_AVRCP_FOLDER_TYPE_GENRES    0x04
749 #define BTIF_AVRCP_FOLDER_TYPE_PLAYLISTS 0x05
750 #define BTIF_AVRCP_FOLDER_TYPE_YEARS     0x06
751 
752 typedef uint8_t avrcp_is_playable_t;
753 typedef uint16_t avrcp_capabilityId_t;
754 typedef void avrcp_advanced_pdu_t;
755 
756 #define BTIF_AVRCP_IS_NOT_PLAYABLE  0x00
757 #define BTIF_AVRCP_IS_PLAYABLE      0x01
758 
759 typedef uint8_t avrcp_media_type_t;
760 
761 #define BTIF_AVRCP_MEDIA_TYPE_AUDIO 0x00
762 #define BTIF_AVRCP_MEIDA_TYPE_VIDEO 0x01
763 
764 #define BTIF_AVCTP_RESPONSE_INTERIM            0x0F
765 
766 typedef struct {
767 
768     /* Index 0 == Off, Index 1 == On */
769     const char *string[2];
770     uint8_t len[2];
771 } avrcp_eq_string_t;
772 
773 typedef struct {
774 
775     /* Index 0 == Off, Index 1 == Single, Index 2 == All, Index 3 == Group */
776     const char *string[4];
777     uint8_t len[4];
778 } avrcp_repeat_string_t;
779 
780 typedef struct {
781 
782     /* Index 0 == Off, Index 1 == All, Index 2 == Group */
783     const char *string[3];
784     uint8_t len[3];
785 } avrcp_shuffle_string_t;
786 
787 typedef struct {
788 
789     /* Index 0 == Off, Index 1 == All, Index 2 == Group */
790     const char *string[3];
791     uint8_t len[3];
792 } avrcp_scan_string_t;
793 
794 #ifndef BTIF_AVRCP_MAX_PLAYER_STRINGS
795 #define BTIF_AVRCP_MAX_PLAYER_STRINGS  5
796 #endif
797 /*--------------------------------------------------------------------------
798  * NUM  PLAYER SETTINGS constant
799  */
800 
801 #define BTIF_AVRCP_PANEL_STATE_NONE       0
802 
803 #define BTIF_AVRCP_PANEL_STATE_C_IDLE     1
804 #define BTIF_AVRCP_PANEL_STATE_C_PRESS    2
805 #define BTIF_AVRCP_PANEL_STATE_C_PRESS_R  3
806 #define BTIF_AVRCP_PANEL_STATE_C_RELEASE  4
807 #define BTIF_AVRCP_PANEL_STATE_C_SKIP     5
808 
809 #define BTIF_AVRCP_PANEL_STATE_T_IDLE     101
810 #define BTIF_AVRCP_PANEL_STATE_T_PRESS    102
811 #define BTIF_AVRCP_PANEL_STATE_T_HOLD     103
812 
813 typedef struct {
814 
815     /* Number of extended player settings */
816     uint8_t numStrings;
817     const char *string[BTIF_AVRCP_MAX_PLAYER_STRINGS];  /* The player setting string */
818     uint8_t len[BTIF_AVRCP_MAX_PLAYER_STRINGS]; /* The player setting string length */
819 } avrcp_ext_string_t;
820 typedef uint8_t avrcp_player_attrId_t;
821 
822 typedef struct {
823     avrcp_player_attrId_t attrId;   /* Media Player Attribute ID */
824     union {
825         avrcp_eq_value_t eq;
826         avrcp_repeat_value_t repeat;
827         avrcp_shuffle_value_t shuffle;
828         avrcp_scan_value_t scan;
829         avrcp_ext_value_t extValue;
830         uint8_t value;          /* Used Internally */
831     } setting;
832 } avrcp_player_setting_t;
833 
834 typedef struct {
835     const char *attrString;     /* Media Player Attribute Text */
836     uint8_t attrLen;            /* Length of the Attribute Text */
837     union {
838         avrcp_eq_string_t eq;   /* Equalizer status */
839         avrcp_repeat_string_t repeat;   /* Repeat mode status */
840         avrcp_shuffle_string_t shuffle; /* Shuffle mode status */
841         avrcp_scan_string_t scan;   /* Scan mode status */
842         avrcp_ext_string_t ext; /* Extended settings status */
843     } setting;
844 } avrcp_player_strings_t;
845 
846 typedef struct {
847     avrcp_media_attrId_t attrId;    /* Media element attribute ID */
848     const char *string;         /* The media element */
849     uint16_t length;            /* Length of the media element */
850 } avrcp_media_info_t;
851 
852 typedef struct {
853     uint8_t numCharSets;
854     uint16_t charSets[BTIF_AVRCP_MAX_CHAR_SETS];
855 } avrcp_char_sets_t;
856 
857 typedef struct {
858     uint32_t length;
859 
860     uint32_t position;
861     avrcp_media_status_t mediaStatus;
862 } avrcp_media_play_status_t;
863 
864 typedef struct {
865     uint16_t nameLen;
866     const char *name;
867 } avrcp_folder_t;
868 
869 typedef struct {
870 
871     /* Used Internally */
872     list_entry_t node;
873 
874     /* Used Internally */
875     uint16_t playerId;
876 
877     /* Major Player Type */
878     avrcp_maj_player_type_t majorType;
879 
880     /* Player Sub Type */
881     avrcp_player_sub_type_t subType;
882 
883     /* Current media play status */
884     avrcp_media_status_t mediaStatus;
885 
886     /* Player feature bitmask */
887     avrcp_plyr_featr_byte_t features[16];
888 
889     /* Displayable character set */
890     uint16_t charSet;
891 
892     /* Player name length */
893     uint16_t nameLen;
894 
895     /* Player name */
896     const char *name;
897 
898     /* Folder depth */
899     uint16_t folderDepth;
900 
901     /* Current folder */
902     avrcp_folder_t folder[BTIF_AVRCP_MAX_FOLDER_DEPTH];
903 
904     /* Number of items in the current folder */
905     uint32_t numItems;
906 } avrcp_media_player_item_t;
907 typedef uint16_t avrcp_event_mask_t;
908 typedef uint8_t avrcp_operation_t;
909 
910 typedef struct _AvrcpFolderItem {
911 
912     /* The UID of this media element */
913     uint8_t uid[8];
914 
915     /* Folder Type */
916     avrcp_folder_type_t folderType;
917 
918     /* Is Playable Flag */
919     avrcp_is_playable_t isPlayable;
920 
921     /* Character Set */
922     uint16_t charSet;
923 
924     /* The name length of this media element */
925     uint16_t nameLen;
926 
927     /* The name of this media element */
928     uint8_t *name;
929 } avrcp_folder_item_t;
930 
931 typedef struct {
932 
933     /* Attribute ID */
934     avrcp_media_attrId_t attrId;
935 
936     /* Character Set */
937     uint16_t charSet;
938 
939     /* Attribute Length */
940     uint16_t valueLen;
941 
942     /* Attribute Name */
943     uint8_t *value;
944 } avrcp_media_attribute_t;
945 
946 typedef struct {
947 
948     /* The UID of this media element */
949     uint8_t uid[8];
950 
951     /* Media type (audio or video) */
952     avrcp_media_type_t mediaType;
953 
954     /* Character Set */
955     uint16_t charSet;
956 
957     /* The name length of this media element */
958     uint16_t nameLen;
959 
960     /* The name of this media element */
961     uint8_t *name;
962 
963     /* Number of media attributes */
964     uint8_t numAttrs;
965 
966     /* Media Attributes */
967     avrcp_media_attribute_t attrs[BTIF_AVRCP_NUM_MEDIA_ATTRIBUTES];
968 } avrcp_media_element_item_t;
969 
970 typedef uint8_t avrcp_Item_type_t;
971 
972 typedef struct {
973 
974     /* Media Item Type */
975     avrcp_Item_type_t itemType;
976 
977     /* The Media Item */
978     union {
979         avrcp_media_player_item_t player;
980         avrcp_folder_item_t folder;
981         avrcp_media_element_item_t element;
982     } item;
983 } avrcp_media_item_t;
984 
985 typedef struct {
986 
987     /* The most significant 32 bits of the track index information.  */
988     uint32_t msU32;
989 
990     /* The least significant 32 bits of the track index information.  */
991     uint32_t lsU32;
992 } avrcp_track_struct_t;
993 
994 typedef struct {
995 
996     /* Transaction ID of the request */
997     uint32_t transId;
998     union {
999 
1000         /* Contains an item to be played on the addressed media player.  This
1001          * is valid when "advOp" is set to AVRCP_OP_PLAY_ITEM or
1002          * AVRCP_OP_ADD_TO_NOW_PLAYING.
1003          */
1004         struct {
1005             avrcp_scope_t scope;
1006             uint8_t uid[8];
1007             uint16_t uidCounter;
1008         } item;
1009     } p;
1010 } avrcp_adv_req_parms_t;
1011 
1012 typedef union {
1013 
1014     /* The value of each player setting.  This is valid when "advOp" is set
1015      * to AVRCP_OP_SET_PLAYER_SETTING_VALUE.
1016      */
1017     avrcp_player_setting_t playerSetting;
1018     struct {
1019 
1020         /* Bitmask that describes which
1021          * attributes are being reported
1022          */
1023         avrcp_player_attrId_mask_t attrMask;
1024 
1025         /* The equalizer setting. */
1026         avrcp_eq_value_t eq;
1027 
1028         /* The repeat setting. */
1029         avrcp_repeat_value_t repeat;
1030 
1031         /* The shuffle setting. */
1032         avrcp_shuffle_value_t shuffle;
1033 
1034         /* The scan setting. */
1035         avrcp_scan_value_t scan;
1036 
1037 #if BTIF_AVRCP_NUM_PLAYER_SETTINGS > 4
1038         /* Extended player setting. */
1039         avrcp_ext_value_t extValue[BTIF_AVRCP_NUM_PLAYER_SETTINGS - 4];
1040 
1041 #endif                          /*  */
1042     } setting;
1043 
1044     /* The list of character sets displayable on the controller.
1045      * This is valid when "advOp" is set to AVRCP_OP_INFORM_DISP_CHAR_SET. The
1046      * default is 106 (UTF-8).
1047      */
1048     avrcp_char_sets_t charSet;
1049 
1050     /* The battery status of the controller.
1051      * This is valid when "advOp" is set to AVRCP_OP_INFORM_BATT_STATUS.
1052      */
1053     avrcp_battery_status_t battStatus;
1054 
1055 #if BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED
1056     /* The Absolute Volume
1057      * This is valid when "advOp" is set to AVRCP_OP_SET_ABSOLUTE_VOLUME.
1058      */
1059     uint8_t volume;
1060 
1061     /* The addressed player
1062      * This is valid when "advOp" is set to AVRCP_OP_SET_ADDRESSED_PLAYER.
1063      */
1064     avrcp_media_player_item_t *addrPlayer;
1065 
1066 #endif                          /* BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED */
1067 } avrcp_adv_inf_parms_t;
1068 
1069 typedef struct {
1070     avrcp_player_attrId_t attrId;
1071     uint16_t charSet;
1072     uint8_t length;
1073     const char *string;
1074 } avrcp_player_attrib_t;
1075 
1076 typedef struct {
1077     uint8_t valueId;
1078     uint16_t charSet;
1079     uint8_t length;
1080     const char *string;
1081 } avrcp_player_settings_t;
1082 
1083 typedef struct {
1084     U32 attrId;
1085     uint16_t charSet;
1086     uint16_t length;
1087     const char *string;
1088 } avrcp_media_attr_t;
1089 typedef uint16_t avrcp_player_attrId_mask_t;
1090 
1091 typedef struct {
1092     uint32_t length;
1093     uint32_t position;
1094     uint8_t mediaStatus;
1095 } adv_play_status_t;
1096 
1097 typedef union {
1098 
1099     /* The capabilities of the target.
1100      * This is valid when "advOp" is set to AVRCP_OP_GET_CAPABILITIES.
1101      */
1102     struct {
1103 
1104         /* The type of capability. */
1105         uint8_t type;
1106 
1107         /* The capability info. */
1108         union {
1109 
1110             /* The list of company IDs.
1111              * (type == AVRCP_CAPABILITY_COMPANY_ID)
1112              */
1113             struct {
1114 
1115                 /* The number of supported company IDs. */
1116                 uint8_t numIds;
1117 
1118                 /* An array of company IDs (3 bytes each). */
1119                 uint8_t *ids;
1120             } companyId;
1121 
1122             /* A bitmask of the supported events.
1123              * (type == AVRCP_CAPABILITY_EVENTS_SUPPORTED)
1124              */
1125             uint16_t eventMask;
1126         } info;
1127     } capability;
1128 
1129     /* A bitmask that indicates the player settings supported by
1130      * the target device.
1131      * This is valid when "advOp" is set to
1132      * AVRCP_OP_LIST_PLAYER_SETTING_ATTRIBS.
1133      */
1134     uint16_t attrMask;
1135 
1136     /* The list of values for the requested attribute on the target
1137      * device.
1138      * This is valid when "advOp" is set to AVRCP_OP_LIST_PLAYER_SETTING_VALUES.
1139      */
1140     struct {
1141 
1142         /* The number of supported value IDs. */
1143         uint8_t numIds;
1144 
1145         /* An array of value ID (1 byte each). */
1146         uint8_t *ids;
1147     } attrValues;
1148 
1149     /* The text of each player setting attribute.
1150      * This is valid when "advOp" is set to
1151      * AVRCP_OP_GET_PLAYER_SETTING_ATTR_TEXT
1152      */
1153     struct {
1154 
1155         /* The number of attribute IDs returned. */
1156         uint8_t numIds;
1157 
1158         /* An array of attribute text information */
1159         avrcp_player_attrib_t txt[BTIF_AVRCP_NUM_PLAYER_SETTINGS];
1160     } attrStrings;
1161 
1162     /* The value of each player setting.
1163      * This is valid when "advOp" is set to AVRCP_OP_GET_PLAYER_SETTING_VALUE.
1164      */
1165     struct {
1166 
1167         /* Bitmask that describes which
1168          * attributes are being reported
1169          */
1170         avrcp_player_attrId_mask_t attrMask;
1171 
1172         /* The equalizer setting. */
1173         avrcp_eq_value_t eq;
1174 
1175         /* The repeat setting. */
1176         avrcp_repeat_value_t repeat;
1177 
1178         /* The shuffle setting. */
1179         avrcp_shuffle_value_t shuffle;
1180 
1181         /* The scan setting. */
1182         avrcp_scan_value_t scan;
1183 
1184 #if BTIF_AVRCP_NUM_PLAYER_SETTINGS > 4
1185         /* Extended player setting. */
1186         avrcp_ext_value_t extValue[BTIF_AVRCP_NUM_PLAYER_SETTINGS - 4];
1187 
1188 #endif                          /*  */
1189     } setting;
1190 
1191     /* The list of setting values for the requested attribute on the target.
1192      * This is valid when "advOp" is set to
1193      * AVRCP_OP_GET_PLAYER_SETTING_VALUE_TEXT.
1194      */
1195     struct {
1196 
1197         /* The number of settings returned */
1198         uint8_t numSettings;
1199 
1200         /* An array of value text information */
1201         avrcp_player_settings_t txt[BTIF_AVRCP_NUM_PLAYER_SETTINGS];
1202     } settingStrings;
1203 
1204     /* The list of element values for the current track on the
1205      * target.  This is valid when "advOp" is set to AVRCP_OP_GET_MEDIA_INFO.
1206      */
1207     struct {
1208 
1209         /* The number of elements returned */
1210         uint8_t numIds;
1211 
1212         /* An array of element value text information */
1213         avrcp_media_attr_t txt[BTIF_AVRCP_NUM_MEDIA_ATTRIBUTES];
1214     } element;
1215 
1216     adv_play_status_t playStatus;
1217 
1218 #if BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED
1219     /* The Absolute Volume
1220      * This is valid when "advOp" is set to AVRCP_OP_SET_ABSOLUTE_VOLUME.
1221      */
1222     uint8_t volume;
1223 
1224 #endif                          /* BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED */
1225 } avrcp_adv_rsp_parms_t;
1226 
1227 /*---------------------------------------------------------------------------
1228  * AvrcpNotifyParms structure
1229  *
1230  * Defines the callback parameters for AVRCP_EVENT_ADV_RESPONSE when "advOp" is
1231  * set to AVRCP_OP_REGISTER_NOTIFY, and for the AVRCP_EVENT_ADV_NOTIFY event.
1232  */
1233 typedef struct {
1234 
1235     /* Defines the event ID that was received */
1236     avrcp_event_Id_t event;
1237     union {
1238 
1239         /* Play status of the media.  Valid when the event ID is
1240          * AVRCP_EID_MEDIA_STATUS_CHANGED.
1241          */
1242         avrcp_media_status_t mediaStatus;
1243 
1244         /* The current track.  Valid when the event ID is
1245          * AVRCP_EID_TRACK_CHANGED.
1246          */
1247         avrcp_track_struct_t track;
1248 
1249         /* The position (ms) of the current track.  Valid when the event
1250          * ID is AVRCP_EID_PLAY_POS_CHANGED.
1251          */
1252         uint32_t position;
1253 
1254         /* The battery status of the target.  Valid when the event ID is
1255          * AVRCP_EID_BATT_STATUS_CHANGED.
1256          */
1257         avrcp_battery_status_t battStatus;
1258 
1259         /* The system status of the target.  Valid when the event ID is
1260          * AVRCP_EID_SYS_STATUS_CHANGED.
1261          */
1262         avrcp_system_status_t sysStatus;
1263 
1264         /* The player settings.  Valid when the event ID is
1265          * AVRCP_EID_APP_SETTING_CHANGED
1266          */
1267         struct {
1268 
1269             /* Bitmask that describes which
1270              * attributes are being reported
1271              */
1272             avrcp_player_attrId_mask_t attrMask;
1273 
1274             /* The equalizer setting. */
1275             avrcp_eq_value_t eq;
1276 
1277             /* The repeat setting. */
1278             avrcp_repeat_value_t repeat;
1279 
1280             /* The shuffle setting. */
1281             avrcp_shuffle_value_t shuffle;
1282 
1283             /* The scan setting. */
1284             avrcp_scan_value_t scan;
1285 
1286 #if BTIF_AVRCP_NUM_PLAYER_SETTINGS > 4
1287             /* Extended player setting. */
1288             avrcp_ext_value_t extValue[BTIF_AVRCP_NUM_PLAYER_SETTINGS - 4];
1289 
1290 #endif                          /*  */
1291         } setting;
1292 
1293 #if BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED
1294         /* Absolute volume.  Valid when the event ID is
1295          * AVRCP_EID_VOLUME_CHANGED.
1296          */
1297         uint8_t volume;
1298 
1299         /* The addressed player.  Valid when the event ID is
1300          * AVRCP_EID_ADDRESSED_PLAYER_CHANGED.
1301          */
1302         struct {
1303             uint16_t playerId;
1304             uint16_t uidCounter;
1305         } addrPlayer;
1306 
1307         /* The UID counter.  Valid when the event ID is
1308          * AVRCP_EID_UIDS_CHANGED.
1309          */
1310         uint16_t uidCounter;
1311 
1312 #endif                          /* BTIF_AVRCP_VERSION_1_3_ONLY == BTIF_DISABLED */
1313     } p;
1314 } avrcp_adv_notify_parms_t;
1315 
1316 typedef struct {
1317     uint8_t transId;
1318     union {
1319 
1320         /* Folder Item.  Valid when "advOp" is AVRCP_OP_GET_FOLDER_ITEMS */
1321         struct {
1322             avrcp_scope_t scope;    /* The requested scope */
1323             uint32_t start;     /* The starting item */
1324             uint32_t end;       /* The ending item */
1325             uint8_t numAttrs;   /* Number of attributes requested */
1326             uint8_t *attrList;  /* List of attributes requested */
1327         } folder;
1328 
1329         /* Path.  Valid when "advOp" is AVRCP_OP_CHANGE_PATH */
1330         struct {
1331             uint16_t uidCounter;    /* Current UID counter */
1332             uint8_t direction;  /* Direction to change in the path (up or down) */
1333             uint8_t *uid;       /* UID of folder to change to (down) */
1334         } chPath;
1335 
1336         /* Item Attributes.  Valid when "advOp" is AVRCP_OP_GET_ITEM_ATTRIBUTES */
1337         struct {
1338             avrcp_scope_t scope;    /* The requested scope */
1339             uint8_t *uid;       /* UID of the requested item */
1340             uint16_t uidCounter;    /* Current UID counter */
1341             uint8_t numAttrs;   /* Number of attributes requested */
1342             uint8_t *attrList;  /* List of attributes requested */
1343         } attr;
1344 
1345         /* Search. Valid when "advOp" is AVRCP_OP_SEARCH */
1346         struct {
1347             uint16_t charSet;   /* Character set of the search string */
1348             uint16_t len;       /* Length of the search string */
1349             uint8_t *str;       /* Search string */
1350         } search;
1351     } p;
1352 } avrcp_browse_req_parms_t;
1353 
1354 typedef union {
1355     /* The browsed player.  Valid when "advOp" is AVRCP_OP_SET_BROWSED_PLAYER
1356      */
1357     avrcp_media_player_item_t *brwsPlayer;
1358 } avrcp_browse_inf_parms_t;
1359 
1360 typedef union {
1361     /* Browsed Player. Valid when "advOp" is AVRCP_OP_SET_BROWSED_PLAYER */
1362     struct {
1363         uint16_t uidCounter;    /* Current UID counter */
1364         uint32_t numItems;      /* Number of items in the current path */
1365         uint16_t charSet;       /* Character set used by the player */
1366         uint8_t fDepth;         /* Number of folder length/name pairs to follow */
1367         uint8_t *list;          /* List of folder names */
1368     } brwsPlayer;
1369 
1370     /* Folder Items. Valid when "advOp" is AVRCP_OP_GET_FOLDER_ITEMS */
1371     struct {
1372         uint16_t uidCounter;    /* Current UID counter */
1373         uint32_t numItems;      /* Number of items in the current path */
1374         uint8_t *list;          /* List of items returned */
1375     } fldrItems;
1376 
1377     /* Change Path. Valid when "advOp" is AVRCP_OP_CHANGE_PATH */
1378     struct {
1379         uint32_t numItems;      /* Number of items in the current path */
1380     } chPath;
1381 
1382     /* Item Attributes. Valid when "advOp" is AVRCP_OP_GET_ITEM_ATTRIBUTES */
1383     struct {
1384         uint8_t numAttrs;       /* Number of attributes returned */
1385         uint8_t *list;          /* List of attributes returned */
1386     } itemAttrs;
1387 
1388     /* Search. Valid when "advOp" is AVRCP_OP_SEARCH */
1389     struct {
1390         uint16_t uidCounter;    /* Current UID counter */
1391         uint32_t numItems;      /* Number of items found in the search */
1392     } search;
1393 } avrcp_browse_rsp_parms_t;
1394 
1395 typedef struct {
1396 
1397     /* Operation to which the remote target responded */
1398     uint16_t operation;
1399 
1400     /* The press state of the key in the command to which
1401      * the target responded.
1402      */
1403     BOOL press;
1404 
1405     /* Response from the target. May indicate
1406      * an "extended" response code such as
1407      * AVRCP_RESPONSE_SKIPPED or AVRCP_RESPONSE_TIMEOUT.
1408      */
1409     uint8_t response;
1410 } avrcp_panel_cnf_t;
1411 typedef struct {
1412 
1413     /* Operation corresponding to the key pressed, held, or
1414      * released. AVRCP will only indicate a new operation
1415      * when the previous one has been _RELEASE'd.
1416      */
1417     uint16_t operation;
1418 } avrcp_panel_ind_t;
1419 
1420 /* Channel Packet */
1421 typedef struct {
1422     list_entry_t node;
1423     U8 transId;
1424     U8 msgType;
1425     U8 msgHdrLen;
1426     U8 msgHdr[BTIF_AVTP_HEADER_LEN];
1427     U8 txIdSize;
1428     U16 txId;
1429     U16 txDataLen;
1430     U8 *txData;
1431     U32 context;
1432 } avtp_packet_t;
1433 
1434 typedef struct {
1435     list_entry_t node;          /* Used internally by AVCTP. */
1436     uint8_t transId;            /* Transaction ID */
1437     uint8_t ctype;              /* 4 bits */
1438     uint8_t subunitType;        /* 5 bits */
1439     uint8_t subunitId;          /* 3 bits */
1440     uint8_t opcode;             /* 8 bits */
1441     uint8_t headerLen;          /* Header length */
1442     uint8_t header[6];          /* Header information */
1443     uint16_t operandLen;         /* Length of buffer in "operands" */
1444     uint8_t *operands;          /* Buffer containing the command data */
1445     BOOL more;                  /* Indicates whether to expect additional
1446                                  * frames containing more operand data. */
1447     avtp_packet_t avtpPacket;   /* For sending over AVTP */
1448 
1449     // EvmTimer    timer;          /* Timer for the command */
1450 } avctp_cmd_frame_t;
1451 
1452 enum {
1453     BTIF_AVRCP_STATE_DISCONNECTED,
1454     BTIF_AVRCP_STATE_CONNECTED
1455 };
1456 typedef void avrcp_callback_parms_t;
1457 
1458 typedef void (*btif_avrcp_callback)(btif_avrcp_chnl_handle_t chnl, const avrcp_callback_parms_t *parms);
1459 
btif_convert_avrcp_event(btif_avrcp_event_t event)1460 static POSSIBLY_UNUSED inline btif_avctp_event_t btif_convert_avrcp_event(btif_avrcp_event_t event)
1461 {
1462     return (btif_avctp_event_t) event;
1463 }
1464 
1465 #define BTIF_AVRCP_EVENT(stack_avrcp_event)   btif_convert_avrcp_event(stack_avrcp_event)
1466 #define BTIF_AVRCP_ERROR_CODE(statck_error_code)  statck_error_code
1467 
1468 typedef struct
1469 {
1470     list_entry_t node;
1471     U8 op;
1472     U16 parm_len;
1473     U8 *parms;
1474     U8  trans_id;
1475 
1476     BOOL more;
1477     U16  cur_len;
1478     U16  bytes_to_send;
1479     U8   cont_op;
1480     BOOL abort;
1481 
1482     BOOL  internal;
1483     U8  response;
1484     U8 error;
1485 
1486     BOOL is_cmd;
1487     U8  ctype;          /* 4 bits */
1488 } btif_avrcp_advanced_cmd_pdu_t ;
1489 
1490 typedef struct
1491 {
1492     bool free;
1493     uint8_t state;
1494     list_entry_t tx_cmd_list;
1495     bool cmd_in_use;
1496     bool op_in_use;
1497     CQueue tx_op_queue;
1498     uint8_t tx_op_queue_buff[BTIF_AVRCP_SUBUNIT_OP_QUEUE_MAX*3]; // 3 bytes per operation
1499     avctp_cmd_frame_t rx_cmd_frame;
1500     uint8_t rx_frag_buff[BTIF_AVRCP_RX_FRAG_BUFF_SIZE];
1501     uint32_t rx_frag_buff_offset;
1502     struct
1503     {
1504         avrcp_event_mask_t rem_eventMask;
1505         btif_avrcp_advanced_cmd_pdu_t *tx_cmd;
1506     } adv;
1507     btif_avrcp_callback cb;
1508     btif_avrcp_chnl_handle_t avrcp_channel_handle;
1509 } btif_avrcp_channel_t;
1510 
1511 typedef struct
1512 {
1513     btif_avrcp_advanced_cmd_pdu_t *tx_cmd;
1514     avrcp_adv_rsp_parms_t rsp;
1515     avrcp_adv_notify_parms_t notify;
1516 } btif_avrcp_rsp_adv;
1517 
1518 typedef struct
1519 {
1520     btif_avrcp_event_t event;
1521     btif_avrcp_channel_t *channel;
1522     bt_status_t status;
1523     uint8_t error_code;
1524     btif_avrcp_operation_t adv_op;
1525     union
1526     {
1527         avctp_cmd_frame_t *cmdFrame;
1528         btif_avrcp_rsp_adv adv;
1529         avrcp_panel_cnf_t panel_cnf;
1530         avrcp_panel_ind_t panel_ind;
1531     } p;
1532 } btif_avrcp_callback_parms_t;
1533 
1534 #ifdef __cplusplus
1535 extern "C" {
1536 #endif
1537 
1538     void btif_avrcp_init(void);
1539 
1540     bt_status_t btif_avrcp_register(btif_avrcp_channel_t *channel, btif_avrcp_callback cb, avrcp_features_t feat);
1541 
1542     btif_avrcp_channel_t *btif_alloc_avrcp_channel(void);
1543 
1544     btif_avrcp_channel_t *btif_get_avrcp_channel(btif_avrcp_chnl_handle_t handle);
1545 
1546     btif_avctp_event_t btif_avrcp_get_callback_event(const avrcp_callback_parms_t * parms);
1547 
1548     bool btif_avrcp_adv_cmd_inuse(btif_avrcp_channel_t * channel);
1549 
1550     bool btif_avrcp_state_connected(btif_avrcp_channel_t * channel);
1551 
1552     void btif_avrcp_set_volume_cmd(void *cmd, uint8_t transid, int8_t volume);
1553 
1554 
1555     void btif_avrcp_send_custom_cmd_generic(btif_avrcp_channel_t * chnl, uint8_t * ptrData,
1556                                             uint32_t len);
1557     bt_status_t btif_avrcp_ct_accept_custom_cmd_rsp(btif_avrcp_channel_t * chnl, void *cmd_res,
1558                                                     uint8_t isAccept);
1559     bt_status_t btif_avrcp_connect(btif_avrcp_channel_t * channel, bt_bdaddr_t * addr);
1560 
1561     bt_status_t btif_avrcp_connect_rsp(btif_avrcp_channel_t * chnl, BOOL accept);
1562 
1563     bt_status_t btif_avrcp_disconnect(btif_avrcp_chnl_handle_t channel);
1564 
1565     bt_status_t btif_avrcp_ct_get_play_status(btif_avrcp_channel_t * channel,
1566 
1567                                               avrcp_advanced_pdu_t * cmd);
1568     avrcp_version_t btif_get_avrcp_version(btif_avrcp_channel_t * channel);
1569 
1570     bt_status_t btif_avrcp_ct_get_capabilities(btif_avrcp_channel_t * channel,
1571                                                avrcp_advanced_pdu_t * pdu,
1572                                                btif_avrcp_capabilityId capabilityId);
1573 
1574     void btif_set_avrcp_state(btif_avrcp_channel_t * channel, uint8_t avrcp_state);
1575 
1576     uint8_t btif_get_avrcp_state(btif_avrcp_channel_t * channel);
1577 
1578     btif_remote_device_t *btif_avrcp_get_remote_device(btif_avrcp_chnl_handle_t handle);
1579 
1580     uint8_t btif_avrcp_get_channel_panel_int_state(btif_avrcp_chnl_handle_t handle);
1581 
1582     uint8_t btif_avrcp_get_channel_avrcp_state(btif_avrcp_chnl_handle_t handle);
1583 
1584     bt_status_t btif_avrcp_ct_register_notification(btif_avrcp_channel_t * channel,
1585 
1586                                                     avrcp_advanced_pdu_t * pdu,
1587                                                     btif_avrcp_event_t eventId, uint32_t interval);
1588     bt_status_t btif_get_avrcp_cb_channel_state(const avrcp_callback_parms_t * parms);
1589 
1590     avrcp_error_code_t btif_get_avrcp_cb_channel_error_code(const avrcp_callback_parms_t * parms);
1591 
1592     btif_avrcp_operation_t btif_get_avrcp_cb_channel_advOp(const avrcp_callback_parms_t * parms);
1593 
1594     void *btif_get_avrcp_cb_txPdu(const avrcp_callback_parms_t * parms);
1595 
1596     btif_avrcp_operation_t btif_get_avrcp_cb_txPdu_Op(const avrcp_callback_parms_t * parms);
1597 
1598     uint8_t  btif_get_avrcp_pdu_ctype(void * adv_pdu);
1599 
1600     uint8_t btif_get_avrcp_cb_txPdu_transId(const avrcp_callback_parms_t * parms);
1601 
1602     avrcp_role_t btif_get_avrcp_cb_channel_role(btif_avrcp_channel_t * channel);
1603 
1604     avrcp_panel_cnf_t *btif_get_panel_cnf(const avrcp_callback_parms_t * parms);
1605 
1606     avrcp_role_t btif_get_avrcp_channel_role(btif_avrcp_channel_t * channel);
1607 
1608     adv_play_status_t *btif_get_avrcp_adv_rsp_play_status(const avrcp_callback_parms_t * parms);
1609 
1610     avrcp_adv_rsp_parms_t *btif_get_avrcp_adv_rsp(const avrcp_callback_parms_t * parms);
1611 
1612     avrcp_adv_notify_parms_t *btif_get_avrcp_adv_notify(const avrcp_callback_parms_t * parms);
1613 
1614     avrcp_event_mask_t btif_get_avrcp_adv_rem_event_mask(btif_avrcp_channel_t * channel);
1615 
1616     void btif_set_avrcp_adv_rem_event_mask(btif_avrcp_channel_t * channel, uint16_t mask);
1617 
1618     void btif_set_app_bt_device_avrcp_notify_rsp_ctype(avrcp_advanced_pdu_t * cmd, uint8_t type);
1619 
1620     uint8_t btif_get_app_bt_device_avrcp_notify_rsp_transid(avrcp_advanced_pdu_t * cmd);
1621 
1622     bt_status_t btif_avrcp_ct_get_media_Info(btif_avrcp_channel_t * channel,
1623 
1624                                              avrcp_advanced_pdu_t * cmd,
1625                                              avrcp_media_attrId_mask_t mediaMask);
1626     avctp_cmd_frame_t *btif_get_avrcp_cmd_frame(const avrcp_callback_parms_t * parms);
1627 
1628     void btif_avrcp_set_capabilities_rsp_cmd(avrcp_advanced_pdu_t * cmd_pdu, uint8_t transId,
1629 
1630                                              uint8_t type);
1631 
1632     void btif_avrcp_set_control_rsp_cmd(avrcp_advanced_pdu_t * cmd_pdu, uint8_t transId,
1633                                         uint8_t type);
1634 
1635 	void btif_avrcp_set_control_rsp_cmd_witherror(avrcp_advanced_pdu_t * cmd_pdu, uint8_t transId, uint8_t type, uint8_t error);
1636 
1637     bt_status_t btif_avrcp_ct_get_capabilities_rsp(btif_avrcp_channel_t * channel,
1638                                                    avrcp_advanced_pdu_t * cmd_pdu,
1639                                                    avrcp_capabilityId_t capid, uint16_t mask);
1640 
1641     bt_status_t btif_avrcp_ct_accept_absolute_volume_rsp(btif_avrcp_channel_t * channel,
1642                                                          avrcp_advanced_pdu_t * cmd_pdu,
1643                                                          uint8_t volume);
1644 
1645     void btif_avrcp_set_notify_rsp_cmd(avrcp_advanced_pdu_t * cmd_pdu, uint8_t transId,
1646                                        uint8_t type);
1647 
1648 	void btif_avrcp_set_notify_rsp_cmd_witherror(avrcp_advanced_pdu_t * cmd_pdu, uint8_t transId, uint8_t type, uint8_t error);
1649 
1650     void btif_avrcp_recheck_vol_ctrl_flag(uint8_t * flag);
1651 
1652     bt_status_t btif_avrcp_ct_get_absolute_volume_rsp(btif_avrcp_channel_t * channel,
1653                                                       avrcp_advanced_pdu_t * cmd_pdu,
1654                                                       uint8_t volume);
1655 
1656     bt_status_t btif_avrcp_tg_absolute_volume_notify(btif_avrcp_channel_t * channel, avrcp_advanced_pdu_t * cmd_pdu, uint8_t volume);
1657 
1658     uint16_t btif_avrcp_get_cmgrhandler_remDev_hciHandle(btif_avrcp_channel_t * channel);
1659 
1660     avrcp_panel_cnf_t *btif_get_avrcp_panel_cnf(const avrcp_callback_parms_t * parms);
1661 
1662     avrcp_panel_ind_t *btif_get_avrcp_panel_ind(const avrcp_callback_parms_t * parms);
1663 
1664     bt_status_t btif_avrcp_set_panel_key(btif_avrcp_channel_t * channel, avrcp_panel_operation_t op,
1665                                          bool press);
1666 
1667     uint8_t btif_avrcp_get_ctl_trans_id(btif_avrcp_channel_t * channel);
1668     void btif_avrcp_set_ctl_trans_id(btif_avrcp_channel_t * channel, uint8_t trans_id);
1669 
1670     bt_status_t btif_avrcp_ct_set_absolute_volume(btif_avrcp_channel_t *channel, avrcp_advanced_pdu_t *_pdu, uint8_t volume);
1671 
1672     void btif_avrcp_set_channel_adv_event_mask(btif_avrcp_chnl_handle_t handle, uint16_t mask);
1673 
1674     bt_status_t btif_avrcp_tg_send_general_rsp(btif_avrcp_channel_t * channel, avrcp_advanced_pdu_t * cmd_pdu, uint8_t op, uint8_t error_code);
1675 
1676    	bt_status_t btif_avrcp_ct_invalid_volume_rsp(btif_avrcp_channel_t * channel, avrcp_advanced_pdu_t * cmd_pdu);
1677 
1678 #if defined(IBRT)
1679     uint32_t btif_avrcp_profile_save_ctxs(btif_remote_device_t *rem_dev, uint8_t *buf, uint32_t buf_len);
1680     uint32_t btif_avrcp_profile_restore_ctxs(uint8_t *buf, uint32_t buf_len);
1681 #endif
1682 
1683 #ifdef __cplusplus
1684 }
1685 #endif
1686 #endif
1687