tcpip_adapter: add event declarations

This commit is contained in:
Ivan Grokhotkov 2018-12-25 15:28:56 +08:00
parent c001553027
commit 1872e34115
2 changed files with 27 additions and 0 deletions

View file

@ -143,6 +143,31 @@ typedef enum{
/* Deprecated name for tcpip_adapter_dhcp_option_id_t, to remove after ESP-IDF V4.0 */
typedef tcpip_adapter_dhcp_option_id_t tcpip_adapter_option_id_t;
/** IP event declarations */
typedef enum {
IP_EVENT_STA_GOT_IP, /*!< ESP32 station got IP from connected AP */
IP_EVENT_STA_LOST_IP, /*!< ESP32 station lost IP and the IP is reset to 0 */
IP_EVENT_AP_STAIPASSIGNED, /*!< ESP32 soft-AP assign an IP to a connected station */
IP_EVENT_GOT_IP6, /*!< ESP32 station or ap or ethernet interface v6IP addr is preferred */
IP_EVENT_ETH_GOT_IP, /*!< ESP32 ethernet got IP from connected AP */
} ip_event_t;
/** @brief IP event base declaration */
ESP_EVENT_DECLARE_BASE(IP_EVENT);
/** Event structure for IP_EVENT_STA_GOT_IP, IP_EVENT_ETH_GOT_IP events */
typedef struct {
tcpip_adapter_if_t if_index; /*!< Interface for which the event is received */
tcpip_adapter_ip_info_t ip_info; /*!< IP address, netmask, gatway IP address */
bool ip_changed; /*!< Whether the assigned IP has changed or not */
} ip_event_got_ip_t;
/** Event structure for IP_EVENT_GOT_IP6 event */
typedef struct {
tcpip_adapter_if_t if_index; /*!< Interface for which the event is received */
tcpip_adapter_ip6_info_t ip6_info; /*!< IPv6 address of the interface */
} ip_event_got_ip6_t;
/**
* @brief Initialize the underlying TCP/IP stack
*

View file

@ -70,6 +70,8 @@ static sys_sem_t api_lock_sem = NULL;
extern sys_thread_t g_lwip_task;
static const char* TAG = "tcpip_adapter";
ESP_EVENT_DEFINE_BASE(IP_EVENT);
static void tcpip_adapter_api_cb(void* api_msg)
{
tcpip_adapter_api_msg_t *msg = (tcpip_adapter_api_msg_t*)api_msg;