mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 12:10:59 +00:00
add got ip event handler
This commit is contained in:

committed by
Wu Jian Gang

parent
6f122928f0
commit
1325a761e9
@@ -79,6 +79,7 @@ static system_event_handle_t g_system_event_handle_table[] = {
|
||||
{SYSTEM_EVENT_STA_CONNECTED, system_event_sta_connected_handle_default},
|
||||
{SYSTEM_EVENT_STA_DISCONNECTED, system_event_sta_disconnected_handle_default},
|
||||
{SYSTEM_EVENT_STA_AUTHMODE_CHANGE, NULL},
|
||||
{SYSTEM_EVENT_STA_GOTIP, NULL},
|
||||
{SYSTEM_EVENT_AP_START, system_event_ap_start_handle_default},
|
||||
{SYSTEM_EVENT_AP_STOP, system_event_ap_stop_handle_default},
|
||||
{SYSTEM_EVENT_AP_STACONNECTED, NULL},
|
||||
@@ -161,6 +162,7 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
system_event_sta_connected_t *connected;
|
||||
system_event_sta_disconnected_t *disconnected;
|
||||
system_event_sta_authmode_change_t *auth_change;
|
||||
system_event_sta_gotip_t *got_ip;
|
||||
system_event_ap_staconnected_t *staconnected;
|
||||
system_event_ap_stadisconnected_t *stadisconnected;
|
||||
system_event_ap_probe_req_rx_t *ap_probereqrecved;
|
||||
@@ -202,6 +204,10 @@ static esp_err_t esp_system_event_debug(system_event_t *event)
|
||||
auth_change = &event->event_info.auth_change;
|
||||
os_printf("SYSTEM_EVENT_STA_AUTHMODE_CHNAGE\nold_mode:%d, new_mode:%d\n", auth_change->old_mode, auth_change->new_mode);
|
||||
break;
|
||||
case SYSTEM_EVENT_STA_GOTIP:
|
||||
got_ip = &event->event_info.got_ip;
|
||||
os_printf("SYSTEM_EVENT_STA_GOTIP\n");
|
||||
break;
|
||||
case SYSTEM_EVENT_AP_START:
|
||||
os_printf("SYSTEM_EVENT_AP_START\n");
|
||||
break;
|
||||
|
@@ -32,6 +32,7 @@ typedef enum {
|
||||
SYSTEM_EVENT_STA_CONNECTED, /**< ESP32 station connected to AP */
|
||||
SYSTEM_EVENT_STA_DISCONNECTED, /**< ESP32 station disconnected to AP */
|
||||
SYSTEM_EVENT_STA_AUTHMODE_CHANGE, /**< the auth mode of AP connected by ESP32 station changed */
|
||||
SYSTEM_EVENT_STA_GOTIP,
|
||||
SYSTEM_EVENT_AP_START, /**< ESP32 softap start */
|
||||
SYSTEM_EVENT_AP_STOP, /**< ESP32 softap start */
|
||||
SYSTEM_EVENT_AP_STACONNECTED, /**< a station connected to ESP32 soft-AP */
|
||||
@@ -40,6 +41,10 @@ typedef enum {
|
||||
SYSTEM_EVENT_MAX
|
||||
} system_event_id_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t addr;
|
||||
} esp_ip_addr_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t status; /**< status of scanning APs*/
|
||||
uint8_t number;
|
||||
@@ -64,6 +69,12 @@ typedef struct {
|
||||
uint8_t new_mode; /**< the new auth mode of AP */
|
||||
} system_event_sta_authmode_change_t;
|
||||
|
||||
typedef struct {
|
||||
esp_ip_addr_t ip;
|
||||
esp_ip_addr_t netmask;
|
||||
esp_ip_addr_t gw;
|
||||
} system_event_sta_gotip_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t mac[6]; /**< MAC address of the station connected to ESP32 soft-AP */
|
||||
uint8_t aid; /**< the aid that ESP32 soft-AP gives to the station connected to */
|
||||
@@ -84,6 +95,7 @@ typedef union {
|
||||
system_event_sta_disconnected_t disconnected; /**< ESP32 station disconnected to AP */
|
||||
system_event_sta_scan_done_t scan_done; /**< ESP32 station scan (APs) done */
|
||||
system_event_sta_authmode_change_t auth_change; /**< the auth mode of AP ESP32 station connected to changed */
|
||||
system_event_sta_gotip_t got_ip;
|
||||
system_event_ap_staconnected_t sta_connected; /**< a station connected to ESP32 soft-AP */
|
||||
system_event_ap_stadisconnected_t sta_disconnected; /**< a station disconnected to ESP32 soft-AP */
|
||||
system_event_ap_probe_req_rx_t ap_probereqrecved; /**< ESP32 softAP receive probe request packet */
|
||||
|
Reference in New Issue
Block a user