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

Common process - Initialization 更多...

#include "tuya_cloud_types.h"
#include "tuya_cloud_com_defs.h"
#include "base_event_info.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
 

函数

OPERATE_RET bt_netcfg_init (VOID_T)
 Init network configuration by bluetooth 更多...
 
OPERATE_RET bt_netcfg_uninit (VOID_T)
 Uninit network configuration by bluetooth 更多...
 
BOOL_T is_bt_connected (VOID_T)
 Check bluetooth is connected. 更多...
 
VOID_T tuya_ble_connect_enable (BOOL_T enable)
 Control the BLE fearture 更多...
 
VOID_T tuya_ble_disable_expt_unbind (VOID_T)
 Disable function for execept unbinding 更多...
 
BOOL_T tuya_ble_is_serv_opened (VOID_T)
 Check bluetooth service is available 更多...
 
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_restart_adv (VOID_T)
 Resend the ble adv data to hal and start ble adv 更多...
 
VOID_T tuya_ble_set_auto_close (BOOL_T auto_close)
 Close or open ble adv when mqtt disconnect or connected 更多...
 
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 更多...
 
TUYA_BT_CONN_STAT tuya_bt_get_connect_status (VOID)
 Get connection status of bluetooth 更多...
 
OPERATE_RET tuya_set_bt_device_name (CHAR_T *dev_name)
 Set name for bluetooth device. 更多...
 
OPERATE_RET ty_ble_init_env_for_mftest (VOID_T)
 
OPERATE_RET ty_bt_dp_report (IN CONST DP_REPT_TYPE_E dp_rept_type, IN CONST VOID_T *data)
 Report dp by bluetooth 更多...
 
OPERATE_RET ty_bt_init_env (IN CONST TY_BT_SDK_PARAM_S *p)
 Init the running environment for 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

函数说明

◆ bt_netcfg_init()

OPERATE_RET bt_netcfg_init ( VOID_T  )

Init network configuration by bluetooth

参数
VOID
注解
This API is used for initializing network configuration by bluetooth
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ bt_netcfg_uninit()

OPERATE_RET bt_netcfg_uninit ( VOID_T  )

Uninit network configuration by bluetooth

参数
VOID
注解
This API is used for uninitializing network configuration by bluetooth
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ 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_connect_enable()

VOID_T tuya_ble_connect_enable ( BOOL_T  enable)

Control the BLE fearture

参数
enable.TRUEenable FALSE disable the ble feature
注解
Currrent system default BLE fearture is enabled
返回
VOID

◆ 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_is_serv_opened()

BOOL_T tuya_ble_is_serv_opened ( VOID_T  )

Check bluetooth service is available

参数
VOID
注解
This API is used to check the bluetooth service is available.
返回
TRUE enable, FALSE disable

◆ 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_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_auto_close()

VOID_T tuya_ble_set_auto_close ( BOOL_T  auto_close)

Close or open ble adv when mqtt disconnect or connected

参数
auto_close
注解
Currrent system defualt action is auto close or open ble when mqtt disconnect or connected
返回
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_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.
返回
VOID

◆ ty_bt_dp_report()

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

Report dp by bluetooth

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

◆ ty_bt_init_env()

OPERATE_RET ty_bt_init_env ( IN CONST TY_BT_SDK_PARAM_S p)

Init the running environment for bluetooth.

参数
[in]pinitial parameters for bluetooth
注解
This API is used for initializing the running environment for bluetooth.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ 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