MT2523 API Reference  LinkIt SDK v4
bt_a2dp.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2017 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __BT_A2DP_H__
36 #define __BT_A2DP_H__
37 
174 #include <stdint.h>
175 #include <stdbool.h>
176 #include "bt_type.h"
177 
187 #define BT_A2DP_CONNECT_IND (BT_MODULE_A2DP | 0x1200)
189 #define BT_A2DP_CONNECT_CNF (BT_MODULE_A2DP | 0x1201)
190 #define BT_A2DP_DISCONNECT_IND (BT_MODULE_A2DP | 0x1202)
191 #define BT_A2DP_DISCONNECT_CNF (BT_MODULE_A2DP | 0x1203)
192 #define BT_A2DP_START_STREAMING_IND (BT_MODULE_A2DP | 0x1204)
194 #define BT_A2DP_START_STREAMING_CNF (BT_MODULE_A2DP | 0x1205)
195 #define BT_A2DP_SUSPEND_STREAMING_IND (BT_MODULE_A2DP | 0x1206)
197 #define BT_A2DP_SUSPEND_STREAMING_CNF (BT_MODULE_A2DP | 0x1207)
198 #define BT_A2DP_RECONFIGURE_IND (BT_MODULE_A2DP | 0x1208)
200 #define BT_A2DP_RECONFIGURE_CNF (BT_MODULE_A2DP | 0x1209)
201 #define BT_A2DP_STREAMING_RECEIVED_IND (BT_MODULE_A2DP | 0x120A)
206 #define BT_STATUS_A2DP_TIMEOUT (BT_MODULE_A2DP|0xF0)
207 #define BT_STATUS_A2DP_BAD_STATE (BT_MODULE_A2DP|0xF1)
208 #define BT_STATUS_A2DP_NO_CONNECTION (BT_MODULE_A2DP|0xF2)
213 #define BT_A2DP_CODEC_SBC (0)
214 #define BT_A2DP_CODEC_AAC (2)
215 typedef uint8_t bt_a2dp_codec_type_t;
221 #define BT_A2DP_SOURCE (0)
222 #define BT_A2DP_SINK (1)
223 #define BT_A2DP_SOURCE_AND_SINK (2)
224 #define BT_A2DP_INVALID_ROLE (0xFF)
225 typedef uint8_t bt_a2dp_role_t;
231 #define BT_A2DP_IDLE (0)
232 #define BT_A2DP_OPENED (1)
233 #define BT_A2DP_STREAMING (2)
234 #define BT_A2DP_INVALID_STATE (0xFF)
235 typedef uint8_t bt_a2dp_state_t;
248 BT_PACKED(
249 typedef struct {
250  uint8_t channel_mode: 4;
252  uint8_t sample_freq: 4;
253  uint8_t alloc_method: 2;
254  uint8_t subbands: 2;
255  uint8_t block_len: 4;
256  uint8_t min_bitpool;
257  uint8_t max_bitpool;
259 
263 BT_PACKED(
264 typedef struct {
265  uint8_t object_type;
266  uint8_t freq_h;
267  uint8_t reserved:2;
268  uint8_t channels:2;
269  uint8_t freq_l:4;
270  uint8_t br_h:7;
271  uint8_t vbr:1;
272  uint8_t br_m;
273  uint8_t br_l;
275 
279 typedef struct {
280  bt_a2dp_codec_type_t type;
281  uint8_t sep_type;
282  uint8_t length;
283  union {
286  } codec;
292 typedef struct {
293  uint32_t handle;
294  bt_a2dp_role_t role;
295  bt_bd_addr_t *address;
301 typedef struct {
302  uint32_t handle;
303  bt_status_t status;
304  bt_a2dp_codec_capability_t *codec_cap;
310 typedef struct {
311  uint32_t handle;
313 
317 typedef struct {
318  uint32_t handle;
319  bt_status_t status;
325 typedef struct {
326  uint32_t handle;
327  bt_a2dp_codec_capability_t *codec_cap;
333 typedef struct {
334  uint32_t handle;
335  bt_status_t status;
336  bt_a2dp_codec_capability_t *codec_cap;
342 typedef struct {
343  uint32_t handle;
345 
349 typedef struct {
350  uint32_t handle;
351  bt_status_t status;
357 typedef struct {
358  uint32_t handle;
359  bt_a2dp_codec_capability_t *codec_cap;
365 typedef struct {
366  uint32_t handle;
367  bt_status_t status;
373 typedef struct {
374  uint32_t handle;
375  uint8_t *data_node;
376  uint16_t total_length;
377  uint16_t media_offset;
383 typedef struct {
384  uint32_t codec_number;
385  bt_a2dp_codec_capability_t *codec_list;
392 BT_EXTERN_C_BEGIN
393 
403 bt_status_t bt_a2dp_connect(uint32_t *handle, const bt_bd_addr_t *address, bt_a2dp_role_t role);
404 
412 bt_status_t bt_a2dp_start_streaming(uint32_t handle);
413 
422 bt_status_t bt_a2dp_suspend_streaming(uint32_t handle);
423 
435 
447 bt_status_t bt_a2dp_send_media_data(uint32_t handle,uint8_t *buffer,uint32_t payload_size, uint32_t timestamp);
448 
455 uint32_t bt_a2dp_get_mtu_size(uint32_t handle);
456 
466 bt_status_t bt_a2dp_abort_streaming(uint32_t handle);
467 
475 bt_status_t bt_a2dp_connect_response(uint32_t handle, bool accept);
476 
484 bt_status_t bt_a2dp_disconnect(uint32_t handle);
485 
493 bt_status_t bt_a2dp_start_streaming_response(uint32_t handle, bool accept);
494 
503 bt_status_t bt_a2dp_suspend_streaming_response(uint32_t handle, bool accept);
504 
513 bt_status_t bt_a2dp_reconfigure_response(uint32_t handle, bool accept);
514 
523 
529 void bt_a2dp_hold_media_data_node(uint8_t *data_node);
530 
536 void bt_a2dp_release_media_data_node(uint8_t *data_node);
537 
538 BT_EXTERN_C_END
543 #endif /*__BT_A2DP_H__*/
544 
bt_status_t bt_a2dp_get_init_params(bt_a2dp_init_params_t *param)
This function is A2DP initialization API.
bt_status_t bt_a2dp_suspend_streaming(uint32_t handle)
This function suspends the current streaming with the specified remote device.
bt_status_t bt_a2dp_abort_streaming(uint32_t handle)
This function aborts the current connection channel with the specified remote device.
uint8_t bt_a2dp_role_t
The type of A2DP role.
Definition: bt_a2dp.h:229
This structure defines the data type of the parameter in the callback for BT_A2DP_SUSPEND_STREAMING_I...
Definition: bt_a2dp.h:346
This structure defines the data type of the parameter in the callback for BT_A2DP_RECONFIGURE_CNF eve...
Definition: bt_a2dp.h:369
bt_status_t bt_a2dp_reconfigure_response(uint32_t handle, bool accept)
This function responds to the reconfiguration of the specified remote device.
bt_status_t bt_a2dp_connect(uint32_t *handle, const bt_bd_addr_t *address, bt_a2dp_role_t role)
This function connects to the specified remote device.
bt_status_t bt_a2dp_reconfigure_stream(uint32_t handle, bt_a2dp_codec_capability_t *codec_cap)
This function reconfigures the already configured stream and the API needs to be called only in strea...
This structure defines the data type of the parameter in the callback for BT_A2DP_START_STREAMING_CNF...
Definition: bt_a2dp.h:337
This structure defines the data type of the parameter in the callback for BT_A2DP_SUSPEND_STREAMING_C...
Definition: bt_a2dp.h:353
This structure defines the data type of the parameter in the callback for BT_A2DP_STREAMING_RECEIVED_...
Definition: bt_a2dp.h:377
bt_status_t bt_a2dp_start_streaming_response(uint32_t handle, bool accept)
This function responds to the incoming streaming from the specified remote device.
uint8_t bt_a2dp_codec_type_t
The type of A2DP codec.
Definition: bt_a2dp.h:219
bt_status_t bt_a2dp_disconnect(uint32_t handle)
This function disconnects from the specified remote device.
This structure defines the data type of the parameter in the callback for BT_A2DP_CONNECT_IND event...
Definition: bt_a2dp.h:296
bt_status_t bt_a2dp_start_streaming(uint32_t handle)
This function starts streaming with the specified remote device.
void bt_a2dp_hold_media_data_node(uint8_t *data_node)
This function holds a media packet from A2DP, preventing from that the packet is released before cons...
This structure defines the initialization parameters.
Definition: bt_a2dp.h:387
This structure defines the data type of the parameter in the callback for BT_A2DP_DISCONNECT_IND even...
Definition: bt_a2dp.h:314
This structure defines the A2DP codec capability.
Definition: bt_a2dp.h:283
bt_status_t bt_a2dp_suspend_streaming_response(uint32_t handle, bool accept)
This function responds to suspended streaming from the specified remote device.
uint8_t bt_bd_addr_t[6]
Address type, defined in Bluetooth core specification version 4.2.
Definition: bt_type.h:180
int32_t bt_status_t
Define the status type, returned from the APIs, and defined as BT_STATUS_XXX.
Definition: bt_type.h:173
uint32_t bt_a2dp_get_mtu_size(uint32_t handle)
This function returns the maximum A2DP payload data value in bytes so that the app can send data less...
void bt_a2dp_release_media_data_node(uint8_t *data_node)
This function releases a media packet after it is consumed.
This structure defines the data type of the parameter in the callback for BT_A2DP_RECONFIGURE_IND eve...
Definition: bt_a2dp.h:361
This structure defines the data type of the parameter in the callback for BT_A2DP_CONNECT_CNF event...
Definition: bt_a2dp.h:305
This structure defines the AAC codec details.
Definition: bt_a2dp.h:278
This structure defines the data type of the parameter in the callback for BT_A2DP_START_STREAMING_IND...
Definition: bt_a2dp.h:329
his structure defines the data type of the parameter in the callback for BT_A2DP_DISCONNECT_CNF event...
Definition: bt_a2dp.h:321
bt_status_t bt_a2dp_send_media_data(uint32_t handle, uint8_t *buffer, uint32_t payload_size, uint32_t timestamp)
This function sends media data to the remote device.
This structure defines the SBC codec details.
Definition: bt_a2dp.h:262
bt_status_t bt_a2dp_connect_response(uint32_t handle, bool accept)
This function responds to the specified remote device&#39;s incoming connection.