hyperlink-sw/main/src/main.cpp

47 lines
1.4 KiB
C++

#include <nvs/nvs.h>
#include <wifi/wifi.h>
#include "esp_log.h"
extern "C" void app_main(void) {
try {
nvs::init();
wifi::init();
// wifi::set_mode(wifi::Mode::station);
// wifi::configure_station(
// "Vodafone-180C", "giraffen!",
// {.stationStarted = []() { wifi::station_connect(); },
// .disconnected = [] { wifi::station_connect(); },
// .gotIp =
// [](auto ip) {
// ESP_LOGI("DEBUG - ip callback ", "Got ip: %s",
// ip.data());
// }});
// wifi::start();
// wifi::stop();
// wifi::clear_callbacks();
// wifi::stop();
// wifi::deinit();
wifi::set_mode(wifi::Mode::soft_ap);
wifi::configure_soft_ap(
"HyperLink", "1234567890",
{.connected =
[](auto mac, auto aid) {
ESP_LOGI("DEBUG - ap callback", "Connected to mac %s",
mac.data());
},
.disconnected =
[](auto mac, auto aid) {
ESP_LOGI("DEBUG - ap callback", "Disconnected from mac %s",
mac.data());
}});
wifi::start();
} catch (const std::exception& e) {
ESP_LOGE("main", "Exception: %s", e.what());
}
}