|
@@ -28,7 +28,7 @@ using std::vector;
|
|
|
using std::atomic;
|
|
|
|
|
|
namespace dk {
|
|
|
- void handleConnect(wifi::AP::STA &sta);
|
|
|
+ void handleConnect(wifi::STA &sta);
|
|
|
|
|
|
void setupPairingMode();
|
|
|
|
|
@@ -36,8 +36,6 @@ namespace dk {
|
|
|
|
|
|
void testNotification();
|
|
|
|
|
|
- void startMdns();
|
|
|
-
|
|
|
rtos::EventGroup eventGroup;
|
|
|
struct Events {
|
|
|
static const constexpr unsigned int SET_PAIRING_MODE = 0;
|
|
@@ -79,17 +77,17 @@ namespace dk {
|
|
|
armedService.middleware<PairingIdMiddleware>();
|
|
|
|
|
|
if (paired()) {
|
|
|
- wifi::start();
|
|
|
auto wifiConfig = SettingsManager::instance()->wifiConfig();
|
|
|
- wifi::getSTA()->onIp = ([]() {
|
|
|
+ wifi::sta::onIp = ([]() {
|
|
|
setupArmedMode();
|
|
|
});
|
|
|
- wifi::getSTA()->onDisconnect = ([]() {
|
|
|
+ wifi::sta::onDisconnect = ([]() {
|
|
|
lcd.println("disconnected", 1);
|
|
|
// TODO try to reconnect, or fire event?
|
|
|
});
|
|
|
lcd.println("connecting...", 1);
|
|
|
- wifi::getSTA()->connect(wifiConfig.ssid, wifiConfig.password);
|
|
|
+ wifi::sta::start();
|
|
|
+ wifi::sta::connect(wifiConfig.ssid, wifiConfig.password);
|
|
|
} else {
|
|
|
setupPairingMode();
|
|
|
}
|
|
@@ -112,7 +110,7 @@ namespace dk {
|
|
|
lcd.println("", 1);
|
|
|
}
|
|
|
|
|
|
- void handleConnect(wifi::AP::STA &sta) {
|
|
|
+ void handleConnect(wifi::STA &sta) {
|
|
|
lcd.clear();
|
|
|
kbf::sleep(50);
|
|
|
lcd.print("waiting for");
|
|
@@ -129,11 +127,8 @@ namespace dk {
|
|
|
pairingService.stop();
|
|
|
wifi::stop();
|
|
|
|
|
|
- auto sta = wifi::STA::create();
|
|
|
- auto ap = wifi::AP::create("doorkeeper", "initinit");
|
|
|
- ap->onConnect = handleConnect;
|
|
|
-
|
|
|
- wifi::start(ap, sta);
|
|
|
+ wifi::ap::onConnect = handleConnect;
|
|
|
+ wifi::dual::start("doorkeeper", "initinit");
|
|
|
pairingService.start();
|
|
|
}
|
|
|
|