brazenparadox

Untitled

May 19th, 2020
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. static esp_err_t event_handler(void *ctx, system_event_t *event)
  2. {
  3.     /* For accessing reason codes in case of disconnection */
  4.     system_event_info_t *info = &event->event_info;
  5.  
  6.     switch(event->event_id) {
  7.         case SYSTEM_EVENT_WIFI_READY:
  8.             ESP_LOGI(LOG_TAG, "Wifi is primed and ready!");
  9.             break;
  10.  
  11.         case SYSTEM_EVENT_STA_START:
  12.             ESP_LOGI(LOG_TAG, "Wifi station started");
  13.             scan_for_ap();
  14.             break;
  15.  
  16.         case SYSTEM_EVENT_SCAN_DONE:
  17.             ESP_LOGI(LOG_TAG, "Scan Completed Successfully.");
  18.             list_ap();
  19.             break;
  20.  
  21.         default:
  22.             ESP_LOGI(LOG_TAG, "Some other event %d", event->event_id);
  23.             break;
  24.  
  25.     }
  26.  
  27.     return ESP_OK;
  28. }
Add Comment
Please, Sign In to add comment