MT2523 API Reference  LinkIt SDK v4
bt_aws.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_AWS_H__
36 #define __BT_AWS_H__
37 
38 #include "bt_a2dp.h"
39 #include "bt_type.h"
40 
143 #define BT_AWS_CONNECT_IND (BT_MODULE_AWS | 0x0001)
144 #define BT_AWS_CONNECT_CNF (BT_MODULE_AWS | 0x0002)
145 #define BT_AWS_DISCONNECT_IND (BT_MODULE_AWS | 0x0003)
146 #define BT_AWS_DISCONNECT_CNF (BT_MODULE_AWS | 0x0004)
147 #define BT_AWS_COMMAND_IND (BT_MODULE_AWS | 0x000C)
148 #define BT_AWS_NOTIFY_PLAY_IND (BT_MODULE_AWS | 0x000E)
149 #define BT_AWS_STREAMING_PACKET_RECEIVED_IND (BT_MODULE_AWS | 0x0013)
150 #define BT_AWS_OFFSET_UPDATE_IND (BT_MODULE_AWS | 0x0015)
151 #define BT_AWS_BT_CLOCK_IND (BT_MODULE_AWS | 0x0016)
154 BT_EXTERN_C_BEGIN
155 
159 typedef uint16_t bt_aws_module_id_t;
160 
161 
165 typedef uint8_t bt_aws_streaming_type_t;
166 #define BT_AWS_STREAMING_TYPE_A2DP 0X01
167 #define BT_AWS_STREAMING_TYPE_CUSTOM 0X02
173 typedef struct
174 {
175  uint32_t nclk;
176  uint32_t nclk_intra;
178 
179 
183 typedef struct
184 {
185  uint32_t offset;
186  uint32_t offset_intra;
188 
189 
193 typedef struct {
194  uint8_t *data_node;
195  uint16_t total_length;
196  uint16_t media_offset;
198 
199 
203 typedef struct {
204  uint8_t *data;
205  uint16_t data_length;
206  uint8_t *media_header;
207  uint16_t media_header_len;
209 
210 
214 typedef struct {
216  union
217  {
220  };
222 
223 
227 typedef struct
228 {
229  uint32_t play_time;
230  uint32_t sequence_num;
233  uint32_t data_len;
234  uint8_t *user_data;
236 
237 
241 typedef struct {
242  uint32_t handle;
245 
246 
250 typedef struct {
251  uint32_t handle;
254 
255 
259 typedef struct {
260  uint32_t handle;
262 
263 
267 typedef struct {
268  uint32_t handle;
271 
272 
276 typedef struct {
277  uint32_t handle;
279  uint8_t *data;
280  uint16_t data_length;
282 
283 
287 typedef struct {
288  uint32_t handle;
291 
292 
293 
297 typedef struct {
298  uint32_t handle;
301 
302 
306 typedef struct {
307  uint32_t handle;
311 
312 
316 typedef struct {
317  uint32_t handle;
321 
322 
323 
333 bt_status_t bt_aws_connect(uint32_t *handle, bt_bd_addr_t *address);
334 
335 
344 bt_status_t bt_aws_connect_response(uint32_t handle, bool accept);
345 
346 
354 bt_status_t bt_aws_disconnect(uint32_t handle);
355 
356 
367 bt_status_t bt_aws_send_command(uint32_t handle,
368  bt_aws_module_id_t module_id,
369  const uint8_t *data,
370  uint16_t data_length);
371 
372 
382 bt_status_t bt_aws_notify_play(uint32_t handle, bt_aws_module_id_t module_id, bt_aws_play_notify_t *notification);
383 
384 
392 
393 
403 
404 
415  bt_aws_clock_offset_t offset,
416  bt_aws_clock_t local_clock,
417  bt_aws_clock_t *bt_clock);
418 
419 
427 
428 
436 uint16_t bt_aws_send_streaming_packet(uint32_t handle, bt_aws_module_id_t module_id, bt_aws_streaming_packet_t *streaming_packet);
437 
438 
444 uint32_t bt_aws_get_max_streaming_packet_size(uint32_t handle);
445 
446 
447 
448 BT_EXTERN_C_END
449 
450 
451 #endif /*__BT_AWS_H__*/
bt_status_t bt_aws_fetch_bt_time_offset(uint32_t handle)
This function fetches the current Bluetooth clock offset.
bt_status_t bt_aws_connect(uint32_t *handle, bt_bd_addr_t *address)
This function sends an AWS connection request to the remote device.
uint8_t * data_node
Media data pointer.
Definition: bt_aws.h:194
bt_aws_a2dp_packet_t a2dp_packet
The A2DP packet.
Definition: bt_aws.h:218
uint32_t offset_intra
The Bluetooth clock offset in microseconds.
Definition: bt_aws.h:186
This structure defines the Bluetooth clock.
Definition: bt_aws.h:173
uint32_t offset
The Bluetooth clock offset in 312.5us units.
Definition: bt_aws.h:185
This structure defines the BT_AWS_DISCONNECT_IND result.
Definition: bt_aws.h:259
This structure defines the BT_AWS_CONNECT_CNF result.
Definition: bt_aws.h:250
This structure defines the BT_AWS_DISCONNECT_CNF result.
Definition: bt_aws.h:267
bt_status_t bt_aws_get_bt_time_by_local_time(bt_role_t role, bt_aws_clock_offset_t offset, bt_aws_clock_t local_clock, bt_aws_clock_t *bt_clock)
This function gets the current Bluetooth clock.
uint16_t total_length
The total length of a media packet.
Definition: bt_aws.h:195
This structure defines the BT_AWS_COMMAND_IND result.
Definition: bt_aws.h:276
uint16_t bt_aws_module_id_t
This structure defines the module ID.
Definition: bt_aws.h:159
This structure defines the A2DP packet.
Definition: bt_aws.h:193
uint8_t bt_role_t
Define the role type.
Definition: bt_type.h:98
bt_status_t bt_aws_get_curr_bt_time(bt_role_t role, bt_aws_clock_offset_t offset, bt_aws_clock_t *bt_clock)
This function gets the current Bluetooth clock.
uint8_t * media_header
The media header pointer.
Definition: bt_aws.h:206
uint16_t media_header_len
The media header length.
Definition: bt_aws.h:207
bt_status_t bt_aws_disconnect(uint32_t handle)
This function sends an AWS disconnect request to the remote device.
uint16_t media_offset
The offset of media payload from the whole packet.
Definition: bt_aws.h:196
This structure defines the BT_AWS_BT_CLOCK_IND result.
Definition: bt_aws.h:297
This structure defines the AWS play time with a notification ID #BT_AWS_NOTIFY_ID_READY_TO_PLAY.
Definition: bt_aws.h:227
This structure defines the result of the BT_AWS_CONNECT_IND event.
Definition: bt_aws.h:241
bt_aws_module_id_t module_id
The module ID.
Definition: bt_aws.h:278
This structure defines the AWS streaming packet.
Definition: bt_aws.h:214
This structure defines the Bluetooth clock offset.
Definition: bt_aws.h:183
bt_status_t bt_aws_notify_play(uint32_t handle, bt_aws_module_id_t module_id, bt_aws_play_notify_t *notification)
This function sends an AWS notification to the remote device.
uint16_t bt_aws_send_streaming_packet(uint32_t handle, bt_aws_module_id_t module_id, bt_aws_streaming_packet_t *streaming_packet)
This function sends the streaming data to the remote device.
This structure defines the BT_AWS_NOTIFY_PLAY_IND result.
Definition: bt_aws.h:306
uint32_t data_len
The user data length.
Definition: bt_aws.h:233
uint32_t bt_aws_get_max_streaming_packet_size(uint32_t handle)
Get the max streaming data length.
uint32_t play_time
The delay time in microseconds.
Definition: bt_aws.h:229
This structure defines the custom packet.
Definition: bt_aws.h:203
bt_aws_clock_t play_bt_clock
The Bluetooth clock during play.
Definition: bt_aws.h:231
bt_role_t bt_local_role
The Bluetooth role.
Definition: bt_aws.h:232
bt_status_t bt_aws_send_command(uint32_t handle, bt_aws_module_id_t module_id, const uint8_t *data, uint16_t data_length)
This function sends an AWS command to the 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
uint16_t data_length
The total length of media packet.
Definition: bt_aws.h:205
uint32_t nclk_intra
The Bluetooth clock in microseconds.
Definition: bt_aws.h:176
uint8_t * user_data
The user data.
Definition: bt_aws.h:234
bt_aws_custom_packet_t custom_packet
The customized packet.
Definition: bt_aws.h:219
bt_aws_clock_t bt_clock
The current Bluetooth clock offset.
Definition: bt_aws.h:299
bt_bd_addr_t * address
Bluetooth address of a remote device.
Definition: bt_aws.h:243
uint32_t nclk
The Bluetooth clock in 312.5us units.
Definition: bt_aws.h:175
This structure defines the BT_AWS_STREAMING_PACKET_RECEIVED_IND result.
Definition: bt_aws.h:316
bt_aws_streaming_packet_t packet
The streaming packet.
Definition: bt_aws.h:319
bt_aws_clock_offset_t offset
The Bluetooth clock offset.
Definition: bt_aws.h:289
bt_status_t bt_aws_get_bt_local_time(bt_aws_clock_t *native_clock)
This function gets the current native clock.
uint32_t sequence_num
The packet sequence number.
Definition: bt_aws.h:230
uint8_t bt_aws_streaming_type_t
This structure defines the streaming packet type.
Definition: bt_aws.h:165
bt_status_t bt_aws_connect_response(uint32_t handle, bool accept)
This function is a response to the remote device's incoming connection request.
uint8_t * data
Media data pointer.
Definition: bt_aws.h:204
uint32_t handle
AWS handle.
Definition: bt_aws.h:242
This structure defines the BT_AWS_OFFSET_UPDATE_IND result.
Definition: bt_aws.h:287
bt_aws_streaming_type_t type
The streaming type.
Definition: bt_aws.h:215
bt_aws_play_notify_t * play_notify
The play notification settings.
Definition: bt_aws.h:309
bt_status_t status
Connection status.
Definition: bt_aws.h:252