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