2025-11-28 18:26:32 -06:00
|
|
|
#ifndef WIFI_H
|
|
|
|
|
#define WIFI_H
|
|
|
|
|
|
2025-11-29 16:24:56 -06:00
|
|
|
#include "esp_wifi.h"
|
|
|
|
|
#include <string>
|
2025-12-18 22:19:54 -06:00
|
|
|
#include <atomic>
|
2025-11-29 16:24:56 -06:00
|
|
|
|
|
|
|
|
class WiFi {
|
|
|
|
|
public:
|
|
|
|
|
static void init();
|
2025-12-17 21:52:00 -06:00
|
|
|
static bool attemptConnect(const std::string ssid, const std::string password,
|
|
|
|
|
const wifi_auth_mode_t authMode);
|
|
|
|
|
static bool attemptConnect(const std::string ssid, const std::string uname,
|
|
|
|
|
const std::string password, const wifi_auth_mode_t authMode);
|
2025-12-18 22:08:07 -06:00
|
|
|
static bool isConnected();
|
|
|
|
|
static void scanAndUpdateSSIDList();
|
2025-11-29 16:24:56 -06:00
|
|
|
private:
|
2025-12-18 22:08:07 -06:00
|
|
|
static void processScanResults();
|
|
|
|
|
static std::atomic<bool> authFailed;
|
2025-11-29 16:24:56 -06:00
|
|
|
static bool awaitConnected();
|
|
|
|
|
static esp_event_handler_instance_t instance_any_id;
|
|
|
|
|
static esp_event_handler_instance_t instance_got_ip;
|
|
|
|
|
static EventGroupHandle_t s_wifi_event_group;
|
|
|
|
|
static esp_netif_t* netif;
|
|
|
|
|
static void event_handler(void* arg, esp_event_base_t event_base,
|
|
|
|
|
int32_t event_id, void* event_data);
|
|
|
|
|
static std::string getIP();
|
|
|
|
|
};
|
|
|
|
|
|
2025-11-28 18:26:32 -06:00
|
|
|
#endif
|