mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
Merge branch 'feature/add_ap_sta_ip_assigned' into 'release/v3.3'
feat(tcpip_adapter): add AP assigned IP event data See merge request sdk/ESP8266_RTOS_SDK!1336
This commit is contained in:
@ -129,6 +129,11 @@ typedef struct {
|
||||
uint8_t mac[6]; /**< MAC address of the station which send probe request */
|
||||
} system_event_ap_probe_req_rx_t;
|
||||
|
||||
/** Event structure for IP_EVENT_AP_STAIPASSIGNED event */
|
||||
typedef struct {
|
||||
ip4_addr_t ip; /*!< IP address which was assigned to the station */
|
||||
} system_event_ap_staipassigned_t;
|
||||
|
||||
typedef union {
|
||||
system_event_sta_connected_t connected; /**< ESP8266 station connected to AP */
|
||||
system_event_sta_disconnected_t disconnected; /**< ESP8266 station disconnected to AP */
|
||||
@ -140,6 +145,7 @@ typedef union {
|
||||
system_event_ap_staconnected_t sta_connected; /**< a station connected to ESP8266 soft-AP */
|
||||
system_event_ap_stadisconnected_t sta_disconnected; /**< a station disconnected to ESP8266 soft-AP */
|
||||
system_event_ap_probe_req_rx_t ap_probereqrecved; /**< ESP8266 soft-AP receive probe request packet */
|
||||
system_event_ap_staipassigned_t ap_staipassigned; /**< ESP8266 soft-AP assign an IP to the station*/
|
||||
system_event_got_ip6_t got_ip6; /**< ESP8266 station or ap or ethernet ipv6 addr state change to preferred */
|
||||
} system_event_info_t;
|
||||
|
||||
|
@ -93,6 +93,7 @@ static void tcpip_adapter_dhcps_cb(u8_t client_ip[4])
|
||||
client_ip[0],client_ip[1],client_ip[2],client_ip[3]);
|
||||
system_event_t evt;
|
||||
evt.event_id = SYSTEM_EVENT_AP_STAIPASSIGNED;
|
||||
memcpy(&evt.event_info.ap_staipassigned.ip, client_ip, sizeof(ip4_addr_t));
|
||||
esp_event_send(&evt);
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,10 @@ static esp_err_t event_handler(void *ctx, system_event_t *event)
|
||||
esp_wifi_connect();
|
||||
xEventGroupClearBits(wifi_event_group, WIFI_CONNECTED_BIT);
|
||||
break;
|
||||
case SYSTEM_EVENT_AP_STAIPASSIGNED:
|
||||
ESP_LOGI(TAG, "assigned ip:%s",
|
||||
ip4addr_ntoa(&event->event_info.ap_staipassigned.ip));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user