TuyaOS
tkl_bluetooth_bredr.h
浏览该文件的文档.
1
11#ifndef __TKL_BLUETOOTH_BREDR_H__
12#define __TKL_BLUETOOTH_BREDR_H__
13
14#include "tuya_cloud_types.h"
15#include "tuya_error_code.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*
22* 统一蓝牙BREDR接口,主要应用场景如下:
23* 1,作为蓝牙音箱设备(Sink),由手机端(Source)播放音频于设备上。如:涂鸦智能音箱,涂鸦wifi语音音箱等
24* 2,作为蓝牙耳机(Sink),由手机端或移动终端(Sink)播放音频于设备上。如:涂鸦蓝牙耳机
25*
26* 注:制定该接口主要应用场景为Sink端,由于暂无Source需求,我们将专注于Sink端接口规范,且无需关心音频数据流。
27* 如:将音箱数据送入下一个音频播放设备等不在我们考虑范围,协议不支持点到多点连接,故暂不考虑。
28*
29* 规范蓝牙BREDR接口目的:
30* 1,剥离业务到驱动接口,最大限度规范上下层行为。
31* 2,更好地按需进行业务与驱动拓展,避免无效的接口导入与应用。
32* 3,更好地拓展TuyaOS在蓝牙业务上的需求点。
33* 4,轻量化接口便于理解。
34*/
35
36/***********************************************************************
37 ********************* constant ( macro and enum ) *********************
38 **********************************************************************/
39typedef enum {
58
59typedef enum {
65
66typedef enum {
73
74typedef enum {
75 // [AVRCP], Audio/Video Remote Control, 4.6.X Support level in CT&TG
89 // [HFP], Hands-Free Profile
96 // [HFP], Need to post the data
109
111typedef enum {
115
116typedef enum {
124
125typedef enum {
136
137typedef enum {
142
143typedef enum {
150
151typedef enum {
154 TUYA_BT_PAIR_REQUEST_PRESSKEY,
157
158/***********************************************************************
159 ********************* struct ******************************************
160 **********************************************************************/
161typedef struct {
162 UCHAR_T type;
163 UCHAR_T addr[6];
165
166typedef struct {
170 UCHAR_T oob_data;
171 UCHAR_T mitm;
173 UINT_T passkey;
175
176typedef struct {
178 UCHAR_T link_key[16];
180 VOID *user_data;
182
183typedef struct {
185 UINT_T passkey;
187 VOID *user_data;
189
190typedef struct {
192 UINT_T reason;
193 VOID *user_data;
195
196typedef struct {
198 UINT_T passkey;
199 VOID *user_data;
201
202typedef struct {
204 UCHAR_T *name;
205 UCHAR_T name_len;
206 VOID *user_data;
208
209
210typedef struct {
213 VOID_T *p_endpoint;
214 VOID_T *p_connection;
215 VOID_T *user_data;
217
218typedef struct {
221 VOID_T *user_data;
223
224typedef struct {
226 INT_T result;
228 union {
236 } profile_event;
238
239
240/***********************************************************************
241 ********************* variable ****************************************
242 **********************************************************************/
245
246/***********************************************************************
247 ********************* function ****************************************
248 **********************************************************************/
249
250
251
261OPERATE_RET tkl_bt_bredr_init(TUYA_BT_BREDR_ROLE_E role, TUYA_BT_BREDR_EVT_FUNC_CB p_event, VOID_T *user_data);
262
271
280
290
299
309OPERATE_RET tkl_bt_bredr_page_enable(BOOL_T enable, TUYA_BT_GAP_ADDR_T *p_peer_addr);
310
319OPERATE_RET tkl_bt_bredr_inquiry_enable(BOOL_T enable);
320
328OPERATE_RET tkl_bt_gap_address_set(TUYA_BT_GAP_ADDR_T CONST *p_peer_addr);
329
338
346OPERATE_RET tkl_bt_gap_name_set(CHAR_T *name);
347
355OPERATE_RET tkl_bt_gap_name_get(CHAR_T *name);
356
366
374OPERATE_RET tkl_bt_gap_paring_passkey_send(UINT_T passkey);
375
383OPERATE_RET tkl_bt_gap_paring_enable_send(BOOL_T en);
384
393
402
411
421OPERATE_RET tkl_bt_bredr_control(TUYA_BT_BREDR_CONTROL_E crtl_event, UCHAR_T *user_data, USHORT_T data_len);
422
432OPERATE_RET tkl_bt_bredr_equalizer_set(UCHAR_T eq_mode, UCHAR_T *eq_data, USHORT_T eq_data_len);
433
442OPERATE_RET tkl_bt_bredr_equalizer_switch(UCHAR_T eq_mode, BOOL_T enable);
443
452OPERATE_RET tkl_bt_bredr_noise_set(UCHAR_T noise_mode, USHORT_T noise_data);
453
462OPERATE_RET tkl_bt_bredr_noise_switch(UCHAR_T noise_mode, BOOL_T enable);
463
464
465#ifdef __cplusplus
466}
467#endif
468
469#endif /* __TKL_BLUETOOTH_BREDR_H__ */
Definition: tkl_bluetooth_bredr.h:224
TUYA_BT_BREDR_PHONE_T phone
Definition: tkl_bluetooth_bredr.h:235
TUYA_BT_PAIR_BOND_EVT_T pair
Definition: tkl_bluetooth_bredr.h:229
TUYA_BT_PAIR_INQUIRY_EVT_T device
Definition: tkl_bluetooth_bredr.h:230
TUYA_BT_BREDR_STEAM_T audio
Definition: tkl_bluetooth_bredr.h:234
TUYA_BT_PAIR_BOND_INFO_T bond
Definition: tkl_bluetooth_bredr.h:232
TUYA_BT_DISCONNECT_EVT_T disconnect
Definition: tkl_bluetooth_bredr.h:231
TUYA_BT_BREDR_EVENT_TYPE_E type
Definition: tkl_bluetooth_bredr.h:225
INT_T result
Definition: tkl_bluetooth_bredr.h:226
Definition: tkl_bluetooth_bredr.h:218
VOID_T * user_data
Definition: tkl_bluetooth_bredr.h:221
TUYA_BT_BREDR_PHONE_STATUS_E status
Definition: tkl_bluetooth_bredr.h:219
UINT8_T user_data_len
Definition: tkl_bluetooth_bredr.h:220
Definition: tkl_bluetooth_bredr.h:210
TUYA_BT_BREDR_STEAM_STATUS_E status
Definition: tkl_bluetooth_bredr.h:211
VOID_T * p_connection
Definition: tkl_bluetooth_bredr.h:214
VOID_T * p_endpoint
Definition: tkl_bluetooth_bredr.h:213
VOID_T * user_data
Definition: tkl_bluetooth_bredr.h:215
Definition: tkl_bluetooth_bredr.h:190
TUYA_BT_GAP_ADDR_T addr
Definition: tkl_bluetooth_bredr.h:191
UINT_T reason
Definition: tkl_bluetooth_bredr.h:192
Definition: tkl_bluetooth_bredr.h:161
UCHAR_T type
Definition: tkl_bluetooth_bredr.h:162
Definition: tkl_bluetooth_bredr.h:196
TUYA_BT_PAIR_REQUEST_T req
Definition: tkl_bluetooth_bredr.h:197
UINT_T passkey
Definition: tkl_bluetooth_bredr.h:198
Definition: tkl_bluetooth_bredr.h:176
TUYA_BT_GAP_ADDR_T addr
Definition: tkl_bluetooth_bredr.h:177
Definition: tkl_bluetooth_bredr.h:183
TUYA_BT_GAP_ADDR_T addr
Definition: tkl_bluetooth_bredr.h:184
UINT_T passkey
Definition: tkl_bluetooth_bredr.h:185
Definition: tkl_bluetooth_bredr.h:166
BOOL_T ble_secure_conn
Definition: tkl_bluetooth_bredr.h:172
TUYA_BT_PAIR_IO_CAP_E io_cap
Definition: tkl_bluetooth_bredr.h:168
UINT_T passkey
Definition: tkl_bluetooth_bredr.h:173
UCHAR_T mitm
Definition: tkl_bluetooth_bredr.h:171
TUYA_BT_PAIR_MODE_E mode
Definition: tkl_bluetooth_bredr.h:167
Definition: tkl_bluetooth_bredr.h:202
UCHAR_T * name
Definition: tkl_bluetooth_bredr.h:204
TUYA_BT_GAP_ADDR_T addr
Definition: tkl_bluetooth_bredr.h:203
TUYA_BT_PAIR_MODE_E
Definition: tkl_bluetooth_bredr.h:137
@ TUYA_BT_PAIR_MODE_INITIATE
Definition: tkl_bluetooth_bredr.h:140
@ TUYA_BT_PAIR_MODE_WAIT_FOR_REQ
Definition: tkl_bluetooth_bredr.h:139
@ TUYA_BT_PAIR_MODE_NO_PAIRING
Definition: tkl_bluetooth_bredr.h:138
OPERATE_RET tkl_bt_gap_paring_enable_send(BOOL_T en)
Enable or Disable pair when pairing request
TUYA_BT_PAIR_REQUEST_T
Definition: tkl_bluetooth_bredr.h:151
@ TUYA_BT_PAIR_REQUEST_CONFIRMATION
Definition: tkl_bluetooth_bredr.h:152
@ TUYA_BT_PAIR_REQUEST_PASSKEY
Definition: tkl_bluetooth_bredr.h:153
@ TUYA_BT_PAIR_REQUEST_PIN
Definition: tkl_bluetooth_bredr.h:155
OPERATE_RET tkl_bt_bredr_equalizer_switch(UCHAR_T eq_mode, BOOL_T enable)
Swicth the bredr eq mode
OPERATE_RET tkl_bt_gap_disconnect(TUYA_BT_PAIR_BOND_INFO_T *bond_info)
disconnect the link.
OPERATE_RET tkl_bt_gap_address_set(TUYA_BT_GAP_ADDR_T CONST *p_peer_addr)
Set the BT Address
BOOL_T tkl_bt_pairing_status_get(VOID_T)
check if device is paired
OPERATE_RET tkl_bt_bredr_equalizer_set(UCHAR_T eq_mode, UCHAR_T *eq_data, USHORT_T eq_data_len)
Control the bredr eq
OPERATE_RET tkl_bt_bredr_noise_switch(UCHAR_T noise_mode, BOOL_T enable)
Swicth the bredr noise mode
TUYA_BT_PAIR_EVENT_TYPE_E
Definition: tkl_bluetooth_bredr.h:66
@ TUYA_BT_PAIR_BOND_FAIL
Definition: tkl_bluetooth_bredr.h:71
@ TUYA_BT_PAIR_BOND_SUCCESS
Definition: tkl_bluetooth_bredr.h:70
@ TUYA_BT_PAIR_BOND_CONFIRM
Definition: tkl_bluetooth_bredr.h:69
@ TUYA_BT_PAIR_BOND_REQUEST
Definition: tkl_bluetooth_bredr.h:68
@ TUYA_BT_PAIR_BOND_START
Definition: tkl_bluetooth_bredr.h:67
TUYA_BT_BREDR_CONTROL_E
Definition: tkl_bluetooth_bredr.h:74
@ TUYA_BT_BREDR_RCP_PLAY
Definition: tkl_bluetooth_bredr.h:77
@ TUYA_BT_BREDR_RCP_REPEAT
Definition: tkl_bluetooth_bredr.h:84
@ TUYA_BT_BREDR_A2DP_DISCONNECT
Definition: tkl_bluetooth_bredr.h:104
@ TUYA_BT_BREDR_CANCEL_CONNECTION
Definition: tkl_bluetooth_bredr.h:107
@ TUYA_BT_BREDR_HFP_GET_VOLUME
Definition: tkl_bluetooth_bredr.h:102
@ TUYA_BT_BREDR_HFP_REJECT
Definition: tkl_bluetooth_bredr.h:93
@ TUYA_BT_BREDR_RCP_PREV
Definition: tkl_bluetooth_bredr.h:81
@ TUYA_BT_BREDR_HFP_HANGUP
Definition: tkl_bluetooth_bredr.h:92
@ TUYA_BT_BREDR_RCP_NEXT
Definition: tkl_bluetooth_bredr.h:80
@ TUYA_BT_BREDR_RCP_PAUSE
Definition: tkl_bluetooth_bredr.h:79
@ TUYA_BT_BREDR_HFP_START
Definition: tkl_bluetooth_bredr.h:90
@ TUYA_BT_BREDR_RCP_FORWARD
Definition: tkl_bluetooth_bredr.h:82
@ TUYA_BT_BREDR_HFP_CALL
Definition: tkl_bluetooth_bredr.h:94
@ TUYA_BT_BREDR_HFP_SET_VOLUME
Definition: tkl_bluetooth_bredr.h:100
@ TUYA_BT_BREDR_RCP_START
Definition: tkl_bluetooth_bredr.h:76
@ TUYA_BT_BREDR_RCP_STOP
Definition: tkl_bluetooth_bredr.h:78
@ TUYA_BT_BREDR_HFP_UPDATE_BATTERY
Definition: tkl_bluetooth_bredr.h:97
@ TUYA_BT_BREDR_START_CONNECTION
Definition: tkl_bluetooth_bredr.h:106
@ TUYA_BT_BREDR_RCP_VOLUME_UP
Definition: tkl_bluetooth_bredr.h:86
@ TUYA_BT_BREDR_HFP_VOLUME_UP
Definition: tkl_bluetooth_bredr.h:98
@ TUYA_BT_BREDR_RCP_REWIND
Definition: tkl_bluetooth_bredr.h:83
@ TUYA_BT_BREDR_HFP_VOLUME_DOWN
Definition: tkl_bluetooth_bredr.h:99
@ TUYA_BT_BREDR_RCP_VOLUME_DOWN
Definition: tkl_bluetooth_bredr.h:87
@ TUYA_BT_BREDR_HFP_ANSWER
Definition: tkl_bluetooth_bredr.h:91
@ TUYA_BT_BREDR_HFP_DISCONNECT
Definition: tkl_bluetooth_bredr.h:105
@ TUYA_BT_BREDR_RCP_MUTE
Definition: tkl_bluetooth_bredr.h:85
OPERATE_RET tkl_bt_bredr_control(TUYA_BT_BREDR_CONTROL_E crtl_event, UCHAR_T *user_data, USHORT_T data_len)
Control the audio or phone, please refer to @TUYA_BT_BREDR_CONTROL_E.
OPERATE_RET tkl_bt_bredr_init(TUYA_BT_BREDR_ROLE_E role, TUYA_BT_BREDR_EVT_FUNC_CB p_event, VOID_T *user_data)
Init the Bluetooth BR-EDR Interface.
OPERATE_RET tkl_bt_gap_name_get(CHAR_T *name)
Get the BT GAP Name
OPERATE_RET tkl_bt_gap_name_set(CHAR_T *name)
Set the BT GAP Name
TUYA_BT_SCAN_MODE_E
Definition: tkl_bluetooth_bredr.h:59
@ TUYA_BT_BREDR_MODE_IDLE
Definition: tkl_bluetooth_bredr.h:60
@ TUYA_BT_BREDR_MODE_SCAN_PAGE_ONLY
Definition: tkl_bluetooth_bredr.h:62
@ TUYA_BT_BREDR_MODE_SCAN_INQUIRY_AND_SCAN_PAGE
Definition: tkl_bluetooth_bredr.h:63
@ TUYA_BT_BREDR_MODE_SCAN_INQUIRY_ONLY
Definition: tkl_bluetooth_bredr.h:61
OPERATE_RET tkl_bt_bredr_noise_set(UCHAR_T noise_mode, USHORT_T noise_data)
Control the bredr noise
TUYA_BT_BREDR_PHONE_STATUS_E
Definition: tkl_bluetooth_bredr.h:125
@ TUYA_BT_PHONE_STATUS_CONNECTED
Definition: tkl_bluetooth_bredr.h:127
@ TUYA_BT_PHONE_STATUS_DISCONNECTED
Definition: tkl_bluetooth_bredr.h:128
@ TUYA_BT_PHONE_INCOMING
Definition: tkl_bluetooth_bredr.h:129
@ TUYA_BT_PHONE_UPDATE_BATTERY
Definition: tkl_bluetooth_bredr.h:134
@ TUYA_BT_PHONE_STATUS_IDLE
Definition: tkl_bluetooth_bredr.h:126
@ TUYA_BT_PHONE_OUTGOING
Definition: tkl_bluetooth_bredr.h:130
@ TUYA_BT_PHONE_VOLOUME_CHANGED
Definition: tkl_bluetooth_bredr.h:133
@ TUYA_BT_PHONE_HANGUP
Definition: tkl_bluetooth_bredr.h:132
@ TUYA_BT_PHONE_ACTIVE
Definition: tkl_bluetooth_bredr.h:131
OPERATE_RET tkl_bt_bredr_deinit(TUYA_BT_BREDR_ROLE_E role)
De-Init the Bluetooth BR-EDR Interface.
TUYA_BT_BREDR_ROLE_E
Definition: tkl_bluetooth_bredr.h:111
@ TUYA_BT_BREDR_ROLE_MASTER
Definition: tkl_bluetooth_bredr.h:112
@ TUYA_BT_BREDR_ROLE_SLAVE
Definition: tkl_bluetooth_bredr.h:113
OPERATE_RET tkl_bt_gap_paring_passkey_send(UINT_T passkey)
Send paring passkey when in keyboard mode.
OPERATE_RET tkl_bt_bredr_pair_set(TUYA_BT_PAIR_INIT_PARAM_T pair)
Set the Bluetooth BR-EDR pair mode Interface.
OPERATE_RET tkl_bt_bredr_inquiry_enable(BOOL_T enable)
Enable the Bluetooth BR-EDR Interface.
OPERATE_RET tkl_bt_bredr_page_enable(BOOL_T enable, TUYA_BT_GAP_ADDR_T *p_peer_addr)
Enable the Bluetooth BR-EDR Interface.
OPERATE_RET tkl_bt_bredr_reset(TUYA_BT_BREDR_ROLE_E role)
Reset the Bluetooth BR-EDR Interface.
OPERATE_RET tkl_bt_gap_paring_delete(TUYA_BT_PAIR_BOND_INFO_T *bond_info)
Delete the pair informations.
OPERATE_RET tkl_bt_gap_address_get(TUYA_BT_GAP_ADDR_T *p_peer_addr)
Get the BT Address
OPERATE_RET tkl_bt_gap_paring_request(TUYA_BT_PAIR_DEVICE_T *p_device)
Request the pair while in BT-Master Mode.
TUYA_BT_BREDR_EVENT_TYPE_E
Definition: tkl_bluetooth_bredr.h:39
@ TUYA_BT_BREDR_GAP_EVT_CONNECT
Definition: tkl_bluetooth_bredr.h:46
@ TUYA_BT_BREDR_GAP_EVT_PAIR
Definition: tkl_bluetooth_bredr.h:50
@ TUYA_BT_BREDR_STACK_RESET
Definition: tkl_bluetooth_bredr.h:44
@ TUYA_BT_BREDR_STACK_DEINIT
Definition: tkl_bluetooth_bredr.h:42
@ TUYA_BT_BREDR_STACK_INIT
Definition: tkl_bluetooth_bredr.h:40
@ TUYA_BT_BREDR_PHONE_STATUS
Definition: tkl_bluetooth_bredr.h:56
@ TUYA_BT_BREDR_GAP_EVT_DISCONNECT
Definition: tkl_bluetooth_bredr.h:48
@ TUYA_BT_BREDR_STREAM_STATUS
Definition: tkl_bluetooth_bredr.h:54
@ TUYA_BT_BREDR_GAP_INFO_INQUIRY
Definition: tkl_bluetooth_bredr.h:52
TUYA_BT_BREDR_STEAM_STATUS_E
Definition: tkl_bluetooth_bredr.h:116
@ TUYA_BT_STREAM_STATUS_IDLE
Definition: tkl_bluetooth_bredr.h:117
@ TUYA_BT_STREAM_STATUS_SUSPENDING
Definition: tkl_bluetooth_bredr.h:121
@ TUYA_BT_STREAM_STATUS_START
Definition: tkl_bluetooth_bredr.h:120
@ TUYA_BT_STREAM_STATUS_CONNECTED
Definition: tkl_bluetooth_bredr.h:118
@ TUYA_BT_STREAM_STATUS_DISCONNECTED
Definition: tkl_bluetooth_bredr.h:119
@ TUYA_BT_STREAM_STATUS_STOP
Definition: tkl_bluetooth_bredr.h:122
OPERATE_RET tkl_bt_bredr_enable(TUYA_BT_SCAN_MODE_E mode)
Enable the Bluetooth BR-EDR Interface.
VOID(* TUYA_BT_BREDR_EVT_FUNC_CB)(TUYA_BT_BREDR_EVENT_T *p_event)
Definition: tkl_bluetooth_bredr.h:244
TUYA_BT_PAIR_IO_CAP_E
Definition: tkl_bluetooth_bredr.h:143
@ TUYA_BT_IO_CAP_KEYBOARD_DISPLAY
Definition: tkl_bluetooth_bredr.h:148
@ TUYA_BT_IO_CAP_DISPLAY_YES_NO
Definition: tkl_bluetooth_bredr.h:145
@ TUYA_BT_IO_CAP_DISPLAY_ONLY
Definition: tkl_bluetooth_bredr.h:144
@ TUYA_BT_IO_CAP_NO_INPUT_NO_OUTPUT
Definition: tkl_bluetooth_bredr.h:147
@ TUYA_BT_IO_CAP_KEYBOARD_ONLY
Definition: tkl_bluetooth_bredr.h:146