1 /******************************************************************************
2  *
3  *  Copyright (C) 2006-2012 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  *  nterface to AVRCP Application Programming Interface
22  *
23  ******************************************************************************/
24 #ifndef AVRC_API_H
25 #define AVRC_API_H
26 #include "avct_api.h"
27 #include "avrc_defs.h"
28 #include "bt_target.h"
29 #include "sdp_api.h"
30 
31 /*****************************************************************************
32  *  constants
33  ****************************************************************************/
34 
35 /* API function return value result codes. */
36 /* 0 Function successful */
37 #define AVRC_SUCCESS AVCT_SUCCESS
38 /* 1 Not enough resources */
39 #define AVRC_NO_RESOURCES AVCT_NO_RESOURCES
40 /* 2 Bad handle */
41 #define AVRC_BAD_HANDLE AVCT_BAD_HANDLE
42 /* 3 PID already in use */
43 #define AVRC_PID_IN_USE AVCT_PID_IN_USE
44 /* 4 Connection not open */
45 #define AVRC_NOT_OPEN AVCT_NOT_OPEN
46 /* 5 the message length exceed the MTU of the browsing channel */
47 #define AVRC_MSG_TOO_BIG 5
48 /* 0x10 generic failure */
49 #define AVRC_FAIL 0x10
50 /* 0x11 bad parameter   */
51 #define AVRC_BAD_PARAM 0x11
52 
53 /* Control role - same as AVCT_TARGET/AVCT_CONTROL */
54 /* target  */
55 #define AVRC_CT_TARGET 1
56 /* controller  */
57 #define AVRC_CT_CONTROL 2
58 /* If conflict, allow the other side to succeed  */
59 #define AVRC_CT_PASSIVE 4
60 
61 /* Connection role */
62 /* initiator */
63 #define AVRC_CONN_INT AVCT_INT
64 /* Acceptor  */
65 #define AVRC_CONN_ACP AVCT_ACP
66 
67 /* AVRC CTRL events */
68 /* AVRC_OPEN_IND_EVT event is sent when the connection is successfully opened.
69  * This eventis sent in response to an AVRC_Open(). */
70 #define AVRC_OPEN_IND_EVT 0
71 
72 /* AVRC_CLOSE_IND_EVT event is sent when a connection is closed.
73  * This event can result from a call to AVRC_Close() or when the peer closes
74  * the connection.  It is also sent when a connection attempted through
75  * AVRC_Open() fails. */
76 #define AVRC_CLOSE_IND_EVT 1
77 
78 /* AVRC_CONG_IND_EVT event indicates that AVCTP is congested and cannot send
79  * any more messages. */
80 #define AVRC_CONG_IND_EVT 2
81 
82 /* AVRC_UNCONG_IND_EVT event indicates that AVCTP is uncongested and ready to
83  * send messages. */
84 #define AVRC_UNCONG_IND_EVT 3
85 
86 /* AVRC_BROWSE_OPEN_IND_EVT event is sent when the browse channel is
87 * successfully opened.
88 * This eventis sent in response to an AVRC_Open() or AVRC_OpenBrowse() . */
89 #define AVRC_BROWSE_OPEN_IND_EVT 4
90 
91 /* AVRC_BROWSE_CLOSE_IND_EVT event is sent when a browse channel is closed.
92  * This event can result from a call to AVRC_Close(), AVRC_CloseBrowse() or
93  * when the peer closes the connection.  It is also sent when a connection
94  * attempted through AVRC_OpenBrowse() fails. */
95 #define AVRC_BROWSE_CLOSE_IND_EVT 5
96 
97 /* AVRC_BROWSE_CONG_IND_EVT event indicates that AVCTP browse channel is
98  * congested and cannot send any more messages. */
99 #define AVRC_BROWSE_CONG_IND_EVT 6
100 
101 /* AVRC_BROWSE_UNCONG_IND_EVT event indicates that AVCTP browse channel is
102  * uncongested and ready to send messages. */
103 #define AVRC_BROWSE_UNCONG_IND_EVT 7
104 
105 /* AVRC_CMD_TIMEOUT_EVT event indicates timeout waiting for AVRC command
106  * response from the peer */
107 #define AVRC_CMD_TIMEOUT_EVT 8
108 
109 /* Supported categories */
110 #define AVRC_SUPF_CT_CAT1 0x0001         /* Category 1 */
111 #define AVRC_SUPF_CT_CAT2 0x0002         /* Category 2 */
112 #define AVRC_SUPF_CT_CAT3 0x0004         /* Category 3 */
113 #define AVRC_SUPF_CT_CAT4 0x0008         /* Category 4 */
114 #define AVRC_SUPF_CT_APP_SETTINGS 0x0010 /* Player Application Settings */
115 #define AVRC_SUPF_CT_GROUP_NAVI 0x0020   /* Group Navigation */
116 #define AVRC_SUPF_CT_BROWSE 0x0040       /* Browsing */
117 
118 /* Cover Art, get image property */
119 #define AVRC_SUPF_CT_COVER_ART_GET_IMAGE_PROP 0x0080
120 /* Cover Art, get image */
121 #define AVRC_SUPF_CT_COVER_ART_GET_IMAGE 0x0100
122 /* Cover Art, get Linked Thumbnail */
123 #define AVRC_SUPF_CT_COVER_ART_GET_THUMBNAIL 0x0200
124 
125 #define AVRC_SUPF_TG_CAT1 0x0001             /* Category 1 */
126 #define AVRC_SUPF_TG_CAT2 0x0002             /* Category 2 */
127 #define AVRC_SUPF_TG_CAT3 0x0004             /* Category 3 */
128 #define AVRC_SUPF_TG_CAT4 0x0008             /* Category 4 */
129 #define AVRC_SUPF_TG_APP_SETTINGS 0x0010     /* Player Application Settings */
130 #define AVRC_SUPF_TG_GROUP_NAVI 0x0020       /* Group Navigation */
131 #define AVRC_SUPF_TG_BROWSE 0x0040           /* Browsing */
132 #define AVRC_SUPF_TG_MULTI_PLAYER 0x0080     /* Muliple Media Player */
133 #define AVRC_SUPF_TG_PLAYER_COVER_ART 0x0100 /* Cover Art */
134 
135 #define AVRC_META_SUCCESS AVRC_SUCCESS
136 #define AVRC_META_FAIL AVRC_FAIL
137 #define AVRC_METADATA_CMD 0x0000
138 #define AVRC_METADATA_RESP 0x0001
139 
140 /*****************************************************************************
141  *  data type definitions
142  ****************************************************************************/
143 
144 /* This data type is used in AVRC_FindService() to initialize the SDP database
145  * to hold the result service search. */
146 typedef struct {
147   uint32_t db_len;         /* Length, in bytes, of the discovery database */
148   tSDP_DISCOVERY_DB* p_db; /* Pointer to the discovery database */
149   uint16_t num_attr;       /* The number of attributes in p_attrs */
150   uint16_t* p_attrs;       /* The attributes filter. If NULL, AVRCP API sets the
151                             * attribute filter
152                             * to be ATTR_ID_SERVICE_CLASS_ID_LIST,
153                             * ATTR_ID_BT_PROFILE_DESC_LIST,
154                             * ATTR_ID_SUPPORTED_FEATURES, ATTR_ID_SERVICE_NAME and
155                             * ATTR_ID_PROVIDER_NAME.
156                             * If not NULL, the input is taken as the filter. */
157 } tAVRC_SDP_DB_PARAMS;
158 
159 /* This callback function returns service discovery information to the
160  * application after the AVRC_FindService() API function is called.  The
161  * implementation of this callback function must copy the p_service_name
162  * and p_provider_name parameters passed to it as they are not guaranteed
163  * to remain after the callback function exits. */
164 typedef void(tAVRC_FIND_CBACK)(uint16_t status);
165 
166 /* This is the control callback function.  This function passes events
167  * listed in Table 20 to the application. */
168 typedef void(tAVRC_CTRL_CBACK)(uint8_t handle, uint8_t event, uint16_t result,
169                                BD_ADDR peer_addr);
170 
171 /* This is the message callback function.  It is executed when AVCTP has
172  * a message packet ready for the application.  The implementation of this
173  * callback function must copy the tAVRC_MSG structure passed to it as it
174  * is not guaranteed to remain after the callback function exits. */
175 typedef void(tAVRC_MSG_CBACK)(uint8_t handle, uint8_t label, uint8_t opcode,
176                               tAVRC_MSG* p_msg);
177 
178 typedef struct {
179   tAVRC_CTRL_CBACK* p_ctrl_cback; /* pointer to application control callback */
180   tAVRC_MSG_CBACK* p_msg_cback;   /* pointer to application message callback */
181   uint32_t company_id;            /* the company ID  */
182   uint8_t conn;                   /* Connection role (Initiator/acceptor) */
183   uint8_t control;                /* Control role (Control/Target) */
184 } tAVRC_CONN_CB;
185 
186 typedef struct {
187   uint8_t handle;
188   uint8_t label;
189   uint8_t msg_mask;
190 } tAVRC_PARAM;
191 
192 /*****************************************************************************
193  *  external function declarations
194  ****************************************************************************/
195 
196 /******************************************************************************
197  *
198  * Function         AVRC_AddRecord
199  *
200  * Description      This function is called to build an AVRCP SDP record.
201  *                  Prior to calling this function the application must
202  *                  call SDP_CreateRecord() to create an SDP record.
203  *
204  *                  Input Parameters:
205  *                      service_uuid:  Indicates
206  *                                       TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
207  *                                    or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
208  *
209  *                      p_service_name:  Pointer to a null-terminated character
210  *                      string containing the service name.
211  *                      If service name is not used set this to NULL.
212  *
213  *                      p_provider_name:  Pointer to a null-terminated character
214  *                      string containing the provider name.
215  *                      If provider name is not used set this to NULL.
216  *
217  *                      categories:  Supported categories.
218  *
219  *                      sdp_handle:  SDP handle returned by SDP_CreateRecord().
220  *
221  *                  Output Parameters:
222  *                      None.
223  *
224  * Returns          AVRC_SUCCESS if successful.
225  *                  AVRC_NO_RESOURCES if not enough resources to build the SDP
226  *                                    record.
227  *
228  *****************************************************************************/
229 extern uint16_t AVRC_AddRecord(uint16_t service_uuid,
230                                const char* p_service_name,
231                                const char* p_provider_name, uint16_t categories,
232                                uint32_t sdp_handle, bool browse_supported,
233                                uint16_t profile_version);
234 
235 /******************************************************************************
236  *
237  * Function         AVRC_FindService
238  *
239  * Description      This function is called by the application to perform
240  *                  service discovery and retrieve AVRCP SDP record information
241  *                  from a peer device.  Information is returned for the first
242  *                  service record found on the server that matches the service
243  *                  UUID. The callback function will be executed when service
244  *                  discovery is complete.  There can only be one outstanding
245  *                  call to AVRC_FindService() at a time; the application must
246  *                  wait for the callback before it makes another call to the
247  *                  function. The application is responsible for allocating
248  *                  memory for the discovery database.  It is recommended that
249  *                  the size of the discovery database be at least 300 bytes.
250  *                  The application can deallocate the memory after the
251  *                  callback function has executed.
252  *
253  *                  Input Parameters:
254  *                      service_uuid: Indicates
255  *                                       TG(UUID_SERVCLASS_AV_REM_CTRL_TARGET)
256  *                                    or CT(UUID_SERVCLASS_AV_REMOTE_CONTROL)
257  *
258  *                      bd_addr:  BD address of the peer device.
259  *
260  *                      p_db:  SDP discovery database parameters.
261  *
262  *                      p_cback:  Pointer to the callback function.
263  *
264  *                  Output Parameters:
265  *                      None.
266  *
267  * Returns          AVRC_SUCCESS if successful.
268  *                  AVRC_BAD_PARAMS if discovery database parameters are
269  *                                  invalid.
270  *                  AVRC_NO_RESOURCES if there are not enough resources to
271  *                                    perform the service search.
272  *
273  *****************************************************************************/
274 extern uint16_t AVRC_FindService(uint16_t service_uuid, BD_ADDR bd_addr,
275                                  tAVRC_SDP_DB_PARAMS* p_db,
276                                  tAVRC_FIND_CBACK* p_cback);
277 
278 /******************************************************************************
279  *
280  * Function         AVRC_Open
281  *
282  * Description      This function is called to open a connection to AVCTP.
283  *                  The connection can be either an initiator or acceptor, as
284  *                  determined by the p_ccb->stream parameter.
285  *                  The connection can be a target, a controller or for both
286  *                  roles, as determined by the p_ccb->control parameter.
287  *                  By definition, a target connection is an acceptor connection
288  *                  that waits for an incoming AVCTP connection from the peer.
289  *                  The connection remains available to the application until
290  *                  the application closes it by calling AVRC_Close().  The
291  *                  application does not need to reopen the connection after an
292  *                  AVRC_CLOSE_IND_EVT is received.
293  *
294  *                  Input Parameters:
295  *                      p_ccb->company_id: Company Identifier.
296  *
297  *                      p_ccb->p_ctrl_cback:  Pointer to the control callback
298  *                                            function.
299  *
300  *                      p_ccb->p_msg_cback:  Pointer to the message callback
301  *                                           function.
302  *
303  *                      p_ccb->conn: AVCTP connection role.  This is set to
304  *                      AVCTP_INT for initiator connections and AVCTP_ACP
305  *                      for acceptor connections.
306  *
307  *                      p_ccb->control: Control role.  This is set to
308  *                      AVRC_CT_TARGET for target connections, AVRC_CT_CONTROL
309  *                      for control connections or
310  *                      (AVRC_CT_TARGET|AVRC_CT_CONTROL) for connections that
311  *                      support both roles.
312  *
313  *                      peer_addr: BD address of peer device.  This value is
314  *                      only used for initiator connections; for acceptor
315  *                      connections it can be set to NULL.
316  *
317  *                  Output Parameters:
318  *                      p_handle: Pointer to handle.  This parameter is only
319  *                                valid if AVRC_SUCCESS is returned.
320  *
321  * Returns          AVRC_SUCCESS if successful.
322  *                  AVRC_NO_RESOURCES if there are not enough resources to open
323  *                  the connection.
324  *
325  *****************************************************************************/
326 extern uint16_t AVRC_Open(uint8_t* p_handle, tAVRC_CONN_CB* p_ccb,
327                           BD_ADDR_PTR peer_addr);
328 
329 /******************************************************************************
330  *
331  * Function         AVRC_Close
332  *
333  * Description      Close a connection opened with AVRC_Open().
334  *                  This function is called when the
335  *                  application is no longer using a connection.
336  *
337  *                  Input Parameters:
338  *                      handle: Handle of this connection.
339  *
340  *                  Output Parameters:
341  *                      None.
342  *
343  * Returns          AVRC_SUCCESS if successful.
344  *                  AVRC_BAD_HANDLE if handle is invalid.
345  *
346  *****************************************************************************/
347 extern uint16_t AVRC_Close(uint8_t handle);
348 
349 /******************************************************************************
350  *
351  * Function         AVRC_OpenBrowse
352  *
353  * Description      This function is called to open a browsing connection to
354  *                  AVCTP. The connection can be either an initiator or
355  *                  acceptor, as determined by the conn_role.
356  *                  The handle is returned by a previous call to AVRC_Open.
357  *
358  * Returns          AVRC_SUCCESS if successful.
359  *                  AVRC_NO_RESOURCES if there are not enough resources to open
360  *                  the connection.
361  *
362  *****************************************************************************/
363 extern uint16_t AVRC_OpenBrowse(uint8_t handle, uint8_t conn_role);
364 
365 /******************************************************************************
366  *
367  * Function         AVRC_CloseBrowse
368  *
369  * Description      Close a connection opened with AVRC_OpenBrowse().
370  *                  This function is called when the
371  *                  application is no longer using a connection.
372  *
373  * Returns          AVRC_SUCCESS if successful.
374  *                  AVRC_BAD_HANDLE if handle is invalid.
375  *
376  *****************************************************************************/
377 extern uint16_t AVRC_CloseBrowse(uint8_t handle);
378 
379 /******************************************************************************
380  *
381  * Function         AVRC_MsgReq
382  *
383  * Description      This function is used to send the AVRCP byte stream in p_pkt
384  *                  down to AVCTP.
385  *
386  *                  It is expected that:
387  *                  p_pkt->offset is at least AVCT_MSG_OFFSET
388  *                  p_pkt->layer_specific is AVCT_DATA_CTRL or AVCT_DATA_BROWSE
389  *                  p_pkt->event is AVRC_OP_VENDOR, AVRC_OP_PASS_THRU or
390  *                                  AVRC_OP_BROWSING
391  *                  The above BT_HDR settings are set by the AVRC_Bld*
392  *                  functions.
393  *
394  * Returns          AVRC_SUCCESS if successful.
395  *                  AVRC_BAD_HANDLE if handle is invalid.
396  *
397  *****************************************************************************/
398 extern uint16_t AVRC_MsgReq(uint8_t handle, uint8_t label, uint8_t ctype,
399                             BT_HDR* p_pkt);
400 
401 /******************************************************************************
402  *
403  * Function         AVRC_UnitCmd
404  *
405  * Description      Send a UNIT INFO command to the peer device.  This
406  *                  function can only be called for controller role connections.
407  *                  Any response message from the peer is passed back through
408  *                  the tAVRC_MSG_CBACK callback function.
409  *
410  *                  Input Parameters:
411  *                      handle: Handle of this connection.
412  *
413  *                      label: Transaction label.
414  *
415  *                  Output Parameters:
416  *                      None.
417  *
418  * Returns          AVRC_SUCCESS if successful.
419  *                  AVRC_BAD_HANDLE if handle is invalid.
420  *
421  *****************************************************************************/
422 extern uint16_t AVRC_UnitCmd(uint8_t handle, uint8_t label);
423 
424 /******************************************************************************
425  *
426  * Function         AVRC_SubCmd
427  *
428  * Description      Send a SUBUNIT INFO command to the peer device.  This
429  *                  function can only be called for controller role connections.
430  *                  Any response message from the peer is passed back through
431  *                  the tAVRC_MSG_CBACK callback function.
432  *
433  *                  Input Parameters:
434  *                      handle: Handle of this connection.
435  *
436  *                      label: Transaction label.
437  *
438  *                      page: Specifies which part of the subunit type table
439  *                      is requested.  For AVRCP it is typically zero.
440  *                      Value range is 0-7.
441  *
442  *                  Output Parameters:
443  *                      None.
444  *
445  * Returns          AVRC_SUCCESS if successful.
446  *                  AVRC_BAD_HANDLE if handle is invalid.
447  *
448  *****************************************************************************/
449 extern uint16_t AVRC_SubCmd(uint8_t handle, uint8_t label, uint8_t page);
450 
451 /******************************************************************************
452  *
453  * Function         AVRC_PassCmd
454  *
455  * Description      Send a PASS THROUGH command to the peer device.  This
456  *                  function can only be called for controller role connections.
457  *                  Any response message from the peer is passed back through
458  *                  the tAVRC_MSG_CBACK callback function.
459  *
460  *                  Input Parameters:
461  *                      handle: Handle of this connection.
462  *
463  *                      label: Transaction label.
464  *
465  *                      p_msg: Pointer to PASS THROUGH message structure.
466  *
467  *                  Output Parameters:
468  *                      None.
469  *
470  * Returns          AVRC_SUCCESS if successful.
471  *                  AVRC_BAD_HANDLE if handle is invalid.
472  *
473  *****************************************************************************/
474 extern uint16_t AVRC_PassCmd(uint8_t handle, uint8_t label,
475                              tAVRC_MSG_PASS* p_msg);
476 
477 /******************************************************************************
478  *
479  * Function         AVRC_PassRsp
480  *
481  * Description      Send a PASS THROUGH response to the peer device.  This
482  *                  function can only be called for target role connections.
483  *                  This function must be called when a PASS THROUGH command
484  *                  message is received from the peer through the
485  *                  tAVRC_MSG_CBACK callback function.
486  *
487  *                  Input Parameters:
488  *                      handle: Handle of this connection.
489  *
490  *                      label: Transaction label.  Must be the same value as
491  *                      passed with the command message in the callback
492  *                      function.
493  *
494  *                      p_msg: Pointer to PASS THROUGH message structure.
495  *
496  *                  Output Parameters:
497  *                      None.
498  *
499  * Returns          AVRC_SUCCESS if successful.
500  *                  AVRC_BAD_HANDLE if handle is invalid.
501  *
502  *****************************************************************************/
503 extern uint16_t AVRC_PassRsp(uint8_t handle, uint8_t label,
504                              tAVRC_MSG_PASS* p_msg);
505 
506 /******************************************************************************
507  *
508  * Function         AVRC_VendorCmd
509  *
510  * Description      Send a VENDOR DEPENDENT command to the peer device.  This
511  *                  function can only be called for controller role connections.
512  *                  Any response message from the peer is passed back through
513  *                  the tAVRC_MSG_CBACK callback function.
514  *
515  *                  Input Parameters:
516  *                      handle: Handle of this connection.
517  *
518  *                      label: Transaction label.
519  *
520  *                      p_msg: Pointer to VENDOR DEPENDENT message structure.
521  *
522  *                  Output Parameters:
523  *                      None.
524  *
525  * Returns          AVRC_SUCCESS if successful.
526  *                  AVRC_BAD_HANDLE if handle is invalid.
527  *
528  *****************************************************************************/
529 extern uint16_t AVRC_VendorCmd(uint8_t handle, uint8_t label,
530                                tAVRC_MSG_VENDOR* p_msg);
531 
532 /******************************************************************************
533  *
534  * Function         AVRC_VendorRsp
535  *
536  * Description      Send a VENDOR DEPENDENT response to the peer device.  This
537  *                  function can only be called for target role connections.
538  *                  This function must be called when a VENDOR DEPENDENT
539  *                  command message is received from the peer through the
540  *                  tAVRC_MSG_CBACK callback function.
541  *
542  *                  Input Parameters:
543  *                      handle: Handle of this connection.
544  *
545  *                      label: Transaction label.  Must be the same value as
546  *                      passed with the command message in the callback
547  *                      function.
548  *
549  *                      p_msg: Pointer to VENDOR DEPENDENT message structure.
550  *
551  *                  Output Parameters:
552  *                      None.
553  *
554  * Returns          AVRC_SUCCESS if successful.
555  *                  AVRC_BAD_HANDLE if handle is invalid.
556  *
557  *****************************************************************************/
558 extern uint16_t AVRC_VendorRsp(uint8_t handle, uint8_t label,
559                                tAVRC_MSG_VENDOR* p_msg);
560 
561 /******************************************************************************
562  *
563  * Function         AVRC_SetTraceLevel
564  *
565  * Description      Sets the trace level for AVRC. If 0xff is passed, the
566  *                  current trace level is returned.
567  *
568  *                  Input Parameters:
569  *                      new_level:  The level to set the AVRC tracing to:
570  *                      0xff-returns the current setting.
571  *                      0-turns off tracing.
572  *                      >= 1-Errors.
573  *                      >= 2-Warnings.
574  *                      >= 3-APIs.
575  *                      >= 4-Events.
576  *                      >= 5-Debug.
577  *
578  * Returns          The new trace level or current trace level if
579  *                  the input parameter is 0xff.
580  *
581  *****************************************************************************/
582 extern uint8_t AVRC_SetTraceLevel(uint8_t new_level);
583 
584 /*******************************************************************************
585  *
586  * Function         AVRC_Init
587  *
588  * Description      This function is called at stack startup to allocate the
589  *                  control block (if using dynamic memory), and initializes the
590  *                  control block and tracing level.
591  *
592  * Returns          void
593  *
594  ******************************************************************************/
595 extern void AVRC_Init(void);
596 
597 /*******************************************************************************
598  *
599  * Function         AVRC_Ctrl_ParsCommand
600  *
601  * Description      This function is used to parse cmds received for CTRL
602  *                  Currently it is for SetAbsVolume and Volume Change
603  *                      Notification..
604  *
605  * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
606  *                      successfully.
607  *                  Otherwise, the error code defined by AVRCP 1.4
608  *
609  ******************************************************************************/
610 extern tAVRC_STS AVRC_Ctrl_ParsCommand(tAVRC_MSG* p_msg,
611                                        tAVRC_COMMAND* p_result);
612 
613 /*******************************************************************************
614  *
615  * Function         AVRC_ParsCommand
616  *
617  * Description      This function is used to parse the received command.
618  *
619  * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
620  *                      successfully.
621  *                  Otherwise, the error code defined by AVRCP 1.4
622  *
623  ******************************************************************************/
624 extern tAVRC_STS AVRC_ParsCommand(tAVRC_MSG* p_msg, tAVRC_COMMAND* p_result,
625                                   uint8_t* p_buf, uint16_t buf_len);
626 
627 /*******************************************************************************
628  *
629  * Function         AVRC_ParsResponse
630  *
631  * Description      This function is used to parse the received response.
632  *
633  * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
634  *                      successfully.
635  *                  Otherwise, the error code defined by AVRCP 1.4
636  *
637  ******************************************************************************/
638 extern tAVRC_STS AVRC_ParsResponse(tAVRC_MSG* p_msg, tAVRC_RESPONSE* p_result,
639                                    uint8_t* p_buf, uint16_t buf_len);
640 
641 /*******************************************************************************
642  *
643  * Function         AVRC_Ctrl_ParsResponse
644  *
645  * Description      This function is a parse response for AVRCP Controller.
646  *
647  * Returns          AVRC_STS_NO_ERROR, if the message in p_data is parsed
648  *                      successfully.
649  *                  Otherwise, the error code defined by AVRCP 1.4
650  *
651  ******************************************************************************/
652 extern tAVRC_STS AVRC_Ctrl_ParsResponse(tAVRC_MSG* p_msg,
653                                         tAVRC_RESPONSE* p_result,
654                                         uint8_t* p_buf, uint16_t* buf_len);
655 
656 /*******************************************************************************
657  *
658  * Function         AVRC_BldCommand
659  *
660  * Description      This function builds the given AVRCP command to the given
661  *                  GKI buffer
662  *
663  * Returns          AVRC_STS_NO_ERROR, if the command is built successfully
664  *                  Otherwise, the error code.
665  *
666  ******************************************************************************/
667 extern tAVRC_STS AVRC_BldCommand(tAVRC_COMMAND* p_cmd, BT_HDR** pp_pkt);
668 
669 /*******************************************************************************
670  *
671  * Function         AVRC_BldResponse
672  *
673  * Description      This function builds the given AVRCP response to the given
674  *                  GKI buffer
675  *
676  * Returns          AVRC_STS_NO_ERROR, if the response is built successfully
677  *                  Otherwise, the error code.
678  *
679  ******************************************************************************/
680 extern tAVRC_STS AVRC_BldResponse(uint8_t handle, tAVRC_RESPONSE* p_rsp,
681                                   BT_HDR** pp_pkt);
682 
683 /**************************************************************************
684  *
685  * Function         AVRC_IsValidAvcType
686  *
687  * Description      Check if correct AVC type is specified
688  *
689  * Returns          returns true if it is valid
690  *
691  *
692  ******************************************************************************/
693 extern bool AVRC_IsValidAvcType(uint8_t pdu_id, uint8_t avc_type);
694 
695 /*******************************************************************************
696  *
697  * Function         AVRC_IsValidPlayerAttr
698  *
699  * Description      Check if the given attrib value is a valid one
700  *
701  *
702  * Returns          returns true if it is valid
703  *
704  ******************************************************************************/
705 extern bool AVRC_IsValidPlayerAttr(uint8_t attr);
706 
707 #endif /* AVRC_API_H */
708