20
20
// Not to include
21
21
#define ESP_MDNS_NETWORKING_H_
22
22
#define _TCPIP_ADAPTER_H_
23
- #define __ESP_EVENT_H__
24
23
25
24
26
25
#ifdef USE_BSD_STRING
@@ -116,6 +115,47 @@ typedef enum {
116
115
WIFI_MODE_MAX
117
116
} wifi_mode_t ;
118
117
118
+ extern const char * WIFI_EVENT ;
119
+ extern const char * IP_EVENT ;
120
+ extern const char * ETH_EVENT ;
121
+
122
+ typedef enum {
123
+ WIFI_EVENT_WIFI_READY = 0 , /**< ESP32 WiFi ready */
124
+ WIFI_EVENT_SCAN_DONE , /**< ESP32 finish scanning AP */
125
+ WIFI_EVENT_STA_START , /**< ESP32 station start */
126
+ WIFI_EVENT_STA_STOP , /**< ESP32 station stop */
127
+ WIFI_EVENT_STA_CONNECTED , /**< ESP32 station connected to AP */
128
+ WIFI_EVENT_STA_DISCONNECTED , /**< ESP32 station disconnected from AP */
129
+ WIFI_EVENT_STA_AUTHMODE_CHANGE , /**< the auth mode of AP connected by ESP32 station changed */
130
+
131
+ WIFI_EVENT_STA_WPS_ER_SUCCESS , /**< ESP32 station wps succeeds in enrollee mode */
132
+ WIFI_EVENT_STA_WPS_ER_FAILED , /**< ESP32 station wps fails in enrollee mode */
133
+ WIFI_EVENT_STA_WPS_ER_TIMEOUT , /**< ESP32 station wps timeout in enrollee mode */
134
+ WIFI_EVENT_STA_WPS_ER_PIN , /**< ESP32 station wps pin code in enrollee mode */
135
+
136
+ WIFI_EVENT_AP_START , /**< ESP32 soft-AP start */
137
+ WIFI_EVENT_AP_STOP , /**< ESP32 soft-AP stop */
138
+ WIFI_EVENT_AP_STACONNECTED , /**< a station connected to ESP32 soft-AP */
139
+ WIFI_EVENT_AP_STADISCONNECTED , /**< a station disconnected from ESP32 soft-AP */
140
+
141
+ WIFI_EVENT_AP_PROBEREQRECVED , /**< Receive probe request packet in soft-AP interface */
142
+ } wifi_event_t ;
143
+
144
+ typedef enum {
145
+ ETHERNET_EVENT_START , /**< ESP32 ethernet start */
146
+ ETHERNET_EVENT_STOP , /**< ESP32 ethernet stop */
147
+ ETHERNET_EVENT_CONNECTED , /**< ESP32 ethernet phy link up */
148
+ ETHERNET_EVENT_DISCONNECTED , /**< ESP32 ethernet phy link down */
149
+ } eth_event_t ;
150
+
151
+ typedef enum {
152
+ IP_EVENT_STA_GOT_IP , /*!< ESP32 station got IP from connected AP */
153
+ IP_EVENT_STA_LOST_IP , /*!< ESP32 station lost IP and the IP is reset to 0 */
154
+ IP_EVENT_AP_STAIPASSIGNED , /*!< ESP32 soft-AP assign an IP to a connected station */
155
+ IP_EVENT_GOT_IP6 , /*!< ESP32 station or ap or ethernet interface v6IP addr is preferred */
156
+ IP_EVENT_ETH_GOT_IP , /*!< ESP32 ethernet got IP from connected AP */
157
+ } ip_event_t ;
158
+
119
159
/* status of DHCP client or DHCP server */
120
160
typedef enum {
121
161
TCPIP_ADAPTER_DHCP_INIT = 0 , /**< DHCP client/server in initial state */
@@ -124,34 +164,6 @@ typedef enum {
124
164
TCPIP_ADAPTER_DHCP_STATUS_MAX
125
165
} tcpip_adapter_dhcp_status_t ;
126
166
127
- typedef enum {
128
- SYSTEM_EVENT_WIFI_READY = 0 , /**< ESP32 WiFi ready */
129
- SYSTEM_EVENT_SCAN_DONE , /**< ESP32 finish scanning AP */
130
- SYSTEM_EVENT_STA_START , /**< ESP32 station start */
131
- SYSTEM_EVENT_STA_STOP , /**< ESP32 station stop */
132
- SYSTEM_EVENT_STA_CONNECTED , /**< ESP32 station connected to AP */
133
- SYSTEM_EVENT_STA_DISCONNECTED , /**< ESP32 station disconnected from AP */
134
- SYSTEM_EVENT_STA_AUTHMODE_CHANGE , /**< the auth mode of AP connected by ESP32 station changed */
135
- SYSTEM_EVENT_STA_GOT_IP , /**< ESP32 station got IP from connected AP */
136
- SYSTEM_EVENT_STA_LOST_IP , /**< ESP32 station lost IP and the IP is reset to 0 */
137
- SYSTEM_EVENT_STA_WPS_ER_SUCCESS , /**< ESP32 station wps succeeds in enrollee mode */
138
- SYSTEM_EVENT_STA_WPS_ER_FAILED , /**< ESP32 station wps fails in enrollee mode */
139
- SYSTEM_EVENT_STA_WPS_ER_TIMEOUT , /**< ESP32 station wps timeout in enrollee mode */
140
- SYSTEM_EVENT_STA_WPS_ER_PIN , /**< ESP32 station wps pin code in enrollee mode */
141
- SYSTEM_EVENT_AP_START , /**< ESP32 soft-AP start */
142
- SYSTEM_EVENT_AP_STOP , /**< ESP32 soft-AP stop */
143
- SYSTEM_EVENT_AP_STACONNECTED , /**< a station connected to ESP32 soft-AP */
144
- SYSTEM_EVENT_AP_STADISCONNECTED , /**< a station disconnected from ESP32 soft-AP */
145
- SYSTEM_EVENT_AP_PROBEREQRECVED , /**< Receive probe request packet in soft-AP interface */
146
- SYSTEM_EVENT_GOT_IP6 , /**< ESP32 station or ap or ethernet interface v6IP addr is preferred */
147
- SYSTEM_EVENT_ETH_START , /**< ESP32 ethernet start */
148
- SYSTEM_EVENT_ETH_STOP , /**< ESP32 ethernet stop */
149
- SYSTEM_EVENT_ETH_CONNECTED , /**< ESP32 ethernet phy link up */
150
- SYSTEM_EVENT_ETH_DISCONNECTED , /**< ESP32 ethernet phy link down */
151
- SYSTEM_EVENT_ETH_GOT_IP , /**< ESP32 ethernet got IP from connected AP */
152
- SYSTEM_EVENT_MAX
153
- } system_event_id_t ;
154
-
155
167
struct udp_pcb {
156
168
uint8_t dummy ;
157
169
};
@@ -180,7 +192,6 @@ typedef struct {
180
192
ip4_addr_t gw ;
181
193
} tcpip_adapter_ip_info_t ;
182
194
183
- // typedef int32_t system_event_id_t;
184
195
typedef enum {
185
196
TCPIP_ADAPTER_IF_STA = 0 , /**< ESP32 station interface */
186
197
TCPIP_ADAPTER_IF_AP , /**< ESP32 soft-AP interface */
@@ -191,18 +202,13 @@ typedef enum {
191
202
typedef struct {
192
203
ip6_addr_t ip ;
193
204
} tcpip_adapter_ip6_info_t ;
194
- typedef struct {
195
- tcpip_adapter_if_t if_index ;
196
- tcpip_adapter_ip6_info_t ip6_info ;
197
- } system_event_got_ip6_t ;
198
- typedef union {
199
- system_event_got_ip6_t got_ip6 ; /**< ESP32 station or ap or ethernet ipv6 addr state change to preferred */
200
- } system_event_info_t ;
201
205
202
206
typedef struct {
203
- system_event_id_t event_id ; /**< event ID */
204
- system_event_info_t event_info ; /**< event information */
205
- } system_event_t ;
207
+ tcpip_adapter_if_t if_index ; /*!< Interface for which the event is received */
208
+ tcpip_adapter_ip6_info_t ip6_info ; /*!< IPv6 address of the interface */
209
+ } ip_event_got_ip6_t ;
210
+
211
+ typedef void * system_event_t ;
206
212
207
213
inline esp_err_t esp_wifi_get_mode (wifi_mode_t * mode )
208
214
{
0 commit comments