TuyaOS
tuya_cloud_wifi_defs.h
浏览该文件的文档.
1
9#ifndef TUYA_CLOUD_WIFI_DEFS_H
10#define TUYA_CLOUD_WIFI_DEFS_H
11
12#include "tuya_cloud_types.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* tuya sdk definition of wifi work mode */
19typedef BYTE_T GW_WF_CFG_MTHD_SEL; // wifi config method select
20#define GWCM_OLD 0 // do not have low power mode
21#define GWCM_LOW_POWER 1 // with low power mode
22#define GWCM_SPCL_MODE 2 // special with low power mode
23#define GWCM_OLD_PROD 3 // GWCM_OLD mode with product
24#define GWCM_LOW_POWER_AUTOCFG 4 // with low power mode && auto cfg
25#define GWCM_SPCL_AUTOCFG 5 // special with low power mode && auto cfg
26
27
28
29/* tuya sdk definition of wifi start mode */
30typedef BYTE_T GW_WF_START_MODE;
31#define WF_START_AP_ONLY 0 // only have ap-cfg mode
32#define WF_START_SMART_ONLY 1 // only have smart-cfg mode
33#define WF_START_AP_FIRST 2 // have both ap-cfg and smart-cfg. default is ap-cfg mode
34#define WF_START_SMART_FIRST 3 // have both ap-cfg and smart-cfg. default is smart-cfg mode
35#define WF_START_SMART_AP_CONCURRENT 4 // ap-cfg and smart-cfg is concurrent
36
37/* tuya sdk definition of wifi-config status */
38typedef BYTE_T GW_WF_NWC_STAT_T;
39#define GWNS_LOWPOWER 0 // current in low power mode
40#define GWNS_UNCFG_SMC 1 // current in smart-cfg mode
41#define GWNS_UNCFG_AP 2 // current in ap-cfg mode
42#define GWNS_TY_SMARTCFG 3 // already get ssid && passwd from smart-cfg mode
43#define GWNS_TY_AP 4 // already get ssid && passwd from ap-cfg mode
44#define GWNS_WECHAT_AK 5 // already get ssid && passwd from wechat mode
45#define GWNS_OTHER_CFG 6 // already get ssid && passwd from other mode.for example:uart、bluetooth、qrcode and so on
46#define GWNS_NO_NEED_CFG 7 // no need config wifi
47#define GWNS_TY_SMART_AP_CFG 9 //already get ssid && passwd from smart-cfg and ap-cfg concurrent mode
48#define GWNS_UNCFG_SMC_AP 10 //current in smart-cfg and ap-cfg concurrent mode
49#define GWNS_PROXY_ACTIVED 11 // bt actived
50#define GWNS_PROXY_CONFIG_WF 12 //in bt actived,has configed wifi
51
52/* tuya sdk definition of wifi-config fast status */
53typedef BYTE_T GW_WF_NWC_FAST_STAT_T;
54#define GWNS_FAST_LOWPOWER 0 // current in low power mode
55#define GWNS_FAST_UNCFG_SMC 1 // current in smart-cfg mode
56#define GWNS_FAST_UNCFG_AP 2 // current in ap-cfg mode
57#define GWNS_FAST_UNCFG_NORMAL 3 // current in normal mode
58#define GWNS_FAST_UNCFG_SMC_AP 4 // current in smart and ap concurrent mode
59
60typedef BYTE_T GW_WF_MD_T;
61#define GWM_NORMAL 0 // Normal
62#define GWM_SPECIAL_SMT_CFG 1 // special smart cfg
63#define GWM_SPECIAL_AP_CFG 2 // special ap cfg
64#define GWM_SPECIAL_SMT_AP_CFG 3 // special smart and ap cfg
65
66/* tuya sdk definition of wifi-net status */
67typedef BYTE_T GW_WIFI_NW_STAT_E;
68#define STAT_LOW_POWER 0 // idle status,use to external config network
69#define STAT_UNPROVISION 1 // smart config status
70#define STAT_AP_STA_UNCFG 2 // ap WIFI config status
71#define STAT_AP_STA_DISC 3 // ap WIFI already config,station disconnect
72#define STAT_AP_STA_CONN 4 // ap station mode,station connect
73#define STAT_STA_DISC 5 // only station mode,disconnect
74#define STAT_STA_CONN 6 // station mode connect
75#define STAT_CLOUD_CONN 7 // cloud connect
76#define STAT_AP_CLOUD_CONN 8 // cloud connect and ap start
77#define STAT_REG_FAIL 9 // register fail
78#define STAT_OFFLINE 10 // offline
79#define STAT_MQTT_ONLINE 11
80#define STAT_MQTT_OFFLINE 12
81#define STAT_UNPROVISION_AP_STA_UNCFG 13 //smart-cfg and ap-cfg concurrent config status
82#define STAT_PROXY_ACTIVED 14
83
84
85typedef BYTE_T NW_CFG_ERR_CODE_E;
86#define NW_CFG_INIT 0 // initial state
87#define NW_CFG_ACTIVE_FAILED 1 // active failed
88#define NW_CFG_AP_NOT_FOUND 2 // ap not found
89#define NW_CFG_ERR_PASSWD 3 // password error
90#define NW_CFG_CANT_CONN_AP 4 // can not connect to ap
91#define NW_CFG_DHCP_FAILED 5 // dhcp failed
92#define NW_CFG_SUCC 100 // succeed
93
94typedef int AP_CFG_ERR_CODE;
95#define AP_CFG_SUCC 0
96#define AP_CFG_ERR_PCK 1
97#define AP_CFG_AP_NOT_FOUND 2
98#define AP_CFG_ERR_PASSWD 3
99#define AP_CFG_CANT_CONN_AP 4
100#define AP_CFG_DHCP_FAILED 5
101#define AP_CFG_CONN_CLOUD_FAILED 6
102#define AP_CFG_GET_URL_FAILED 7
103#define AP_CFG_GW_ACTIVE_FAILED 8
104#define AP_CFG_GW_ACTIVE_SUCCESS 9
105
106/* tuya sdk definition of wifi-reset type */
107typedef BYTE_T WF_RESET_TP_T;
108#define WRT_SMT_CFG 0
109#define WRT_AP 1
110#define WRT_AUTO 2
111#define WRT_SMT_AP_CFG 3
112
113/* tuya sdk definition of ip-mode type */
114typedef BYTE_T IP_MODE_TYPE;
115#define IPV4_ONLY 0
116#define IPV4_FIRST 1
117#define IPV6_ONLY 2
118#define IPV6_FIRST 3
119
123typedef struct {
124 CHAR_T *uuid; // strlen(uuid) <= 16,must not be null
125 CHAR_T *auth_key; // strlen(auth_key) <= 32,must not be null
126 CHAR_T *ap_ssid; // strlen(ap_ssid) <= 16,if ap_ssid is null ,then the default ssid is Smartlife_xxxx
127 CHAR_T *ap_passwd; // strlen(ap_passwd) <= 16,default null
128 CHAR_T *pin; // strlen(ap_passwd) <= 8,default null
130
134typedef struct {
135 BOOL_T has_auth; // authFlag
136 CHAR_T *ap_ssid; // strlen(ap_ssid) <= 16,if ap_ssid is null ,then the default ssid is Smartlife_xxxx
137 CHAR_T *ap_passwd; // strlen(ap_passwd) <= 16,default null
139
145typedef VOID (*GET_WF_NW_STAT_CB)(IN CONST GW_WIFI_NW_STAT_E stat);
146
152typedef VOID (*WF_NW_CFG_ERR_CODE_CB)(IN CONST NW_CFG_ERR_CODE_E err_code);
153
154#ifdef __cplusplus
155}
156#endif
157
158#endif // TUYA_CLOUD_WIFI_DEFS_H
Definition of product info (for debug)
Definition: tuya_cloud_wifi_defs.h:134
Definition: tuya_cloud_wifi_defs.h:123
VOID(* WF_NW_CFG_ERR_CODE_CB)(IN CONST NW_CFG_ERR_CODE_E err_code)
Handler when network configuration error happens
Definition: tuya_cloud_wifi_defs.h:152
VOID(* GET_WF_NW_STAT_CB)(IN CONST GW_WIFI_NW_STAT_E stat)
Handler when network connection error happens
Definition: tuya_cloud_wifi_defs.h:145