58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#pragma once
|
|
|
|
|
|
#include <span>
|
|
#include <string_view>
|
|
|
|
#include <util/inplace_function.h>
|
|
|
|
|
|
namespace wifi {
|
|
|
|
|
|
enum class Mode { station, soft_ap, /* station_and_soft_ap */ };
|
|
|
|
|
|
// TODO: Authmode
|
|
struct soft_ap_settings_t {
|
|
uint8_t channel = 11;
|
|
uint8_t max_connections = 5;
|
|
|
|
inplace_function<void(std::array<char, 18>, uint8_t)> connected;
|
|
inplace_function<void(std::array<char, 18>, uint8_t)> disconnected;
|
|
};
|
|
|
|
struct station_settings_t {
|
|
inplace_function<void()> stationStarted = [] {};
|
|
inplace_function<void()> disconnected = [] {};
|
|
inplace_function<void(std::array<char, 17>)> gotIp = [](auto...) {};
|
|
};
|
|
|
|
struct scanned_ap_t {
|
|
std::array<char, 33> ssid = {0};
|
|
int rssi;
|
|
};
|
|
|
|
|
|
void init();
|
|
void deinit();
|
|
|
|
void set_mode(Mode mode);
|
|
|
|
void configure_soft_ap(std::string_view ssid, std::string_view password,
|
|
soft_ap_settings_t settings = {});
|
|
void configure_station(std::string_view ssid, std::string_view password,
|
|
station_settings_t settings = {});
|
|
void clear_callbacks();
|
|
|
|
void station_connect();
|
|
void station_disconnect();
|
|
|
|
void start();
|
|
void stop();
|
|
|
|
std::span<scanned_ap_t> scan(std::span<scanned_ap_t> memory);
|
|
|
|
|
|
} // namespace wifi
|