diff --git a/lib/ESP_WiFiManager/ESP_WiFiManager-Impl.h b/lib/ESP_WiFiManager/ESP_WiFiManager-Impl.h index 328a4a2..c666ffd 100644 --- a/lib/ESP_WiFiManager/ESP_WiFiManager-Impl.h +++ b/lib/ESP_WiFiManager/ESP_WiFiManager-Impl.h @@ -16,7 +16,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.8.0 + Version: 1.10.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -56,7 +56,10 @@ 1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library 1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5- 1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug - 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h + 1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ *****************************************************************************************************************************/ #pragma once diff --git a/lib/ESP_WiFiManager/ESP_WiFiManager.h b/lib/ESP_WiFiManager/ESP_WiFiManager.h index cd7f5aa..4c06b02 100644 --- a/lib/ESP_WiFiManager/ESP_WiFiManager.h +++ b/lib/ESP_WiFiManager/ESP_WiFiManager.h @@ -16,7 +16,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.8.0 + Version: 1.10.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -56,7 +56,10 @@ 1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library 1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5- 1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug - 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h + 1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ *****************************************************************************************************************************/ #pragma once @@ -64,665 +67,8 @@ #ifndef ESP_WiFiManager_h #define ESP_WiFiManager_h -#if !( defined(ESP8266) || defined(ESP32) ) - #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. -#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ - ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ - ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) - #warning Using ESP32_S2. To follow library instructions to install esp32-s2 core and WebServer Patch - #warning You have to select HUGE APP or 1.9-2.0 MB APP to be able to run Config Portal. Must use PSRAM - #define USING_ESP32_S2 true -#elif ( ARDUINO_ESP32C3_DEV ) - #warning Using ESP32_C3. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK. - #warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards - #define USING_ESP32_C3 true -#endif - -#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.8.0" - -#define ESP_WIFIMANAGER_VERSION_MAJOR 1 -#define ESP_WIFIMANAGER_VERSION_MINOR 8 -#define ESP_WIFIMANAGER_VERSION_PATCH 0 - -#define ESP_WIFIMANAGER_VERSION_INT 1008000 - -#include "ESP_WiFiManager_Debug.h" - -#if ( defined(HTTP_PORT) && (HTTP_PORT < 65536) && (HTTP_PORT > 0) ) - #if (_WIFIMGR_LOGLEVEL_ > 2) - #warning Using custom HTTP_PORT - #endif - - #define HTTP_PORT_TO_USE HTTP_PORT -#else - #if (_WIFIMGR_LOGLEVEL_ > 2) - #warning Using default HTTP_PORT = 80 - #endif - - #define HTTP_PORT_TO_USE 80 -#endif - -//KH, for ESP32 -#ifdef ESP8266 - #include - #include -#else //ESP32 - #include - #include -#endif - -#include -#include -#undef min -#undef max -#include - -//KH, for ESP32 -#ifdef ESP8266 - extern "C" - { - #include "user_interface.h" - } - - #define ESP_getChipId() (ESP.getChipId()) -#else //ESP32 - #include - #define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) -#endif - -// New in v1.4.0 -typedef struct -{ - IPAddress _ap_static_ip; - IPAddress _ap_static_gw; - IPAddress _ap_static_sn; - -} WiFi_AP_IPConfig; - -// Thanks to @Amorphous for the feature and code -// (https://community.blynk.cc/t/esp-wifimanager-for-esp32-and-esp8266/42257/13) -// To enable to configure from sketch -#if !defined(USE_CONFIGURABLE_DNS) - #define USE_CONFIGURABLE_DNS false -#endif - -typedef struct -{ - IPAddress _sta_static_ip; - IPAddress _sta_static_gw; - IPAddress _sta_static_sn; - IPAddress _sta_static_dns1; - IPAddress _sta_static_dns2; -} WiFi_STA_IPConfig; -////// - -#define WFM_LABEL_BEFORE 1 -#define WFM_LABEL_AFTER 2 -#define WFM_NO_LABEL 0 - -/** Handle CORS in pages */ -// Default false for using only whenever necessary to avoid security issue when using CORS (Cross-Origin Resource Sharing) -#ifndef USING_CORS_FEATURE - // Contributed by AlesSt (https://github.com/AlesSt) to solve AJAX CORS protection problem of API redirects on client side - // See more in https://github.com/khoih-prog/ESP_WiFiManager/issues/27 and https://en.wikipedia.org/wiki/Cross-origin_resource_sharing - #define USING_CORS_FEATURE false -#endif - -//KH -//Mofidy HTTP_HEAD to WM_HTTP_HEAD_START to avoid conflict in Arduino esp8266 core 2.6.0+ -const char WM_HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; -const char WM_HTTP_HEAD_START[] PROGMEM = "{v}"; - -// KH, update from v1.0.10 -const char WM_HTTP_STYLE[] PROGMEM = ""; -////// - -// KH, update from v1.1.0 -const char WM_HTTP_SCRIPT[] PROGMEM = ""; -////// - -// From v1.0.9 to permit disable or configure NTP from sketch -#ifndef USE_ESP_WIFIMANAGER_NTP - // From v1.0.6 to enable NTP config - #define USE_ESP_WIFIMANAGER_NTP true -#endif - -#if USE_ESP_WIFIMANAGER_NTP - -#include "utils/TZ.h" - -const char WM_HTTP_SCRIPT_NTP_MSG[] PROGMEM = "

Your Timezone is :

"; -const char WM_HTTP_SCRIPT_NTP_HIDDEN[] PROGMEM = "

"; - -#if ESP8266 - #if !(USE_CLOUDFLARE_NTP) - #undef USE_CLOUDFLARE_NTP - #define USE_CLOUDFLARE_NTP true - #warning Forcing USE_CLOUDFLARE_NTP for ESP8266 as low memory can cause blank page - #endif -#endif - -// To permit disable or configure NTP from sketch -#ifndef USE_CLOUDFLARE_NTP - #define USE_CLOUDFLARE_NTP false -#endif - -#if USE_CLOUDFLARE_NTP -const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; -#else -const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; -#endif - -#else - const char WM_HTTP_SCRIPT_NTP_MSG[] PROGMEM = ""; - const char WM_HTTP_SCRIPT_NTP_HIDDEN[] PROGMEM = ""; - const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; -#endif - -// KH, update from v1.0.10 -const char WM_HTTP_HEAD_END[] PROGMEM = "
"; - -const char WM_FLDSET_START[] PROGMEM = "
"; -const char WM_FLDSET_END[] PROGMEM = "
"; -////// - -const char WM_HTTP_PORTAL_OPTIONS[] PROGMEM = "



"; -const char WM_HTTP_ITEM[] PROGMEM = "
{v} {r}%
"; -const char JSON_ITEM[] PROGMEM = "{\"SSID\":\"{v}\", \"Encryption\":{i}, \"Quality\":\"{r}\"}"; - -// KH, update from v1.1.0 -//const char WM_HTTP_FORM_START[] PROGMEM = "
"; -//const char WM_HTTP_FORM_START[] PROGMEM = "
"; -////// - -// KH, add from v1.0.10 -const char WM_HTTP_FORM_LABEL_BEFORE[] PROGMEM = "
"; -const char WM_HTTP_FORM_LABEL_AFTER[] PROGMEM = "
"; -////// - -const char WM_HTTP_FORM_LABEL[] PROGMEM = ""; -const char WM_HTTP_FORM_PARAM[] PROGMEM = ""; - -const char WM_HTTP_FORM_END[] PROGMEM = "
"; - -// KH, update from v1.1.0 -const char WM_HTTP_SAVED[] PROGMEM = "
Credentials Saved
Try connecting ESP to the {x}/{x1} network. Wait around 10 seconds then check if it's OK.

The {v} AP will run on the same WiFi channel of the {x}/{x1} AP. You may have to manually reconnect to the {v} AP.

"; -////// - -const char WM_HTTP_END[] PROGMEM = "
"; - -//KH, from v1.1.0 -const char WM_HTTP_HEAD_CL[] PROGMEM = "Content-Length"; -const char WM_HTTP_HEAD_CT[] PROGMEM = "text/html"; -const char WM_HTTP_HEAD_CT2[] PROGMEM = "text/plain"; - -//KH Add repeatedly used const -const char WM_HTTP_CACHE_CONTROL[] PROGMEM = "Cache-Control"; -const char WM_HTTP_NO_STORE[] PROGMEM = "no-cache, no-store, must-revalidate"; -const char WM_HTTP_PRAGMA[] PROGMEM = "Pragma"; -const char WM_HTTP_NO_CACHE[] PROGMEM = "no-cache"; -const char WM_HTTP_EXPIRES[] PROGMEM = "Expires"; -const char WM_HTTP_CORS[] PROGMEM = "Access-Control-Allow-Origin"; -const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*"; - -#if USE_AVAILABLE_PAGES -const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = "

Available Pages

PageFunction
/Menu page.
/wifiShow WiFi scan results and enter WiFi configuration.
/wifisaveSave WiFi configuration information and configure device. Needs variables supplied.
/closeClose the configuration server and configuration WiFi network.
/iThis page.
/rDelete WiFi configuration and reboot. ESP device will not reconnect to a network until new WiFi configuration data is entered.
/stateCurrent device state in JSON format. Interface for programmatic WiFi configuration.
/scanRun a WiFi scan and return results in JSON format. Interface for programmatic WiFi configuration.
"; -#else -const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = ""; -#endif - -//KH -#define WIFI_MANAGER_MAX_PARAMS 20 - -///////////////////////////////////////////////////////////////////////////// -// New in v1.4.0 -typedef struct -{ - const char *_id; - const char *_placeholder; - char *_value; - int _length; - int _labelPlacement; - -} WMParam_Data; -////// - -class ESP_WMParameter -{ - public: - ESP_WMParameter(const char *custom); - ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length, - const char *custom = "", int labelPlacement = WFM_LABEL_BEFORE); - - // New in v1.4.0 - ESP_WMParameter(const WMParam_Data& WMParam_data); - ////// - - ~ESP_WMParameter(); - - // New in v1.4.0 - void setWMParam_Data(const WMParam_Data& WMParam_data); - void getWMParam_Data(WMParam_Data &WMParam_data); - ////// - - const char *getID(); - const char *getValue(); - const char *getPlaceholder(); - int getValueLength(); - int getLabelPlacement(); - const char *getCustomHTML(); - - private: - - WMParam_Data _WMParam_data; - - const char *_customHTML; - - void init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement); - - friend class ESP_WiFiManager; -}; - -#define USE_DYNAMIC_PARAMS true -#define DEFAULT_PORTAL_TIMEOUT 60000L - -// From v1.0.10 to permit disable/enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used. -// You have to explicitly specify false to disable the feature. -#ifndef USE_STATIC_IP_CONFIG_IN_CP - #define USE_STATIC_IP_CONFIG_IN_CP true -#endif - -class ESP_WiFiManager -{ - public: - - ESP_WiFiManager(const char *iHostname = ""); - - ~ESP_WiFiManager(); - - // Update feature from v1.0.11. Can use with STA staticIP now - bool autoConnect(); - bool autoConnect(char const *apName, char const *apPassword = NULL); - ////// - - //if you want to start the config portal - bool startConfigPortal(); - bool startConfigPortal(char const *apName, char const *apPassword = NULL); - - // get the AP name of the config portal, so it can be used in the callback - String getConfigPortalSSID(); - // get the AP password of the config portal, so it can be used in the callback - String getConfigPortalPW(); - - void resetSettings(); - - //sets timeout before webserver loop ends and exits even if there has been no setup. - //usefully for devices that failed to connect at some point and got stuck in a webserver loop - //in seconds setConfigPortalTimeout is a new name for setTimeout - void setConfigPortalTimeout(unsigned long seconds); - void setTimeout(unsigned long seconds); - - //sets timeout for which to attempt connecting, usefull if you get a lot of failed connects - void setConnectTimeout(unsigned long seconds); - - - void setDebugOutput(bool debug); - //defaults to not showing anything under 8% signal quality if called - void setMinimumSignalQuality(int quality = 8); - - // KH, new from v1.0.10 to enable dynamic/random channel - int setConfigPortalChannel(int channel = 1); - ////// - - //sets a custom ip /gateway /subnet configuration - void setAPStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn); - - // New in v1.4.0 - void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig); - void getAPStaticIPConfig(WiFi_AP_IPConfig &WM_AP_IPconfig); - ////// - - //sets config for a static IP - void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn); - - // New in v1.4.0 - void setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig); - void getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig); - ////// - -#if USE_CONFIGURABLE_DNS - void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn, - const IPAddress& dns_address_1, const IPAddress& dns_address_2); -#endif - - //called when AP mode and config portal is started - void setAPCallback(void(*func)(ESP_WiFiManager*)); - //called when settings have been changed and connection was successful - void setSaveConfigCallback(void(*func)()); - -#if USE_DYNAMIC_PARAMS - //adds a custom parameter - bool addParameter(ESP_WMParameter *p); -#else - //adds a custom parameter - void addParameter(ESP_WMParameter *p); -#endif - - //if this is set, it will exit after config, even if connection is unsucessful. - void setBreakAfterConfig(bool shouldBreak); - //if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins) - //TODO - //if this is set, customise style - void setCustomHeadElement(const char* element); - //if this is true, remove duplicated Access Points - defaut true - void setRemoveDuplicateAPs(bool removeDuplicates); - //Scan for WiFiNetworks in range and sort by signal strength - //space for indices array allocated on the heap and should be freed when no longer required - int scanWifiNetworks(int **indicesptr); - - // return SSID of router in STA mode got from config portal. NULL if no user's input //KH - String getSSID() - { - return _ssid; - } - - // return password of router in STA mode got from config portal. NULL if no user's input //KH - String getPW() - { - return _pass; - } - - // New from v1.1.0 - // return SSID of router in STA mode got from config portal. NULL if no user's input //KH - String getSSID1() - { - return _ssid1; - } - - // return password of router in STA mode got from config portal. NULL if no user's input //KH - String getPW1() - { - return _pass1; - } - - #define MAX_WIFI_CREDENTIALS 2 - - String getSSID(uint8_t index) - { - if (index == 0) - return _ssid; - else if (index == 1) - return _ssid1; - else - return String(""); - } - - String getPW(uint8_t index) - { - if (index == 0) - return _pass; - else if (index == 1) - return _pass1; - else - return String(""); - } - ////// - - // New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*" -#if USING_CORS_FEATURE - void setCORSHeader(const char* CORSHeaders) - { - _CORS_Header = CORSHeaders; - - LOGWARN1(F("Set CORS Header to : "), _CORS_Header); - } - - const char* getCORSHeader() - { - return _CORS_Header; - } -#endif - - //returns the list of Parameters - ESP_WMParameter** getParameters(); - // returns the Parameters Count - int getParametersCount(); - - const char* getStatus(int status); - -#ifdef ESP32 - String getStoredWiFiSSID(); - String getStoredWiFiPass(); -#endif - - String WiFi_SSID() - { -#ifdef ESP8266 - return WiFi.SSID(); -#else - return getStoredWiFiSSID(); -#endif - } - - String WiFi_Pass() - { -#ifdef ESP8266 - return WiFi.psk(); -#else - return getStoredWiFiPass(); -#endif - } - - void setHostname() - { - if (RFC952_hostname[0] != 0) - { -#if ESP8266 - WiFi.hostname(RFC952_hostname); -#else - - // Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h - //#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2) - #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) - WiFi.setHostname(RFC952_hostname); - #else - // Still have bug in ESP32_S2 for old core. If using WiFi.setHostname() => WiFi.localIP() always = 255.255.255.255 - if ( String(ARDUINO_BOARD) != "ESP32S2_DEV" ) - { - // See https://github.com/espressif/arduino-esp32/issues/2537 - WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); - WiFi.setHostname(RFC952_hostname); - } - #endif -#endif - } - } - -#if USE_ESP_WIFIMANAGER_NTP - - String getTimezoneName() - { - return _timezoneName; - } - - void setTimezoneName(const String& inTimezoneName) - { - _timezoneName = inTimezoneName; - } - ////// - - //See: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html - // EST5EDT,M3.2.0,M11.1.0 (for America/New_York) - // EST5EDT is the name of the time zone - // EST is the abbreviation used when DST is off - // 6 hours is the time difference from GMT - // EDT is the abbreviation used when DST is on - // ,M3 is the third month - // .2 is the second occurrence of the day in the month - // .0 is Sunday - // ,M11 is the eleventh month - // .1 is the first occurrence of the day in the month - // .0 is Sunday - - const char * getTZ(const char * timezoneName) - { - //const char TZ_NAME[][TIMEZONE_MAX_LEN] - for (uint16_t index = 0; index < sizeof(TZ_NAME) / TIMEZONE_MAX_LEN; index++) - { - if ( !strncmp(timezoneName, (TZ_NAME[index]), strlen((TZ_NAME[index])) ) ) - { - yield(); - return (ESP_TZ_NAME[index]); - } - } - - return ""; - } - - - const char * getTZ(const String& timezoneName) - { - return getTZ(timezoneName.c_str()); - } - - -#endif - - private: - std::unique_ptr dnsServer; - - //KH, for ESP32 -#ifdef ESP8266 - std::unique_ptr server; -#else //ESP32 - std::unique_ptr server; -#endif - -#define RFC952_HOSTNAME_MAXLEN 24 - char RFC952_hostname[RFC952_HOSTNAME_MAXLEN + 1]; - - char* getRFC952_hostname(const char* iHostname); - - void setupConfigPortal(); - void startWPS(); - //const char* getStatus(int status); - - const char* _apName = "no-net"; - const char* _apPassword = NULL; - - String _ssid = ""; - String _pass = ""; - - // New from v1.1.0 - String _ssid1 = ""; - String _pass1 = ""; - ////// - -#if USE_ESP_WIFIMANAGER_NTP - // Timezone info - String _timezoneName = ""; -#endif - - unsigned long _configPortalTimeout = 0; - - unsigned long _connectTimeout = 0; - unsigned long _configPortalStart = 0; - - int numberOfNetworks; - int *networkIndices; - - // KH, new from v1.0.10 to enable dynamic/random channel - // default to channel 1 - #define MIN_WIFI_CHANNEL 1 - #define MAX_WIFI_CHANNEL 11 // Channel 12,13 is flaky, because of bad number 13 ;-) - - int _WiFiAPChannel = 1; - ////// - - // New in v1.4.0 - WiFi_AP_IPConfig _WiFi_AP_IPconfig; - - WiFi_STA_IPConfig _WiFi_STA_IPconfig = { IPAddress(0, 0, 0, 0), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0), - IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8) }; - ////// - - int _paramsCount = 0; - int _minimumQuality = -1; - bool _removeDuplicateAPs = true; - bool _shouldBreakAfterConfig = false; - bool _tryWPS = false; - - const char* _customHeadElement = ""; - - int status = WL_IDLE_STATUS; - - // New from v1.1.0, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*" -#if USING_CORS_FEATURE - const char* _CORS_Header = WM_HTTP_CORS_ALLOW_ALL; //"*"; -#endif - ////// - - // New v1.0.8 - void setWifiStaticIP(); - - // New v1.1.0 - int reconnectWifi(); - ////// - - // New v1.0.11 - int connectWifi(const String& ssid = "", const String& pass = ""); - ////// - - uint8_t waitForConnectResult(); - - void handleRoot(); - void handleWifi(); - void handleWifiSave(); - void handleServerClose(); - void handleInfo(); - void handleState(); - void handleScan(); - void handleReset(); - void handleNotFound(); - bool captivePortal(); - - void reportStatus(String &page); - - // DNS server - const byte DNS_PORT = 53; - - //helpers - int getRSSIasQuality(int RSSI); - bool isIp(const String& str); - String toStringIp(const IPAddress& ip); - - bool connect; - bool stopConfigPortal = false; - - bool _debug = false; //true; - - void(*_apcallback) (ESP_WiFiManager*) = NULL; - void(*_savecallback)() = NULL; - -#if USE_DYNAMIC_PARAMS - int _max_params; - ESP_WMParameter** _params; -#else - ESP_WMParameter* _params[WIFI_MANAGER_MAX_PARAMS]; -#endif - - template - void DEBUG_WM(Generic text); - - template - auto optionalIPFromString(T *obj, const char *s) -> decltype(obj->fromString(s)) { - return obj->fromString(s); - } - auto optionalIPFromString(...) -> bool { - LOGINFO("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work."); - return false; - } -}; +#include //https://github.com/khoih-prog/ESP_WiFiManager +#include //https://github.com/khoih-prog/ESP_WiFiManager #endif // ESP_WiFiManager_h diff --git a/lib/ESP_WiFiManager/ESP_WiFiManager.hpp b/lib/ESP_WiFiManager/ESP_WiFiManager.hpp new file mode 100644 index 0000000..448d457 --- /dev/null +++ b/lib/ESP_WiFiManager/ESP_WiFiManager.hpp @@ -0,0 +1,739 @@ +/**************************************************************************************************************************** + ESP_WiFiManager.hpp + For ESP8266 / ESP32 boards + + ESP_WiFiManager is a library for the ESP8266/Arduino platform + (https://github.com/esp8266/Arduino) to enable easy + configuration and reconfiguration of WiFi credentials using a Captive Portal + inspired by: + http://www.esp8266.com/viewtopic.php?f=29&t=2520 + https://github.com/chriscook8/esp-arduino-apboot + https://github.com/esp8266/Arduino/blob/master/libraries/DNSServer/examples/CaptivePortalAdvanced/ + + Modified from Tzapu https://github.com/tzapu/WiFiManager + and from Ken Taylor https://github.com/kentaylor + + Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager + Licensed under MIT license + + Version: 1.10.1 + + Version Modified By Date Comments + ------- ----------- ---------- ----------- + 1.0.0 K Hoang 07/10/2019 Initial coding + 1.0.1 K Hoang 13/12/2019 Fix bug. Add features. Add support for ESP32 + 1.0.2 K Hoang 19/12/2019 Fix bug thatkeeps ConfigPortal in endless loop if Portal/Router SSID or Password is NULL. + 1.0.3 K Hoang 05/01/2020 Option not displaying AvailablePages in Info page. Enhance README.md. Modify examples + 1.0.4 K Hoang 07/01/2020 Add RFC952 setHostname feature. + 1.0.5 K Hoang 15/01/2020 Add configurable DNS feature. Thanks to @Amorphous of https://community.blynk.cc + 1.0.6 K Hoang 03/02/2020 Add support for ArduinoJson version 6.0.0+ ( tested with v6.14.1 ) + 1.0.7 K Hoang 13/04/2020 Reduce start time, fix SPIFFS bug in examples, update README.md + 1.0.8 K Hoang 10/06/2020 Fix STAstaticIP issue. Restructure code. Add LittleFS support for ESP8266 core 2.7.1+ + 1.0.9 K Hoang 29/07/2020 Fix ESP32 STAstaticIP bug. Permit changing from DHCP <-> static IP using Config Portal. + Add, enhance examples (fix MDNS for ESP32) + 1.0.10 K Hoang 08/08/2020 Add more features to Config Portal. Use random WiFi AP channel to avoid conflict. + 1.0.11 K Hoang 17/08/2020 Add CORS feature. Fix bug in softAP, autoConnect, resetSettings. + 1.1.0 K Hoang 28/08/2020 Add MultiWiFi feature to autoconnect to best WiFi at runtime + 1.1.1 K Hoang 30/08/2020 Add setCORSHeader function to allow flexible CORS. Fix typo and minor improvement. + 1.1.2 K Hoang 17/08/2020 Fix bug. Add example. + 1.2.0 K Hoang 09/10/2020 Restore cpp code besides Impl.h code to use if linker error. Fix bug. + 1.3.0 K Hoang 04/12/2020 Add LittleFS support to ESP32 using LITTLEFS Library + 1.4.1 K Hoang 22/12/2020 Fix staticIP not saved. Add functions. Add complex examples. Sync with ESPAsync_WiFiManager + 1.4.2 K Hoang 14/01/2021 Fix examples' bug not using saved WiFi Credentials after losing all WiFi connections. + 1.4.3 K Hoang 23/01/2021 Fix examples' bug not saving Static IP in certain cases. + 1.5.0 K Hoang 12/02/2021 Add support to new ESP32-S2 + 1.5.1 K Hoang 26/03/2021 Fix compiler error if setting Compiler Warnings to All. Retest with esp32 core v1.0.6 + 1.5.2 K Hoang 08/04/2021 Fix example misleading messages. + 1.5.3 K Hoang 13/04/2021 Add dnsServer error message. + 1.6.0 K Hoang 20/04/2021 Add support to new ESP32-C3 using SPIFFS or EEPROM + 1.6.1 K Hoang 25/04/2021 Fix MultiWiFi bug. Fix captive-portal bug if CP AP address is not default 192.168.4.1 + 1.7.0 K Hoang 06/05/2021 Set _timezoneName. Add support to new ESP32-S2 (METRO_ESP32S2, FUNHOUSE_ESP32S2, etc.) + 1.7.1 K Hoang 08/05/2021 Fix Json bug. Fix timezoneName not displayed in Info page. + 1.7.2 K Hoang 08/05/2021 Fix warnings with ESP8266 core v3.0.0 + 1.7.3 K Hoang 29/07/2021 Fix MultiWiFi connection issue with ESP32 core v2.0.0-rc1+ + 1.7.4 K Hoang 13/08/2021 Add WiFi scanning of hidden SSIDs + 1.7.5 K Hoang 10/10/2021 Update `platform.ini` and `library.json` + 1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library + 1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5- + 1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug + 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h + 1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ + *****************************************************************************************************************************/ + +#pragma once + +#ifndef ESP_WiFiManager_hpp +#define ESP_WiFiManager_hpp + +#if !( defined(ESP8266) || defined(ESP32) ) + #error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting. +#elif ( ARDUINO_ESP32S2_DEV || ARDUINO_FEATHERS2 || ARDUINO_ESP32S2_THING_PLUS || ARDUINO_MICROS2 || \ + ARDUINO_METRO_ESP32S2 || ARDUINO_MAGTAG29_ESP32S2 || ARDUINO_FUNHOUSE_ESP32S2 || \ + ARDUINO_ADAFRUIT_FEATHER_ESP32S2_NOPSRAM ) + #warning Using ESP32_S2. To follow library instructions to install esp32-s2 core and WebServer Patch + #warning You have to select HUGE APP or 1.9-2.0 MB APP to be able to run Config Portal. Must use PSRAM + #define USING_ESP32_S2 true +#elif ( ARDUINO_ESP32C3_DEV ) + #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) + #warning Using ESP32_C3 using core v2.0.0+. Either LittleFS, SPIFFS or EEPROM OK. + #else + #warning Using ESP32_C3 using core v1.0.6-. To follow library instructions to install esp32-c3 core. Only SPIFFS and EEPROM OK. + #endif + + #warning You have to select Flash size 2MB and Minimal APP (1.3MB + 700KB) for some boards + #define USING_ESP32_C3 true +#elif ( defined(ARDUINO_ESP32S3_DEV) || defined(ARDUINO_ESP32_S3_BOX) || defined(ARDUINO_TINYS3) || \ + defined(ARDUINO_PROS3) || defined(ARDUINO_FEATHERS3) ) + #warning Using ESP32_S3. To install esp32-s3-support branch if using core v2.0.2-. + #define USING_ESP32_S3 true +#endif + +#define ESP_WIFIMANAGER_VERSION "ESP_WiFiManager v1.10.1" + +#define ESP_WIFIMANAGER_VERSION_MAJOR 1 +#define ESP_WIFIMANAGER_VERSION_MINOR 10 +#define ESP_WIFIMANAGER_VERSION_PATCH 1 + +#define ESP_WIFIMANAGER_VERSION_INT 1010001 + +#include "ESP_WiFiManager_Debug.h" + +#if ( defined(HTTP_PORT) && (HTTP_PORT < 65536) && (HTTP_PORT > 0) ) + #if (_WIFIMGR_LOGLEVEL_ > 2) + #warning Using custom HTTP_PORT + #endif + + #define HTTP_PORT_TO_USE HTTP_PORT +#else + #if (_WIFIMGR_LOGLEVEL_ > 2) + #warning Using default HTTP_PORT = 80 + #endif + + #define HTTP_PORT_TO_USE 80 +#endif + +//KH, for ESP32 +#ifdef ESP8266 + #include + #include +#else //ESP32 + #include + #include +#endif + +#include +#include +#undef min +#undef max +#include + +//KH, for ESP32 +#ifdef ESP8266 + extern "C" + { + #include "user_interface.h" + } + + #define ESP_getChipId() (ESP.getChipId()) +#else //ESP32 + #include + #define ESP_getChipId() ((uint32_t)ESP.getEfuseMac()) +#endif + +// New in v1.4.0 +typedef struct +{ + IPAddress _ap_static_ip; + IPAddress _ap_static_gw; + IPAddress _ap_static_sn; + +} WiFi_AP_IPConfig; + +// Thanks to @Amorphous for the feature and code +// (https://community.blynk.cc/t/esp-wifimanager-for-esp32-and-esp8266/42257/13) +// To enable to configure from sketch +#if !defined(USE_CONFIGURABLE_DNS) + #define USE_CONFIGURABLE_DNS false +#endif + +typedef struct +{ + IPAddress _sta_static_ip; + IPAddress _sta_static_gw; + IPAddress _sta_static_sn; + IPAddress _sta_static_dns1; + IPAddress _sta_static_dns2; +} WiFi_STA_IPConfig; +////// + +#define WFM_LABEL_BEFORE 1 +#define WFM_LABEL_AFTER 2 +#define WFM_NO_LABEL 0 + +/** Handle CORS in pages */ +// Default false for using only whenever necessary to avoid security issue when using CORS (Cross-Origin Resource Sharing) +#ifndef USING_CORS_FEATURE + // Contributed by AlesSt (https://github.com/AlesSt) to solve AJAX CORS protection problem of API redirects on client side + // See more in https://github.com/khoih-prog/ESP_WiFiManager/issues/27 and https://en.wikipedia.org/wiki/Cross-origin_resource_sharing + #define USING_CORS_FEATURE false +#endif + +//KH +//Mofidy HTTP_HEAD to WM_HTTP_HEAD_START to avoid conflict in Arduino esp8266 core 2.6.0+ +const char WM_HTTP_200[] PROGMEM = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; +const char WM_HTTP_HEAD_START[] PROGMEM = "{v}"; + +// KH, update from v1.0.10 +const char WM_HTTP_STYLE[] PROGMEM = ""; +////// + +// KH, update from v1.1.0 +const char WM_HTTP_SCRIPT[] PROGMEM = ""; +////// + +// From v1.0.9 to permit disable or configure NTP from sketch +#ifndef USE_ESP_WIFIMANAGER_NTP + // From v1.0.6 to enable NTP config + #define USE_ESP_WIFIMANAGER_NTP true +#endif + +#if USE_ESP_WIFIMANAGER_NTP + +#include "utils/TZ.h" + +const char WM_HTTP_SCRIPT_NTP_MSG[] PROGMEM = "

Your Timezone is :

"; +const char WM_HTTP_SCRIPT_NTP_HIDDEN[] PROGMEM = "

"; + +#if ESP8266 + #if !(USE_CLOUDFLARE_NTP) + #undef USE_CLOUDFLARE_NTP + #define USE_CLOUDFLARE_NTP true + #warning Forcing USE_CLOUDFLARE_NTP for ESP8266 as low memory can cause blank page + #endif +#endif + +// To permit disable or configure NTP from sketch +#ifndef USE_CLOUDFLARE_NTP + #define USE_CLOUDFLARE_NTP false +#endif + +#if USE_CLOUDFLARE_NTP +const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; +#else +const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; +#endif + +#else + const char WM_HTTP_SCRIPT_NTP_MSG[] PROGMEM = ""; + const char WM_HTTP_SCRIPT_NTP_HIDDEN[] PROGMEM = ""; + const char WM_HTTP_SCRIPT_NTP[] PROGMEM = ""; +#endif + +// KH, update from v1.0.10 +const char WM_HTTP_HEAD_END[] PROGMEM = "
"; + +const char WM_FLDSET_START[] PROGMEM = "
"; +const char WM_FLDSET_END[] PROGMEM = "
"; +////// + +const char WM_HTTP_PORTAL_OPTIONS[] PROGMEM = "



"; +const char WM_HTTP_ITEM[] PROGMEM = "
{v} {r}%
"; +const char JSON_ITEM[] PROGMEM = "{\"SSID\":\"{v}\", \"Encryption\":{i}, \"Quality\":\"{r}\"}"; + +// KH, update from v1.1.0 +const char WM_HTTP_FORM_START[] PROGMEM = "
"; +////// + +// KH, add from v1.0.10 +const char WM_HTTP_FORM_LABEL_BEFORE[] PROGMEM = "
"; +const char WM_HTTP_FORM_LABEL_AFTER[] PROGMEM = "
"; +////// + +const char WM_HTTP_FORM_LABEL[] PROGMEM = ""; +const char WM_HTTP_FORM_PARAM[] PROGMEM = ""; + +const char WM_HTTP_FORM_END[] PROGMEM = "
"; + +// KH, update from v1.1.0 +const char WM_HTTP_SAVED[] PROGMEM = "
Credentials Saved
Try connecting ESP to the {x}/{x1} network. Wait around 10 seconds then check if it's OK.

The {v} AP will run on the same WiFi channel of the {x}/{x1} AP. You may have to manually reconnect to the {v} AP.

"; +////// + +const char WM_HTTP_END[] PROGMEM = "
"; + +//KH, from v1.1.0 +const char WM_HTTP_HEAD_CL[] PROGMEM = "Content-Length"; +const char WM_HTTP_HEAD_CT[] PROGMEM = "text/html"; +const char WM_HTTP_HEAD_CT2[] PROGMEM = "text/plain"; + +//KH Add repeatedly used const +const char WM_HTTP_CACHE_CONTROL[] PROGMEM = "Cache-Control"; +const char WM_HTTP_NO_STORE[] PROGMEM = "no-cache, no-store, must-revalidate"; +const char WM_HTTP_PRAGMA[] PROGMEM = "Pragma"; +const char WM_HTTP_NO_CACHE[] PROGMEM = "no-cache"; +const char WM_HTTP_EXPIRES[] PROGMEM = "Expires"; +const char WM_HTTP_CORS[] PROGMEM = "Access-Control-Allow-Origin"; +const char WM_HTTP_CORS_ALLOW_ALL[] PROGMEM = "*"; + +#if USE_AVAILABLE_PAGES +const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = "

Available Pages

PageFunction
/Menu page.
/wifiShow WiFi scan results and enter WiFi configuration.
/wifisaveSave WiFi configuration information and configure device. Needs variables supplied.
/closeClose the configuration server and configuration WiFi network.
/iThis page.
/rDelete WiFi configuration and reboot. ESP device will not reconnect to a network until new WiFi configuration data is entered.
/stateCurrent device state in JSON format. Interface for programmatic WiFi configuration.
/scanRun a WiFi scan and return results in JSON format. Interface for programmatic WiFi configuration.
"; +#else +const char WM_HTTP_AVAILABLE_PAGES[] PROGMEM = ""; +#endif + +//KH +#define WIFI_MANAGER_MAX_PARAMS 20 + +///////////////////////////////////////////////////////////////////////////// +// New in v1.4.0 +typedef struct +{ + const char *_id; + const char *_placeholder; + char *_value; + int _length; + int _labelPlacement; + +} WMParam_Data; +////// + +class ESP_WMParameter +{ + public: + ESP_WMParameter(const char *custom); + ESP_WMParameter(const char *id, const char *placeholder, const char *defaultValue, int length, + const char *custom = "", int labelPlacement = WFM_LABEL_BEFORE); + + // New in v1.4.0 + ESP_WMParameter(const WMParam_Data& WMParam_data); + ////// + + ~ESP_WMParameter(); + + // New in v1.4.0 + void setWMParam_Data(const WMParam_Data& WMParam_data); + void getWMParam_Data(WMParam_Data &WMParam_data); + ////// + + const char *getID(); + const char *getValue(); + const char *getPlaceholder(); + int getValueLength(); + int getLabelPlacement(); + const char *getCustomHTML(); + + private: + + WMParam_Data _WMParam_data; + + const char *_customHTML; + + void init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom, int labelPlacement); + + friend class ESP_WiFiManager; +}; + +#define USE_DYNAMIC_PARAMS true +#define DEFAULT_PORTAL_TIMEOUT 60000L + +// From v1.0.10 to permit disable/enable StaticIP configuration in Config Portal from sketch. Valid only if DHCP is used. +// You have to explicitly specify false to disable the feature. +#ifndef USE_STATIC_IP_CONFIG_IN_CP + #define USE_STATIC_IP_CONFIG_IN_CP true +#endif + +class ESP_WiFiManager +{ + public: + + ESP_WiFiManager(const char *iHostname = ""); + + ~ESP_WiFiManager(); + + // Update feature from v1.0.11. Can use with STA staticIP now + bool autoConnect(); + bool autoConnect(char const *apName, char const *apPassword = NULL); + ////// + + //if you want to start the config portal + bool startConfigPortal(); + bool startConfigPortal(char const *apName, char const *apPassword = NULL); + + // get the AP name of the config portal, so it can be used in the callback + String getConfigPortalSSID(); + // get the AP password of the config portal, so it can be used in the callback + String getConfigPortalPW(); + + void resetSettings(); + + //sets timeout before webserver loop ends and exits even if there has been no setup. + //usefully for devices that failed to connect at some point and got stuck in a webserver loop + //in seconds setConfigPortalTimeout is a new name for setTimeout + void setConfigPortalTimeout(unsigned long seconds); + void setTimeout(unsigned long seconds); + + //sets timeout for which to attempt connecting, usefull if you get a lot of failed connects + void setConnectTimeout(unsigned long seconds); + + + void setDebugOutput(bool debug); + //defaults to not showing anything under 8% signal quality if called + void setMinimumSignalQuality(int quality = 8); + + // KH, new from v1.0.10 to enable dynamic/random channel + int setConfigPortalChannel(int channel = 1); + ////// + + //sets a custom ip /gateway /subnet configuration + void setAPStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn); + + // New in v1.4.0 + void setAPStaticIPConfig(const WiFi_AP_IPConfig& WM_AP_IPconfig); + void getAPStaticIPConfig(WiFi_AP_IPConfig &WM_AP_IPconfig); + ////// + + //sets config for a static IP + void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn); + + // New in v1.4.0 + void setSTAStaticIPConfig(const WiFi_STA_IPConfig& WM_STA_IPconfig); + void getSTAStaticIPConfig(WiFi_STA_IPConfig &WM_STA_IPconfig); + ////// + +#if USE_CONFIGURABLE_DNS + void setSTAStaticIPConfig(const IPAddress& ip, const IPAddress& gw, const IPAddress& sn, + const IPAddress& dns_address_1, const IPAddress& dns_address_2); +#endif + + //called when AP mode and config portal is started + void setAPCallback(void(*func)(ESP_WiFiManager*)); + //called when settings have been changed and connection was successful + void setSaveConfigCallback(void(*func)()); + +#if USE_DYNAMIC_PARAMS + //adds a custom parameter + bool addParameter(ESP_WMParameter *p); +#else + //adds a custom parameter + void addParameter(ESP_WMParameter *p); +#endif + + //if this is set, it will exit after config, even if connection is unsucessful. + void setBreakAfterConfig(bool shouldBreak); + //if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins) + //TODO + //if this is set, customise style + void setCustomHeadElement(const char* element); + //if this is true, remove duplicated Access Points - defaut true + void setRemoveDuplicateAPs(bool removeDuplicates); + //Scan for WiFiNetworks in range and sort by signal strength + //space for indices array allocated on the heap and should be freed when no longer required + int scanWifiNetworks(int **indicesptr); + + // return SSID of router in STA mode got from config portal. NULL if no user's input //KH + String getSSID() + { + return _ssid; + } + + // return password of router in STA mode got from config portal. NULL if no user's input //KH + String getPW() + { + return _pass; + } + + // New from v1.1.0 + // return SSID of router in STA mode got from config portal. NULL if no user's input //KH + String getSSID1() + { + return _ssid1; + } + + // return password of router in STA mode got from config portal. NULL if no user's input //KH + String getPW1() + { + return _pass1; + } + + #define MAX_WIFI_CREDENTIALS 2 + + String getSSID(uint8_t index) + { + if (index == 0) + return _ssid; + else if (index == 1) + return _ssid1; + else + return String(""); + } + + String getPW(uint8_t index) + { + if (index == 0) + return _pass; + else if (index == 1) + return _pass1; + else + return String(""); + } + ////// + + // New from v1.1.1, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*" +#if USING_CORS_FEATURE + void setCORSHeader(const char* CORSHeaders) + { + _CORS_Header = CORSHeaders; + + LOGWARN1(F("Set CORS Header to : "), _CORS_Header); + } + + const char* getCORSHeader() + { + return _CORS_Header; + } +#endif + + //returns the list of Parameters + ESP_WMParameter** getParameters(); + // returns the Parameters Count + int getParametersCount(); + + const char* getStatus(int status); + +#ifdef ESP32 + String getStoredWiFiSSID(); + String getStoredWiFiPass(); +#endif + + String WiFi_SSID() + { +#ifdef ESP8266 + return WiFi.SSID(); +#else + return getStoredWiFiSSID(); +#endif + } + + String WiFi_Pass() + { +#ifdef ESP8266 + return WiFi.psk(); +#else + return getStoredWiFiPass(); +#endif + } + + void setHostname() + { + if (RFC952_hostname[0] != 0) + { +#if ESP8266 + WiFi.hostname(RFC952_hostname); +#else + + // Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h + //#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2) + #if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) ) + WiFi.setHostname(RFC952_hostname); + #else + // Still have bug in ESP32_S2 for old core. If using WiFi.setHostname() => WiFi.localIP() always = 255.255.255.255 + if ( String(ARDUINO_BOARD) != "ESP32S2_DEV" ) + { + // See https://github.com/espressif/arduino-esp32/issues/2537 + WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); + WiFi.setHostname(RFC952_hostname); + } + #endif +#endif + } + } + +#if USE_ESP_WIFIMANAGER_NTP + + String getTimezoneName() + { + return _timezoneName; + } + + void setTimezoneName(const String& inTimezoneName) + { + _timezoneName = inTimezoneName; + } + ////// + + //See: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html + // EST5EDT,M3.2.0,M11.1.0 (for America/New_York) + // EST5EDT is the name of the time zone + // EST is the abbreviation used when DST is off + // 6 hours is the time difference from GMT + // EDT is the abbreviation used when DST is on + // ,M3 is the third month + // .2 is the second occurrence of the day in the month + // .0 is Sunday + // ,M11 is the eleventh month + // .1 is the first occurrence of the day in the month + // .0 is Sunday + + const char * getTZ(const char * timezoneName) + { + //const char TZ_NAME[][TIMEZONE_MAX_LEN] + for (uint16_t index = 0; index < sizeof(TZ_NAME) / TIMEZONE_MAX_LEN; index++) + { + if ( !strncmp(timezoneName, (TZ_NAME[index]), strlen((TZ_NAME[index])) ) ) + { + yield(); + return (ESP_TZ_NAME[index]); + } + } + + return ""; + } + + + const char * getTZ(const String& timezoneName) + { + return getTZ(timezoneName.c_str()); + } + + +#endif + + private: + std::unique_ptr dnsServer; + + //KH, for ESP32 +#ifdef ESP8266 + std::unique_ptr server; +#else //ESP32 + std::unique_ptr server; +#endif + +#define RFC952_HOSTNAME_MAXLEN 24 + char RFC952_hostname[RFC952_HOSTNAME_MAXLEN + 1]; + + char* getRFC952_hostname(const char* iHostname); + + void setupConfigPortal(); + void startWPS(); + //const char* getStatus(int status); + + const char* _apName = "no-net"; + const char* _apPassword = NULL; + + String _ssid = ""; + String _pass = ""; + + // New from v1.1.0 + String _ssid1 = ""; + String _pass1 = ""; + ////// + +#if USE_ESP_WIFIMANAGER_NTP + // Timezone info + String _timezoneName = ""; +#endif + + unsigned long _configPortalTimeout = 0; + + unsigned long _connectTimeout = 0; + unsigned long _configPortalStart = 0; + + int numberOfNetworks; + int *networkIndices; + + // KH, new from v1.0.10 to enable dynamic/random channel + // default to channel 1 + #define MIN_WIFI_CHANNEL 1 + #define MAX_WIFI_CHANNEL 11 // Channel 12,13 is flaky, because of bad number 13 ;-) + + int _WiFiAPChannel = 1; + ////// + + // New in v1.4.0 + WiFi_AP_IPConfig _WiFi_AP_IPconfig; + + WiFi_STA_IPConfig _WiFi_STA_IPconfig = { IPAddress(0, 0, 0, 0), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0), + IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8) }; + ////// + + int _paramsCount = 0; + int _minimumQuality = -1; + bool _removeDuplicateAPs = true; + bool _shouldBreakAfterConfig = false; + bool _tryWPS = false; + + const char* _customHeadElement = ""; + + int status = WL_IDLE_STATUS; + + // New from v1.1.0, for configure CORS Header, default to WM_HTTP_CORS_ALLOW_ALL = "*" +#if USING_CORS_FEATURE + const char* _CORS_Header = WM_HTTP_CORS_ALLOW_ALL; //"*"; +#endif + ////// + + // New v1.0.8 + void setWifiStaticIP(); + + // New v1.1.0 + int reconnectWifi(); + ////// + + // New v1.0.11 + int connectWifi(const String& ssid = "", const String& pass = ""); + ////// + + uint8_t waitForConnectResult(); + + void handleRoot(); + void handleWifi(); + void handleWifiSave(); + void handleServerClose(); + void handleInfo(); + void handleState(); + void handleScan(); + void handleReset(); + void handleNotFound(); + bool captivePortal(); + + void reportStatus(String &page); + + // DNS server + const byte DNS_PORT = 53; + + //helpers + int getRSSIasQuality(int RSSI); + bool isIp(const String& str); + String toStringIp(const IPAddress& ip); + + bool connect; + bool stopConfigPortal = false; + + bool _debug = false; //true; + + void(*_apcallback) (ESP_WiFiManager*) = NULL; + void(*_savecallback)() = NULL; + +#if USE_DYNAMIC_PARAMS + int _max_params; + ESP_WMParameter** _params; +#else + ESP_WMParameter* _params[WIFI_MANAGER_MAX_PARAMS]; +#endif + + template + void DEBUG_WM(Generic text); + + template + auto optionalIPFromString(T *obj, const char *s) -> decltype(obj->fromString(s)) { + return obj->fromString(s); + } + auto optionalIPFromString(...) -> bool { + LOGINFO("NO fromString METHOD ON IPAddress, you need ESP8266 core 2.1.0 or newer for Custom IP configuration to work."); + return false; + } +}; + +#endif // ESP_WiFiManager_h + diff --git a/lib/ESP_WiFiManager/ESP_WiFiManager_Debug.h b/lib/ESP_WiFiManager/ESP_WiFiManager_Debug.h index c60454b..7dc78ea 100644 --- a/lib/ESP_WiFiManager/ESP_WiFiManager_Debug.h +++ b/lib/ESP_WiFiManager/ESP_WiFiManager_Debug.h @@ -16,7 +16,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/ESP_WiFiManager Licensed under MIT license - Version: 1.8.0 + Version: 1.10.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -56,7 +56,10 @@ 1.7.6 K Hoang 26/11/2021 Auto detect ESP32 core and use either built-in LittleFS or LITTLEFS library 1.7.7 K Hoang 26/11/2021 Fix compile error for ESP32 core v1.0.5- 1.7.8 K Hoang 30/11/2021 Fix bug to permit using HTTP port different from 80. Fix bug - 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.8.0 K Hoang 29/12/2021 Fix `multiple-definitions` linker error and weird bug related to src_cpp + 1.9.0 K Hoang 17/01/2022 Enable compatibility with old code to include only ESP_WiFiManager.h + 1.10.0 K Hoang 10/02/2022 Add support to new ESP32-S3 + 1.10.1 K Hoang 11/02/2022 Add LittleFS support to ESP32-C3. Use core LittleFS instead of Lorol's LITTLEFS for v2.0.0+ *****************************************************************************************************************************/ #pragma once diff --git a/lib/ESP_WiFiManager/utils/TZ.h b/lib/ESP_WiFiManager/utils/TZ.h index 223b9be..ee26e91 100644 --- a/lib/ESP_WiFiManager/utils/TZ.h +++ b/lib/ESP_WiFiManager/utils/TZ.h @@ -71,8 +71,6 @@ //////////////////////////////////////////////////// -#if 1 - #define TZ_Africa_Abidjan ("GMT0") #define TZ_Africa_Accra ("GMT0") #define TZ_Africa_Addis_Ababa ("EAT-3") @@ -534,479 +532,11 @@ #define TZ_Etc_Universal ("UTC0") #define TZ_Etc_Zulu ("UTC0") - -#else - - -#define TZ_Africa_Abidjan PSTR("GMT0") -#define TZ_Africa_Accra PSTR("GMT0") -#define TZ_Africa_Addis_Ababa PSTR("EAT-3") -#define TZ_Africa_Algiers PSTR("CET-1") -#define TZ_Africa_Asmara PSTR("EAT-3") -#define TZ_Africa_Bamako PSTR("GMT0") -#define TZ_Africa_Bangui PSTR("WAT-1") -#define TZ_Africa_Banjul PSTR("GMT0") -#define TZ_Africa_Bissau PSTR("GMT0") -#define TZ_Africa_Blantyre PSTR("CAT-2") -#define TZ_Africa_Brazzaville PSTR("WAT-1") -#define TZ_Africa_Bujumbura PSTR("CAT-2") -#define TZ_Africa_Cairo PSTR("EET-2") -#define TZ_Africa_Casablanca PSTR("<+01>-1") -#define TZ_Africa_Ceuta PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Africa_Conakry PSTR("GMT0") -#define TZ_Africa_Dakar PSTR("GMT0") -#define TZ_Africa_Dar_es_Salaam PSTR("EAT-3") -#define TZ_Africa_Djibouti PSTR("EAT-3") -#define TZ_Africa_Douala PSTR("WAT-1") -#define TZ_Africa_El_Aaiun PSTR("<+01>-1") -#define TZ_Africa_Freetown PSTR("GMT0") -#define TZ_Africa_Gaborone PSTR("CAT-2") -#define TZ_Africa_Harare PSTR("CAT-2") -#define TZ_Africa_Johannesburg PSTR("SAST-2") -#define TZ_Africa_Juba PSTR("EAT-3") -#define TZ_Africa_Kampala PSTR("EAT-3") -#define TZ_Africa_Khartoum PSTR("CAT-2") -#define TZ_Africa_Kigali PSTR("CAT-2") -#define TZ_Africa_Kinshasa PSTR("WAT-1") -#define TZ_Africa_Lagos PSTR("WAT-1") -#define TZ_Africa_Libreville PSTR("WAT-1") -#define TZ_Africa_Lome PSTR("GMT0") -#define TZ_Africa_Luanda PSTR("WAT-1") -#define TZ_Africa_Lubumbashi PSTR("CAT-2") -#define TZ_Africa_Lusaka PSTR("CAT-2") -#define TZ_Africa_Malabo PSTR("WAT-1") -#define TZ_Africa_Maputo PSTR("CAT-2") -#define TZ_Africa_Maseru PSTR("SAST-2") -#define TZ_Africa_Mbabane PSTR("SAST-2") -#define TZ_Africa_Mogadishu PSTR("EAT-3") -#define TZ_Africa_Monrovia PSTR("GMT0") -#define TZ_Africa_Nairobi PSTR("EAT-3") -#define TZ_Africa_Ndjamena PSTR("WAT-1") -#define TZ_Africa_Niamey PSTR("WAT-1") -#define TZ_Africa_Nouakchott PSTR("GMT0") -#define TZ_Africa_Ouagadougou PSTR("GMT0") -#define TZ_Africa_PortomNovo PSTR("WAT-1") -#define TZ_Africa_Sao_Tome PSTR("GMT0") -#define TZ_Africa_Tripoli PSTR("EET-2") -#define TZ_Africa_Tunis PSTR("CET-1") -#define TZ_Africa_Windhoek PSTR("CAT-2") -#define TZ_America_Adak PSTR("HST10HDT,M3.2.0,M11.1.0") -#define TZ_America_Anchorage PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_Anguilla PSTR("AST4") -#define TZ_America_Antigua PSTR("AST4") -#define TZ_America_Araguaina PSTR("<-03>3") -#define TZ_America_Argentina_Buenos_Aires PSTR("<-03>3") -#define TZ_America_Argentina_Catamarca PSTR("<-03>3") -#define TZ_America_Argentina_Cordoba PSTR("<-03>3") -#define TZ_America_Argentina_Jujuy PSTR("<-03>3") -#define TZ_America_Argentina_La_Rioja PSTR("<-03>3") -#define TZ_America_Argentina_Mendoza PSTR("<-03>3") -#define TZ_America_Argentina_Rio_Gallegos PSTR("<-03>3") -#define TZ_America_Argentina_Salta PSTR("<-03>3") -#define TZ_America_Argentina_San_Juan PSTR("<-03>3") -#define TZ_America_Argentina_San_Luis PSTR("<-03>3") -#define TZ_America_Argentina_Tucuman PSTR("<-03>3") -#define TZ_America_Argentina_Ushuaia PSTR("<-03>3") -#define TZ_America_Aruba PSTR("AST4") -#define TZ_America_Asuncion PSTR("<-04>4<-03>,M10.1.0/0,M3.4.0/0") -#define TZ_America_Atikokan PSTR("EST5") -#define TZ_America_Bahia PSTR("<-03>3") -#define TZ_America_Bahia_Banderas PSTR("CST6CDT,M4.1.0,M10.5.0") -#define TZ_America_Barbados PSTR("AST4") -#define TZ_America_Belem PSTR("<-03>3") -#define TZ_America_Belize PSTR("CST6") -#define TZ_America_BlancmSablon PSTR("AST4") -#define TZ_America_Boa_Vista PSTR("<-04>4") -#define TZ_America_Bogota PSTR("<-05>5") -#define TZ_America_Boise PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Cambridge_Bay PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Campo_Grande PSTR("<-04>4") -#define TZ_America_Cancun PSTR("EST5") -#define TZ_America_Caracas PSTR("<-04>4") -#define TZ_America_Cayenne PSTR("<-03>3") -#define TZ_America_Cayman PSTR("EST5") -#define TZ_America_Chicago PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Chihuahua PSTR("MST7MDT,M4.1.0,M10.5.0") -#define TZ_America_Costa_Rica PSTR("CST6") -#define TZ_America_Creston PSTR("MST7") -#define TZ_America_Cuiaba PSTR("<-04>4") -#define TZ_America_Curacao PSTR("AST4") -#define TZ_America_Danmarkshavn PSTR("GMT0") -#define TZ_America_Dawson PSTR("MST7") -#define TZ_America_Dawson_Creek PSTR("MST7") -#define TZ_America_Denver PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Detroit PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Dominica PSTR("AST4") -#define TZ_America_Edmonton PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Eirunepe PSTR("<-05>5") -#define TZ_America_El_Salvador PSTR("CST6") -#define TZ_America_Fortaleza PSTR("<-03>3") -#define TZ_America_Fort_Nelson PSTR("MST7") -#define TZ_America_Glace_Bay PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_America_Godthab PSTR("<-03>3<-02>,M3.5.0/-2,M10.5.0/-1") -#define TZ_America_Goose_Bay PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_America_Grand_Turk PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Grenada PSTR("AST4") -#define TZ_America_Guadeloupe PSTR("AST4") -#define TZ_America_Guatemala PSTR("CST6") -#define TZ_America_Guayaquil PSTR("<-05>5") -#define TZ_America_Guyana PSTR("<-04>4") -#define TZ_America_Halifax PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_America_Havana PSTR("CST5CDT,M3.2.0/0,M11.1.0/1") -#define TZ_America_Hermosillo PSTR("MST7") -#define TZ_America_Indiana_Indianapolis PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Knox PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Marengo PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Petersburg PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Tell_City PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Vevay PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Vincennes PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Indiana_Winamac PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Inuvik PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Iqaluit PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Jamaica PSTR("EST5") -#define TZ_America_Juneau PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_Kentucky_Louisville PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Kentucky_Monticello PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Kralendijk PSTR("AST4") -#define TZ_America_La_Paz PSTR("<-04>4") -#define TZ_America_Lima PSTR("<-05>5") -#define TZ_America_Los_Angeles PSTR("PST8PDT,M3.2.0,M11.1.0") -#define TZ_America_Lower_Princes PSTR("AST4") -#define TZ_America_Maceio PSTR("<-03>3") -#define TZ_America_Managua PSTR("CST6") -#define TZ_America_Manaus PSTR("<-04>4") -#define TZ_America_Marigot PSTR("AST4") -#define TZ_America_Martinique PSTR("AST4") -#define TZ_America_Matamoros PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Mazatlan PSTR("MST7MDT,M4.1.0,M10.5.0") -#define TZ_America_Menominee PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Merida PSTR("CST6CDT,M4.1.0,M10.5.0") -#define TZ_America_Metlakatla PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_Mexico_City PSTR("CST6CDT,M4.1.0,M10.5.0") -#define TZ_America_Miquelon PSTR("<-03>3<-02>,M3.2.0,M11.1.0") -#define TZ_America_Moncton PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_America_Monterrey PSTR("CST6CDT,M4.1.0,M10.5.0") -#define TZ_America_Montevideo PSTR("<-03>3") -#define TZ_America_Montreal PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Montserrat PSTR("AST4") -#define TZ_America_Nassau PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_New_York PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Nipigon PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Nome PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_Noronha PSTR("<-02>2") -#define TZ_America_North_Dakota_Beulah PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_North_Dakota_Center PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_North_Dakota_New_Salem PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Ojinaga PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_America_Panama PSTR("EST5") -#define TZ_America_Pangnirtung PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Paramaribo PSTR("<-03>3") -#define TZ_America_Phoenix PSTR("MST7") -#define TZ_America_PortmaumPrince PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Port_of_Spain PSTR("AST4") -#define TZ_America_Porto_Velho PSTR("<-04>4") -#define TZ_America_Puerto_Rico PSTR("AST4") -#define TZ_America_Punta_Arenas PSTR("<-03>3") -#define TZ_America_Rainy_River PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Rankin_Inlet PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Recife PSTR("<-03>3") -#define TZ_America_Regina PSTR("CST6") -#define TZ_America_Resolute PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Rio_Branco PSTR("<-05>5") -#define TZ_America_Santarem PSTR("<-03>3") -#define TZ_America_Santiago PSTR("<-04>4<-03>,M9.1.6/24,M4.1.6/24") -#define TZ_America_Santo_Domingo PSTR("AST4") -#define TZ_America_Sao_Paulo PSTR("<-03>3") -#define TZ_America_Scoresbysund PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1") -#define TZ_America_Sitka PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_St_Barthelemy PSTR("AST4") -#define TZ_America_St_Johns PSTR("NST3:30NDT,M3.2.0,M11.1.0") -#define TZ_America_St_Kitts PSTR("AST4") -#define TZ_America_St_Lucia PSTR("AST4") -#define TZ_America_St_Thomas PSTR("AST4") -#define TZ_America_St_Vincent PSTR("AST4") -#define TZ_America_Swift_Current PSTR("CST6") -#define TZ_America_Tegucigalpa PSTR("CST6") -#define TZ_America_Thule PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_America_Thunder_Bay PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Tijuana PSTR("PST8PDT,M3.2.0,M11.1.0") -#define TZ_America_Toronto PSTR("EST5EDT,M3.2.0,M11.1.0") -#define TZ_America_Tortola PSTR("AST4") -#define TZ_America_Vancouver PSTR("PST8PDT,M3.2.0,M11.1.0") -#define TZ_America_Whitehorse PSTR("MST7") -#define TZ_America_Winnipeg PSTR("CST6CDT,M3.2.0,M11.1.0") -#define TZ_America_Yakutat PSTR("AKST9AKDT,M3.2.0,M11.1.0") -#define TZ_America_Yellowknife PSTR("MST7MDT,M3.2.0,M11.1.0") -#define TZ_Antarctica_Casey PSTR("<+11>-11") -#define TZ_Antarctica_Davis PSTR("<+07>-7") -#define TZ_Antarctica_DumontDUrville PSTR("<+10>-10") -#define TZ_Antarctica_Macquarie PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") -#define TZ_Antarctica_Mawson PSTR("<+05>-5") -#define TZ_Antarctica_McMurdo PSTR("NZST-12NZDT,M9.5.0,M4.1.0/3") -#define TZ_Antarctica_Palmer PSTR("<-03>3") -#define TZ_Antarctica_Rothera PSTR("<-03>3") -#define TZ_Antarctica_Syowa PSTR("<+03>-3") -#define TZ_Antarctica_Troll PSTR("<+00>0<+02>-2,M3.5.0/1,M10.5.0/3") -#define TZ_Antarctica_Vostok PSTR("<+06>-6") -#define TZ_Arctic_Longyearbyen PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Asia_Aden PSTR("<+03>-3") -#define TZ_Asia_Almaty PSTR("<+06>-6") -#define TZ_Asia_Amman PSTR("EET-2EEST,M3.5.4/24,M10.5.5/1") -#define TZ_Asia_Anadyr PSTR("<+12>-12") -#define TZ_Asia_Aqtau PSTR("<+05>-5") -#define TZ_Asia_Aqtobe PSTR("<+05>-5") -#define TZ_Asia_Ashgabat PSTR("<+05>-5") -#define TZ_Asia_Atyrau PSTR("<+05>-5") -#define TZ_Asia_Baghdad PSTR("<+03>-3") -#define TZ_Asia_Bahrain PSTR("<+03>-3") -#define TZ_Asia_Baku PSTR("<+04>-4") -#define TZ_Asia_Bangkok PSTR("<+07>-7") -#define TZ_Asia_Barnaul PSTR("<+07>-7") -#define TZ_Asia_Beirut PSTR("EET-2EEST,M3.5.0/0,M10.5.0/0") -#define TZ_Asia_Bishkek PSTR("<+06>-6") -#define TZ_Asia_Brunei PSTR("<+08>-8") -#define TZ_Asia_Chita PSTR("<+09>-9") -#define TZ_Asia_Choibalsan PSTR("<+08>-8") -#define TZ_Asia_Colombo PSTR("<+0530>-5:30") -#define TZ_Asia_Damascus PSTR("EET-2EEST,M3.5.5/0,M10.5.5/0") -#define TZ_Asia_Dhaka PSTR("<+06>-6") -#define TZ_Asia_Dili PSTR("<+09>-9") -#define TZ_Asia_Dubai PSTR("<+04>-4") -#define TZ_Asia_Dushanbe PSTR("<+05>-5") -#define TZ_Asia_Famagusta PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Asia_Gaza PSTR("EET-2EEST,M3.4.4/48,M10.4.4/49") -#define TZ_Asia_Hebron PSTR("EET-2EEST,M3.4.4/48,M10.4.4/49") -#define TZ_Asia_Ho_Chi_Minh PSTR("<+07>-7") -#define TZ_Asia_Hong_Kong PSTR("HKT-8") -#define TZ_Asia_Hovd PSTR("<+07>-7") -#define TZ_Asia_Irkutsk PSTR("<+08>-8") -#define TZ_Asia_Jakarta PSTR("WIB-7") -#define TZ_Asia_Jayapura PSTR("WIT-9") -#define TZ_Asia_Jerusalem PSTR("IST-2IDT,M3.4.4/26,M10.5.0") -#define TZ_Asia_Kabul PSTR("<+0430>-4:30") -#define TZ_Asia_Kamchatka PSTR("<+12>-12") -#define TZ_Asia_Karachi PSTR("PKT-5") -#define TZ_Asia_Kathmandu PSTR("<+0545>-5:45") -#define TZ_Asia_Khandyga PSTR("<+09>-9") -#define TZ_Asia_Kolkata PSTR("IST-5:30") -#define TZ_Asia_Krasnoyarsk PSTR("<+07>-7") -#define TZ_Asia_Kuala_Lumpur PSTR("<+08>-8") -#define TZ_Asia_Kuching PSTR("<+08>-8") -#define TZ_Asia_Kuwait PSTR("<+03>-3") -#define TZ_Asia_Macau PSTR("CST-8") -#define TZ_Asia_Magadan PSTR("<+11>-11") -#define TZ_Asia_Makassar PSTR("WITA-8") -#define TZ_Asia_Manila PSTR("PST-8") -#define TZ_Asia_Muscat PSTR("<+04>-4") -#define TZ_Asia_Nicosia PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Asia_Novokuznetsk PSTR("<+07>-7") -#define TZ_Asia_Novosibirsk PSTR("<+07>-7") -#define TZ_Asia_Omsk PSTR("<+06>-6") -#define TZ_Asia_Oral PSTR("<+05>-5") -#define TZ_Asia_Phnom_Penh PSTR("<+07>-7") -#define TZ_Asia_Pontianak PSTR("WIB-7") -#define TZ_Asia_Pyongyang PSTR("KST-9") -#define TZ_Asia_Qatar PSTR("<+03>-3") -#define TZ_Asia_Qyzylorda PSTR("<+05>-5") -#define TZ_Asia_Riyadh PSTR("<+03>-3") -#define TZ_Asia_Sakhalin PSTR("<+11>-11") -#define TZ_Asia_Samarkand PSTR("<+05>-5") -#define TZ_Asia_Seoul PSTR("KST-9") -#define TZ_Asia_Shanghai PSTR("CST-8") -#define TZ_Asia_Singapore PSTR("<+08>-8") -#define TZ_Asia_Srednekolymsk PSTR("<+11>-11") -#define TZ_Asia_Taipei PSTR("CST-8") -#define TZ_Asia_Tashkent PSTR("<+05>-5") -#define TZ_Asia_Tbilisi PSTR("<+04>-4") -#define TZ_Asia_Tehran PSTR("<+0330>-3:30<+0430>,J79/24,J263/24") -#define TZ_Asia_Thimphu PSTR("<+06>-6") -#define TZ_Asia_Tokyo PSTR("JST-9") -#define TZ_Asia_Tomsk PSTR("<+07>-7") -#define TZ_Asia_Ulaanbaatar PSTR("<+08>-8") -#define TZ_Asia_Urumqi PSTR("<+06>-6") -#define TZ_Asia_UstmNera PSTR("<+10>-10") -#define TZ_Asia_Vientiane PSTR("<+07>-7") -#define TZ_Asia_Vladivostok PSTR("<+10>-10") -#define TZ_Asia_Yakutsk PSTR("<+09>-9") -#define TZ_Asia_Yangon PSTR("<+0630>-6:30") -#define TZ_Asia_Yekaterinburg PSTR("<+05>-5") -#define TZ_Asia_Yerevan PSTR("<+04>-4") -#define TZ_Atlantic_Azores PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1") -#define TZ_Atlantic_Bermuda PSTR("AST4ADT,M3.2.0,M11.1.0") -#define TZ_Atlantic_Canary PSTR("WET0WEST,M3.5.0/1,M10.5.0") -#define TZ_Atlantic_Cape_Verde PSTR("<-01>1") -#define TZ_Atlantic_Faroe PSTR("WET0WEST,M3.5.0/1,M10.5.0") -#define TZ_Atlantic_Madeira PSTR("WET0WEST,M3.5.0/1,M10.5.0") -#define TZ_Atlantic_Reykjavik PSTR("GMT0") -#define TZ_Atlantic_South_Georgia PSTR("<-02>2") -#define TZ_Atlantic_Stanley PSTR("<-03>3") -#define TZ_Atlantic_St_Helena PSTR("GMT0") -#define TZ_Australia_Adelaide PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3") -#define TZ_Australia_Brisbane PSTR("AEST-10") -#define TZ_Australia_Broken_Hill PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3") -#define TZ_Australia_Currie PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") -#define TZ_Australia_Darwin PSTR("ACST-9:30") -#define TZ_Australia_Eucla PSTR("<+0845>-8:45") -#define TZ_Australia_Hobart PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") -#define TZ_Australia_Lindeman PSTR("AEST-10") -#define TZ_Australia_Lord_Howe PSTR("<+1030>-10:30<+11>-11,M10.1.0,M4.1.0") -#define TZ_Australia_Melbourne PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") -#define TZ_Australia_Perth PSTR("AWST-8") -#define TZ_Australia_Sydney PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") -#define TZ_Europe_Amsterdam PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Andorra PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Astrakhan PSTR("<+04>-4") -#define TZ_Europe_Athens PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Belgrade PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Berlin PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Bratislava PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Brussels PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Bucharest PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Budapest PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Busingen PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Chisinau PSTR("EET-2EEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Copenhagen PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Dublin PSTR("IST-1GMT0,M10.5.0,M3.5.0/1") -#define TZ_Europe_Gibraltar PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Guernsey PSTR("GMT0BST,M3.5.0/1,M10.5.0") -#define TZ_Europe_Helsinki PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Isle_of_Man PSTR("GMT0BST,M3.5.0/1,M10.5.0") -#define TZ_Europe_Istanbul PSTR("<+03>-3") -#define TZ_Europe_Jersey PSTR("GMT0BST,M3.5.0/1,M10.5.0") -#define TZ_Europe_Kaliningrad PSTR("EET-2") -#define TZ_Europe_Kiev PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Kirov PSTR("<+03>-3") -#define TZ_Europe_Lisbon PSTR("WET0WEST,M3.5.0/1,M10.5.0") -#define TZ_Europe_Ljubljana PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_London PSTR("GMT0BST,M3.5.0/1,M10.5.0") -#define TZ_Europe_Luxembourg PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Madrid PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Malta PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Mariehamn PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Minsk PSTR("<+03>-3") -#define TZ_Europe_Monaco PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Moscow PSTR("MSK-3") -#define TZ_Europe_Oslo PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Paris PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Podgorica PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Prague PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Riga PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Rome PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Samara PSTR("<+04>-4") -#define TZ_Europe_San_Marino PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Sarajevo PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Saratov PSTR("<+04>-4") -#define TZ_Europe_Simferopol PSTR("MSK-3") -#define TZ_Europe_Skopje PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Sofia PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Stockholm PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Tallinn PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Tirane PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Ulyanovsk PSTR("<+04>-4") -#define TZ_Europe_Uzhgorod PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Vaduz PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Vatican PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Vienna PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Vilnius PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Volgograd PSTR("<+04>-4") -#define TZ_Europe_Warsaw PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Zagreb PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Europe_Zaporozhye PSTR("EET-2EEST,M3.5.0/3,M10.5.0/4") -#define TZ_Europe_Zurich PSTR("CET-1CEST,M3.5.0,M10.5.0/3") -#define TZ_Indian_Antananarivo PSTR("EAT-3") -#define TZ_Indian_Chagos PSTR("<+06>-6") -#define TZ_Indian_Christmas PSTR("<+07>-7") -#define TZ_Indian_Cocos PSTR("<+0630>-6:30") -#define TZ_Indian_Comoro PSTR("EAT-3") -#define TZ_Indian_Kerguelen PSTR("<+05>-5") -#define TZ_Indian_Mahe PSTR("<+04>-4") -#define TZ_Indian_Maldives PSTR("<+05>-5") -#define TZ_Indian_Mauritius PSTR("<+04>-4") -#define TZ_Indian_Mayotte PSTR("EAT-3") -#define TZ_Indian_Reunion PSTR("<+04>-4") -#define TZ_Pacific_Apia PSTR("<+13>-13<+14>,M9.5.0/3,M4.1.0/4") -#define TZ_Pacific_Auckland PSTR("NZST-12NZDT,M9.5.0,M4.1.0/3") -#define TZ_Pacific_Bougainville PSTR("<+11>-11") -#define TZ_Pacific_Chatham PSTR("<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45") -#define TZ_Pacific_Chuuk PSTR("<+10>-10") -#define TZ_Pacific_Easter PSTR("<-06>6<-05>,M9.1.6/22,M4.1.6/22") -#define TZ_Pacific_Efate PSTR("<+11>-11") -#define TZ_Pacific_Enderbury PSTR("<+13>-13") -#define TZ_Pacific_Fakaofo PSTR("<+13>-13") -#define TZ_Pacific_Fiji PSTR("<+12>-12<+13>,M11.2.0,M1.2.3/99") -#define TZ_Pacific_Funafuti PSTR("<+12>-12") -#define TZ_Pacific_Galapagos PSTR("<-06>6") -#define TZ_Pacific_Gambier PSTR("<-09>9") -#define TZ_Pacific_Guadalcanal PSTR("<+11>-11") -#define TZ_Pacific_Guam PSTR("ChST-10") -#define TZ_Pacific_Honolulu PSTR("HST10") -#define TZ_Pacific_Kiritimati PSTR("<+14>-14") -#define TZ_Pacific_Kosrae PSTR("<+11>-11") -#define TZ_Pacific_Kwajalein PSTR("<+12>-12") -#define TZ_Pacific_Majuro PSTR("<+12>-12") -#define TZ_Pacific_Marquesas PSTR("<-0930>9:30") -#define TZ_Pacific_Midway PSTR("SST11") -#define TZ_Pacific_Nauru PSTR("<+12>-12") -#define TZ_Pacific_Niue PSTR("<-11>11") -#define TZ_Pacific_Norfolk PSTR("<+11>-11<+12>,M10.1.0,M4.1.0/3") -#define TZ_Pacific_Noumea PSTR("<+11>-11") -#define TZ_Pacific_Pago_Pago PSTR("SST11") -#define TZ_Pacific_Palau PSTR("<+09>-9") -#define TZ_Pacific_Pitcairn PSTR("<-08>8") -#define TZ_Pacific_Pohnpei PSTR("<+11>-11") -#define TZ_Pacific_Port_Moresby PSTR("<+10>-10") -#define TZ_Pacific_Rarotonga PSTR("<-10>10") -#define TZ_Pacific_Saipan PSTR("ChST-10") -#define TZ_Pacific_Tahiti PSTR("<-10>10") -#define TZ_Pacific_Tarawa PSTR("<+12>-12") -#define TZ_Pacific_Tongatapu PSTR("<+13>-13") -#define TZ_Pacific_Wake PSTR("<+12>-12") -#define TZ_Pacific_Wallis PSTR("<+12>-12") -#define TZ_Etc_GMT PSTR("GMT0") -#define TZ_Etc_GMTm0 PSTR("GMT0") -#define TZ_Etc_GMTm1 PSTR("<+01>-1") -#define TZ_Etc_GMTm2 PSTR("<+02>-2") -#define TZ_Etc_GMTm3 PSTR("<+03>-3") -#define TZ_Etc_GMTm4 PSTR("<+04>-4") -#define TZ_Etc_GMTm5 PSTR("<+05>-5") -#define TZ_Etc_GMTm6 PSTR("<+06>-6") -#define TZ_Etc_GMTm7 PSTR("<+07>-7") -#define TZ_Etc_GMTm8 PSTR("<+08>-8") -#define TZ_Etc_GMTm9 PSTR("<+09>-9") -#define TZ_Etc_GMTm10 PSTR("<+10>-10") -#define TZ_Etc_GMTm11 PSTR("<+11>-11") -#define TZ_Etc_GMTm12 PSTR("<+12>-12") -#define TZ_Etc_GMTm13 PSTR("<+13>-13") -#define TZ_Etc_GMTm14 PSTR("<+14>-14") -#define TZ_Etc_GMT0 PSTR("GMT0") -#define TZ_Etc_GMTp0 PSTR("GMT0") -#define TZ_Etc_GMTp1 PSTR("<-01>1") -#define TZ_Etc_GMTp2 PSTR("<-02>2") -#define TZ_Etc_GMTp3 PSTR("<-03>3") -#define TZ_Etc_GMTp4 PSTR("<-04>4") -#define TZ_Etc_GMTp5 PSTR("<-05>5") -#define TZ_Etc_GMTp6 PSTR("<-06>6") -#define TZ_Etc_GMTp7 PSTR("<-07>7") -#define TZ_Etc_GMTp8 PSTR("<-08>8") -#define TZ_Etc_GMTp9 PSTR("<-09>9") -#define TZ_Etc_GMTp10 PSTR("<-10>10") -#define TZ_Etc_GMTp11 PSTR("<-11>11") -#define TZ_Etc_GMTp12 PSTR("<-12>12") -#define TZ_Etc_UCT PSTR("UTC0") -#define TZ_Etc_UTC PSTR("UTC0") -#define TZ_Etc_Greenwich PSTR("GMT0") -#define TZ_Etc_Universal PSTR("UTC0") -#define TZ_Etc_Zulu PSTR("UTC0") -#endif - //////////////////////////////////////////////////////////// #define TIMEZONE_MAX_LEN 50 -#if 1 - -const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = +static const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = { #if USING_AFRICA "Africa/Abidjan", //PSTR("GMT0") @@ -1503,7 +1033,7 @@ const char TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = //////////////////////////////////////////////////////////// -const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = +static const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = { #if USING_AFRICA TZ_Africa_Abidjan, //PSTR("GMT0") @@ -1999,152 +1529,4 @@ const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] /*PROGMEM*/ = #endif }; - - -#else -const char TZ_NAME[][TIMEZONE_MAX_LEN] = -{ - "Pacific/Pago_Pago", - "America/Adak", - "Pacific/Honolulu", - "Pacific/Marquesas", - "Pacific/Gambier", - "America/Anchorage", - "America/Los_Angeles", - "Pacific/Pitcairn", - "America/Phoenix", - "America/Denver", - "America/Guatemala", - "America/Chicago", - "Pacific/Easter", - "America/Bogota", - "America/New_York", - "America/Caracas", - "America/Halifax", - "America/Santo_Domingo", - "America/Santiago", - "America/St_Johns", - "America/Godthab", - "America/Argentina/Buenos_Aires", - "America/Montevideo", - "Etc/GMT+2", - "Atlantic/Azores", - "Atlantic/Cape_Verde", - "Etc/UTC", - "Europe/London", - "Europe/Berlin", - "Africa/Lagos", - "Africa/Windhoek", - "Asia/Beirut", - "Africa/Johannesburg", - "Asia/Baghdad", - "Europe/Moscow", - "Asia/Tehran", - "Asia/Dubai", - "Asia/Baku", - "Asia/Kabul", - "Asia/Yekaterinburg", - "Asia/Karachi", - "Asia/Kolkata", - "Asia/Kathmandu", - "Asia/Dhaka", - "Asia/Omsk", - "Asia/Krasnoyarsk", - "Asia/Jakarta", - "Asia/Shanghai", - "Asia/Irkutsk", - "Australia/Eucla", - "Asia/Yakutsk", - "Asia/Tokyo", - "Australia/Darwin", - "Australia/Adelaide", - "Australia/Brisbane", - "Asia/Vladivostok", - "Australia/Sydney", - "Australia/Lord_Howe", - "Asia/Kamchatka", - "Pacific/Noumea", - "Pacific/Norfolk", - "Pacific/Auckland", - "Pacific/Tarawa", - "Pacific/Chatham", - "Pacific/Tongatapu", - "Pacific/Apia", - "Pacific/Kiritimati", -}; - -//////////////////////////////////////////////////////////// - -const char ESP_TZ_NAME[][TIMEZONE_MAX_LEN] = -{ - TZ_Pacific_Pago_Pago, //PSTR("SST11") - TZ_America_Adak, //PSTR("HST10HDT,M3.2.0,M11.1.0") - TZ_Pacific_Honolulu, //PSTR("HST10") - TZ_Pacific_Marquesas, //PSTR("<-0930>9:30") - TZ_Pacific_Gambier, //PSTR("<-09>9") - TZ_America_Anchorage, //PSTR("AKST9AKDT,M3.2.0,M11.1.0") - TZ_America_Los_Angeles, //"PST8PDT,M3.2.0,M11.1.0", //"America/Los_Angeles", - TZ_Pacific_Pitcairn, //PSTR("<-08>8") - TZ_America_Phoenix, //PSTR("MST7") - TZ_America_Denver, //"MST7MDT,M3.2.0,M11.1.0", //"America/Denver", - TZ_America_Guatemala, //PSTR("CST6") - TZ_America_Chicago, //"CST6CDT,M3.2.0,M11.1.0", //"America/Chicago", - TZ_Pacific_Easter, //PSTR("<-06>6<-05>,M9.1.6/22,M4.1.6/22") - TZ_America_Bogota, //PSTR("<-05>5") - TZ_America_New_York, //"EST5EDT,M3.2.0,M11.1.0", //"America/New_York", - TZ_America_Caracas, //PSTR("<-04>4") - TZ_America_Halifax, //"AST4ADT,M3.2.0,M11.1.0", //"America/Halifax", - TZ_America_Santo_Domingo, //PSTR("AST4") - TZ_America_Santiago, //"<-04>4<-03>,M9.1.6/24,M4.1.6/24", //"America/Santiago", - TZ_America_St_Johns, //PSTR("NST3:30NDT,M3.2.0,M11.1.0") - TZ_America_Godthab, //"<-03>3<-02>,M3.5.0/-2,M10.5.0/-1", //"America/Godthab", - TZ_America_Argentina_Buenos_Aires, //PSTR("<-03>3") - TZ_America_Montevideo, //"<-03>3", //"America/Montevideo", - TZ_Etc_GMTp2, //PSTR("<-02>2") - TZ_Atlantic_Azores, //PSTR("<-01>1<+00>,M3.5.0/0,M10.5.0/1") - TZ_Atlantic_Cape_Verde, //PSTR("<-01>1") - TZ_Etc_UTC, //PSTR("UTC0") - TZ_Europe_London, //PSTR("GMT0BST,M3.5.0/1,M10.5.0") - TZ_Europe_Berlin, //PSTR("CET-1CEST,M3.5.0,M10.5.0/3") - TZ_Africa_Lagos, //PSTR("WAT-1") - TZ_Africa_Windhoek, //PSTR("CAT-2") - TZ_Asia_Beirut, //"EET-2EEST,M3.5.0/0,M10.5.0/0" //"Asia/Beirut", - TZ_Africa_Johannesburg, //"SAST-2", //"Africa/Johannesburg", - TZ_Asia_Baghdad, //"<+03>-3", //"Asia/Baghdad", - TZ_Europe_Moscow, //PSTR("MSK-3") - TZ_Asia_Tehran, //PSTR("<+0330>-3:30<+0430>,J79/24,J263/24") - TZ_Asia_Dubai, //"<+04>-4", //"Asia/Dubai", - TZ_Asia_Baku, //PSTR("<+04>-4") - TZ_Asia_Kabul, //PSTR("<+0430>-4:30") - TZ_Asia_Yekaterinburg, //PSTR("<+05>-5") - TZ_Asia_Karachi, //PSTR("PKT-5") - TZ_Asia_Kolkata, //PSTR("IST-5:30") - TZ_Asia_Kathmandu, //PSTR("<+0545>-5:45") - TZ_Asia_Dhaka, //"<+06>-6", //"Asia/Dhaka", - TZ_Asia_Omsk, //PSTR("<+06>-6") - TZ_Asia_Krasnoyarsk, //PSTR("<+07>-7") - TZ_Asia_Jakarta, //"WIB-7", //"Asia/Jakarta", - TZ_Asia_Shanghai, //"CST-8", //"Asia/Shanghai", - TZ_Asia_Irkutsk, //PSTR("<+08>-8") - TZ_Australia_Eucla, //PSTR("<+0845>-8:45") - TZ_Asia_Yakutsk, //PSTR("<+09>-9") - TZ_Asia_Tokyo, //"JST-9", //"Asia/Tokyo", - TZ_Australia_Darwin, //PSTR("ACST-9:30") - TZ_Australia_Adelaide, //PSTR("ACST-9:30ACDT,M10.1.0,M4.1.0/3") - TZ_Australia_Brisbane, //"AEST-10", //"Australia/Brisbane", - TZ_Asia_Vladivostok, //PSTR("<+10>-10") - TZ_Australia_Sydney, //PSTR("AEST-10AEDT,M10.1.0,M4.1.0/3") - TZ_Australia_Lord_Howe, //PSTR("<+1030>-10:30<+11>-11,M10.1.0,M4.1.0") - TZ_Asia_Kamchatka, //PSTR("<+12>-12") - TZ_Pacific_Noumea, //"<+11>-11", //"Pacific/Noumea", - TZ_Pacific_Norfolk, //PSTR("<+11>-11<+12>,M10.1.0,M4.1.0/3") - TZ_Pacific_Auckland, //"NZST-12NZDT,M9.5.0,M4.1.0/3", //"Pacific/Auckland", - TZ_Pacific_Tarawa, //"<+12>-12", //"Pacific/Tarawa", - TZ_Pacific_Chatham, //PSTR("<+1245>-12:45<+1345>,M9.5.0/2:45,M4.1.0/3:45") - TZ_Pacific_Tongatapu, //PSTR("<+13>-13") - TZ_Pacific_Apia, //PSTR("<+13>-13<+14>,M9.5.0/3,M4.1.0/4") - TZ_Pacific_Kiritimati, //PSTR("<+14>-14") -}; -#endif - #endif // TZDB_H