28 lines
636 B
C++
28 lines
636 B
C++
#ifndef WIFI_MANAGER_HPP
|
|
#define WIFI_MANAGER_HPP
|
|
|
|
#include <esp_wifi.h>
|
|
#include <esp_event.h>
|
|
|
|
class WiFiManager {
|
|
public:
|
|
static WiFiManager& getInstance();
|
|
|
|
void init(const char* ssid, const char* password);
|
|
void connect();
|
|
void disconnect();
|
|
bool isConnected() const;
|
|
const char* getIpAddress() const;
|
|
|
|
private:
|
|
WiFiManager() = default;
|
|
static WiFiManager instance;
|
|
bool connected = false;
|
|
char ip_address[16] = {0};
|
|
|
|
static void eventHandler(void* arg, esp_event_base_t event_base,
|
|
int32_t event_id, void* event_data);
|
|
};
|
|
|
|
#endif // WIFI_MANAGER_HPP
|