TuyaOS
结构体 | 类型定义 | 枚举 | 函数
tkl_bluetooth_bredr.h 文件参考

This is tkl_bluetooth_bredr file 更多...

#include "tuya_cloud_types.h"
#include "tuya_error_code.h"
tkl_bluetooth_bredr.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  TUYA_BT_BREDR_EVENT_T
 

类型定义

typedef VOID(* TUYA_BT_BREDR_EVT_FUNC_CB) (TUYA_BT_BREDR_EVENT_T *p_event)
 

枚举

enum  TUYA_BT_BREDR_CONTROL_E {
  TUYA_BT_BREDR_RCP_START = 0x01 , TUYA_BT_BREDR_RCP_PLAY , TUYA_BT_BREDR_RCP_STOP , TUYA_BT_BREDR_RCP_PAUSE ,
  TUYA_BT_BREDR_RCP_NEXT , TUYA_BT_BREDR_RCP_PREV , TUYA_BT_BREDR_RCP_FORWARD , TUYA_BT_BREDR_RCP_REWIND ,
  TUYA_BT_BREDR_RCP_REPEAT , TUYA_BT_BREDR_RCP_MUTE , TUYA_BT_BREDR_RCP_VOLUME_UP , TUYA_BT_BREDR_RCP_VOLUME_DOWN ,
  TUYA_BT_BREDR_HFP_START , TUYA_BT_BREDR_HFP_ANSWER , TUYA_BT_BREDR_HFP_HANGUP , TUYA_BT_BREDR_HFP_REJECT ,
  TUYA_BT_BREDR_HFP_CALL , TUYA_BT_BREDR_HFP_UPDATE_BATTERY , TUYA_BT_BREDR_HFP_VOLUME_UP , TUYA_BT_BREDR_HFP_VOLUME_DOWN ,
  TUYA_BT_BREDR_HFP_SET_VOLUME , TUYA_BT_BREDR_HFP_GET_VOLUME , TUYA_BT_BREDR_A2DP_DISCONNECT , TUYA_BT_BREDR_HFP_DISCONNECT ,
  TUYA_BT_BREDR_START_CONNECTION , TUYA_BT_BREDR_CANCEL_CONNECTION
}
 
enum  TUYA_BT_BREDR_EVENT_TYPE_E {
  TUYA_BT_BREDR_STACK_INIT = 0x01 , TUYA_BT_BREDR_STACK_DEINIT , TUYA_BT_BREDR_STACK_RESET , TUYA_BT_BREDR_GAP_EVT_CONNECT ,
  TUYA_BT_BREDR_GAP_EVT_DISCONNECT , TUYA_BT_BREDR_GAP_EVT_PAIR , TUYA_BT_BREDR_GAP_INFO_INQUIRY , TUYA_BT_BREDR_STREAM_STATUS ,
  TUYA_BT_BREDR_PHONE_STATUS
}
 
enum  TUYA_BT_BREDR_PHONE_STATUS_E {
  TUYA_BT_PHONE_STATUS_IDLE = 0x01 , TUYA_BT_PHONE_STATUS_CONNECTED , TUYA_BT_PHONE_STATUS_DISCONNECTED , TUYA_BT_PHONE_INCOMING ,
  TUYA_BT_PHONE_OUTGOING , TUYA_BT_PHONE_ACTIVE , TUYA_BT_PHONE_HANGUP , TUYA_BT_PHONE_VOLOUME_CHANGED ,
  TUYA_BT_PHONE_UPDATE_BATTERY
}
 
enum  TUYA_BT_BREDR_ROLE_E { TUYA_BT_BREDR_ROLE_MASTER = 0x01 , TUYA_BT_BREDR_ROLE_SLAVE = 0x02 }
 
enum  TUYA_BT_BREDR_STEAM_STATUS_E {
  TUYA_BT_STREAM_STATUS_IDLE = 0x01 , TUYA_BT_STREAM_STATUS_CONNECTED , TUYA_BT_STREAM_STATUS_DISCONNECTED , TUYA_BT_STREAM_STATUS_START ,
  TUYA_BT_STREAM_STATUS_SUSPENDING , TUYA_BT_STREAM_STATUS_STOP
}
 
enum  TUYA_BT_PAIR_EVENT_TYPE_E {
  TUYA_BT_PAIR_BOND_START = 0x01 , TUYA_BT_PAIR_BOND_REQUEST , TUYA_BT_PAIR_BOND_CONFIRM , TUYA_BT_PAIR_BOND_SUCCESS ,
  TUYA_BT_PAIR_BOND_FAIL
}
 
enum  TUYA_BT_PAIR_IO_CAP_E {
  TUYA_BT_IO_CAP_DISPLAY_ONLY , TUYA_BT_IO_CAP_DISPLAY_YES_NO , TUYA_BT_IO_CAP_KEYBOARD_ONLY , TUYA_BT_IO_CAP_NO_INPUT_NO_OUTPUT ,
  TUYA_BT_IO_CAP_KEYBOARD_DISPLAY
}
 
enum  TUYA_BT_PAIR_MODE_E { TUYA_BT_PAIR_MODE_NO_PAIRING , TUYA_BT_PAIR_MODE_WAIT_FOR_REQ , TUYA_BT_PAIR_MODE_INITIATE }
 
enum  TUYA_BT_PAIR_REQUEST_T { TUYA_BT_PAIR_REQUEST_CONFIRMATION , TUYA_BT_PAIR_REQUEST_PASSKEY , TUYA_BT_PAIR_REQUEST_PRESSKEY , TUYA_BT_PAIR_REQUEST_PIN }
 
enum  TUYA_BT_SCAN_MODE_E { TUYA_BT_BREDR_MODE_IDLE = 0x00 , TUYA_BT_BREDR_MODE_SCAN_INQUIRY_ONLY , TUYA_BT_BREDR_MODE_SCAN_PAGE_ONLY , TUYA_BT_BREDR_MODE_SCAN_INQUIRY_AND_SCAN_PAGE }
 

函数

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_deinit (TUYA_BT_BREDR_ROLE_E role)
 De-Init the Bluetooth BR-EDR Interface. 更多...
 
OPERATE_RET tkl_bt_bredr_enable (TUYA_BT_SCAN_MODE_E mode)
 Enable the Bluetooth BR-EDR Interface. 更多...
 
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_equalizer_switch (UCHAR_T eq_mode, BOOL_T enable)
 Swicth the bredr eq mode 更多...
 
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_bredr_inquiry_enable (BOOL_T enable)
 Enable the Bluetooth BR-EDR Interface. 更多...
 
OPERATE_RET tkl_bt_bredr_noise_set (UCHAR_T noise_mode, USHORT_T noise_data)
 Control the bredr noise 更多...
 
OPERATE_RET tkl_bt_bredr_noise_switch (UCHAR_T noise_mode, BOOL_T enable)
 Swicth the bredr noise mode 更多...
 
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_pair_set (TUYA_BT_PAIR_INIT_PARAM_T pair)
 Set the Bluetooth BR-EDR pair mode Interface. 更多...
 
OPERATE_RET tkl_bt_bredr_reset (TUYA_BT_BREDR_ROLE_E role)
 Reset the Bluetooth BR-EDR Interface. 更多...
 
OPERATE_RET tkl_bt_gap_address_get (TUYA_BT_GAP_ADDR_T *p_peer_addr)
 Get the BT Address 更多...
 
OPERATE_RET tkl_bt_gap_address_set (TUYA_BT_GAP_ADDR_T CONST *p_peer_addr)
 Set the BT Address 更多...
 
OPERATE_RET tkl_bt_gap_disconnect (TUYA_BT_PAIR_BOND_INFO_T *bond_info)
 disconnect the link. 更多...
 
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 更多...
 
OPERATE_RET tkl_bt_gap_paring_delete (TUYA_BT_PAIR_BOND_INFO_T *bond_info)
 Delete the pair informations. 更多...
 
OPERATE_RET tkl_bt_gap_paring_enable_send (BOOL_T en)
 Enable or Disable pair when pairing request 更多...
 
OPERATE_RET tkl_bt_gap_paring_passkey_send (UINT_T passkey)
 Send paring passkey when in keyboard mode. 更多...
 
OPERATE_RET tkl_bt_gap_paring_request (TUYA_BT_PAIR_DEVICE_T *p_device)
 Request the pair while in BT-Master Mode. 更多...
 
BOOL_T tkl_bt_pairing_status_get (VOID_T)
 check if device is paired 更多...
 

详细描述

This is tkl_bluetooth_bredr file

版本
1.0
日期
2022-08-10

类型定义说明

◆ TUYA_BT_BREDR_EVT_FUNC_CB

typedef VOID(* TUYA_BT_BREDR_EVT_FUNC_CB) (TUYA_BT_BREDR_EVENT_T *p_event)

< Tuya Bluetooth BR-EDR Callback Register function definition

枚举类型说明

◆ TUYA_BT_BREDR_CONTROL_E

枚举值
TUYA_BT_BREDR_RCP_START 

Start to control Audio

TUYA_BT_BREDR_RCP_PLAY 

Play Music

TUYA_BT_BREDR_RCP_STOP 

Stop Playing Music

TUYA_BT_BREDR_RCP_PAUSE 

Pause Music

TUYA_BT_BREDR_RCP_NEXT 

Play Next Music

TUYA_BT_BREDR_RCP_PREV 

Play Previous Music

TUYA_BT_BREDR_RCP_FORWARD 

Forward Music

TUYA_BT_BREDR_RCP_REWIND 

Rewind Music

TUYA_BT_BREDR_RCP_REPEAT 

Repeat Music

TUYA_BT_BREDR_RCP_MUTE 

Mute for Music, user_data: NULL

TUYA_BT_BREDR_RCP_VOLUME_UP 

Volume up for Music, step: 1, user_data: NULL

TUYA_BT_BREDR_RCP_VOLUME_DOWN 

Volume down for Music, step: 1, user_data: NULL

TUYA_BT_BREDR_HFP_START 

Start to control Phone

TUYA_BT_BREDR_HFP_ANSWER 

Answer the Phone

TUYA_BT_BREDR_HFP_HANGUP 

Hang Up the Phone

TUYA_BT_BREDR_HFP_REJECT 

Reject the Phone

TUYA_BT_BREDR_HFP_CALL 

Call the Phone

TUYA_BT_BREDR_HFP_UPDATE_BATTERY 

Update Battery to the Phone

TUYA_BT_BREDR_HFP_VOLUME_UP 

Volume up for the phone, step: 1, user_data: NULL

TUYA_BT_BREDR_HFP_VOLUME_DOWN 

Volume down for the phone, step: 1, user_data: NULL

TUYA_BT_BREDR_HFP_SET_VOLUME 

Set the volume for the phone, post volume percent into adapter. Eg: Set Volume into 50%[Range: 0-100],we should post 50(or hex: 0x32)

TUYA_BT_BREDR_HFP_GET_VOLUME 

Get the volume from the phone, user_data: NULL

TUYA_BT_BREDR_A2DP_DISCONNECT 

Request Disconnect A2DP Profile

TUYA_BT_BREDR_HFP_DISCONNECT 

Request Disconnect HFP Profile

TUYA_BT_BREDR_START_CONNECTION 

Request Connect One Device

TUYA_BT_BREDR_CANCEL_CONNECTION 

Cancel Connecting One Device

◆ TUYA_BT_BREDR_EVENT_TYPE_E

枚举值
TUYA_BT_BREDR_STACK_INIT 

Init Bluetooth BR-EDR Stack, return refer@Stack Error Code.result

TUYA_BT_BREDR_STACK_DEINIT 

Deinit Bluetooth BR-EDR Stack

TUYA_BT_BREDR_STACK_RESET 

Reset Bluetooth BR-EDR Stack

TUYA_BT_BREDR_GAP_EVT_CONNECT 

General Connected

TUYA_BT_BREDR_GAP_EVT_DISCONNECT 

General Disconnected

TUYA_BT_BREDR_GAP_EVT_PAIR 

General Pairing

TUYA_BT_BREDR_GAP_INFO_INQUIRY 

Report Device Info inquiry

TUYA_BT_BREDR_STREAM_STATUS 

Report BR-EDR Stream Status

TUYA_BT_BREDR_PHONE_STATUS 

Report Phone Status

◆ TUYA_BT_BREDR_PHONE_STATUS_E

枚举值
TUYA_BT_PHONE_STATUS_IDLE 

Current Device Being in Idle Mode.

TUYA_BT_PHONE_STATUS_CONNECTED 

HFP Connected

TUYA_BT_PHONE_STATUS_DISCONNECTED 

HFP Disonnected

TUYA_BT_PHONE_INCOMING 

Incoming phone, indicate the status for device

TUYA_BT_PHONE_OUTGOING 

Outgoing phone, indicate the status for device

TUYA_BT_PHONE_ACTIVE 

Currently, the device is being phone active

TUYA_BT_PHONE_HANGUP 

Hang Up phone, indicate the status for device

TUYA_BT_PHONE_VOLOUME_CHANGED 

Indicate the volume changed

TUYA_BT_PHONE_UPDATE_BATTERY 

Update the battery

◆ TUYA_BT_BREDR_ROLE_E

枚举值
TUYA_BT_BREDR_ROLE_MASTER 

BR-EDR Role: Master, Not Central From Core Spec

TUYA_BT_BREDR_ROLE_SLAVE 

BR-EDR Role: Slave

◆ TUYA_BT_BREDR_STEAM_STATUS_E

枚举值
TUYA_BT_STREAM_STATUS_IDLE 

Current Audio Streaming Being in Idle Mode.

TUYA_BT_STREAM_STATUS_CONNECTED 

A2DP Connected

TUYA_BT_STREAM_STATUS_DISCONNECTED 

A2DP Disonnected

TUYA_BT_STREAM_STATUS_START 

Current Audio Streaming Has been started.

TUYA_BT_STREAM_STATUS_SUSPENDING 

Current Audio Streaming Being in Suspend Mode.

TUYA_BT_STREAM_STATUS_STOP 

Current Audio Streaming Has been stoped.

◆ TUYA_BT_PAIR_EVENT_TYPE_E

枚举值
TUYA_BT_PAIR_BOND_START 

Indicatet the pairing procedure running

TUYA_BT_PAIR_BOND_REQUEST 

After the phone request pairing with any passkey, we need to input the passkey

TUYA_BT_PAIR_BOND_CONFIRM 

After the phone request pairing with one passkey, we can show it and do confirm

TUYA_BT_PAIR_BOND_SUCCESS 

Pairing successfully

TUYA_BT_PAIR_BOND_FAIL 

Pairing fail

◆ TUYA_BT_PAIR_IO_CAP_E

枚举值
TUYA_BT_IO_CAP_DISPLAY_ONLY 

Display Only Device

TUYA_BT_IO_CAP_DISPLAY_YES_NO 

Display and Yes and No Capable

TUYA_BT_IO_CAP_KEYBOARD_ONLY 

Keyboard Only

TUYA_BT_IO_CAP_NO_INPUT_NO_OUTPUT 

No Display or Input Device

TUYA_BT_IO_CAP_KEYBOARD_DISPLAY 

Both Keyboard and Display Capable

◆ TUYA_BT_PAIR_MODE_E

枚举值
TUYA_BT_PAIR_MODE_NO_PAIRING 

Pairing is not allowed

TUYA_BT_PAIR_MODE_WAIT_FOR_REQ 

Wait for a pairing request or slave security request

TUYA_BT_PAIR_MODE_INITIATE 

Don't wait, initiate a pairing request or slave security request

◆ TUYA_BT_PAIR_REQUEST_T

枚举值
TUYA_BT_PAIR_REQUEST_CONFIRMATION 

Confirmation request then should send pair_enable

TUYA_BT_PAIR_REQUEST_PASSKEY 

passkey request then should enter passkey

TUYA_BT_PAIR_REQUEST_PIN 

pin request then should enter pair_enable

◆ TUYA_BT_SCAN_MODE_E

枚举值
TUYA_BT_BREDR_MODE_IDLE 

device is idle mode

TUYA_BT_BREDR_MODE_SCAN_INQUIRY_ONLY 

device is only inquiry_scan mode

TUYA_BT_BREDR_MODE_SCAN_PAGE_ONLY 

device is only page_scan mode

TUYA_BT_BREDR_MODE_SCAN_INQUIRY_AND_SCAN_PAGE 

device is both inquiry_scan and page_scan mode

函数说明

◆ tkl_bt_bredr_control()

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.

参数
[in]crtl_eventcontrol operations. [in] user_data: post the user-data for audio-control. [in] data_len: post the user-data length for audio-control.
返回
SUCCESS ERROR

◆ tkl_bt_bredr_deinit()

OPERATE_RET tkl_bt_bredr_deinit ( TUYA_BT_BREDR_ROLE_E  role)

De-Init the Bluetooth BR-EDR Interface.

参数
[in]roleDe-init the bt bredr role;
返回
SUCCESS ERROR

◆ tkl_bt_bredr_enable()

OPERATE_RET tkl_bt_bredr_enable ( TUYA_BT_SCAN_MODE_E  mode)

Enable the Bluetooth BR-EDR Interface.

参数
[in]modesee TUYA_BT_SCAN_MODE_E
返回
SUCCESS ERROR

◆ tkl_bt_bredr_equalizer_set()

OPERATE_RET tkl_bt_bredr_equalizer_set ( UCHAR_T  eq_mode,
UCHAR_T *  eq_data,
USHORT_T  eq_data_len 
)

Control the bredr eq

参数
[in]eq_modecontrol equalizer mode. [in] eq_data: post the eq-data for eq. [in] eq_data_len: post the eq-data length for eq.
返回
SUCCESS ERROR

◆ tkl_bt_bredr_equalizer_switch()

OPERATE_RET tkl_bt_bredr_equalizer_switch ( UCHAR_T  eq_mode,
BOOL_T  enable 
)

Swicth the bredr eq mode

参数
[in]eq_modeSwitch equalizer mode. [in] enable: Enable the current mode or not
返回
SUCCESS ERROR

◆ tkl_bt_bredr_init()

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.

参数
[in]roleInit the bt bredr role; [in] p_event: register callback; [in] user_data: Init the user data;
返回
SUCCESS ERROR

◆ tkl_bt_bredr_inquiry_enable()

OPERATE_RET tkl_bt_bredr_inquiry_enable ( BOOL_T  enable)

Enable the Bluetooth BR-EDR Interface.

参数
[in]enableTRUE: Enable the bluetooth bredr inquiry. FALSE: Disable the bluetooth bredr inquiry.
返回
SUCCESS ERROR

◆ tkl_bt_bredr_noise_set()

OPERATE_RET tkl_bt_bredr_noise_set ( UCHAR_T  noise_mode,
USHORT_T  noise_data 
)

Control the bredr noise

参数
[in]noise_modecontrol noise mode. [in] noise_data: post the noise data.
返回
SUCCESS ERROR

◆ tkl_bt_bredr_noise_switch()

OPERATE_RET tkl_bt_bredr_noise_switch ( UCHAR_T  noise_mode,
BOOL_T  enable 
)

Swicth the bredr noise mode

参数
[in]noise_modeSwitch noise mode. [in] enable: Enable the current mode or not
返回
SUCCESS ERROR

◆ tkl_bt_bredr_page_enable()

OPERATE_RET tkl_bt_bredr_page_enable ( BOOL_T  enable,
TUYA_BT_GAP_ADDR_T p_peer_addr 
)

Enable the Bluetooth BR-EDR Interface.

参数
[in]enableTRUE: Enable the bluetooth bredr page. FALSE: Disable the bluetooth bredr page. [in] peer_addr: peer address for device which should be paging. if is NULL, will page the last device
返回
SUCCESS ERROR

◆ tkl_bt_bredr_pair_set()

OPERATE_RET tkl_bt_bredr_pair_set ( TUYA_BT_PAIR_INIT_PARAM_T  pair)

Set the Bluetooth BR-EDR pair mode Interface.

参数
[in]pairBluetooth BR-EDR pair mode; [in] user_data: Init the user data;
返回
SUCCESS ERROR

◆ tkl_bt_bredr_reset()

OPERATE_RET tkl_bt_bredr_reset ( TUYA_BT_BREDR_ROLE_E  role)

Reset the Bluetooth BR-EDR Interface.

参数
[in]roleReset the bt bredr role;
返回
SUCCESS ERROR

◆ tkl_bt_gap_address_get()

OPERATE_RET tkl_bt_gap_address_get ( TUYA_BT_GAP_ADDR_T p_peer_addr)

Get the BT Address

参数
[out]p_peer_addrget peer address for BT;
返回
SUCCESS ERROR

◆ tkl_bt_gap_address_set()

OPERATE_RET tkl_bt_gap_address_set ( TUYA_BT_GAP_ADDR_T CONST *  p_peer_addr)

Set the BT Address

参数
[in]p_peer_addrset peer address for BT;
返回
SUCCESS ERROR

◆ tkl_bt_gap_disconnect()

OPERATE_RET tkl_bt_gap_disconnect ( TUYA_BT_PAIR_BOND_INFO_T bond_info)

disconnect the link.

参数
[in]bond_infodisconnect the bond info.
返回
SUCCESS ERROR

◆ tkl_bt_gap_name_get()

OPERATE_RET tkl_bt_gap_name_get ( CHAR_T *  name)

Get the BT GAP Name

参数
[in]p_peer_addrget local bluetooth gap name for BT;
返回
SUCCESS ERROR

◆ tkl_bt_gap_name_set()

OPERATE_RET tkl_bt_gap_name_set ( CHAR_T *  name)

Set the BT GAP Name

参数
[in]p_peer_addrset local bluetooth gap name for BT;
返回
SUCCESS ERROR

◆ tkl_bt_gap_paring_delete()

OPERATE_RET tkl_bt_gap_paring_delete ( TUYA_BT_PAIR_BOND_INFO_T bond_info)

Delete the pair informations.

参数
[in]bond_infodelete the bond info.
返回
SUCCESS ERROR

◆ tkl_bt_gap_paring_enable_send()

OPERATE_RET tkl_bt_gap_paring_enable_send ( BOOL_T  en)

Enable or Disable pair when pairing request

参数
[in]enTRUE for enable and FALSE for disable pair
返回
SUCCESS ERROR

◆ tkl_bt_gap_paring_passkey_send()

OPERATE_RET tkl_bt_gap_paring_passkey_send ( UINT_T  passkey)

Send paring passkey when in keyboard mode.

参数
[in]passkeyeg: 0x0001E240 means the passkey is 123456
返回
SUCCESS ERROR

◆ tkl_bt_gap_paring_request()

OPERATE_RET tkl_bt_gap_paring_request ( TUYA_BT_PAIR_DEVICE_T p_device)

Request the pair while in BT-Master Mode.

参数
[in]moderequest security pairing mode for BT; [in] bond_info: post the major information for pairing.
返回
SUCCESS ERROR

◆ tkl_bt_pairing_status_get()

BOOL_T tkl_bt_pairing_status_get ( VOID_T  )

check if device is paired

参数
[in]NULL
返回
TRUE FALSE