55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
///
|
|
/// Simple WiFi Configuration features
|
|
///
|
|
#ifndef WIFICONFIGURATION_H
|
|
#define WIFICONFIGURATION_H
|
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#define CFG_NAMESIZE 32
|
|
#define CFG_SSIDSIZE 32
|
|
#define CFG_PASSSIZE 64
|
|
#define CFG_UURLSIZE 64
|
|
|
|
/// Provides a handy interface for WiFi configuration.
|
|
///
|
|
/// @code
|
|
/// WiFiConfiguration config;
|
|
/// ...
|
|
/// config.load();
|
|
/// ssid = config.getSSID();
|
|
/// pass = config.getPassword();
|
|
/// ...
|
|
/// WiFi.begin(ssid.c_str(), pass.c_str());
|
|
///
|
|
/// @endcode
|
|
///
|
|
class ConfigManager {
|
|
public:
|
|
ConfigManager();
|
|
void load();
|
|
void save();
|
|
void factoryReset();
|
|
String getName();
|
|
void setName(String _name);
|
|
String getSSID();
|
|
void setSSID(String _ssid);
|
|
String getPassword();
|
|
void setPassword(String _password);
|
|
String getURL();
|
|
void setURL(String _url);
|
|
uint16_t getOnRef();
|
|
void setOnRef(uint16 onR);
|
|
uint16_t getOffRef();
|
|
void setOffRef(uint16 offR);
|
|
uint16_t getAutoOff();
|
|
void setAutoOff(uint16 autoOff);
|
|
#if 0
|
|
String getNTPServerName();
|
|
void setNTPServerName(String _name);
|
|
#endif
|
|
private:
|
|
};
|
|
|
|
#endif // !WIFICONFIGURATION_H
|