MAC2STR(ap_probereqrecved->mac));
break;
}
- case SYSTEM_EVENT_AP_STA_GOT_IP6: {
+ case SYSTEM_EVENT_GOT_IP6: {
ip6_addr_t *addr = &event->event_info.got_ip6.ip6_info.ip;
ESP_LOGD(TAG, "SYSTEM_EVENT_AP_STA_GOT_IP6 address %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x",
IP6_ADDR_BLOCK1(addr),
SYSTEM_EVENT_AP_STACONNECTED, /**< a station connected to ESP32 soft-AP */
SYSTEM_EVENT_AP_STADISCONNECTED, /**< a station disconnected from ESP32 soft-AP */
SYSTEM_EVENT_AP_PROBEREQRECVED, /**< Receive probe request packet in soft-AP interface */
- SYSTEM_EVENT_AP_STA_GOT_IP6, /**< ESP32 station or ap interface v6IP addr is preferred */
+ SYSTEM_EVENT_GOT_IP6, /**< ESP32 station or ap or ethernet interface v6IP addr is preferred */
SYSTEM_EVENT_ETH_START, /**< ESP32 ethernet start */
SYSTEM_EVENT_ETH_STOP, /**< ESP32 ethernet stop */
SYSTEM_EVENT_ETH_CONNECTED, /**< ESP32 ethernet phy link up */
SYSTEM_EVENT_MAX
} system_event_id_t;
+/* add this macro define for compatible with old IDF version */
+#ifndef SYSTEM_EVENT_AP_STA_GOT_IP6
+#define SYSTEM_EVENT_AP_STA_GOT_IP6 SYSTEM_EVENT_GOT_IP6
+#endif
+
typedef enum {
WPS_FAIL_REASON_NORMAL = 0, /**< ESP32 WPS normal fail reason */
WPS_FAIL_REASON_RECV_M2D, /**< ESP32 WPS receive M2D frame */
} system_event_sta_wps_er_pin_t;
typedef struct {
+ tcpip_adapter_if_t if_index;
tcpip_adapter_ip6_info_t ip6_info;
-} system_event_ap_sta_got_ip6_t;
+} system_event_got_ip6_t;
typedef struct {
uint8_t mac[6]; /**< MAC address of the station connected to ESP32 soft-AP */
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 soft-AP receive probe request packet */
- system_event_ap_sta_got_ip6_t got_ip6; /**< ESP32 station or ap ipv6 addr state change to preferred */
+ system_event_got_ip6_t got_ip6; /**< ESP32 station or ap or ethernet ipv6 addr state change to preferred */
} system_event_info_t;
typedef struct {
{
tcpip_adapter_ip6_info_t *ip6_info;
+ system_event_t evt;
+ //notify event
+
+ evt.event_id = SYSTEM_EVENT_GOT_IP6;
+
if (!p_netif) {
ESP_LOGD(TAG, "null p_netif=%p", p_netif);
return;
if (p_netif == esp_netif[TCPIP_ADAPTER_IF_STA]) {
ip6_info = &esp_ip6[TCPIP_ADAPTER_IF_STA];
+ evt.event_info.got_ip6.if_index = TCPIP_ADAPTER_IF_STA;
} else if (p_netif == esp_netif[TCPIP_ADAPTER_IF_AP]) {
ip6_info = &esp_ip6[TCPIP_ADAPTER_IF_AP];
+ evt.event_info.got_ip6.if_index = TCPIP_ADAPTER_IF_AP;
+ } else if (p_netif == esp_netif[TCPIP_ADAPTER_IF_ETH]) {
+ ip6_info = &esp_ip6[TCPIP_ADAPTER_IF_ETH];
+ evt.event_info.got_ip6.if_index = TCPIP_ADAPTER_IF_ETH;
} else {
return;
}
- system_event_t evt;
-
ip6_addr_set(&ip6_info->ip, ip_2_ip6(&p_netif->ip6_addr[ip_idex]));
- //notify event
- evt.event_id = SYSTEM_EVENT_AP_STA_GOT_IP6;
memcpy(&evt.event_info.got_ip6.ip6_info, ip6_info, sizeof(tcpip_adapter_ip6_info_t));
esp_event_send(&evt);
}