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

Common process - Initialization 更多...

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

浏览源代码.

结构体

struct  TY_RAW_DP_REPT_S
 dp data report information for raw type 更多...
 

类型定义

typedef struct msg_data_s MSG_DATA_S
 info of dp message data
 
typedef OPERATE_RET(* sf_special_dp_cb) (IN CONST UINT16_T dpid, IN CONST ty_cJSON *dp_obj)
 
typedef OPERATE_RET(* sf_subdev_dev_cntl_traversal_cb) (subdev_dev_cntl_cb, VOID *param)
 
typedef BOOL_T(* sf_subdev_reliable_transfer_check_cb) (IN CHAR_T *id)
 
typedef UINT_T(* sf_subdev_reliable_transfer_time_get_cb) (IN CHAR_T *id)
 
typedef BOOL_T(* sf_subdev_report_check_cb) (IN CHAR_T *id)
 
typedef OPERATE_RET(* sf_trans_type_cb) (IN CONST UINT16_T dpid, IN CONST ty_cJSON *data_js)
 
typedef OPERATE_RET(* subdev_dev_cntl_cb) (IN DEV_CNTL_N_S *subdev_cntl, VOID *param)
 

函数

DP_CNTL_Ssf_dp_data_get (IN CHAR_T *id, IN CONST uint8_t dp_id)
 Get dp control information 更多...
 
BOOL_T sf_dp_data_is_equl (IN ty_cJSON *dp_cmd)
 Check the dp data is same 更多...
 
OPERATE_RET sf_dp_low_power_query (IN CONST UCHAR_T *dps, IN CONST UINT_T cnt, OUT TY_RECV_OBJ_DP_S **obj_dps, OUT TY_RECV_MULTI_RAW_DP_S **raw_dps)
 Query dp for low power 更多...
 
OPERATE_RET sf_dp_set_delete_null_dp (BOOL_T enable)
 Set enable switch for deleting null dp 更多...
 
OPERATE_RET sf_dp_set_report_timeout (UINT_T timeout_s)
 Set default dp report timeout 更多...
 
UINT_T sf_get_serial_no (VOID)
 Get serial number for dp report 更多...
 
CHAR_T * sf_pack_local_obj_dp_data (IN DEV_CNTL_N_S *dev_cntl, IN CONST UINT_T max_len, IN CONST BOOL_T addDevId, OUT BOOL_T *p_all_data_packed, BOOL_T reset_flow_ctl, IN CONST BOOL_T is_lan, OUT CHAR_T **time_str)
 Packed the local dp data as string in json format 更多...
 
OPERATE_RET sf_regist_dp_rept_cb (IN DP_REPT_HADLE_CB_S *dp_rept_cbs)
 Register callback function for dp report 更多...
 
OPERATE_RET sf_respone_obj_dp_query (IN UINT_T cmd_tp, IN CONST ty_cJSON *pCidArr, IN CONST ty_cJSON *pDpIdArr)
 Response for dp query 更多...
 
OPERATE_RET sf_send_gw_dev_cmd (IN SF_GW_DEV_CMD_S *gd_cmd)
 Send dp command 更多...
 
OPERATE_RET sf_special_dp_register_cb (IN sf_special_dp_cb handler)
 Register special dp callback function 更多...
 
VOID sf_start_sync_obj_dp (VOID)
 Start to synchronize dp data 更多...
 
OPERATE_RET sf_subdev_register_cb (IN SF_SUBDEV_HANDLE_CB_S *cbs)
 Register callback function for subdevice 更多...
 
OPERATE_RET sf_trans_type_register_cb (IN CONST DP_TRANS_TYPE_T trans, IN sf_trans_type_cb handler)
 Register callback function for different kind of transport type 更多...
 
OPERATE_RET smart_frame_init (VOID)
 Smart frame init 更多...
 
BOOL_T ty_check_dpid_need_rept (CHAR_T *dev_id, BYTE_T dpid, DP_CMD_TYPE_E type, DP_DESC_IF_S *dp_desc)
 check dp id need report 更多...
 
OPERATE_RET ty_dp_report (IN CONST DP_REPT_TYPE_E dp_rept_type, IN VOID_T *dp_rept)
 Report dp data 更多...
 
VOID_T ty_free_obj_dp_data (TY_OBJ_DP_S *dp_data, UINT_T cnt)
 ty_free_obj_dp_data @desc free memory of object dp 更多...
 
UINT8_T ty_get_dpid_rept_rule (VOID_T)
 get dp id report rule 更多...
 
OPERATE_RET ty_get_obj_dp_from_json (IN CHAR_T *dev_id, IN CONST CHAR_T *json_str, OUT TY_OBJ_DP_S **dp_data, OUT UINT_T *cnt)
 ty_dp_json_to_obj @desc transfer json format dp to object 更多...
 
VOID_T ty_print_dp_time (VOID_T)
 Print the key time for dp report 更多...
 
VOID ty_set_dpid_rept_rule (UINT8_T rept_rule)
 set dp id report rule 更多...
 

详细描述

Common process - Initialization

作者
nzy@t.nosp@m.uya..nosp@m.com
版本
0.1
日期
2020-11-09

函数说明

◆ sf_dp_data_get()

DP_CNTL_S * sf_dp_data_get ( IN CHAR_T *  id,
IN CONST uint8_t  dp_id 
)

Get dp control information

参数
[in]iddevice id
[in]dp_iddp id
注解
This API is used for getting dp control information by device id and dp id.
返回
the dp control information

◆ sf_dp_data_is_equl()

BOOL_T sf_dp_data_is_equl ( IN ty_cJSON dp_cmd)

Check the dp data is same

参数
[in]dp_cmddp information in josn format
注解
This API is used for checking the dp data is same.
返回
the result whether the dp data is same.

◆ sf_dp_low_power_query()

OPERATE_RET sf_dp_low_power_query ( IN CONST UCHAR_T *  dps,
IN CONST UINT_T  cnt,
OUT TY_RECV_OBJ_DP_S **  obj_dps,
OUT TY_RECV_MULTI_RAW_DP_S **  raw_dps 
)

Query dp for low power

参数
[in]dpsdp string
[in]cntdp count
[out]obj_dpsdp in object format
[out]raw_dpsdp in raw format
注解
This API is used for quering dp for low power
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_dp_set_delete_null_dp()

OPERATE_RET sf_dp_set_delete_null_dp ( BOOL_T  enable)

Set enable switch for deleting null dp

参数
[in]enableenable switch
注解
This API is used for setting enable switch for deleting null dp.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_dp_set_report_timeout()

OPERATE_RET sf_dp_set_report_timeout ( UINT_T  timeout_s)

Set default dp report timeout

参数
[in]timeout_sin second
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_get_serial_no()

UINT_T sf_get_serial_no ( VOID  )

Get serial number for dp report

参数
VOID
注解
This API is used for getting serial number for dp report
返回
the serial number

◆ sf_pack_local_obj_dp_data()

CHAR_T * sf_pack_local_obj_dp_data ( IN DEV_CNTL_N_S dev_cntl,
IN CONST UINT_T  max_len,
IN CONST BOOL_T  addDevId,
OUT BOOL_T *  p_all_data_packed,
BOOL_T  reset_flow_ctl,
IN CONST BOOL_T  is_lan,
OUT CHAR_T **  time_str 
)

Packed the local dp data as string in json format

参数
[in]dev_cntldevice control handle
[in]max_lenmax lenth of the dp string
[in]addDevIdif add devid or not
[out]p_all_data_packedif all dp is packed or not
[in]reset_flow_ctlif need reset flow control or not
[in]is_lanif be lan or not
注解
This API is used for packing the local dp data as string in json format
返回
the dp string in json format

◆ sf_regist_dp_rept_cb()

OPERATE_RET sf_regist_dp_rept_cb ( IN DP_REPT_HADLE_CB_S dp_rept_cbs)

Register callback function for dp report

参数
[in]dp_rept_cbscallback functions
注解
This API is used for registering callback function for dp report.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_respone_obj_dp_query()

OPERATE_RET sf_respone_obj_dp_query ( IN UINT_T  cmd_tp,
IN CONST ty_cJSON pCidArr,
IN CONST ty_cJSON pDpIdArr 
)

Response for dp query

参数
[in]pCidArrcid in json format
[in]pDpIdArrdp id in json format
注解
This API is used for response for dp query
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_send_gw_dev_cmd()

OPERATE_RET sf_send_gw_dev_cmd ( IN SF_GW_DEV_CMD_S gd_cmd)

Send dp command

参数
[in]gd_cmddp command information
注解
This API is used for sending dp command from mqtt/lan/bt
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_special_dp_register_cb()

OPERATE_RET sf_special_dp_register_cb ( IN sf_special_dp_cb  handler)

Register special dp callback function

参数
[in]handlerspecial dp callback function
注解
This API is used to register special dp callback function.
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_start_sync_obj_dp()

VOID sf_start_sync_obj_dp ( VOID  )

Start to synchronize dp data

参数
VOID
注解
This API is used to start a timer task to synchronize dp data to the cloud/app
返回
VOID

◆ sf_subdev_register_cb()

OPERATE_RET sf_subdev_register_cb ( IN SF_SUBDEV_HANDLE_CB_S cbs)

Register callback function for subdevice

参数
[in]cbscallback functions
注解
This API is used for registering callback function for subdevice
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ sf_trans_type_register_cb()

OPERATE_RET sf_trans_type_register_cb ( IN CONST DP_TRANS_TYPE_T  trans,
IN sf_trans_type_cb  handler 
)

Register callback function for different kind of transport type

参数
[in]transtransport type
[in]handlercallback function
注解
This API is used for registering callback function for different kind of transport type
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ smart_frame_init()

OPERATE_RET smart_frame_init ( VOID  )

Smart frame init

参数
VOID
注解
This API is used for initializing the resource of smart frame
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ ty_check_dpid_need_rept()

BOOL_T ty_check_dpid_need_rept ( CHAR_T *  dev_id,
BYTE_T  dpid,
DP_CMD_TYPE_E  type,
DP_DESC_IF_S dp_desc 
)

check dp id need report

参数
[in]dev_iddev id
[in]dpiddp id
[in]typeref type DP_CMD_TYPE_E
[in]DP_DESC_IF_Sdp desc info
注解
This API is used to check if dp id need rept
返回
true:need rept,false:no need rept

◆ ty_dp_report()

OPERATE_RET ty_dp_report ( IN CONST DP_REPT_TYPE_E  dp_rept_type,
IN VOID_T *  dp_rept 
)

Report dp data

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

◆ ty_free_obj_dp_data()

VOID_T ty_free_obj_dp_data ( TY_OBJ_DP_S dp_data,
UINT_T  cnt 
)

ty_free_obj_dp_data @desc free memory of object dp

参数
[in]dp_datadp data
[in]cntdp count
注解
This API is used to free memory of object dp.
返回
VOID

◆ ty_get_dpid_rept_rule()

UINT8_T ty_get_dpid_rept_rule ( VOID_T  )

get dp id report rule

返回
dp id rept vaule

◆ ty_get_obj_dp_from_json()

OPERATE_RET ty_get_obj_dp_from_json ( IN CHAR_T *  dev_id,
IN CONST CHAR_T *  json_str,
OUT TY_OBJ_DP_S **  dp_data,
OUT UINT_T *  cnt 
)

ty_dp_json_to_obj @desc transfer json format dp to object

参数
[in]dev_idif sub-device, then devid = sub-device_id if gateway/soc/mcu, then devid = NULL
[in]json_strstring in json format
[OUT]dp_data: dp array header
[OUT]cnt: dp array count
注解
This API is used to transfer json format dp to object. Memory of dp_data need to be freed.
返回
OPRT_OK: success Other: fail

◆ ty_print_dp_time()

VOID_T ty_print_dp_time ( VOID_T  )

Print the key time for dp report

参数
VOID
注解
This API is used to print the key time for dp report
返回
VOID

◆ ty_set_dpid_rept_rule()

VOID ty_set_dpid_rept_rule ( UINT8_T  rept_rule)

set dp id report rule

参数
[in]rept_ruleref to DP_ID_REPT_TYPE_E
注解
This API is used to set dp id report rule
返回
VOID