event: Add IP_EVENT_ETH_LOST_IP event

Closes https://github.com/espressif/esp-idf/issues/6971
pull/7041/head
yuanjm 2021-05-07 11:36:13 +08:00
rodzic 3d7211e2a0
commit 922992b519
5 zmienionych plików z 9 dodań i 1 usunięć

Wyświetl plik

@ -121,6 +121,9 @@ static system_event_id_t esp_event_legacy_ip_event_id(int32_t event_id)
case IP_EVENT_ETH_GOT_IP:
return SYSTEM_EVENT_ETH_GOT_IP;
case IP_EVENT_ETH_LOST_IP:
return SYSTEM_EVENT_ETH_LOST_IP;
default:
ESP_LOGE(TAG, "invalid ip event id %d", event_id);
return SYSTEM_EVENT_MAX;

Wyświetl plik

@ -58,6 +58,7 @@ typedef enum {
SYSTEM_EVENT_ETH_CONNECTED, /*!< ESP32 ethernet phy link up */
SYSTEM_EVENT_ETH_DISCONNECTED, /*!< ESP32 ethernet phy link down */
SYSTEM_EVENT_ETH_GOT_IP, /*!< ESP32 ethernet got IP from connected AP */
SYSTEM_EVENT_ETH_LOST_IP, /*!< ESP32 ethernet lost IP and the IP is reset to 0 */
SYSTEM_EVENT_MAX /*!< Number of members in this enum */
} system_event_id_t;

Wyświetl plik

@ -55,7 +55,7 @@ extern "C" {
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(mac) \
ESP_COMPILER_DESIGNATED_INIT_AGGREGATE_TYPE_EMPTY(ip_info) \
.get_ip_event = IP_EVENT_ETH_GOT_IP, \
.lost_ip_event = 0, \
.lost_ip_event = IP_EVENT_ETH_LOST_IP, \
.if_key = "ETH_DEF", \
.if_desc = "eth", \
.route_prio = 50 \

Wyświetl plik

@ -88,6 +88,7 @@ typedef enum {
IP_EVENT_AP_STAIPASSIGNED, /*!< soft-AP assign an IP to a connected station */
IP_EVENT_GOT_IP6, /*!< station or ap or ethernet interface v6IP addr is preferred */
IP_EVENT_ETH_GOT_IP, /*!< ethernet got IP from connected AP */
IP_EVENT_ETH_LOST_IP, /*!< ethernet lost IP and the IP is reset to 0 */
IP_EVENT_PPP_GOT_IP, /*!< PPP interface got IP */
IP_EVENT_PPP_LOST_IP, /*!< PPP interface lost IP */
} ip_event_t;

Wyświetl plik

@ -123,6 +123,9 @@ Event IDs and Corresponding Data Structures
| IP_EVENT_ETH_GOT_IP | :cpp:class:`ip_event_got_ip_t` |
| (SYSTEM_EVENT_ETH_GOT_IP) | |
+------------------------------------+-----------------------------------------------+
| IP_EVENT_ETH_LOST_IP | n/a |
| (SYSTEM_EVENT_ETH_LOST_IP) | |
+------------------------------------+-----------------------------------------------+
Mesh Events
-----------