1 /* 2 * Copyright (C) 2015-2020 Alibaba Group Holding Limited 3 */ 4 #ifndef _A2DP_API_H 5 #define _A2DP_API_H 6 #include "bluetooth.h" 7 #include "avrcp_api.h" 8 9 #include "avdtp_api.h" 10 #include "conmgr_api.h" 11 #include "codec_sbc.h" 12 13 typedef enum{ 14 BTIF_DEVICE_ID_1 = 0, 15 #ifdef __BT_ONE_BRING_TWO__ 16 BTIF_DEVICE_ID_2, 17 #endif 18 BTIF_DEVICE_NUM 19 }btif_dev_it_e; 20 21 typedef void a2dp_stream_t; 22 typedef void a2dp_callback_parms_t; 23 24 typedef uint8_t btif_a2dp_event_t; 25 26 #define A2DP_AAC_OCTET_NUMBER (6) 27 #define A2DP_AAC_OCTET0_MPEG2_AAC_LC 0x80 28 #define A2DP_AAC_OCTET1_SAMPLING_FREQUENCY_44100 0x01 29 #define A2DP_AAC_OCTET2_CHANNELS_1 0x08 30 #define A2DP_AAC_OCTET2_CHANNELS_2 0x04 31 #define A2DP_AAC_OCTET2_SAMPLING_FREQUENCY_48000 0x80 32 #define A2DP_AAC_OCTET3_VBR_SUPPORTED 0x80 33 /** Accept or reject by calling btif_a2dp_open_stream_rsp(). 34 */ 35 #define BTIF_A2DP_EVENT_STREAM_OPEN_IND 1 36 37 /** This event is the response to a call from btif_a2dp_open_stream() or 38 * btif_a2dp_open_stream_rsp(). 39 */ 40 #define BTIF_A2DP_EVENT_STREAM_OPEN 2 41 42 /** This event is received during the establishment of an 43 * outgoing stream (btif_a2dp_open_stream()) to indicate the capabilities of the 44 * remote device. This event may also be received after calling 45 * btif_a2dp_get_stream_capabilities(). 46 */ 47 #define BTIF_A2DP_EVENT_CODEC_INFO 3 48 49 /** This event is received during the establishment of an 50 * outgoing stream (btif_a2dp_open_stream()) to indicated the capabilities of the 51 * remote device. This event may also be received after calling 52 * btif_a2dp_get_stream_capabilities(). 53 * 54 */ 55 #define BTIF_A2DP_EVENT_CP_INFO 4 56 57 /** If this event is received, then the remote device 58 * supports the Delay Reporting feature. 59 */ 60 #define BTIF_A2DP_EVENT_DELAY_REPORTING_INFO 5 61 62 /** This event is received when a stream is opening and 63 * all matching capabilities have been found. The application must call 64 * btif_a2dp_set_stream_config() to configure the stream. If successful, the 65 * stream will be opened. btif_a2dp_close_stream() can also be called to close 66 * the stream. This event is only received on outgoing connections. 67 */ 68 #define BTIF_A2DP_EVENT_GET_CONFIG_IND 6 69 70 /** This event is received after calling btif_a2dp_get_stream_capabilities(). This 71 * event is received after all the capabilities of the remote device have 72 * been indicated (see BTIF_A2DP_EVENT_CODEC_INFO and BTIF_A2DP_EVENT_CP_INFO). 73 */ 74 #define BTIF_A2DP_EVENT_GET_CAP_CNF 7 75 76 /** This event is received when an open stream has been 77 * closed. This can happen as a result of a call to btif_a2dp_close_stream(), if 78 * the stream has been closed by the remote device, if a link loss has been 79 * detected, or if the remote device rejects a request to open the stream. 80 * 81 */ 82 #define BTIF_A2DP_EVENT_STREAM_CLOSED 8 83 84 /** This event is received when an open stream has been 85 * set to the idle state. result of a call to btif_a2dp_idle_stream(). 86 */ 87 #define BTIF_A2DP_EVENT_STREAM_IDLE 9 88 89 /** When the remote device requests streaming to begin, this event will be 90 * received . The application can accept or reject 91 * this request by calling btif_a2dp_start_stream_rsp(). (Note: this event 92 * will be received only after BTIF_A2DP_EVENT_STREAM_OPEN_IND but it may arrive 93 * before BTIF_A2DP_EVENT_STREAM_OPEN.) 94 */ 95 #define BTIF_A2DP_EVENT_STREAM_START_IND 10 96 97 /** When streaming has been started, this event will be received. This can happen as the result to a call to 98 * btif_a2dp_start_stream() or btif_a2dp_start_stream_rsp(). 99 */ 100 #define BTIF_A2DP_EVENT_STREAM_STARTED 11 101 102 /** When streaming has been suspended, this event will be received . as the result to a call to 103 * btif_a2dp_suspend_stream(), or when the remote device suspends the stream. 104 */ 105 #define BTIF_A2DP_EVENT_STREAM_SUSPENDED 12 106 107 /** When the remote device wishes to reconfigure an open stream, this event 108 * is received by the application. The application can accept or reject 109 * the request by calling btif_a2dp_reconfig_stream_rsp(). 110 * 111 */ 112 #define BTIF_A2DP_EVENT_STREAM_RECONFIG_IND 13 113 114 /** When an open stream is reconfigured, this event is received by the 115 * application. 116 * 117 */ 118 #define BTIF_A2DP_EVENT_STREAM_RECONFIG_CNF 14 119 120 /** This event is received when the remote device requests the security 121 * process to begin. The application responds to this request by calling 122 * btif_a2dp_security_control_rsp(). 123 */ 124 #define BTIF_A2DP_EVENT_STREAM_SECURITY_IND 15 125 126 /** This event is received when the remote device responds 127 * to the security process request. 128 */ 129 #define BTIF_A2DP_EVENT_STREAM_SECURITY_CNF 16 130 131 /** When the stream is aborted, this event is received by the application. 132 * This can happen in response to a request from the remote device to abort 133 * the stream, or as the result of a call to btif_a2dp_abort_stream(). When a 134 * stream is aborted, the stream is closed. 135 */ 136 #define BTIF_A2DP_EVENT_STREAM_ABORTED 17 137 138 /** This event is received when stream data has been received from the remote 139 * device. The data is raw and is not parsed by A2DP. It should contain 140 * a single media packet. 141 */ 142 #define BTIF_A2DP_EVENT_STREAM_DATA_IND 18 143 144 /** This event is received when raw data has been sent to the remote device. 145 * This happens as the result of a call to btif_a2dp_stream_send_raw_packet(). 146 * 147 */ 148 #define BTIF_A2DP_EVENT_STREAM_PACKET_SENT 19 149 150 /** This event is received when SBC data has been sent to the remote device. 151 * This happens as the result of a call to btif_a2dp_stream_send_sbc_packet(). 152 */ 153 #define BTIF_A2DP_EVENT_STREAM_SBC_PACKET_SENT 20 154 155 /** This event is received by a Source when the Sink reports the value of its 156 * buffer/processing delay. This may happen when the stream is configured 157 * (or reconfigured), and when the stream is in the streaming state. 158 * 159 */ 160 #define BTIF_A2DP_EVENT_DELAY_REPORT_IND 21 161 162 /** This event is received by a Sink when the Source acknowldeges the 163 * transmitted buffer/processing delay. 164 */ 165 #define BTIF_A2DP_EVENT_DELAY_REPORT_CNF 22 166 167 /** When the the lower level AVDTP connection is established between the 168 * local and remote devices, this event will be generated. 169 * 170 * During this callback, the 'p.device' parameter contains a pointer to the 171 * device that was connected. 172 */ 173 #define BTIF_A2DP_EVENT_AVDTP_CONNECT 23 174 175 /** When the the lower level AVDTP connection is disconnected, this event 176 * will be generated. 177 * 178 */ 179 #define BTIF_A2DP_EVENT_AVDTP_DISCONNECT 24 180 181 #if BTIF_AV_WORKER 182 /* Confirms has received configuration information after an 183 * btif_avdtp_get_config() request. 184 */ 185 #define BTIF_A2DP_AVDTP_EVENT_GET_CFG_CNF 27 186 187 /* Confirms has sent configuration information after an 188 * btif_avdtp_open_stream() request. 189 */ 190 #define BTIF_A2DP_AVDTP_EVENT_SET_CFG_CNF 28 191 192 #endif 193 194 #define BTIF_A2DP_EVENT_STREAM_STARTED_MOCK 29 195 196 //user define @biao 197 #define BTIF_A2DP_EVENT_AVDTP_CLOSE_IND 81 198 #define BTIF_A2DP_EVENT_AVDTP_DISCOVER_IND 82 199 #define BTIF_A2DP_EVENT_AVDTP_DISCOVER_RSP 83 200 //#define AVDTP_EVENT_STREAM_CLOSE_IND 201 202 /* event that let app level to see a stream is good to select */ 203 #define BTIF_A2DP_EVENT_STREAM_SELECT 84 204 /* event that let app level to confirm stream(sep) state */ 205 #define BTIF_A2DP_EVENT_STREAM_STATE_CFM 85 206 207 typedef uint8_t btif_a2dp_error_t; 208 209 #define BTIF_A2DP_ERR_NO_ERROR 0x00 210 211 #define BTIF_A2DP_ERR_BAD_SERVICE 0x80 212 213 #define BTIF_A2DP_ERR_INSUFFICIENT_RESOURCE 0x81 214 215 #define BTIF_A2DP_ERR_INVALID_CODEC_TYPE 0xC1 216 217 #define BTIF_A2DP_ERR_NOT_SUPPORTED_CODEC_TYPE AVDTP_ERR_NOT_SUPPORTED_CODEC_TYPE 218 219 #define BTIF_A2DP_ERR_INVALID_SAMPLING_FREQUENCY 0xC3 220 221 #define BTIF_A2DP_ERR_NOT_SUPPORTED_SAMP_FREQ 0xC4 222 223 /** Channel mode not valid 224 * 225 * SBC 226 * MPEG-1,2 Audio 227 * ATRAC family 228 */ 229 #define BTIF_A2DP_ERR_INVALID_CHANNEL_MODE 0xC5 230 231 #define BTIF_A2DP_ERR_NOT_SUPPORTED_CHANNEL_MODE 0xC6 232 233 #define BTIF_A2DP_ERR_INVALID_SUBBANDS 0xC7 234 235 #define BTIF_A2DP_ERR_NOT_SUPPORTED_SUBBANDS 0xC8 236 237 #define BTIF_A2DP_ERR_INVALID_ALLOCATION_METHOD 0xC9 238 239 #define BTIF_A2DP_ERR_NOT_SUPPORTED_ALLOC_METHOD 0xCA 240 241 #define BTIF_A2DP_ERR_INVALID_MIN_BITPOOL_VALUE 0xCB 242 243 #define BTIF_A2DP_ERR_NOT_SUPPORTED_MIN_BITPOOL_VALUE 0xCC 244 245 #define BTIF_A2DP_ERR_INVALID_MAX_BITPOOL_VALUE 0xCD 246 247 #define BTIF_A2DP_ERR_NOT_SUPPORTED_MAX_BITPOOL_VALUE 0xCE 248 249 #define BTIF_A2DP_ERR_INVALID_LAYER 0xCF 250 251 #define BTIF_A2DP_ERR_NOT_SUPPORTED_LAYER 0xD0 252 253 #define BTIF_A2DP_ERR_NOT_SUPPORTED_CRC 0xD1 254 255 #define BTIF_A2DP_ERR_NOT_SUPPORTED_MPF 0xD2 256 257 #define BTIF_A2DP_ERR_NOT_SUPPORTED_VBR 0xD3 258 259 #define BTIF_A2DP_ERR_INVALID_BIT_RATE 0xD4 260 261 #define BTIF_A2DP_ERR_NOT_SUPPORTED_BIT_RATE 0xD5 262 263 #define BTIF_A2DP_ERR_INVALID_OBJECT_TYPE 0xD6 264 265 #define BTIF_A2DP_ERR_NOT_SUPPORTED_OBJECT_TYPE 0xD7 266 267 #define BTIF_A2DP_ERR_INVALID_CHANNELS 0xD8 268 269 #define BTIF_A2DP_ERR_NOT_SUPPORTED_CHANNELS 0xD9 270 271 #define A2DP_SCALABLE_OCTET_NUMBER (7) 272 273 #define BTIF_A2DP_ERR_INVALID_VERSION 0xDA 274 275 #define BTIF_A2DP_ERR_NOT_SUPPORTED_VERSION 0xDB 276 277 #define BTIF_A2DP_ERR_NOT_SUPPORTED_MAXIMUM_SUL 0xDC 278 279 #define BTIF_A2DP_ERR_INVALID_BLOCK_LENGTH 0xDD 280 281 #define BTIF_A2DP_ERR_INVALID_CP_TYPE 0xE0 282 283 #define BTIF_A2DP_ERR_INVALID_CP_FORMAT 0xE1 284 285 #define BTIF_A2DP_ERR_UNKNOWN_ERROR AVDTP_ERR_UNKNOWN_ERROR 286 287 typedef U16 btif_a22dp_version_t; 288 289 typedef U16 btif_a2dp_features_t; 290 291 /* Audio Player */ 292 #define BTIF_A2DP_SRC_FEATURE_PLAYER 0x01 293 294 /* Microphone */ 295 #define BTIF_A2DP_SRC_FEATURE_MIC 0x02 296 297 /* Tuner */ 298 #define BTIF_A2DP_SRC_FEATURE_TUNER 0x04 299 300 /* Mixer */ 301 #define BTIF_A2DP_SRC_FEATURE_MIXER 0x08 302 303 /* Headphones */ 304 #define BTIF_A2DP_SNK_FEATURE_HEADPHONE 0x01 305 306 /* Loudspeaker */ 307 #define BTIF_A2DP_SNK_FEATURE_SPEAKER 0x02 308 309 /* Audio Recorder */ 310 #define BTIF_A2DP_SNK_FEATURE_RECORDER 0x04 311 312 /* Amplifier */ 313 #define BTIF_A2DP_SNK_FEATURE_AMP 0x08 314 315 typedef U8 btif_a2dp_endpoint_type_t; 316 317 /* The stream is a source */ 318 #define BTIF_A2DP_STREAM_TYPE_SOURCE 0 319 320 /* The stream is a sink */ 321 #define BTIF_A2DP_STREAM_TYPE_SINK 1 322 323 typedef uint8_t btif_a2dp_stream_state_t; 324 325 /* The stream is closed */ 326 #define BTIF_A2DP_STREAM_STATE_CLOSED 0 327 328 /* The stream is idle */ 329 #define BTIF_A2DP_STREAM_STATE_IDLE 1 330 331 /* The stream is open */ 332 #define BTIF_A2DP_STREAM_STATE_OPEN 2 333 334 /* The stream is streaming */ 335 #define BTIF_A2DP_STREAM_STATE_STREAMING 3 336 337 /* Unknown state */ 338 #define BTIF_A2DP_STREAM_STATE_UNKNOWN 0xFF 339 340 typedef void (*btif_a2dp_callback) (a2dp_stream_t * Stream, const a2dp_callback_parms_t * Info); 341 342 343 typedef void btif_av_device_t; 344 345 struct btif_get_codec_cap_t 346 { 347 uint8_t ** cap; 348 uint16_t * cap_len; 349 bool done; 350 }; 351 352 typedef struct { 353 btif_a2dp_event_t event; 354 uint16_t len; 355 I8 status; 356 btif_a2dp_error_t error; 357 btif_a2dp_error_t discReason; 358 union { 359 btif_avdtp_content_prot_t *cp; 360 btif_avdtp_codec_t *codec; 361 btif_avdtp_capability_t *capability; 362 btif_avdtp_config_request_t *configReq; /* AVDTP Config request */ 363 btif_bt_packet_t *btPacket; /* Raw Transmit packet */ 364 btif_a2dp_sbc_packet_t *sbcPacket; /* SBC Transmit packet */ 365 uint8_t *data; /* Receive data */ 366 uint16_t delayMs; /* Buffering/processing delay of 367 * the Sink. 368 */ 369 btif_avdtp_stream_info_t *streamInfo; /* Stream information */ 370 btif_av_device_t *device; /* The connecting or disconnectin device. */ 371 struct btif_get_codec_cap_t *get_cap; 372 373 a2dp_stream_t *dstStream; /* Stream to switch */ 374 } p; 375 btif_remote_device_t *remDev; 376 } btif_a2dp_callback_parms_t; 377 378 typedef struct { 379 list_entry_t node; /* Used internally by A2DP. */ 380 btif_avdtp_stream_info_t info; /* Stream information */ 381 } btif_a2dp_streamInfo_t; 382 383 typedef struct { 384 #if defined(__TWS__) 385 btif_avdtp_codec_t setconfig_codec; 386 #endif /* */ 387 bool free; 388 uint8_t state; 389 a2dp_stream_t *a2dp_stream; //stack A2dpStream object 390 } btif_a2dp_stream_t; 391 392 393 394 #ifdef __cplusplus 395 extern "C" { 396 #endif 397 398 void btif_a2dp_init(void); 399 400 int a2dp_hid_init(void); 401 402 btif_a2dp_stream_t *btif_a2dp_alloc_stream(void); 403 404 uint16_t btif_avdtp_parse_mediaHeader(btif_media_header_t * header, 405 btif_a2dp_callback_parms_t * Info, uint8_t avdtp_cp); 406 407 void btif_app_a2dp_avrcpadvancedpdu_mempool_init(); 408 409 void btif_app_a2dp_avrcpadvancedpdu_mempool_calloc(void **buf); 410 411 void btif_app_a2dp_avrcpadvancedpdu_mempool_free(void *buf); 412 413 void a2dp_set_config_codec(btif_avdtp_codec_t * config_codec, 414 const btif_a2dp_callback_parms_t * Info); 415 416 btif_avdtp_codec_type_t btif_a2dp_get_stream_register_codec_type(a2dp_stream_t *stream); 417 418 bt_status_t btif_a2dp_register(a2dp_stream_t *Stream, 419 btif_a2dp_endpoint_type_t stream_type, 420 btif_avdtp_codec_t *Codec, 421 btif_avdtp_content_prot_t *Prot, 422 uint8_t Priority, 423 uint8_t Device_id, 424 btif_a2dp_callback Callback); 425 426 bt_status_t btif_a2dp_add_content_protection(a2dp_stream_t *Stream, btif_avdtp_content_prot_t *Prot); 427 428 bt_status_t btif_a2dp_deregister(a2dp_stream_t * Stream); 429 430 int8_t btif_a2dp_is_register_codec_same(a2dp_stream_t *src_stream, a2dp_stream_t *dst_stream); 431 432 void btif_a2dp_lhdc_config_tws_audio(const a2dp_callback_parms_t * info); 433 434 void btif_a2dp_aac_config_tws_audio(const a2dp_callback_parms_t * info); 435 436 void btif_a2dp_sbc_config_tws_audio(const a2dp_callback_parms_t * info); 437 438 void btif_a2dp_tws_set_mobile_codec_info(const a2dp_callback_parms_t * info); 439 440 btif_remote_device_t *btif_a2dp_get_remote_device(a2dp_stream_t * stream); 441 442 uint8_t *btif_a2dp_get_stream_devic_cmgrHandler_remdev_bdAddr(a2dp_stream_t * Stream); 443 444 void *btif_a2dp_get_stream_device(a2dp_stream_t * Stream); 445 446 void *btif_a2dp_get_stream_devic_cmgrHandler_bt_handler(a2dp_stream_t * Stream); 447 448 void *btif_a2dp_get_stream_devic_cmgrHandler_remdev(a2dp_stream_t * Stream); 449 450 uint8_t btif_a2dp_get_stream_devic_cmgrHandler_remdev_role(a2dp_stream_t * Stream); 451 452 btif_cmgr_handler_t *btif_a2dp_get_stream_devic_cmgrHandler(a2dp_stream_t * Stream); 453 454 void btif_me_set_sniffer_env(uint8_t sniffer_acitve, uint8_t sniffer_role, 455 uint8_t * monitored_addr, uint8_t * sniffer_addr); 456 457 uint16_t btif_me_get_remote_device_hci_handle(btif_remote_device_t * rdev); 458 459 bt_bdaddr_t *btif_a2dp_stream_conn_remDev_bdAddr(a2dp_stream_t * Stream); 460 461 uint8_t *btif_a2dp_get_remote_device_version(btif_remote_device_t * remDev); 462 463 btif_a2dp_event_t btif_a2dp_get_cb_event(a2dp_callback_parms_t * info); 464 465 bt_status_t btif_a2dp_set_sink_delay(a2dp_stream_t * Stream, U16 delayMs); 466 467 bt_status_t btif_a2dp_set_stream_config(a2dp_stream_t * Stream, 468 btif_avdtp_codec_t * Codec, 469 btif_avdtp_content_prot_t * Cp); 470 471 bt_status_t btif_a2dp_open_stream(a2dp_stream_t * Stream, bt_bdaddr_t * Addr); 472 473 bt_status_t btif_a2dp_disc_stream(a2dp_stream_t * Stream); 474 475 bt_status_t btif_a2dp_start_stream(a2dp_stream_t * Stream); 476 477 bt_status_t btif_a2dp_idle_stream(a2dp_stream_t * Stream); 478 479 bt_status_t btif_a2dp_suspend_stream(a2dp_stream_t * Stream); 480 481 bt_status_t btif_a2dp_start_stream_rsp(a2dp_stream_t * Stream, btif_a2dp_error_t error); 482 483 bt_status_t btif_a2dp_close_stream(a2dp_stream_t * Stream); 484 485 bt_status_t btif_a2dp_reconfig_stream_rsp(a2dp_stream_t * Stream, 486 btif_a2dp_error_t Error, 487 btif_avdtp_capability_type_t Type); 488 489 bt_status_t btif_a2dp_reconfig_stream(a2dp_stream_t * Stream, 490 btif_avdtp_codec_t * codec_cfg, 491 btif_avdtp_content_prot_t * cp); 492 493 uint8_t btif_a2dp_security_control_req(a2dp_stream_t *stream, uint8_t *data, uint16_t len); 494 uint8_t btif_a2dp_security_control_rsp(a2dp_stream_t *stream,uint8_t* data,uint16_t len, uint8_t error); 495 496 bt_status_t btif_a2dp_open_stream_rsp(a2dp_stream_t * Stream, 497 btif_a2dp_error_t Error, 498 btif_avdtp_capability_type_t CapType); 499 500 bool btif_a2dp_stream_has_remote_device(btif_a2dp_stream_t * stream); 501 502 bt_bdaddr_t *btif_a2dp_stream_get_remote_bd_addr(btif_a2dp_stream_t * stream); 503 504 btif_a2dp_stream_t *btif_get_a2dp_stream(a2dp_stream_t * stream); 505 506 btif_a2dp_endpoint_type_t btif_a2dp_get_stream_type(a2dp_stream_t * Stream); 507 508 btif_avdtp_stream_state_t btif_a2dp_get_stream_state(a2dp_stream_t * Stream); 509 510 uint8_t btif_a2dp_get_stream_loc_strmId(a2dp_stream_t * Stream); 511 512 uint8_t btif_a2dp_get_stream_rem_strmId(a2dp_stream_t * Stream); 513 514 uint16_t btif_a2dp_get_stream_chnl_sigchnl_l2ChannelId(a2dp_stream_t * Stream); 515 516 void btif_a2dp_set_stream_state(a2dp_stream_t * Stream, btif_avdtp_stream_state_t state); 517 518 void btif_a2dp_set_stream_conn_l2ChannelId(a2dp_stream_t * Stream, uint16_t id); 519 520 void btif_a2dp_set_stream_chnl_conn_l2ChannelId(a2dp_stream_t * Stream, uint16_t id); 521 522 void btif_a2dp_set_stream_chnl_sigChnl_l2ChannelId(a2dp_stream_t * Stream, uint16_t id); 523 524 void btif_a2dp_set_stream_loc_streamId(a2dp_stream_t * Stream, uint8_t id); 525 526 void btif_a2dp_set_stream_remote_streamId(a2dp_stream_t * Stream, uint8_t id); 527 528 void btif_a2dp_discover(a2dp_stream_t* Stream); 529 530 BOOL btif_a2dp_is_stream_device_has_delay_reporting(a2dp_stream_t * Stream); 531 532 btif_avdtp_codec_t *btif_a2dp_get_stream_codec(a2dp_stream_t * Stream); 533 534 btif_avdtp_codec_t *btif_a2dp_get_stream_codecCfg(a2dp_stream_t * Stream); 535 536 uint16_t btif_a2dp_get_stream_conn_remDev_hciHandle(a2dp_stream_t * Stream); 537 538 uint16_t btif_a2dp_get_stream_device_cmgrhandler_remDev_hciHandle(a2dp_stream_t * Stream); 539 540 btif_avdtp_codec_t *btif_a2dp_get_avdtp_setconfig_codec(a2dp_stream_t * stream); 541 542 bt_status_t btif_a2dp_get_stream_capabilities(a2dp_stream_t * Stream); 543 544 bt_status_t btif_a2dp_stream_send_sbc_packet(a2dp_stream_t * stream, 545 btif_a2dp_sbc_packet_t * Packet, 546 btif_sbc_stream_info_short_t * StreamInfo); 547 548 void btif_a2dp_sync_avdtp_streaming_state(bt_bdaddr_t *addr); 549 550 void btif_app_a2dp_source_init(void); 551 552 uint8_t btif_a2dp_get_cb_error(const btif_a2dp_callback_parms_t * Info); 553 554 uint8_t btif_a2dp_set_dst_stream(a2dp_callback_parms_t *Info, a2dp_stream_t *stream); 555 556 btif_remote_device_t *btif_a2dp_get_stream_conn_remDev(a2dp_stream_t * stream); 557 558 uint8_t btif_a2dp_get_stream_codec_element(a2dp_stream_t * stream,uint8_t index); 559 560 bt_status_t btif_a2dp_set_master_role(a2dp_stream_t * Stream, BOOL Flag); 561 562 uint16_t btif_a2dp_get_stream_conn_l2ChannelId(a2dp_stream_t * Stream); 563 564 btif_media_header_t *btif_a2dp_get_stream_media_header(a2dp_stream_t * stream); 565 566 int tws_if_get_a2dpbuff_available(void); 567 568 int a2dp_codec_init(void); 569 void btif_a2dp_lock_same_deviceid_endpoint(a2dp_stream_t * Stream,btif_remote_device_t *remDev); 570 void btif_a2dp_unlock_same_deviceid_endpoint(a2dp_stream_t * Stream,btif_remote_device_t *remDev); 571 void btif_a2dp_unlock_the_connected_stream_byRemdev(btif_remote_device_t* RemDev); 572 573 uint8_t btif_a2dp_trylock_the_other_id_by_configedid(btif_remote_device_t* RemDev); 574 575 uint8_t btif_a2dp_confirm_stream_state(a2dp_stream_t *Stream, uint8_t old_state, uint8_t new_state); 576 577 void btif_a2dp_lock_deviceid_endpoint(uint8_t id); 578 579 void btif_a2dp_unlock_deviceid_endpoint(uint8_t unused_id); 580 581 uint8_t btif_a2dp_get_avrcpadvancedpdu_trans_id(void* pdu); 582 void btif_a2dp_set_avrcpadvancedpdu_trans_id(void* pdu, uint8_t trans_id); 583 584 btif_remote_device_t *btif_a2dp_get_remote_device_from_cbparms(a2dp_stream_t *Stream, const a2dp_callback_parms_t *info); 585 586 btif_avdtp_codec_type_t btif_a2dp_get_codec_type(const a2dp_callback_parms_t *info); 587 #if defined(IBRT) 588 void btif_reset_app_bt_device_streaming(uint8_t bt_dev_idx, uint8_t rm_detbl_idx , uint8_t avd_ctx_device_idx); 589 void btif_a2dp_set_codec_info(btif_dev_it_e dev_num, btif_avdtp_codec_type_t codec_type, uint8_t sample_rate, uint8_t sample_bit); 590 #endif 591 #if defined(IBRT) 592 #if defined(ENHANCED_STACK) 593 uint32_t btif_a2dp_profile_save_ctx(btif_remote_device_t *rem_dev, uint8_t *buf, uint32_t buf_len); 594 uint32_t btif_a2dp_profile_restore_ctx(uint8_t *buf, uint32_t buf_len); 595 #endif /* *ENHANCED_STACK */ 596 #endif /* IBRT */ 597 598 /* Callout functions, do not call directly */ 599 uint8_t a2dp_stream_confirm_stream_state(uint8_t index, uint8_t old_state, uint8_t new_state); 600 uint8_t a2dp_stream_locate_the_connected_dev_id(a2dp_stream_t *Stream); 601 602 #ifdef __cplusplus 603 } 604 #endif /* */ 605 #endif /* */ 606