";
29 | const char HTTP_PORTAL_OPTIONS[] PROGMEM = "
";
30 | const char HTTP_ITEM[] PROGMEM = "
";
31 | const char HTTP_FORM_START[] PROGMEM = "
";
34 | const char HTTP_SCAN_LINK[] PROGMEM = "
";
35 | const char HTTP_SAVED[] PROGMEM = "
Credentials Saved
Trying to connect ESP to network.
If it fails reconnect to AP to try again
";
36 | const char HTTP_END[] PROGMEM = "
";
37 |
38 | #ifndef WIFI_MANAGER_MAX_PARAMS
39 | #define WIFI_MANAGER_MAX_PARAMS 10
40 | #endif
41 |
42 | class WiFiManagerParameter {
43 | public:
44 | /**
45 | Create custom parameters that can be added to the WiFiManager setup web page
46 | @id is used for HTTP queries and must not contain spaces nor other special characters
47 | */
48 | WiFiManagerParameter(const char *custom);
49 | WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length);
50 | WiFiManagerParameter(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom);
51 | ~WiFiManagerParameter();
52 |
53 | const char *getID();
54 | const char *getValue();
55 | const char *getPlaceholder();
56 | int getValueLength();
57 | const char *getCustomHTML();
58 | private:
59 | const char *_id;
60 | const char *_placeholder;
61 | char *_value;
62 | int _length;
63 | const char *_customHTML;
64 |
65 | void init(const char *id, const char *placeholder, const char *defaultValue, int length, const char *custom);
66 |
67 | friend class WiFiManager;
68 | };
69 |
70 |
71 | class WiFiManager
72 | {
73 | public:
74 | WiFiManager();
75 | ~WiFiManager();
76 |
77 | boolean autoConnect();
78 | boolean autoConnect(char const *apName, char const *apPassword = NULL);
79 |
80 | //if you want to always start the config portal, without trying to connect first
81 | boolean startConfigPortal();
82 | boolean startConfigPortal(char const *apName, char const *apPassword = NULL);
83 |
84 | // get the AP name of the config portal, so it can be used in the callback
85 | String getConfigPortalSSID();
86 |
87 | void resetSettings();
88 |
89 | //sets timeout before webserver loop ends and exits even if there has been no setup.
90 | //useful for devices that failed to connect at some point and got stuck in a webserver loop
91 | //in seconds setConfigPortalTimeout is a new name for setTimeout
92 | void setConfigPortalTimeout(unsigned long seconds);
93 | void setTimeout(unsigned long seconds);
94 |
95 | //sets timeout for which to attempt connecting, useful if you get a lot of failed connects
96 | void setConnectTimeout(unsigned long seconds);
97 |
98 |
99 | void setDebugOutput(boolean debug);
100 | //defaults to not showing anything under 8% signal quality if called
101 | void setMinimumSignalQuality(int quality = 8);
102 | //sets a custom ip /gateway /subnet configuration
103 | void setAPStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
104 | //sets config for a static IP
105 | void setSTAStaticIPConfig(IPAddress ip, IPAddress gw, IPAddress sn);
106 | //called when AP mode and config portal is started
107 | void setAPCallback( void (*func)(WiFiManager*) );
108 | //called when settings have been changed and connection was successful
109 | void setSaveConfigCallback( void (*func)(void) );
110 | //adds a custom parameter, returns false on failure
111 | bool addParameter(WiFiManagerParameter *p);
112 | //if this is set, it will exit after config, even if connection is unsuccessful.
113 | void setBreakAfterConfig(boolean shouldBreak);
114 | //if this is set, try WPS setup when starting (this will delay config portal for up to 2 mins)
115 | //TODO
116 | //if this is set, customise style
117 | void setCustomHeadElement(const char* element);
118 | //if this is true, remove duplicated Access Points - defaut true
119 | void setRemoveDuplicateAPs(boolean removeDuplicates);
120 |
121 | private:
122 | std::unique_ptr