TuyaOS
tuya_iot_com_api.h
浏览该文件的文档.
1
9#ifndef __TUYA_IOT_COM_API_H
10#define __TUYA_IOT_COM_API_H
11
12#include "tuya_cloud_types.h"
13#include "tuya_cloud_com_defs.h"
14
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20
27
34
45OPERATE_RET tuya_iot_init_params(IN CONST CHAR_T *fs_storge_path, IN CONST TY_INIT_PARAMS_S *p_param);
46#define tuya_iot_init(fs_storge_path) \
47 tuya_iot_init_params(fs_storge_path, NULL)
48
58OPERATE_RET tuya_iot_kv_flash_init_param(IN CONST CHAR_T *fs_storge_path);
59#define tuya_iot_kv_flash_init tuya_iot_kv_flash_init_param
60
69VOID tuya_iot_oem_set(IN CONST BOOL_T oem);
70
81OPERATE_RET tuya_iot_set_udf_parameter(IN CONST CHAR_T *udf);
82
93VOID tuya_iot_upload_rst_log_set(IN CONST BOOL_T upload);
94
105VOID tuya_iot_ignore_upgrade_set(IN CONST BOOL_T ignore);
106
116
126
140OPERATE_RET tuya_iot_upgrade_gw_notify(IN CONST FW_UG_S *fw,
141 IN CONST GET_FILE_DATA_CB get_file_cb, \
142 IN CONST UPGRADE_NOTIFY_CB upgrd_nofity_cb, \
143 IN CONST PVOID_T pri_data, \
144 BOOL_T notify, UINT_T download_buf_size);
145#define tuya_iot_upgrade_gw(fw, get_file_cb, upgrd_nofity_cb, pri_data) \
146 tuya_iot_upgrade_gw_notify(fw, get_file_cb, upgrd_nofity_cb, pri_data, TRUE, 0)
147
156OPERATE_RET tuya_iot_refuse_upgrade(IN CONST FW_UG_S *fw, IN CONST CHAR_T *dev_id);
157
158
167OPERATE_RET tuya_iot_reset_upgrade_detect_timer(IN CONST INT_T time_ms);
168
184OPERATE_RET tuya_iot_upgrade_dev_notify(IN CONST CHAR_T *devid,
185 IN CONST FW_UG_S *fw, \
186 IN CONST GET_FILE_DATA_CB get_file_cb, \
187 IN CONST UPGRADE_NOTIFY_CB upgrd_nofity_cb, \
188 IN CONST PVOID_T pri_data, \
189 BOOL_T notify, UINT_T download_buf_size);
190#define tuya_iot_upgrade_dev(devid, fw, get_file_cb, upgrd_nofity_cb, pri_data) \
191 tuya_iot_upgrade_dev_notify(devid, fw, get_file_cb, upgrd_nofity_cb, pri_data, TRUE, 0)
192
202DP_DESC_IF_S *tuya_iot_get_dp_desc(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid);
203
213DP_PROP_VALUE_U *tuya_iot_get_dp_prop_value(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid);
214
225OPERATE_RET tuya_iot_dev_upgd_progress_with_remain_time(IN CONST UINT_T percent,
226 IN CONST CHAR_T *devid, IN CONST DEV_TYPE_T tp, IN CONST UINT_T remain_time);
227#define tuya_iot_dev_upgd_progress_rept(percent, devid, tp) \
228 tuya_iot_dev_upgd_progress_with_remain_time(percent, devid, tp, 0)
229
239OPERATE_RET tuya_iot_dev_upgd_result_report(IN CONST CHAR_T *dev_id, IN CONST DEV_TYPE_T type, IN CONST INT_T result);
240
249
261OPERATE_RET dev_report_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
262
274OPERATE_RET dev_report_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
275
287OPERATE_RET dev_query_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
288
300OPERATE_RET dev_query_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
301
313OPERATE_RET dev_sync_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
314
326OPERATE_RET dev_sync_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt);
327
342OPERATE_RET dev_report_dp_raw_sync_extend(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid, \
343 IN CONST BYTE_T *data, IN CONST UINT_T len, \
344 IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans);
345#define dev_report_dp_raw_sync(dev_id, dpid, data, len, timeout) \
346 dev_report_dp_raw_sync_extend(dev_id, dpid, data, len, timeout, TRUE)
347
363OPERATE_RET dev_report_dp_raw_sync_extend_with_time(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid, \
364 IN CONST BYTE_T *data, IN CONST UINT_T len, \
365 IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans, \
366 IN CONST CHAR_T *time_str);
367#define dev_report_dp_raw_sync_with_time(dev_id, dpid, data, len, timeout, time_str) \
368 dev_report_dp_raw_sync_extend_with_time(dev_id, dpid, data, len, timeout, TRUE, time_str)
369
384OPERATE_RET dev_report_dp_stat_sync_extend(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, \
385 IN CONST UINT_T cnt, IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans);
386#define dev_report_dp_stat_sync(dev_id, dp_data, cnt, timeout) \
387 dev_report_dp_stat_sync_extend(dev_id, dp_data, cnt, timeout, TRUE)
388
398OPERATE_RET tuya_iot_get_wakeup_data(INOUT BYTE_T *wakeup_data_arr, INOUT UINT_T *p_len);
399
409OPERATE_RET tuya_iot_get_heartbeat_data(INOUT BYTE_T *heartbeat_data_arr, INOUT UINT_T *p_len);
410
418
426
434
444OPERATE_RET tuya_iot_send_custom_mqtt_msg(IN CONST UINT_T protocol, IN CONST BYTE_T *p_data);
445
447//* Function: tuya_iot_media_init
448//* Input: none
449//* Output: none
450//* Return: OPERATE_RET
451//***********************************************************/
452//OPERATE_RET tuya_iot_media_init(VOID);
453
464OPERATE_RET tuya_iot_upload_incre_data(IN CONST USHORT_T map_id, IN CONST UINT_T offset, IN CONST BYTE_T *pbuffer, IN CONST USHORT_T buf_len);
465
476OPERATE_RET tuya_iot_media_data_report(IN CONST FLOW_BODY_ST *dt_body, IN CONST UINT_T timeout);
477
488OPERATE_RET tuya_iot_media_data_report_v2(IN CONST FLOW_BODY_V2_ST *dt_body, IN CONST UINT_T timeout);
489
490#define tuya_iot_upload_layout_buffer(map_id, buffer, len) \
491 tuya_iot_map_cleaner_upload_buffer(map_id, buffer, len, "layout/lay.bin", UP_CLEANER_MAP)
492#define tuya_iot_upload_route_buffer(map_id, buffer, len) \
493 tuya_iot_map_cleaner_upload_buffer(map_id, buffer, len, "route/rou.bin", UP_CLEANER_PATH)
494
495#define tuya_iot_upload_layout_file(map_id, local_file_name) \
496 tuya_iot_map_cleaner_upload_file(map_id, local_file_name, "layout/lay.bin", UP_CLEANER_MAP)
497#define tuya_iot_upload_route_file(map_id, local_file_name) \
498 tuya_iot_map_cleaner_upload_file(map_id, local_file_name, "route/rou.bin", UP_CLEANER_PATH)
499
512OPERATE_RET tuya_iot_map_cleaner_upload_buffer(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, \
513 IN CONST CHAR_T *cloud_file_name, IN CONST UP_MAP_TYPE_E map_type);
514
526OPERATE_RET tuya_iot_map_cleaner_upload_file(IN CONST INT_T map_id, IN CONST CHAR_T *local_file_name, \
527 IN CONST CHAR_T *cloud_file_name, IN CONST UP_MAP_TYPE_E map_type);
528
540OPERATE_RET tuya_iot_map_record_upload_buffer(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *descript);
541
554OPERATE_RET tuya_iot_map_record_upload_buffer_with_filename(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *cloud_file_name, IN CONST CHAR_T *descript);
555
561CHAR_T *tuya_iot_get_gw_id(VOID);
562
570OPERATE_RET tuya_iot_get_region_info(INOUT TY_IOT_REGION_INFO_S *p_region_info);
571
580OPERATE_RET tuya_iot_get_custom_cfg(IN CONST TY_CUSTOM_CFG_E type, OUT CHAR_T **pp_cfg_str);
581
589OPERATE_RET tuya_iot_release_custom_cfg(IN CHAR_T *p_cfg_str);
590
598OPERATE_RET tuya_iot_get_location_info(INOUT TY_LOCATION_INFO_S *p_location);
599
607OPERATE_RET tuya_iot_set_log_attr(IN CONST INT_T log_level);
608
616OPERATE_RET tuya_iot_set_log_bool_time(BOOL_T if_ms_level);
617
629OPERATE_RET tuya_iot_custom_data_report_sync(IN CONST BYTE_T *data, IN CONST INT_T len, IN CONST CHAR_T *topic,
630 IN CONST BYTE_T qos, IN CONST UINT_T timeout);
631
643OPERATE_RET tuya_iot_custom_data_report_async(IN CONST BYTE_T *data, IN CONST INT_T len, IN CONST CHAR_T *topic,
644 IN CONST BYTE_T qos, IN CONST UINT_T timeout);
645
652
653
662
673OPERATE_RET tuya_iot_dp_low_power_query(IN CONST UCHAR_T *dps, IN CONST UINT_T cnt,
674 OUT TY_RECV_OBJ_DP_S **obj_dps, OUT TY_RECV_RAW_DP_S **raw_dps);
675
683void tuya_iot_get_third_cloud_ca(CHAR_T *p_url);
684
685#ifdef __cplusplus
686}
687#endif
688
689#endif
Definition of dp description
Definition: tuya_cloud_com_defs.h:390
Definition of DP handlers
Definition: tuya_cloud_com_defs.h:565
Definition: tuya_cloud_com_defs.h:771
Definition: tuya_cloud_com_defs.h:780
tuya sdk ota firmware info
Definition: tuya_cloud_com_defs.h:584
Definition of TUYA DevOS init param
Definition: tuya_cloud_com_defs.h:163
Definition of IoT callbacks used by APP
Definition: tuya_cloud_com_defs.h:837
Definition of region info
Definition: tuya_cloud_com_defs.h:797
Definition of location info
Definition: tuya_cloud_com_defs.h:819
Definition of structured dp
Definition: tuya_cloud_com_defs.h:445
Definition of recved structured dp
Definition: tuya_cloud_com_defs.h:459
Definition of recved raw dp
Definition: tuya_cloud_com_defs.h:477
OPERATE_RET dev_report_dp_raw_sync_extend(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid, IN CONST BYTE_T *data, IN CONST UINT_T len, IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans)
dev_report_dp_raw_sync_extend @desc report dp raw info synced.
OPERATE_RET tuya_iot_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_RAW_DP_S **raw_dps)
tuya_iot_dp_low_power_query
OPERATE_RET tuya_iot_custom_data_report_async(IN CONST BYTE_T *data, IN CONST INT_T len, IN CONST CHAR_T *topic, IN CONST BYTE_T qos, IN CONST UINT_T timeout)
tuya_iot_custom_data_report_async
INT_T tuya_iot_get_heartbeat_interval(VOID)
tuya_iot_get_heartbeat_interval @desc get mqtt heartbeat interval
CHAR_T * tuya_iot_get_os_adapt_info(VOID_T)
tuya_iot_get_os_adapt_info
OPERATE_RET dev_report_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_report_dp_json_async @desc report dp info a-synced.
OPERATE_RET tuya_iot_get_wakeup_data(INOUT BYTE_T *wakeup_data_arr, INOUT UINT_T *p_len)
tuya_iot_get_wakeup_data @desc get mqtt wakeup string pattern
VOID tuya_iot_mqtt_disconnect(VOID)
tuya_iot_mqtt_disconnect @desc force disconnect MQTT
OPERATE_RET dev_sync_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_sync_dp_json_async @desc report dp info a-synced.
OPERATE_RET tuya_iot_get_location_info(INOUT TY_LOCATION_INFO_S *p_location)
tuya_iot_get_location_info
OPERATE_RET tuya_iot_media_data_report_v2(IN CONST FLOW_BODY_V2_ST *dt_body, IN CONST UINT_T timeout)
tuya_iot_media_data_report_v2
OPERATE_RET tuya_iot_reset_upgrade_detect_timer(IN CONST INT_T time_ms)
tuya_iot_reset_upgrade_detect_timer @desc reset the upgrade detect time
OPERATE_RET tuya_iot_init_params(IN CONST CHAR_T *fs_storge_path, IN CONST TY_INIT_PARAMS_S *p_param)
tuya_iot_init_params @desc init tuya_iot_sdk
OPERATE_RET tuya_iot_set_log_attr(IN CONST INT_T log_level)
tuya_iot_set_log_attr
CHAR_T * tuya_iot_get_sdk_info(VOID)
tuya_iot_get_sdk_info
OPERATE_RET tuya_iot_map_record_upload_buffer(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *descript)
tuya_iot_map_record_upload_buffer @desc sweeper function. upload record map info
OPERATE_RET dev_report_dp_stat_sync_extend(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt, IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans)
dev_report_dp_stat_sync_extend @desc: report dp status info synced. if time_stamp==0,...
OPERATE_RET dev_report_dp_raw_sync_extend_with_time(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid, IN CONST BYTE_T *data, IN CONST UINT_T len, IN CONST UINT_T timeout, IN CONST BOOL_T enable_auto_retrans, IN CONST CHAR_T *time_str)
dev_report_dp_raw_sync_extend_with_time @desc report dp raw info synced.
OPERATE_RET tuya_iot_dev_upgd_result_report(IN CONST CHAR_T *dev_id, IN CONST DEV_TYPE_T type, IN CONST INT_T result)
tuya_iot_dev_upgd_result_report
OPERATE_RET tuya_iot_get_custom_cfg(IN CONST TY_CUSTOM_CFG_E type, OUT CHAR_T **pp_cfg_str)
tuya_iot_get_custom_cfg
DP_PROP_VALUE_U * tuya_iot_get_dp_prop_value(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid)
tuya_iot_get_dp_prop_value @desc get dp value of a sub-device and a dp id
OPERATE_RET tuya_iot_dev_upgd_progress_with_remain_time(IN CONST UINT_T percent, IN CONST CHAR_T *devid, IN CONST DEV_TYPE_T tp, IN CONST UINT_T remain_time)
tuya_iot_dev_upgd_progress_with_remain_time
OPERATE_RET dev_query_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_query_dp_json_async_force @desc report dp info a-synced.
OPERATE_RET tuya_iot_map_cleaner_upload_buffer(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *cloud_file_name, IN CONST UP_MAP_TYPE_E map_type)
tuya_iot_map_cleaner_upload_buffer @desc sweeper function. upload cleaner map info
INT_T tuya_iot_get_mqtt_socket_fd(VOID)
tuya_iot_get_mqtt_socket_fd @desc get curr mqtt socket fd
OPERATE_RET tuya_iot_upgrade_dev_notify(IN CONST CHAR_T *devid, IN CONST FW_UG_S *fw, IN CONST GET_FILE_DATA_CB get_file_cb, IN CONST UPGRADE_NOTIFY_CB upgrd_nofity_cb, IN CONST PVOID_T pri_data, BOOL_T notify, UINT_T download_buf_size)
tuya_iot_upgrade_dev_notify @desc upgrage sub-device/soc/mcu firmware
void tuya_iot_get_third_cloud_ca(CHAR_T *p_url)
according url get third cloud ca
OPERATE_RET tuya_iot_set_udf_parameter(IN CONST CHAR_T *udf)
tuya_iot_set_udf_parameter @desc set user defined funtions
VOID tuya_iot_oem_set(IN CONST BOOL_T oem)
tuya_iot_oem_set @desc set oem mode
OPERATE_RET tuya_iot_media_data_report(IN CONST FLOW_BODY_ST *dt_body, IN CONST UINT_T timeout)
tuya_iot_media_data_report
OPERATE_RET tuya_iot_release_custom_cfg(IN CHAR_T *p_cfg_str)
tuya_iot_release_custom_cfg
VOID tuya_iot_upload_rst_log_set(IN CONST BOOL_T upload)
tuya_iot_upload_rst_log_set @desc set rst log upload mode
OPERATE_RET tuya_iot_regist_dp_rept_cb(IN DP_REPT_HADLE_CB_S *dp_rept_cbs)
tuya_iot_regist_dp_rept_cb
CHAR_T * tuya_iot_get_gw_id(VOID)
tuya_iot_get_gw_id
DP_DESC_IF_S * tuya_iot_get_dp_desc(IN CONST CHAR_T *dev_id, IN CONST BYTE_T dpid)
tuya_iot_get_dp_desc @desc get dp info of a sub-device and a dp id
OPERATE_RET tuya_iot_book_wakeup_topic(VOID)
tuya_iot_book_wakeup_topic @desc unscribe mqtt msg topic and subscribe wakeup topic
OPERATE_RET tuya_iot_send_custom_mqtt_msg(IN CONST UINT_T protocol, IN CONST BYTE_T *p_data)
tuya_iot_send_custom_mqtt_msg @desc send a custom protocol mqtt msg
OPERATE_RET tuya_iot_refuse_upgrade(IN CONST FW_UG_S *fw, IN CONST CHAR_T *dev_id)
tuya_iot_refuse_upgrade
VOID tuya_iot_ignore_upgrade_set(IN CONST BOOL_T ignore)
tuya_iot_ignore_upgrade_set @desc set rst log upload mode
OPERATE_RET dev_query_dp_json_async(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_query_dp_json_async @desc report dp info a-synced.
VOID tuya_iot_app_cbs_init(IN CONST TY_IOT_APP_CBS_S *app_cbs)
tuya_iot_app_cbs_init
OPERATE_RET tuya_iot_custom_data_report_sync(IN CONST BYTE_T *data, IN CONST INT_T len, IN CONST CHAR_T *topic, IN CONST BYTE_T qos, IN CONST UINT_T timeout)
tuya_iot_custom_data_report_sync
OPERATE_RET tuya_iot_map_record_upload_buffer_with_filename(IN CONST INT_T map_id, IN CONST BYTE_T *buffer, IN CONST UINT_T len, IN CONST CHAR_T *cloud_file_name, IN CONST CHAR_T *descript)
tuya_iot_map_record_upload_buffer_with_filename @desc sweeper function. upload record map info
BYTE_T tuya_iot_get_active_stat(VOID)
tuya_iot_get_active_stat
OPERATE_RET tuya_iot_kv_flash_init_param(IN CONST CHAR_T *fs_storge_path)
tuya_iot_kv_flash_init_param @desc init kv flash
OPERATE_RET tuya_iot_get_region_info(INOUT TY_IOT_REGION_INFO_S *p_region_info)
tuya_iot_get_region_info
OPERATE_RET tuya_iot_get_heartbeat_data(INOUT BYTE_T *heartbeat_data_arr, INOUT UINT_T *p_len)
tuya_iot_get_heartbeat_data @desc get mqtt heartbeat string pattern
OPERATE_RET tuya_iot_upgrade_gw_notify(IN CONST FW_UG_S *fw, IN CONST GET_FILE_DATA_CB get_file_cb, IN CONST UPGRADE_NOTIFY_CB upgrd_nofity_cb, IN CONST PVOID_T pri_data, BOOL_T notify, UINT_T download_buf_size)
tuya_iot_upgrade_gw_notify @desc upgrage gateway firmware
VOID tuya_iot_mqtt_restart(VOID)
tuya_iot_mqtt_restart @desc restart MQTT
OPERATE_RET tuya_iot_set_log_bool_time(BOOL_T if_ms_level)
tuya_iot_set_log_bool_time
OPERATE_RET tuya_iot_upload_incre_data(IN CONST USHORT_T map_id, IN CONST UINT_T offset, IN CONST BYTE_T *pbuffer, IN CONST USHORT_T buf_len)
‍***********************************************************
OPERATE_RET dev_sync_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_sync_dp_json_async_force @desc report dp info a-synced.
OPERATE_RET tuya_iot_map_cleaner_upload_file(IN CONST INT_T map_id, IN CONST CHAR_T *local_file_name, IN CONST CHAR_T *cloud_file_name, IN CONST UP_MAP_TYPE_E map_type)
tuya_iot_map_cleaner_upload_file @desc sweeper function. upload cleaner map info
OPERATE_RET dev_report_dp_json_async_force(IN CONST CHAR_T *dev_id, IN CONST TY_OBJ_DP_S *dp_data, IN CONST UINT_T cnt)
dev_report_dp_json_async_force @desc report dp info a-synced.
Definition of dp prop value
Definition: tuya_cloud_com_defs.h:342