knx/src/wpsstate.cpp

34 lines
780 B
C++
Raw Normal View History

2018-11-07 00:32:36 +01:00
#include "arch_config.h"
#ifdef USE_STATES
2018-04-09 23:58:35 +02:00
#include <ESP8266WiFi.h>
#include "wpsstate.h"
#include "runningstate.h"
#include "nowifistate.h"
WpsState wpsState = WpsState();
void WpsState::enterState()
{
//invalidate old wifi settings first
WiFi.begin("fobar", "a12");
Serial.println("WPS config start");
bool wpsSuccess = WiFi.beginWPSConfig();
if (wpsSuccess) {
String newSSID = WiFi.SSID();
if (newSSID.length() > 0)
{
Serial.printf("WPS finished. Connected successfull to SSID '%s'\n", newSSID.c_str());
switchToSate(runningState);
}
else
{
Serial.printf("WPS failed.");
switchToSate(noWifiState);
}
}
}
2018-11-07 00:32:36 +01:00
#endif