mirror of
https://github.com/esp8266/Arduino.git
synced 2025-05-15 17:35:24 +03:00
The key functions added are: `bool enableForwarder(const String &domainName=emptyString, const IPAddress &dns=uint32_t)0)` If specified, `enableForwarder` will update the `domainName` that is used to match DNS request to this AP's IP Address. A non-matching request will be forwarded to the DNS server specified by `dns`. Returns `true` on success. Returns `false`, * when forwarding `dns` is not set, or * unable to allocate resources for managing the DNS forward function. `void disableForwarder(const String &domainName=emptyString, bool freeResources=false)` `disableForwarder` will stop forwarding DNS requests. If specified, updates the `domainName` that is matched for returning this AP's IP Address. Optionally, resources used for the DNS forward function can be freed.
34 lines
829 B
C++
34 lines
829 B
C++
|
|
#if LWIP_FEATURES && !LWIP_IPV6
|
|
|
|
/** Load WLAN credentials from EEPROM */
|
|
void loadCredentials() {
|
|
EEPROM.begin(512);
|
|
EEPROM.get(0, ssid);
|
|
EEPROM.get(0 + sizeof(ssid), password);
|
|
char ok[2 + 1];
|
|
EEPROM.get(0 + sizeof(ssid) + sizeof(password), ok);
|
|
EEPROM.end();
|
|
if (String(ok) != String("OK")) {
|
|
ssid[0] = 0;
|
|
password[0] = 0;
|
|
}
|
|
|
|
CONSOLE_PRINTLN("Recovered credentials:");
|
|
CONSOLE_PRINTF(" %s\r\n", ssid);
|
|
CONSOLE_PRINTF(" %s\r\n", strlen(password) > 0 ? "********" : "<no password>");
|
|
}
|
|
|
|
/** Store WLAN credentials to EEPROM */
|
|
void saveCredentials() {
|
|
EEPROM.begin(512);
|
|
EEPROM.put(0, ssid);
|
|
EEPROM.put(0 + sizeof(ssid), password);
|
|
char ok[2 + 1] = "OK";
|
|
EEPROM.put(0 + sizeof(ssid) + sizeof(password), ok);
|
|
EEPROM.commit();
|
|
EEPROM.end();
|
|
}
|
|
|
|
#endif // LWIP_FEATURES && !LWIP_IPV6
|