bta_av_api.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. /******************************************************************************
  2. *
  3. * Copyright 2004-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. * This is the public interface file for the advanced audio/video streaming
  21. * (AV) subsystem of BTA, Broadcom's Bluetooth application layer for mobile
  22. * phones.
  23. *
  24. ******************************************************************************/
  25. #ifndef BTA_AV_API_H
  26. #define BTA_AV_API_H
  27. #include "a2dp_codec_api.h"
  28. #include "avdt_api.h"
  29. #include "avrc_api.h"
  30. #include "bta_api.h"
  31. /*****************************************************************************
  32. * Constants and data types
  33. ****************************************************************************/
  34. /* Set to TRUE if seperate authorization prompt desired for AVCTP besides A2DP
  35. * authorization */
  36. /* Typically FALSE when AVRCP is used in conjunction with A2DP */
  37. #ifndef BTA_AV_WITH_AVCTP_AUTHORIZATION
  38. #define BTA_AV_WITH_AVCTP_AUTHORIZATION FALSE
  39. #endif
  40. /* AV status values */
  41. #define BTA_AV_SUCCESS 0 /* successful operation */
  42. #define BTA_AV_FAIL 1 /* generic failure */
  43. #define BTA_AV_FAIL_SDP 2 /* service not found */
  44. #define BTA_AV_FAIL_STREAM 3 /* stream connection failed */
  45. #define BTA_AV_FAIL_RESOURCES 4 /* no resources */
  46. #define BTA_AV_FAIL_ROLE 5 /* failed due to role management related issues */
  47. #define BTA_AV_FAIL_GET_CAP \
  48. 6 /* get capability failed due to no SEP availale on the peer */
  49. typedef uint8_t tBTA_AV_STATUS;
  50. /* AV features masks */
  51. #define BTA_AV_FEAT_RCTG 0x0001 /* remote control target */
  52. #define BTA_AV_FEAT_RCCT 0x0002 /* remote control controller */
  53. #define BTA_AV_FEAT_PROTECT 0x0004 /* streaming media contect protection */
  54. #define BTA_AV_FEAT_VENDOR \
  55. 0x0008 /* remote control vendor dependent commands \
  56. */
  57. #define BTA_AV_FEAT_REPORT 0x0020 /* use reporting service for VDP */
  58. #define BTA_AV_FEAT_METADATA \
  59. 0x0040 /* remote control Metadata Transfer command/response */
  60. #define BTA_AV_FEAT_MULTI_AV \
  61. 0x0080 /* use multi-av, if controller supports it */
  62. #define BTA_AV_FEAT_BROWSE 0x0010 /* use browsing channel */
  63. #define BTA_AV_FEAT_MASTER 0x0100 /* stream only as master role */
  64. #define BTA_AV_FEAT_ADV_CTRL \
  65. 0x0200 /* remote control Advanced Control command/response */
  66. #define BTA_AV_FEAT_DELAY_RPT 0x0400 /* allow delay reporting */
  67. #define BTA_AV_FEAT_ACP_START \
  68. 0x0800 /* start stream when 2nd SNK was accepted */
  69. #define BTA_AV_FEAT_APP_SETTING 0x2000 /* Player app setting support */
  70. /* Internal features */
  71. #define BTA_AV_FEAT_NO_SCO_SSPD \
  72. 0x8000 /* Do not suspend av streaming as to AG events(SCO or Call) */
  73. typedef uint16_t tBTA_AV_FEAT;
  74. /* AV channel values */
  75. #define BTA_AV_CHNL_MSK 0xC0
  76. #define BTA_AV_CHNL_AUDIO 0x40 /* audio channel */
  77. #define BTA_AV_CHNL_VIDEO 0x80 /* video channel */
  78. typedef uint8_t tBTA_AV_CHNL;
  79. #define BTA_AV_HNDL_MSK 0x3F
  80. typedef uint8_t tBTA_AV_HNDL;
  81. /* handle index to mask */
  82. #define BTA_AV_HNDL_TO_MSK(h) ((uint8_t)(1 << (h)))
  83. /* maximum number of streams created */
  84. #ifndef BTA_AV_NUM_STRS
  85. #define BTA_AV_NUM_STRS 6
  86. #endif
  87. /* operation id list for BTA_AvRemoteCmd */
  88. typedef uint8_t tBTA_AV_RC;
  89. /* state flag for pass through command */
  90. typedef uint8_t tBTA_AV_STATE;
  91. /* command codes for BTA_AvVendorCmd */
  92. typedef uint8_t tBTA_AV_CMD;
  93. /* response codes for BTA_AvVendorRsp */
  94. typedef uint8_t tBTA_AV_CODE;
  95. /* error codes for BTA_AvProtectRsp */
  96. typedef uint8_t tBTA_AV_ERR;
  97. /* AV callback events */
  98. #define BTA_AV_ENABLE_EVT 0 /* AV enabled */
  99. #define BTA_AV_REGISTER_EVT 1 /* registered to AVDT */
  100. #define BTA_AV_OPEN_EVT 2 /* connection opened */
  101. #define BTA_AV_CLOSE_EVT 3 /* connection closed */
  102. #define BTA_AV_START_EVT 4 /* stream data transfer started */
  103. #define BTA_AV_STOP_EVT 5 /* stream data transfer stopped */
  104. #define BTA_AV_PROTECT_REQ_EVT 6 /* content protection request */
  105. #define BTA_AV_PROTECT_RSP_EVT 7 /* content protection response */
  106. #define BTA_AV_RC_OPEN_EVT 8 /* remote control channel open */
  107. #define BTA_AV_RC_CLOSE_EVT 9 /* remote control channel closed */
  108. #define BTA_AV_REMOTE_CMD_EVT 10 /* remote control command */
  109. #define BTA_AV_REMOTE_RSP_EVT 11 /* remote control response */
  110. #define BTA_AV_VENDOR_CMD_EVT 12 /* vendor dependent remote control command */
  111. #define BTA_AV_VENDOR_RSP_EVT \
  112. 13 /* vendor dependent remote control response \
  113. */
  114. #define BTA_AV_RECONFIG_EVT 14 /* reconfigure response */
  115. #define BTA_AV_SUSPEND_EVT 15 /* suspend response */
  116. #define BTA_AV_PENDING_EVT \
  117. 16 /* incoming connection pending: \
  118. * signal channel is open and stream is \
  119. * not open after \
  120. * BTA_AV_SIGNALLING_TIMEOUT_MS */
  121. #define BTA_AV_META_MSG_EVT 17 /* metadata messages */
  122. #define BTA_AV_REJECT_EVT 18 /* incoming connection rejected */
  123. #define BTA_AV_RC_FEAT_EVT \
  124. 19 /* remote control channel peer supported features update */
  125. #define BTA_AV_SINK_MEDIA_CFG_EVT 20 /* command to configure codec */
  126. #define BTA_AV_SINK_MEDIA_DATA_EVT 21 /* sending data to Media Task */
  127. #define BTA_AV_OFFLOAD_START_RSP_EVT 22 /* a2dp offload start response */
  128. #define BTA_AV_RC_BROWSE_OPEN_EVT 23 /* remote control channel open */
  129. #define BTA_AV_RC_BROWSE_CLOSE_EVT 24 /* remote control channel closed */
  130. /* Max BTA event */
  131. #define BTA_AV_MAX_EVT 25
  132. typedef uint8_t tBTA_AV_EVT;
  133. typedef enum {
  134. BTA_AV_CODEC_TYPE_UNKNOWN = 0x00,
  135. BTA_AV_CODEC_TYPE_SBC = 0x01,
  136. BTA_AV_CODEC_TYPE_AAC = 0x02,
  137. BTA_AV_CODEC_TYPE_APTX = 0x04,
  138. BTA_AV_CODEC_TYPE_APTXHD = 0x08,
  139. BTA_AV_CODEC_TYPE_LDAC = 0x10
  140. } tBTA_AV_CODEC_TYPE;
  141. /* Event associated with BTA_AV_ENABLE_EVT */
  142. typedef struct { tBTA_AV_FEAT features; } tBTA_AV_ENABLE;
  143. /* Event associated with BTA_AV_REGISTER_EVT */
  144. typedef struct {
  145. tBTA_AV_CHNL chnl; /* audio/video */
  146. tBTA_AV_HNDL hndl; /* Handle associated with the stream. */
  147. uint8_t app_id; /* ID associated with call to BTA_AvRegister() */
  148. tBTA_AV_STATUS status;
  149. } tBTA_AV_REGISTER;
  150. /* data associated with BTA_AV_OPEN_EVT */
  151. #define BTA_AV_EDR_2MBPS 0x01
  152. #define BTA_AV_EDR_3MBPS 0x02
  153. typedef uint8_t tBTA_AV_EDR;
  154. typedef struct {
  155. tBTA_AV_CHNL chnl;
  156. tBTA_AV_HNDL hndl;
  157. RawAddress bd_addr;
  158. tBTA_AV_STATUS status;
  159. bool starting;
  160. tBTA_AV_EDR edr; /* 0, if peer device does not support EDR */
  161. uint8_t sep; /* sep type of peer device */
  162. } tBTA_AV_OPEN;
  163. /* data associated with BTA_AV_CLOSE_EVT */
  164. typedef struct {
  165. tBTA_AV_CHNL chnl;
  166. tBTA_AV_HNDL hndl;
  167. } tBTA_AV_CLOSE;
  168. /* data associated with BTA_AV_START_EVT */
  169. typedef struct {
  170. tBTA_AV_CHNL chnl;
  171. tBTA_AV_HNDL hndl;
  172. tBTA_AV_STATUS status;
  173. bool initiator; /* true, if local device initiates the START */
  174. bool suspending;
  175. } tBTA_AV_START;
  176. /* data associated with BTA_AV_SUSPEND_EVT, BTA_AV_STOP_EVT */
  177. typedef struct {
  178. tBTA_AV_CHNL chnl;
  179. tBTA_AV_HNDL hndl;
  180. bool initiator; /* true, if local device initiates the SUSPEND */
  181. tBTA_AV_STATUS status;
  182. } tBTA_AV_SUSPEND;
  183. /* data associated with BTA_AV_RECONFIG_EVT */
  184. typedef struct {
  185. tBTA_AV_CHNL chnl;
  186. tBTA_AV_HNDL hndl;
  187. tBTA_AV_STATUS status;
  188. } tBTA_AV_RECONFIG;
  189. /* data associated with BTA_AV_PROTECT_REQ_EVT */
  190. typedef struct {
  191. tBTA_AV_CHNL chnl;
  192. tBTA_AV_HNDL hndl;
  193. uint8_t* p_data;
  194. uint16_t len;
  195. } tBTA_AV_PROTECT_REQ;
  196. /* data associated with BTA_AV_PROTECT_RSP_EVT */
  197. typedef struct {
  198. tBTA_AV_CHNL chnl;
  199. tBTA_AV_HNDL hndl;
  200. uint8_t* p_data;
  201. uint16_t len;
  202. tBTA_AV_ERR err_code;
  203. } tBTA_AV_PROTECT_RSP;
  204. /* data associated with BTA_AV_RC_OPEN_EVT */
  205. typedef struct {
  206. uint8_t rc_handle;
  207. tBTA_AV_FEAT peer_features;
  208. RawAddress peer_addr;
  209. tBTA_AV_STATUS status;
  210. } tBTA_AV_RC_OPEN;
  211. /* data associated with BTA_AV_RC_CLOSE_EVT */
  212. typedef struct {
  213. uint8_t rc_handle;
  214. RawAddress peer_addr;
  215. } tBTA_AV_RC_CLOSE;
  216. /* data associated with BTA_AV_RC_BROWSE_OPEN_EVT */
  217. typedef struct {
  218. uint8_t rc_handle;
  219. RawAddress peer_addr;
  220. tBTA_AV_STATUS status;
  221. } tBTA_AV_RC_BROWSE_OPEN;
  222. /* data associated with BTA_AV_RC_BROWSE_CLOSE_EVT */
  223. typedef struct {
  224. uint8_t rc_handle;
  225. RawAddress peer_addr;
  226. } tBTA_AV_RC_BROWSE_CLOSE;
  227. /* data associated with BTA_AV_RC_FEAT_EVT */
  228. typedef struct {
  229. uint8_t rc_handle;
  230. tBTA_AV_FEAT peer_features;
  231. RawAddress peer_addr;
  232. } tBTA_AV_RC_FEAT;
  233. /* data associated with BTA_AV_REMOTE_CMD_EVT */
  234. typedef struct {
  235. uint8_t rc_handle;
  236. tBTA_AV_RC rc_id;
  237. tBTA_AV_STATE key_state;
  238. uint8_t len;
  239. uint8_t* p_data;
  240. tAVRC_HDR hdr; /* Message header. */
  241. uint8_t label;
  242. } tBTA_AV_REMOTE_CMD;
  243. /* data associated with BTA_AV_REMOTE_RSP_EVT */
  244. typedef struct {
  245. uint8_t rc_handle;
  246. tBTA_AV_RC rc_id;
  247. tBTA_AV_STATE key_state;
  248. uint8_t len;
  249. uint8_t* p_data;
  250. tBTA_AV_CODE rsp_code;
  251. uint8_t label;
  252. } tBTA_AV_REMOTE_RSP;
  253. /* data associated with BTA_AV_VENDOR_CMD_EVT, BTA_AV_VENDOR_RSP_EVT */
  254. typedef struct {
  255. uint8_t rc_handle;
  256. uint16_t len; /* Max vendor dependent message is 512 */
  257. uint8_t label;
  258. tBTA_AV_CODE code;
  259. uint32_t company_id;
  260. uint8_t* p_data;
  261. } tBTA_AV_VENDOR;
  262. /* data associated with BTA_AV_META_MSG_EVT */
  263. typedef struct {
  264. uint8_t rc_handle;
  265. uint16_t len;
  266. uint8_t label;
  267. tBTA_AV_CODE code;
  268. uint32_t company_id;
  269. uint8_t* p_data;
  270. tAVRC_MSG* p_msg;
  271. } tBTA_AV_META_MSG;
  272. /* data associated with BTA_AV_PENDING_EVT */
  273. typedef struct { RawAddress bd_addr; } tBTA_AV_PEND;
  274. /* data associated with BTA_AV_REJECT_EVT */
  275. typedef struct {
  276. RawAddress bd_addr;
  277. tBTA_AV_HNDL hndl; /* Handle associated with the stream that rejected the
  278. connection. */
  279. } tBTA_AV_REJECT;
  280. /* union of data associated with AV callback */
  281. typedef union {
  282. tBTA_AV_CHNL chnl;
  283. tBTA_AV_ENABLE enable;
  284. tBTA_AV_REGISTER registr;
  285. tBTA_AV_OPEN open;
  286. tBTA_AV_CLOSE close;
  287. tBTA_AV_START start;
  288. tBTA_AV_PROTECT_REQ protect_req;
  289. tBTA_AV_PROTECT_RSP protect_rsp;
  290. tBTA_AV_RC_OPEN rc_open;
  291. tBTA_AV_RC_CLOSE rc_close;
  292. tBTA_AV_RC_BROWSE_OPEN rc_browse_open;
  293. tBTA_AV_RC_BROWSE_CLOSE rc_browse_close;
  294. tBTA_AV_REMOTE_CMD remote_cmd;
  295. tBTA_AV_REMOTE_RSP remote_rsp;
  296. tBTA_AV_VENDOR vendor_cmd;
  297. tBTA_AV_VENDOR vendor_rsp;
  298. tBTA_AV_RECONFIG reconfig;
  299. tBTA_AV_SUSPEND suspend;
  300. tBTA_AV_PEND pend;
  301. tBTA_AV_META_MSG meta_msg;
  302. tBTA_AV_REJECT reject;
  303. tBTA_AV_RC_FEAT rc_feat;
  304. tBTA_AV_STATUS status;
  305. } tBTA_AV;
  306. typedef struct {
  307. uint8_t* codec_info;
  308. RawAddress bd_addr;
  309. } tBTA_AVK_CONFIG;
  310. /* union of data associated with AV Media callback */
  311. typedef union {
  312. BT_HDR* p_data;
  313. tBTA_AVK_CONFIG avk_config;
  314. } tBTA_AV_MEDIA;
  315. #define BTA_GROUP_NAVI_MSG_OP_DATA_LEN 5
  316. /* AV callback */
  317. typedef void(tBTA_AV_CBACK)(tBTA_AV_EVT event, tBTA_AV* p_data);
  318. typedef void(tBTA_AV_SINK_DATA_CBACK)(tBTA_AV_EVT event, tBTA_AV_MEDIA* p_data);
  319. /* type for stream state machine action functions */
  320. struct tBTA_AV_SCB;
  321. union tBTA_AV_DATA;
  322. typedef void (*tBTA_AV_ACT)(tBTA_AV_SCB* p_cb, tBTA_AV_DATA* p_data);
  323. /* AV configuration structure */
  324. typedef struct {
  325. uint32_t company_id; /* AVRCP Company ID */
  326. uint16_t avrc_mtu; /* AVRCP MTU at L2CAP for control channel */
  327. uint16_t avrc_br_mtu; /* AVRCP MTU at L2CAP for browsing channel */
  328. uint16_t avrc_ct_cat; /* AVRCP controller categories */
  329. uint16_t avrc_tg_cat; /* AVRCP target categories */
  330. uint16_t sig_mtu; /* AVDTP signaling channel MTU at L2CAP */
  331. uint16_t audio_mtu; /* AVDTP audio transport channel MTU at L2CAP */
  332. const uint16_t*
  333. p_audio_flush_to; /* AVDTP audio transport channel flush timeout */
  334. uint16_t audio_mqs; /* AVDTP audio channel max data queue size */
  335. bool avrc_group; /* true, to accept AVRC 1.3 group nevigation command */
  336. uint8_t num_co_ids; /* company id count in p_meta_co_ids */
  337. uint8_t num_evt_ids; /* event id count in p_meta_evt_ids */
  338. tBTA_AV_CODE
  339. rc_pass_rsp; /* the default response code for pass through commands */
  340. const uint32_t*
  341. p_meta_co_ids; /* the metadata Get Capabilities response for company id */
  342. const uint8_t* p_meta_evt_ids; /* the the metadata Get Capabilities response
  343. for event id */
  344. const tBTA_AV_ACT* p_act_tbl; /* action function table for audio stream */
  345. char avrc_controller_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP controller
  346. name */
  347. char avrc_target_name[BTA_SERVICE_NAME_LEN]; /* Default AVRCP target name*/
  348. } tBTA_AV_CFG;
  349. /*****************************************************************************
  350. * External Function Declarations
  351. ****************************************************************************/
  352. /*******************************************************************************
  353. *
  354. * Function BTA_AvEnable
  355. *
  356. * Description Enable the advanced audio/video service. When the enable
  357. * operation is complete the callback function will be
  358. * called with a BTA_AV_ENABLE_EVT. This function must
  359. * be called before other function in the AV API are
  360. * called.
  361. *
  362. * Returns void
  363. *
  364. ******************************************************************************/
  365. void BTA_AvEnable(tBTA_SEC sec_mask, tBTA_AV_FEAT features,
  366. tBTA_AV_CBACK* p_cback);
  367. /*******************************************************************************
  368. *
  369. * Function BTA_AvDisable
  370. *
  371. * Description Disable the advanced audio/video service.
  372. *
  373. *
  374. * Returns void
  375. *
  376. ******************************************************************************/
  377. void BTA_AvDisable(void);
  378. /*******************************************************************************
  379. *
  380. * Function BTA_AvRegister
  381. *
  382. * Description Register the audio or video service to stack. When the
  383. * operation is complete the callback function will be
  384. * called with a BTA_AV_REGISTER_EVT. This function must
  385. * be called before AVDT stream is open.
  386. *
  387. *
  388. * Returns void
  389. *
  390. ******************************************************************************/
  391. void BTA_AvRegister(tBTA_AV_CHNL chnl, const char* p_service_name,
  392. uint8_t app_id, tBTA_AV_SINK_DATA_CBACK* p_sink_data_cback,
  393. uint16_t service_uuid);
  394. /*******************************************************************************
  395. *
  396. * Function BTA_AvDeregister
  397. *
  398. * Description Deregister the audio or video service
  399. *
  400. * Returns void
  401. *
  402. ******************************************************************************/
  403. void BTA_AvDeregister(tBTA_AV_HNDL hndl);
  404. /*******************************************************************************
  405. *
  406. * Function BTA_AvOpen
  407. *
  408. * Description Opens an advanced audio/video connection to a peer device.
  409. * When connection is open callback function is called
  410. * with a BTA_AV_OPEN_EVT.
  411. *
  412. * Returns void
  413. *
  414. ******************************************************************************/
  415. void BTA_AvOpen(const RawAddress& bd_addr, tBTA_AV_HNDL handle, bool use_rc,
  416. tBTA_SEC sec_mask, uint16_t uuid);
  417. /*******************************************************************************
  418. *
  419. * Function BTA_AvClose
  420. *
  421. * Description Close the current streams.
  422. *
  423. * Returns void
  424. *
  425. ******************************************************************************/
  426. void BTA_AvClose(tBTA_AV_HNDL handle);
  427. /*******************************************************************************
  428. *
  429. * Function BTA_AvDisconnect
  430. *
  431. * Description Close the connection to the address.
  432. *
  433. * Returns void
  434. *
  435. ******************************************************************************/
  436. void BTA_AvDisconnect(const RawAddress& bd_addr);
  437. /*******************************************************************************
  438. *
  439. * Function BTA_AvStart
  440. *
  441. * Description Start audio/video stream data transfer.
  442. *
  443. * Returns void
  444. *
  445. ******************************************************************************/
  446. void BTA_AvStart(tBTA_AV_HNDL handle);
  447. /*******************************************************************************
  448. *
  449. * Function BTA_AvStop
  450. *
  451. * Description Stop audio/video stream data transfer.
  452. * If suspend is true, this function sends AVDT suspend signal
  453. * to the connected peer(s).
  454. *
  455. * Returns void
  456. *
  457. ******************************************************************************/
  458. void BTA_AvStop(tBTA_AV_HNDL handle, bool suspend);
  459. /*******************************************************************************
  460. *
  461. * Function BTA_AvReconfig
  462. *
  463. * Description Reconfigure the audio/video stream.
  464. * If suspend is true, this function tries the
  465. * suspend/reconfigure procedure first.
  466. * If suspend is false or when suspend/reconfigure fails,
  467. * this function closes and re-opens the AVDT connection.
  468. *
  469. * Returns void
  470. *
  471. ******************************************************************************/
  472. void BTA_AvReconfig(tBTA_AV_HNDL hndl, bool suspend, uint8_t sep_info_idx,
  473. uint8_t* p_codec_info, uint8_t num_protect,
  474. const uint8_t* p_protect_info);
  475. /*******************************************************************************
  476. *
  477. * Function BTA_AvProtectReq
  478. *
  479. * Description Send a content protection request. This function can only
  480. * be used if AV is enabled with feature BTA_AV_FEAT_PROTECT.
  481. *
  482. * Returns void
  483. *
  484. ******************************************************************************/
  485. void BTA_AvProtectReq(tBTA_AV_HNDL hndl, uint8_t* p_data, uint16_t len);
  486. /*******************************************************************************
  487. *
  488. * Function BTA_AvProtectRsp
  489. *
  490. * Description Send a content protection response. This function must
  491. * be called if a BTA_AV_PROTECT_REQ_EVT is received.
  492. * This function can only be used if AV is enabled with
  493. * feature BTA_AV_FEAT_PROTECT.
  494. *
  495. * Returns void
  496. *
  497. ******************************************************************************/
  498. void BTA_AvProtectRsp(tBTA_AV_HNDL hndl, uint8_t error_code, uint8_t* p_data,
  499. uint16_t len);
  500. /*******************************************************************************
  501. *
  502. * Function BTA_AvRemoteCmd
  503. *
  504. * Description Send a remote control command. This function can only
  505. * be used if AV is enabled with feature BTA_AV_FEAT_RCCT.
  506. *
  507. * Returns void
  508. *
  509. ******************************************************************************/
  510. void BTA_AvRemoteCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_RC rc_id,
  511. tBTA_AV_STATE key_state);
  512. /*******************************************************************************
  513. *
  514. * Function BTA_AvRemoteVendorUniqueCmd
  515. *
  516. * Description Send a remote control command with Vendor Unique rc_id.
  517. * This function can only be used if AV is enabled with
  518. * feature BTA_AV_FEAT_RCCT.
  519. *
  520. * Returns void
  521. *
  522. ******************************************************************************/
  523. void BTA_AvRemoteVendorUniqueCmd(uint8_t rc_handle, uint8_t label,
  524. tBTA_AV_STATE key_state, uint8_t* p_msg,
  525. uint8_t buf_len);
  526. /*******************************************************************************
  527. *
  528. * Function BTA_AvVendorCmd
  529. *
  530. * Description Send a vendor dependent remote control command. This
  531. * function can only be used if AV is enabled with feature
  532. * BTA_AV_FEAT_VENDOR.
  533. *
  534. * Returns void
  535. *
  536. ******************************************************************************/
  537. void BTA_AvVendorCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE cmd_code,
  538. uint8_t* p_data, uint16_t len);
  539. /*******************************************************************************
  540. *
  541. * Function BTA_AvVendorRsp
  542. *
  543. * Description Send a vendor dependent remote control response.
  544. * This function must be called if a BTA_AV_VENDOR_CMD_EVT
  545. * is received. This function can only be used if AV is
  546. * enabled with feature BTA_AV_FEAT_VENDOR.
  547. *
  548. * Returns void
  549. *
  550. ******************************************************************************/
  551. void BTA_AvVendorRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code,
  552. uint8_t* p_data, uint16_t len, uint32_t company_id);
  553. /*******************************************************************************
  554. *
  555. * Function BTA_AvOpenRc
  556. *
  557. * Description Open an AVRCP connection toward the device with the
  558. * specified handle
  559. *
  560. * Returns void
  561. *
  562. ******************************************************************************/
  563. void BTA_AvOpenRc(tBTA_AV_HNDL handle);
  564. /*******************************************************************************
  565. *
  566. * Function BTA_AvCloseRc
  567. *
  568. * Description Close an AVRCP connection
  569. *
  570. * Returns void
  571. *
  572. ******************************************************************************/
  573. void BTA_AvCloseRc(uint8_t rc_handle);
  574. /*******************************************************************************
  575. *
  576. * Function BTA_AvMetaRsp
  577. *
  578. * Description Send a Metadata command/response. The message contained
  579. * in p_pkt can be composed with AVRC utility functions.
  580. * This function can only be used if AV is enabled with feature
  581. * BTA_AV_FEAT_METADATA.
  582. *
  583. * Returns void
  584. *
  585. ******************************************************************************/
  586. void BTA_AvMetaRsp(uint8_t rc_handle, uint8_t label, tBTA_AV_CODE rsp_code,
  587. BT_HDR* p_pkt);
  588. /*******************************************************************************
  589. *
  590. * Function BTA_AvMetaCmd
  591. *
  592. * Description Send a Metadata/Advanced Control command. The message
  593. *contained
  594. * in p_pkt can be composed with AVRC utility functions.
  595. * This function can only be used if AV is enabled with feature
  596. * BTA_AV_FEAT_METADATA.
  597. * This message is sent only when the peer supports the TG
  598. *role.
  599. *8 The only command makes sense right now is the absolute
  600. *volume command.
  601. *
  602. * Returns void
  603. *
  604. ******************************************************************************/
  605. void BTA_AvMetaCmd(uint8_t rc_handle, uint8_t label, tBTA_AV_CMD cmd_code,
  606. BT_HDR* p_pkt);
  607. /*******************************************************************************
  608. *
  609. * Function BTA_AvOffloadStart
  610. *
  611. * Description Request Starting of A2DP Offload.
  612. * This function is used to start A2DP offload if vendor lib
  613. * has the feature enabled.
  614. *
  615. * Returns void
  616. *
  617. ******************************************************************************/
  618. void BTA_AvOffloadStart(tBTA_AV_HNDL hndl);
  619. /*******************************************************************************
  620. *
  621. * Function BTA_AvOffloadStartRsp
  622. *
  623. * Description Response from vendor library indicating response for
  624. * OffloadStart.
  625. *
  626. * Returns void
  627. *
  628. ******************************************************************************/
  629. void BTA_AvOffloadStartRsp(tBTA_AV_HNDL hndl, tBTA_AV_STATUS status);
  630. /**
  631. * Obtain the Channel Index for a peer.
  632. * If the peer already has associated internal state, the corresponding
  633. * Channel Index for that state is returned. Otherwise, the Channel Index
  634. * for unused internal state is returned instead.
  635. *
  636. * @param peer_address the peer address
  637. * @return the peer Channel Index index if obtained, otherwise -1
  638. */
  639. int BTA_AvObtainPeerChannelIndex(const RawAddress& peer_address);
  640. /**
  641. * Dump debug-related information for the BTA AV module.
  642. *
  643. * @param fd the file descriptor to use for writing the ASCII formatted
  644. * information
  645. */
  646. void bta_debug_av_dump(int fd);
  647. #endif /* BTA_AV_API_H */