ESP32 Arduino 库中的 WiFi Events 事件

ESP32 Arduino 库中的 WiFi Events 事件

TONYLABS 14 Jul, 2019
Share:

void WiFiEvent(WiFiEvent_t event)
{
  switch (event)
  {
    case SYSTEM_EVENT_WIFI_READY:
      Serial.println("WiFi interface ready");
    break;
    case SYSTEM_EVENT_SCAN_DONE:
      Serial.println("Completed scan for access points");
    break;
    case SYSTEM_EVENT_STA_START:
      Serial.println("WiFi client started");
    break;
    case SYSTEM_EVENT_STA_STOP:
      Serial.println("WiFi clients stopped");
    break;
    case SYSTEM_EVENT_STA_CONNECTED:
      Serial.println("Connected to access point");
    break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
      Serial.println("Disconnected from WiFi access point");
    break;
    case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
      Serial.println("Authentication mode of access point has changed");
    break;
    case SYSTEM_EVENT_STA_GOT_IP:
      Serial.print("Obtained IP address: ");
      Serial.println(WiFi.localIP());
    break;
    case SYSTEM_EVENT_STA_LOST_IP:
      Serial.println("Lost IP address and IP address is reset to 0");
    break;
    case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
      Serial.println("WiFi Protected Setup (WPS): succeeded in enrollee mode");
    break;
    case SYSTEM_EVENT_STA_WPS_ER_FAILED:
      Serial.println("WiFi Protected Setup (WPS): failed in enrollee mode");
    break;
    case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT:
      Serial.println("WiFi Protected Setup (WPS): timeout in enrollee mode");
    break;
    case SYSTEM_EVENT_STA_WPS_ER_PIN:
      Serial.println("WiFi Protected Setup (WPS): pin code in enrollee mode");
    break;
    case SYSTEM_EVENT_AP_START:
      Serial.println("WiFi access point started");
    break;
    case SYSTEM_EVENT_AP_STOP:
      Serial.println("WiFi access point  stopped");
    break;
    case SYSTEM_EVENT_AP_STACONNECTED:
      Serial.println("Client connected");
    break;
    case SYSTEM_EVENT_AP_STADISCONNECTED:
      Serial.println("Client disconnected");
    break;
    case SYSTEM_EVENT_AP_STAIPASSIGNED:

   Serial.println("Assigned IP address to client");

   break;

 case SYSTEM_EVENT_AP_PROBEREQRECVED:

   Serial.println("Received probe request");

   break;

 case SYSTEM_EVENT_GOT_IP6:

   Serial.println("IPv6 is preferred");

   break;

 case SYSTEM_EVENT_ETH_START:

   Serial.println("Ethernet started");

   break;

 case SYSTEM_EVENT_ETH_STOP:

   Serial.println("Ethernet stopped");

   break;

 case SYSTEM_EVENT_ETH_CONNECTED:

   Serial.println("Ethernet connected");

   break;

 case SYSTEM_EVENT_ETH_DISCONNECTED:

   Serial.println("Ethernet disconnected");

   break;

 case SYSTEM_EVENT_ETH_GOT_IP:

   Serial.println("Obtained IP address");

   break;
  }
}

 

 

Like what you're reading? Subscribe to our top stories.

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Medium, Twitter, Facebook, YouTube, and Dribbble.

Image Description
Written by

Hanna Wolfe

I create advanced website builders made exclusively for web developers.

3 Comments

  • Image Description
    Dave Austin 1 day ago

    As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

    Reply
    • Image Description
      Hanna Wolfe 1 day ago

      Love it Dave! We're all about keeping it up.

      Reply
  • Image Description
    Christina Kray 2 days ago

    Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.

    Reply

Post a comment

Stay in the know

Get special offers on the latest developments from Front.