32 lines
609 B
C++
32 lines
609 B
C++
//
|
|
// Created by erki on 07/01/24.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include "nvs_handle.hpp"
|
|
#include <esp_http_server.h>
|
|
#include <expected>
|
|
|
|
class WifiProvisioner
|
|
{
|
|
public:
|
|
WifiProvisioner();
|
|
|
|
bool wifiIsConfigured() const
|
|
{
|
|
return wifi_initialized_;
|
|
}
|
|
|
|
std::expected<void, esp_err_t> startProvisioning();
|
|
|
|
private:
|
|
std::unique_ptr<nvs::NVSHandle> file_handle_;
|
|
bool wifi_initialized_ = false;
|
|
httpd_handle_t http_server_ = nullptr;
|
|
|
|
esp_err_t initializeNvsNamespace_();
|
|
std::expected<void, esp_err_t> initializeWifiAp_();
|
|
std::expected<httpd_handle_t, esp_err_t> initializeCaptivePortal_();
|
|
};
|