13#include "tuya_cloud_types.h"
14#include "tuya_cloud_com_defs.h"
17#include "tuya_error_code.h"
20#if defined(ENABLE_WIFI_SERVICE) && (ENABLE_WIFI_SERVICE==1)
29#define SERIAL_NO_STR_LEN 32
30#define GET_ACCESS_TOKEN_INTERVAL (300 * 1000)
36 CHAR_T uuid[GW_UUID_LEN + 1];
37 CHAR_T auth_key[AUTH_KEY_LEN + 1];
38 CHAR_T psk_key[PSK_KEY_LEN + 1];
46 CHAR_T uuid[GW_UUID_LEN + 1];
48 CHAR_T psk_key[PSK_KEY_LEN + 1];
50 CHAR_T auth_key[AUTH_KEY_LEN + 1];
52#if defined(ENABLE_WIFI_SERVICE) && (ENABLE_WIFI_SERVICE==1)
54 CHAR_T ap_ssid[WIFI_SSID_LEN + 1];
56 CHAR_T ap_passwd[WIFI_PASSWD_LEN + 1];
59#if (defined(ENABLE_WIFI_SERVICE) && (ENABLE_WIFI_SERVICE==1)) || (defined(GW_SUPPORT_COUNTRY_CODE) && (GW_SUPPORT_COUNTRY_CODE==1))
61 CHAR_T country_code[COUNTRY_CODE_LEN];
63#if defined(GPRS_GW) && (GPRS_GW==1)
65 CHAR_T imei[TUYA_IMEI_LEN + 1];
67 CHAR_T sn[TUYA_SN_LEN + 1];
71#if defined(ENABLE_BT_SERVICE) && (ENABLE_BT_SERVICE == 1)
73 CHAR_T bt_mac[BT_MAC_LEN + 1];
75 CHAR_T bt_hid[BT_HID_LEN + 1];
78 CHAR_T fac_pin[20 + 1];
80 CHAR_T psk30_key[PSK_KEY_LEN + 1];
84typedef BYTE_T GW_WORK_STAT_T;
88#define PROXY_ACTIVING (3)
89#define PROXY_ACTIVATED (4)
95#if defined(ENABLE_WIFI_SERVICE) && (ENABLE_WIFI_SERVICE==1)
97 GW_WF_NWC_STAT_T nc_tp;
101 CHAR_T ssid[WIFI_SSID_LEN + 1];
103 CHAR_T passwd[WIFI_PASSWD_LEN + 1];
110 CHAR_T token[TOKEN_LEN + 1];
112 CHAR_T region[REGION_LEN + 1];
114 CHAR_T regist_key[REGIST_KEY_LEN + 1];
126 CHAR_T
id[GW_ID_LEN + 1];
128 CHAR_T sw_ver[SW_VER_LEN + 1];
130 CHAR_T bs_ver[SW_VER_LEN + 1];
132 CHAR_T prtl_ver[SW_VER_LEN + 1];
134 CHAR_T lan_prtl_ver[SW_VER_LEN + 1];
136 CHAR_T cad_ver[SW_VER_LEN + 1];
138 CHAR_T cd_ver[SW_VER_LEN + 1];
140 CHAR_T product_key[PRODUCT_KEY_LEN + 1];
142 CHAR_T firmware_key[PRODUCT_KEY_LEN + 1];
145 CHAR_T dev_sw_ver[SW_VER_LEN + 1];
147 CHAR_T schema_id[SCHEMA_ID_LEN + 1];
165 CHAR_T product_key[PRODUCT_KEY_LEN + 1];
167 CHAR_T firmware_key[PRODUCT_KEY_LEN + 1];
175 CHAR_T key[SEC_KEY_LEN + 1];
177 CHAR_T local_key[LOCAL_KEY_LEN + 1];
181 CHAR_T http_ip[HTTP_URL_LMT + 1];
183 CHAR_T https_url[HTTP_URL_LMT + 1];
185 CHAR_T https_ip[HTTP_URL_LMT + 1];
187 CHAR_T httpsPSK_url[HTTP_URL_LMT + 1];
189 CHAR_T httpsPSK_ip[HTTP_URL_LMT + 1];
192 CHAR_T mq_psk_url[MQ_URL_LMT + 1];
194 CHAR_T mq_psk_ip[MQ_URL_LMT + 1];
196 CHAR_T mq_tls_url[MQ_URL_LMT + 1];
198 CHAR_T mq_tls_ip[MQ_URL_LMT + 1];
200 CHAR_T mq_proto_url[MQ_URL_LMT + 1];
202 CHAR_T mq_proto_ip[MQ_URL_LMT + 1];
204 CHAR_T ai_speech_url[HTTP_URL_LMT + 1];
206 CHAR_T ai_speech_ip[HTTP_URL_LMT + 1];
208 CHAR_T lowpower_url[MQ_URL_LMT + 1];
210 CHAR_T lowpower_ip[MQ_URL_LMT + 1];
213 CHAR_T time_zone[TIME_ZONE_LEN + 1];
215 CHAR_T summer_time_zone[SUMMER_TM_ZONE_LEN + 1];
218 CHAR_T wx_app_id[WXAPPID_LEN + 1];
220 CHAR_T wx_uuid[WXUUID_LEN + 1];
231#define CLOUD_CAPABILITY_WIFI 0
232#define CLOUD_CAPABILITY_CABLE 1
233#define CLOUD_CAPABILITY_GPRS 2
234#define CLOUD_CAPABILITY_NBIOT 3
235#define CLOUD_CAPABILITY_BLUETOOTH 10
236#define CLOUD_CAPABILITY_BLEMESH 11
237#define CLOUD_CAPABILITY_ZIGBEE 12
238#define CLOUD_CAPABILITY_INFRARED 13
239#define CLOUD_CAPABILITY_SUBPIECES 14
240#define CLOUD_CAPABILITY_SIGMESH 15
241#define CLOUD_CAPABILITY_MCU 16
256#define DP_ID_REPT_RULE_ROUTE (0x1)
265 TIME_S fir_rept_timestamp;
276#if defined(RELIABLE_TRANSFER) && (RELIABLE_TRANSFER==1)
284 UINT_T cur_set_rept_num;
285} DP_CUR_SET_REPT_CNTL_S;
305#if defined(RELIABLE_TRANSFER) && (RELIABLE_TRANSFER==1)
307 TIME_S rept_new_time;
311 DP_CUR_SET_REPT_CNTL_S cur_set_rept;
329#define LOG_PHAT_MAX_LEN 64
336 CHAR_T gid[GRP_ID_LEN + 1];
344 CHAR_T s_id[SCENE_ID_LEN + 1];
346 CHAR_T g_id[GRP_ID_LEN + 1];
385 CHAR_T
id[DEV_ID_LEN + 1];
388#if defined(RELIABLE_TRANSFER) && (RELIABLE_TRANSFER==1)
390 BYTE_T reliable_transfer_flag;
451typedef BYTE_T GW_RESET_TP_T;
472 CHAR_T dev_id[DEV_ID_LEN + 1];
OPERATE_RET gw_unregister(IN CONST GW_RESET_S *rst_t)
Reset device to unregister state
OPERATE_RET gw_dup_dev_cntl(IN DEV_CNTL_N_S *dev_cnt_src, OUT DEV_CNTL_N_S **dev_cnt_out)
Duplicate device cntl
OPERATE_RET gw_destroy_dev_cntl(IN DEV_CNTL_N_S *dev_cnt)
Destroy device cntl instance
DEV_CNTL_N_S * get_dev_cntl(IN CHAR_T *id)
Get device cntl
OPERATE_RET gw_create_dev_cntl(IN CONST CHAR_T *dev_id, IN CONST CHAR_T *sch_json, OUT DEV_CNTL_N_S **dev_cnt_out)
Create device cntl instance
TUYA_COUNTRY_CODE_E
Definition Wi-Fi country code
Definition: gw_intf.h:478
@ TY_COUNTRY_CODE_JP
Definition: gw_intf.h:484
@ TY_COUNTRY_CODE_US
Definition: gw_intf.h:482
@ TY_COUNTRY_CODE_EU
Definition: gw_intf.h:486
@ TY_COUNTRY_CODE_CN
Definition: gw_intf.h:480
BYTE_T DP_PV_STAT_E
Definiton of DP status
Definition: gw_intf.h:246
CHAR_T * tuya_get_schema(VOID)
Get device schema info
GW_DESC_IF_S * get_gw_dev_if(VOID)
Get gateway description
OPERATE_RET gw_unactive(IN CONST GW_RESET_S *rst_t)
Reset device to register state
DEV_CNTL_N_S *(* subdev_dev_cntl_get_cb)(IN CHAR_T *id)
Handler to get sub-device control info
Definition: gw_intf.h:408
OPERATE_RET gw_subdev_dev_cntl_get_register_cb(IN subdev_dev_cntl_get_cb cb)
Register handler to get sub-device cntl
UINT_T gw_get_ext_attribute(VOID)
Get device extension attribute
OPERATE_RET gw_fast_unactive(IN CONST GW_RESET_S *rst_t)
Faset reset device to register state
OPERATE_RET gw_get_gpd_type(IN CONST UINT_T type, OUT GW_PERMIT_DEV_TP_T *gpd)
Get device ota channel
DP_CNTL_S * get_dev_dp_cntl(IN CHAR_T *id, IN CONST BYTE_T dpid)
Get DP cntl
BYTE_T DP_ID_REPT_TYPE_E
Definition of dp id report rule
Definition: gw_intf.h:255
OPERATE_RET gw_set_ext_attribute(UINT_T attr)
Set device extension attribute
DEV_CNTL_N_S * get_gw_dev_cntl(VOID)
Get gateway device cntl
struct dev_cntl_n_s DEV_CNTL_N_S
Definition of device control info
OPERATE_RET tuya_get_dp_info(IN CONST CHAR_T *dev_id, INT_T *dp_num, DP_CNTL_S **dp_info)
Get device dp info
GW_CNTL_S * get_gw_cntl(VOID)
Get gateway cntl
CHAR_T * http_url(VOID)
Retrieve active HTTP url of TUYA cloud
Definition of device actv attribute
Definition: gw_intf.h:373
BOOL_T preprocess
Definition: gw_intf.h:377
BOOL_T attach_dp_if
Definition: gw_intf.h:375
Definition of sub-device reset info
Definition: gw_intf.h:468
GW_RESET_TP_T tp
Definition: gw_intf.h:470
Definition of dp control
Definition: gw_intf.h:291
DP_DESC_IF_S dp_desc
Definition: gw_intf.h:293
UINT_T ble_send_sn
Definition: gw_intf.h:304
DP_PROP_VALUE_U prop
Definition: gw_intf.h:295
DP_PV_STAT_E pv_stat
Definition: gw_intf.h:297
DP_REPT_FLOW_CTRL rept_flow_ctrl
Definition: gw_intf.h:300
UINT_T time_stamp
Definition: gw_intf.h:302
Definition of dp description
Definition: tuya_cloud_com_defs.h:392
Definition of dp report flow control unit
Definition: gw_intf.h:261
Definition of dp report flow control
Definition: gw_intf.h:271
Definition of group management
Definition: gw_intf.h:352
BYTE_T cnt
Definition: gw_intf.h:356
Definition of group info
Definition: gw_intf.h:334
Definition of active info
Definition: gw_intf.h:173
BYTE_T dynamic_tls_mode
Definition: gw_intf.h:225
INT_T cloud_capability
Definition: gw_intf.h:222
Definition of attach moudule attribute
Definition: tuya_cloud_com_defs.h:175
Definition gw BASE information
Definition: gw_intf.h:44
BOOL_T prod_test
Definition: gw_intf.h:70
Definition of core device management
Definition: gw_intf.h:413
BOOL_T is_init
Definition: gw_intf.h:424
UINT_T ext_attribute
Definition: gw_intf.h:417
GW_BASE_IF_S gw_base
Definition: gw_intf.h:431
BOOL_T is_oem
Definition: gw_intf.h:422
CHAR_T * serial_no
Definition: gw_intf.h:415
subdev_dev_cntl_get_cb subdev_dev_get_cb
Definition: gw_intf.h:448
GW_DESC_IF_S gw_if
Definition: gw_intf.h:435
TIME_MS data_update_time
Definition: gw_intf.h:446
GW_EXT_STAT_T ext_stat
Definition: gw_intf.h:419
DEV_CNTL_N_S * dev_cntl
Definition: gw_intf.h:440
TY_IOT_CBS_S cbs
Definition: gw_intf.h:443
GW_WORK_STAT_MAG_S gw_wsm
Definition: gw_intf.h:433
GW_ACTV_IF_S gw_actv
Definition: gw_intf.h:437
BOOL_T is_need_recovery
Definition: gw_intf.h:428
BOOL_T is_stride
Definition: gw_intf.h:426
Definition of device description info
Definition: gw_intf.h:122
BYTE_T attr_num
Definition: gw_intf.h:152
BOOL_T sync
Definition: gw_intf.h:157
GW_ABI abi
Definition: gw_intf.h:124
DEV_TYPE_T tp
Definition: gw_intf.h:149
Definition of gateway device reset info
Definition: gw_intf.h:458
BOOL_T lazy
Definition: gw_intf.h:462
GW_RESET_TP_T gw_rst_tp
Definition: gw_intf.h:460
Definition of stride update info
Definition: gw_intf.h:163
Definition of device work state
Definition: gw_intf.h:94
GW_WORK_STAT_T stat
Definition: gw_intf.h:108
TY_DNS_PRIO_T dns_prio
Definition: gw_intf.h:106
BOOL_T is_psk30_cfg
Definition: gw_intf.h:116
Definition of scene management
Definition: gw_intf.h:362
BYTE_T cnt
Definition: gw_intf.h:366
Definition of scene info
Definition: gw_intf.h:342
Definition of schema other attribute
Definition: gw_intf.h:321
BOOL_T preprocess
Definition: gw_intf.h:323
auth info for ext module
Definition: gw_intf.h:35
Definition of gateway callback funtions
Definition: tuya_cloud_com_defs.h:763
Definition of device control info
Definition: gw_intf.h:383
DP_CNTL_S dp[0]
Definition: gw_intf.h:398
MUTEX_HANDLE dp_mutex
Definition: gw_intf.h:394
BYTE_T dp_num
Definition: gw_intf.h:396
DEV_ACTV_ATTR_S attr
Definition: gw_intf.h:387
Common process - adapter the mutex api provide by OS
Common definitions of TUYA cloud
UINT_T TY_DNS_PRIO_T
DNS priority
Definition: uni_network.h:48
Definition of dp prop value
Definition: tuya_cloud_com_defs.h:344