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

Common process - Initialization 更多...

#include "tuya_cloud_types.h"
#include "tuya_cloud_com_defs.h"
#include "base_event_info.h"
#include "tal_bluetooth_def.h"
tuya_bt.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  TUYA_BLE_BT_PARA
 

宏定义

#define TUYA_BLE_ABILITY_ALL   0xFF
 
#define TUYA_BLE_ABILITY_DP_CTRL   0x2
 
#define TUYA_BLE_ABILITY_NETCFG   0x1
 
#define TUYA_BLE_ABILITY_NONE   0x0
 

类型定义

typedef UINT_T(* BT_DP_GET_TM_CB) (CHAR_T *time_str)
 
typedef VOID_T(* BT_DP_QUERY_CB) (VOID_T)
 
typedef VOID(* GET_BT_CONN_STAT_CB) (IN CONST TUYA_BT_CONN_STAT stat)
 
typedef BYTE_T TUYA_BLE_ABILITY_T
 

枚举

enum  TUYA_BLE_BIND_TYPE { TUYA_BLE_OP_UNBIND = 0 , TUYA_BLE_OP_BIND }
 bind type for bluetooth remote controller
 
enum  TUYA_BT_CONN_STAT {
  TUYA_BT_UNBONDING_UNCONN = 0 , TUYA_BT_UNBONDING_CONN , TUYA_BT_BONDING_UNCONN , TUYA_BT_BONDING_CONN ,
  TUYA_BT_UNKNOW_STATUS
}
 connection status for bluetooth
 
enum  TUYA_BT_SERV_STAT { TUYA_BT_SERV_OPENED = 0 , TUYA_BT_SERV_OPENING , TUYA_BT_SERV_CLOSED , TUYA_BT_SERV_CLOSING }
 status for bluetooth service
 

函数

BOOL_T is_bt_connected (VOID_T)
 Check bluetooth is connected. 更多...
 
VOID_T tuya_ble_disable_expt_unbind (VOID_T)
 Disable function for execept unbinding 更多...
 
VOID_T tuya_ble_dp_response_query (IN CONST BYTE_T *dpid, IN CONST BYTE_T num)
 Response dp query with report flag 更多...
 
TUYA_BT_SERV_STAT tuya_ble_get_serv_stat (VOID_T)
 Get status of bluetooth service 更多...
 
BOOL_T tuya_ble_is_mftst_enable (VOID_T)
 
VOID_T tuya_ble_lowpower_handle (VOID_T)
 stop ble netcfg and plug_play when dev under lowpower status 更多...
 
OPERATE_RET tuya_ble_monitor_init (VOID_T)
 Monitor for bluetooth 更多...
 
OPERATE_RET tuya_ble_reg_get_bt_stat_cb (IN CONST GET_BT_CONN_STAT_CB bt_conn_stat_cb)
 Register callback function for getting the connection status of bluetooth 更多...
 
VOID_T tuya_ble_rept_netcfg_stat (IN UINT_T type)
 Report netcfg status 更多...
 
VOID_T tuya_ble_restart_adv (VOID_T)
 Resend the ble adv data to hal and start ble adv 更多...
 
VOID_T tuya_ble_set_bt_para (TUYA_BLE_BT_PARA *para)
 Set parameters for bluetooth. 更多...
 
VOID_T tuya_ble_set_serv_switch (BOOL_T swith)
 Set enable switch for bluetooth service 更多...
 
VOID_T tuya_ble_set_startup_attr (TUYA_BLE_ABILITY_T attr)
 Set abilitiy attribute of bluetooth 更多...
 
OPERATE_RET tuya_ble_start_user_beacon_adv (UCHAR_T *data, UCHAR_T len, UINT_T sec_time)
 Start user defined advertising of bluetooth with time limited 更多...
 
TUYA_BT_CONN_STAT tuya_bt_get_connect_status (VOID)
 Get connection status of bluetooth 更多...
 
VOID_T tuya_enable_ble_active (BOOL_T swith)
 
VOID_T tuya_enable_ble_dp_ctrl (BOOL_T swith)
 
VOID_T tuya_enable_ble_mftst (BOOL_T swith)
 
VOID_T tuya_enable_ble_netcfg (BOOL_T swith)
 
VOID_T tuya_enable_ble_timer (BOOL_T swith)
 
OPERATE_RET tuya_set_bt_device_name (CHAR_T *dev_name)
 Set name for bluetooth device. 更多...
 
OPERATE_RET tuya_svc_bt_init (VOID_T)
 Init tuya bluetooth service 更多...
 
OPERATE_RET ty_bt_dp_report (IN CONST DP_REPT_TYPE_E dp_rept_type, IN CONST VOID_T *data, IN BOOL_T sync)
 Report dp by bluetooth 更多...
 
VOID_T ty_bt_support_dp_sync_report (BOOL_T flag)
 Support dp sync report by bluetooth 更多...
 
OPERATE_RET ty_bt_update_local_key (UINT8_T *p_buf, UINT8_T len)
 Update local key 更多...
 

详细描述

Common process - Initialization

版本
0.1
日期
2020-11-09

函数说明

◆ is_bt_connected()

BOOL_T is_bt_connected ( VOID_T  )

Check bluetooth is connected.

参数
VOID
注解
This API is used to check whether the bluetooth is connected.
返回
be connected or not

◆ tuya_ble_disable_expt_unbind()

VOID_T tuya_ble_disable_expt_unbind ( VOID_T  )

Disable function for execept unbinding

参数
VOID
注解
This API is used for disable function for execept unbinding
返回
VOID

◆ tuya_ble_dp_response_query()

VOID_T tuya_ble_dp_response_query ( IN CONST BYTE_T *  dpid,
IN CONST BYTE_T  num 
)

Response dp query with report flag

参数
dpidquery dpid array
numquery dp num
注解
This API is used for responsing dp query with report flag
返回
VOID

◆ tuya_ble_get_serv_stat()

TUYA_BT_SERV_STAT tuya_ble_get_serv_stat ( VOID_T  )

Get status of bluetooth service

参数
VOID
注解
This API is used to get status of the bluetooth service.
返回
status of the bluetooth service

◆ tuya_ble_lowpower_handle()

VOID_T tuya_ble_lowpower_handle ( VOID_T  )

stop ble netcfg and plug_play when dev under lowpower status

参数
VOID
注解
This API is used for stopping ble netcfg and plug_play when dev under lowpower status
返回
VOID

◆ tuya_ble_monitor_init()

OPERATE_RET tuya_ble_monitor_init ( VOID_T  )

Monitor for bluetooth

参数
VOID
注解
This API is used for monitor for bluetooth. if the device connected cloud, start advertisement, otherwise stoo it.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tuya_ble_reg_get_bt_stat_cb()

OPERATE_RET tuya_ble_reg_get_bt_stat_cb ( IN CONST GET_BT_CONN_STAT_CB  bt_conn_stat_cb)

Register callback function for getting the connection status of bluetooth

参数
[in]bt_conn_stat_cbcallback function
注解
This API is used for registering callback function for getting the connection status of bluetooth
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tuya_ble_rept_netcfg_stat()

VOID_T tuya_ble_rept_netcfg_stat ( IN UINT_T  type)

Report netcfg status

参数
type0-report 1-query
注解
This API is used for reporting netcfg status
返回
VOID

◆ tuya_ble_restart_adv()

VOID_T tuya_ble_restart_adv ( VOID_T  )

Resend the ble adv data to hal and start ble adv

参数

note

返回
VOID

◆ tuya_ble_set_bt_para()

VOID_T tuya_ble_set_bt_para ( TUYA_BLE_BT_PARA para)

Set parameters for bluetooth.

参数
[in]paraparameters for bluetooth
注解
This API is used for setting parameters for bluetooth. this API should be called before bluetooth initialized.
返回
VOID

◆ tuya_ble_set_serv_switch()

VOID_T tuya_ble_set_serv_switch ( BOOL_T  swith)

Set enable switch for bluetooth service

参数
[in]switchenable switch: TRUE-open, FALSE-close
注解
This API is used for setting enable switch for bluetooth service, it should be called before sdk initialization.
返回
VOID

◆ tuya_ble_set_startup_attr()

VOID_T tuya_ble_set_startup_attr ( TUYA_BLE_ABILITY_T  attr)

Set abilitiy attribute of bluetooth

参数
attr
注解
This API is used to set abilitiy attribute of bluetooth.
返回
VOID

◆ tuya_ble_start_user_beacon_adv()

OPERATE_RET tuya_ble_start_user_beacon_adv ( UCHAR_T *  data,
UCHAR_T  len,
UINT_T  sec_time 
)

Start user defined advertising of bluetooth with time limited

参数
[in]dataadv data
[in]lenadv data lenth
[in]sec_timetime in second
注解
This API is used for registering callback function for advertisement scanning raw data processing
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tuya_bt_get_connect_status()

TUYA_BT_CONN_STAT tuya_bt_get_connect_status ( VOID  )

Get connection status of bluetooth

参数
VOID
注解
This API is used for getting the connection status of bluetooth
返回
connection status

◆ tuya_set_bt_device_name()

OPERATE_RET tuya_set_bt_device_name ( CHAR_T *  dev_name)

Set name for bluetooth device.

Set device name for bluetooth.

参数
[in]dev_namedevice name
注解
This API is used for setting name for bluetooth device. this API should be called before bluetooth initialized.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h
参数
[in]dev_namedevice name for bluetooth
注解
This API is used for setting device name for bluetooth. this API should be called before bluetooth initialized.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ tuya_svc_bt_init()

OPERATE_RET tuya_svc_bt_init ( VOID_T  )

Init tuya bluetooth service

参数
[in]VOID
注解
This API is used for initializing tuya bluetooth service
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ ty_bt_dp_report()

OPERATE_RET ty_bt_dp_report ( IN CONST DP_REPT_TYPE_E  dp_rept_type,
IN CONST VOID_T *  data,
IN BOOL_T  sync 
)

Report dp by bluetooth

参数
[in]dp_rept_typedp report type
[in]datadp data
[in]synctrue-support sync report
注解
This API is used for reporting dp data
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ ty_bt_support_dp_sync_report()

VOID_T ty_bt_support_dp_sync_report ( BOOL_T  flag)

Support dp sync report by bluetooth

参数
[in]flagtrue - enable, false - disable
注解
This API is used to support dp sync report by bluetooth
返回
VOID

◆ ty_bt_update_local_key()

OPERATE_RET ty_bt_update_local_key ( UINT8_T *  p_buf,
UINT8_T  len 
)

Update local key

参数
[in]p_buflocal key
[in]lenlenth of local key
注解
This API is used for update local key.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h