ESP_IOT v2.5
IOT ESP Coding
WIFI_APModule.cpp
Go to the documentation of this file.
1//! \link WIFI_APModule
2/*
3 *******************************************************************************
4 Copyright (c) 2021 by M5Stack
5 Equipped with M5StickC-Plus sample source code
6 配套 M5StickC-Plus 示例源代码
7 Visit the website for more information:https://docs.m5stack.com/en/core/m5stickc_plus
8 获取更多资料请访问:https://docs.m5stack.com/zh_CN/core/m5stickc_plus
9
10 describe:WiFi connect. wifi连接
11 date:2021/9/18
12
13 Scott Version: 1.1.2022
14 *******************************************************************************
15 */
16//#include "../../Defines.h"
17#include "WIFI_APModule.h"
18#ifdef USE_WIFI_AP_MODULE
19
20//NOTE: one solution is to create a JSON object, and stringify then pass to the MQTT code to set the credentials..
21//! Will spif up the web page with some small images..
22//! https://randomnerdtutorials.com/display-images-esp32-esp8266-web-server/
23#include <ArduinoJson.h>
24
25#include <WiFi.h>
26#include <ESPmDNS.h>
27#include <WiFiClient.h>
28#include "WebServer.h"
29#include <Preferences.h>
30
31//!returns string for the header image
32String headerImageString();
33
35void WIFI_setupMode();
36String WIFI_makePage(String title, String contents);
37String WIFI_urlDecode(String input);
38
39//used when we server as a WAP (Wireless Access Point == PetTutorSetup_192_168_4_1)
40const char *_WIFIWirelessAP = "192.168.4.1";
41
42//web page afterwards, using the wifi chosen.. NOT USED..
43//const char* _WIFIWirelessPage = "192.168.0.57";
44
45//Define the address of the wireless AP. 定义无线AP的地址
46const IPAddress _WIFIapIP(192, 168, 4, 1);
47
48//Define the name of the created hotspot. 定义创建热点的名称
49const char* _apSSID = "PetTutorSetup_192_168_4_1";
50
53//Store the name of the wireless network. 存储无线网络的名称
55//Store the password of the wireless network. 存储无线网络的密码
57//last ssid saved
59
60//!EPROM INFO .. might be a length issue of the attribute name
61#define AP_EPROM_NAME "ap_wifi"
62#define WIFI_SSID "1ws"
63#define WIFI_PASSWORD "2wp"
64
65//the last time it was saved - only used for the PULL DOWN web list
66#define WIFI_SSID_LAST "3sl"
67
68#define MQTT
69#ifdef MQTT
70#define MQTT_PORT "4pt"
71#define MQTT_SERVER "5sv"
72#define MQTT_USER "6mu"
73#define MQTT_PASSWORD "7mp"
74#define MQTT_GUEST_PASSWORD "8mg"
75
76#define MQTT_TOPIC "9mt"
77#define MQTT_DEVICE_NAME "10md"
78#define MQTT_LOCATION_NAME "11ml"
79
85
87//char _WIFI_mqttTopic[100]; // or it's created from the 'user', etc user/bark
90
91
92#endif
93
94//!rediscover (and prints) the WIFIlist .. scanning each time.. so a page refresh will look again...
96
97//!create the javascript header to convert to lowercase, etc
98String getJavascriptString();
99
100//!remove spaces in a string
101//https://stackoverflow.com/questions/16329358/remove-spaces-from-a-string-in-c
102String removeSpaces(String input)
103{
104 String result = "";
105 for (int i=0; i< input.length(); i++)
106 {
107 if (input[i] != ' ')
108 {
109 result += input[i];
110 }
111 }
112 return result;
113}
114
115//! DNSServer dnsServer;. webServer的类, port 80
117//!client of the web server??
118WiFiClient _WIFIClient;
119
120//! wifi config store. wifi配置存储的类
122
124//!called to set the done flag
125void setDoneWIFI_APModuleFlag(boolean flag)
126{
128}
129
130//!called to see if the WIFIModule has finished bootstrapping..
132{
134}
135
136//!resets the credentials
138{
139 _WIFI_SettingMode = true;
140}
141
142//! the json output string that contain the credentials
144
145//! retrieves the JSON string
147{
148 return _jsonOutputString;
149}
150
151
152//!returns true if the SSID is set, false otherwise. If set, then just exit..
154{
156
159
160 //added for last, only used in the web
162 _WIFIPreferences.end();
163
164 boolean ssidSet = _WIFI_ssid && (_WIFI_ssid.length() > 0);
165 SerialDebug.print("WIFI ssid = ");
166 SerialDebug.println(_WIFI_ssid?_WIFI_ssid:"NULL");
167 return ssidSet;
168}
169
170//!returns true if the SSID is set, false otherwise. If set, then just exit..
172{
174
175 //this is emptied .. as the only way we know to get into this mode is an empty SSID ..
176 // THUS .. it doesn't matter if we had a value before.. UNLESS we save it somewhere else!
177 _WIFI_ssid = "";
179 _WIFIPreferences.end();
180
181 SerialDebug.println("cleaned EPROM WIFI ssid ** REBOOTING");
182
183 //Restart MPU. 重启MPU
184 ESP.restart();
185
186}
187
188//!cleans the eprom info
190{
191 SerialDebug.println("cleanEPROM_WIFI_APModule");
192 _WIFIPreferences.begin(AP_EPROM_NAME, false); //readwrite..
193 _WIFIPreferences.clear();
194 _WIFIPreferences.end();
195}
196
197//! sets the MQTT user/password. It's up to the code to decide who needs to know
198void WIFI_APModule_updateMQTTInfo(char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char *host, char *port, char *locationString)
199{
200 SerialDebug.printf("wifi_apModule.updateMQTTInfo(%s, %s, %s,%s, %s, %s, %s)\n", ssid?ssid:"NULL", ssid_password?ssid_password:"NULL", username?username:"NULL", password?password:"NULL", guestPassword?guestPassword:"NULL", locationString?locationString:"NULL", deviceName?deviceName:"NULL");
201 _WIFIPreferences.begin(AP_EPROM_NAME, false); //readwrite..
202 _WIFIPreferences.putString(WIFI_SSID, ssid);
203 _WIFIPreferences.putString(WIFI_PASSWORD, ssid_password);
204
205 _WIFIPreferences.putString(MQTT_PORT, port);
206 _WIFIPreferences.putString(MQTT_SERVER, host);
207
208 _WIFIPreferences.putString(MQTT_USER, username);
209 _WIFIPreferences.putString(MQTT_PASSWORD, password);
210 _WIFIPreferences.putString(MQTT_GUEST_PASSWORD, guestPassword);
211
212 _WIFIPreferences.putString(MQTT_DEVICE_NAME, deviceName);
213 _WIFIPreferences.putString(MQTT_LOCATION_NAME, locationString);
214
215 _WIFIPreferences.end();
216
217 SerialDebug.println("done wifi_apModule.updateMQTTInfo");
218}
219
220//! 4.8.22. Called to do any state variables.
221//! a presetup() approach ..
223{
224 SerialTemp.printf("preSetup_WIFI_APModule: isSet(%s)\n", isSet_SSID_WIFICredentials()?"set":"notSet");
225
227 {
228 //!Exit setup(). 退出setup()
230 }
231
232}
233
234//!sets the config in the EPPROM called wifi-config. NOTE: the _done isn't valid until after this code...
236
237 SerialTemp.printf("setup_WIFI_APModule: isSet(%s)\n", isSet_SSID_WIFICredentials()?"set":"notSet");
238
240 {
241 //!Exit setup(). 退出setup()
243 return;
244 }
245
246 //NOTE: here is where we would look for SSID set (if empty .. then continue). Not worrying about MQTT
248 delay(10);
249
250 //If there is no stored wifi configuration information, turn on the setting mode. 若没有已存储的wifi配置信息,则开启设置模式
251 _WIFI_SettingMode = true;
253}
254
255//!main loop
258 {
259 }
260 //Check that there is no facility to send requests to the M5StickC Web server over the network.
262}
263
264//!starts the web server
265//!Open the web service. 打开Web服务
267{
268 SerialDebug.println("wifi_apModule.WIFI_startWebServer");
269
270 //If the setting mode is on. 如果设置模式处于开启状态
272 {
278
281
282 //CREATE TOPIC HERE
283#ifdef SPRINTF_WORKS //NOTE: it should work as it's used all over the place..
284 sprintf(_WIFI_mqttTopic, "usersP/bark/%s", _WIFI_mqttUser);
285#else
286 _WIFI_mqttTopic = "usersP/bark/" + _WIFI_mqttUser;
287
288 // strcpy(_WIFI_mqttTopic,"usersP/bark/");
289 // strcat(_WIFI_mqttTopic, &_WIFI_mqttUser[0]);
290#endif
291 SerialDebug.print("Visit Web Server: \n");
292
293 //Output AP address (you can change the address you want through _WIFIapIP at the beginning). 输出AP地址(可通过开头的_WIFIapIP更改自己想要的地址)
294 SerialDebug.print(WiFi.softAPIP());
295
296 /********* ROOT == notFound *****************/
298#ifdef DONT_USE_BASE_ADDRESS
299 // String s = "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=http://192.168.4.1/settings\">";
300
301 String s = "<h1>ESP is now in Access Point mode</h1><p><a href=\"/settings\">Click to update WiFi Credentials</a></p>";
302 // s += "<img src=\"https://idogwatch.com/pettutor/iDogWatch.png\" width=\"200\">";
303 // s += "<img src=\"https://idogwatch.com/pettutor/PetTutor.jpeg\" width=\"500\">";
304
305
306
307 WIFI_webServer.send(200, "text/html", WIFI_makePage("AP mode", s));
308 });
309
310 /******* /settings *******************/
311 //AP web interface settings. AP网页界面设置
312 //NOTE: the <input name=X> has to have X known later to get the value back..
313 WIFI_webServer.on("/settings", []() {
314#endif
315
316 addToTextMessages_displayModule("AP Credentials");
317
318 SerialDebug.println("settings touched, ssid_last = ");
319 String s = headerImageString();
320
321 //!add the javascript
322 s += getJavascriptString();
323
324 //!this re-calculates the WIFI list
326
327 SerialDebug.println(_WIFI_ssid_last);
328
329
330
331#ifdef ESP_M5
332 s += "<h1>Wi-Fi Settings for ESP-M5 Device</h1>";
333#endif
334#ifdef ESP_32
335 s += "<h1>Wi-Fi Settings for ESP-32 Device</h1>";
336#endif
337
338 s += "<p>Enter your password after selecting the visible SSID names";
339//! ##47 https://github.com/konacurrents/ESP_IOT/issues/47
340//!so referting back to this..
341#define TRY_DATA_LIST
342#ifdef TRY_DATA_LIST
343s += " (or type missing WIFI). <i>*older web browsers may not show list, and only 2.4gHz WIFI supported</i></p>";
344 s += "<button onClick=\"window.location.reload();\">Refresh to re-discover WIFI list</button> </p>";
345
346#else
347s += "<button onClick=\"window.location.reload();\">Refresh to re-discover WIFI list</button></p>";
348#endif
349
350 s += "<form method=\"get\" action=\"setap\" onsubmit=\"return validateForm()\">\n";
351 s += "<label>SSID: </label>\n";
352
353#ifdef TRY_DATA_LIST
354 s += "<input list=\"ssid\" class=\"form-control\" name=\"ssid\" id=\"ssid_val\" style=\"width:300px;\">";
355
356 s += "<datalist id=\"ssid\" >";
357 s += _WIFISSIDList; //a list that is discovered..
358 s += "</datalist>";
359#else
360 s += "<select name=\"ssid\" id=\"ssid_val\" length=\"64\" \">";
361 s += _WIFISSIDList; //a list that is discovered..
362 s += "</select>";
363#endif
364 s += "<br>SSID Last: " + _WIFI_ssid_last;
365 s += "<br>Password: <input name=\"pass\" id=\"pass\" length=64 type=\"text\" value=\"" + _WIFI_password + "\">";
366
367 //hard wire for now... TODO remove this..
368 _WIFI_mqttServer = "idogwatch.com";
369 _WIFI_mqttPort = "1883";
370
371#ifdef MQTT
372 s += "<h2>MQTT User Settings</h2>";
373 s += "MQTT user : <input name=\"mqtt_user\" id=\"mqtt_user\" length=\"64\" size=\"64\" type=\"text\" style=\"text-transform: lowercase\" value=\"" + _WIFI_mqttUser + "\">";
374 s += "<br>MQTT pass : <input name=\"mqtt_password\" id=\"mqtt_password\" length=\"64\" size=\"64\" type=\"text\" style=\"text-transform: lowercase\" value=\"" + _WIFI_mqttPassword + "\">";
375 s += "<br>MQTT guestpass: <input name=\"mqtt_guestPassword\" id=\"mqtt_guestPassword\" length=\"64\" size=\"64\" type=\"text\" style=\"text-transform: lowercase\" value=\"" + _WIFI_mqttGuestPassword + "\">";
376#ifdef SPRINTF_WORKS
377 sprintf(_WIFI_mqttTopic, "usersP/bark/%s", _WIFI_mqttUser);
378 String topic(_WIFI_mqttTopic);
379#else
380 _WIFI_mqttTopic = "usersP/bark/" + _WIFI_mqttUser;
381
382 // strcpy(_WIFI_mqttTopic,"usersP/bark/");
383 // strcat(_WIFI_mqttTopic, &_WIFI_mqttUser[0]);
384#endif
385
386 s += "<br>DeviceName : <input name=\"deviceName\" id=\"deviceName\" length=\"64\" size=\"64\" type=\"text\" value=\"" + _WIFI_deviceName + "\">";
387 s += "<br>Location in World : <input name=\"locationString\" length=\"64\" size=\"64\" type=\"text\" value=\"" + _WIFI_locationString + "\">";
388 s += "<h2>MQTT Server Settings</h2>";
389 s += "<br>MQTT Topic : " + _WIFI_mqttTopic;
390 s += "<br>MQTT Server: <input name=\"mqtt_server\" id=\"mqtt_server\" length=\"64\" size=\"64\" type=\"text\" value=\"" + _WIFI_mqttServer + "\">";
391 s += "<br>MQTT Port : <input name=\"mqtt_port\" id=\"mqtt_port\" length=\"10\" size=\"10\" type=\"text\" value=\"" + _WIFI_mqttPort + "\">";
392
393#endif
394 // s += "<br><input type=\"reset\">";
395 s += "<br><input type=\"submit\"></form>";
396 //submit will call /setap
397 // s += "<br><a href=\"http://192.168.4.1\">Restart</a>";
398
399#ifdef M5_CAPTURE_SCREEN
400 //!try to grab the screen as a BMP and post it ...
401 s += "<a href=\"capture\">capture</a>";
402#endif
403 WIFI_webServer.send(200, "text/html", WIFI_makePage("Wi-Fi & MQTT Settings", s));
404 });
405
406 /******** /setap ******************/
407 //call this when the 'submit' touched..
408 WIFI_webServer.on("/setap", []() {
409 SerialDebug.println("setAP touched");
410
411 String ssid = removeSpaces(WIFI_urlDecode(WIFI_webServer.arg("ssid")));
412
414
415 SerialDebug.print("SSID: ");
416 SerialDebug.println(ssid);
417
418 String pass = removeSpaces(WIFI_urlDecode(WIFI_webServer.arg("pass")));
419
420#ifdef MQTT
426
428 //strip spaces
431 //CREATE TOPIC HERE
432#ifdef SPRINTF_WORKS
433 sprintf(_WIFI_mqttTopic, "usersP/bark/%s", _WIFI_mqttUser);
434#else
435 _WIFI_mqttTopic = "usersP/bark/" + _WIFI_mqttUser;
436
437#endif
438
439 SerialDebug.print("mqtt_server = "); SerialDebug.print(_WIFI_mqttServer?_WIFI_mqttServer:"NULL");
440 SerialDebug.print(":");SerialDebug.println(_WIFI_mqttPort);
441 SerialDebug.print("mqtt_user = "); SerialDebug.println(_WIFI_mqttUser?_WIFI_mqttUser:"NULL");
442 SerialDebug.print("mqtt_password = "); SerialDebug.println(_WIFI_mqttPassword?_WIFI_mqttPassword:"NULL");
443 SerialDebug.print("mqtt_guestPassword = "); SerialDebug.println(_WIFI_mqttGuestPassword?_WIFI_mqttGuestPassword:"NULL");
444
445 SerialDebug.print("deviceName = "); SerialDebug.println(_WIFI_deviceName?_WIFI_deviceName:"NULL");
446 SerialDebug.print("mqtt_topic = "); SerialDebug.println(_WIFI_mqttTopic?_WIFI_mqttTopic:"NULL");
447 SerialDebug.print("location = "); SerialDebug.println(_WIFI_locationString?_WIFI_locationString:"NULL");
448
449#endif
450
451
452 _WIFIPreferences.putString(WIFI_SSID, ssid);
453 _WIFIPreferences.putString(WIFI_PASSWORD, pass);
454
455 //last ssid as well
456 _WIFIPreferences.putString(WIFI_SSID_LAST, ssid);
457
458#ifdef MQTT
464
468
469#endif
470 DynamicJsonDocument myObject(1024);
471 myObject["ssid"] = ssid;
472 myObject["ssidPassword"] = pass;
473 myObject["mqtt_server"] = _WIFI_mqttServer;
474 myObject["mqtt_port"] = _WIFI_mqttPort;;
475 myObject["mqtt_user"] = _WIFI_mqttUser;
476 myObject["mqtt_password"] = _WIFI_mqttPassword;
477 myObject["mqtt_guestPassword"] = _WIFI_mqttGuestPassword;
478
479 myObject["mqtt_topic"] = _WIFI_mqttTopic;
480 myObject["deviceName"] = _WIFI_deviceName;
481 myObject["location"] = _WIFI_locationString;
482
483 serializeJson(myObject, _jsonOutputString);
484
485 SerialDebug.print("JSON = ");
486 SerialDebug.println(_jsonOutputString);
487 // Store wifi config. 存储wifi配置信息
488 SerialDebug.println("Write to WIFI_AP_Module.eprom done!");
489
490 //now let the other code work..
492
493 String s = headerImageString();
494 s += "<h1>Credential Setup Complete.</h1><ol><li>Reconnect to your favorite WIFI\n<li>Then to access device commands, click: ";
495 s += "<a href=\"https://idogwatch.com/bot/userpage2/"+ _WIFI_mqttUser + "/" + _WIFI_mqttPassword + "\">Feeding User Page</a></ol>";
496 s += "<br><a href=\"http://192.168.4.1\">Restart Credentials (after connecting to PetTutorSetup_192_168_4_1)</a>";
497 WIFI_webServer.send(200, "text/html", WIFI_makePage("iDogWatch Page", s));
498 //delay(2000);
499 delay(200); //??
500
501 });
502#ifdef M5_CAPTURE_SCREEN
503 /******** /capture ******************/
504 WIFI_webServer.on("/capture", []() {
505
506 SerialDebug.println("capture touched");
507 WiFiClient _WIFIClient = WIFI_webServer.client();
508
509 //!The WIFI client
510
511 _WIFIClient.println("HTTP/1.1 200 OK");
512 _WIFIClient.println("Content-type:image/bmp");
513 _WIFIClient.println();
514 M5Screen2bmp(_WIFIClient);
515 _WIFIClient.println();
516 // _WIFIClient.stop();
517
518 });
519#endif
520 }
521
522 //Start web service. 开启web服务
524}
525
526//!print the WIFIlist .. scanning each time..
528{
529 int n = WiFi.scanNetworks();
530 delay(100);
531 SerialTemp.println(" *** WIFI LIST: ");
532 _WIFISSIDList = "";
533 //Save each wifi name scanned to ssidList. 将扫描到的每个wifi名称保存到ssidList中
534 for (int i = 0; i < n; i++) {
535 SerialTemp.print("SSID: ");
536 SerialTemp.print(WiFi.SSID(i));
537 SerialTemp.print(" Signal: ");
538 SerialTemp.print(WiFi.RSSI(i));
539 SerialTemp.print(" dBm, channel: ");
540 SerialTemp.println(WiFi.channel(i));
541
542 _WIFISSIDList += "<option value=\"";
543 _WIFISSIDList += WiFi.SSID(i);
544 _WIFISSIDList += "\"";
545#ifndef TRY_DATA_LIST
546 if(_WIFI_ssid_last.compareTo(WiFi.SSID(i)) == 0)
547 {
548 _WIFISSIDList += " selected";
549 }
550#endif
551 _WIFISSIDList += ">";
552 _WIFISSIDList += WiFi.SSID(i);
553 _WIFISSIDList += "</option>";
554 }
555}
556
557//!Setup the WIFI access point
559 SerialDebug.println("wifi_apModule.WIFI_setupMode");
560
561 //Set Wi-Fi mode to WIFI_MODE_STA. 设置Wi-Fi模式为WIFI_MODE_STA
562 WiFi.mode(WIFI_MODE_STA);
563
564 //Disconnect wifi connection. 断开wifi连接
565 WiFi.disconnect();
566 //delay(100);
567
568
569 //create an access point
570 WiFi.softAPConfig(_WIFIapIP, _WIFIapIP, IPAddress(255, 255, 255, 0));
571
572 //Turn on Ap mode. 开启Ap模式
573 WiFi.softAP(_apSSID);
574
575 //Set WiFi to soft-AP mode. 设置WiFi为soft-AP模式
576 WiFi.mode(WIFI_MODE_AP);
577
578 //Open the web service. 打开Web服务
580
582
583 SerialDebug.printf("\nStarting Access Point at \n\"%s\"\n", _apSSID);
584
585}
586
587//!makes a webpage with the title, and contents, already in HTML
588String WIFI_makePage(String title, String contents) {
589
590 SerialDebug.print("WIFI_makePage:");
591 SerialDebug.println(title);
592
593 String s = "<!DOCTYPE html><html><head>";
594 s += "<meta name=\"viewport\" content=\"width=device-width,user-scalable=0\">";
595 s += "<title>";
596 s += title;
597 s += "</title></head><body>";
598 s += contents;
599 s += "</body></html>";
600 return s;
601}
602
603//!Decode the URL
604String WIFI_urlDecode(String input) {
605 String s = input;
606 s.replace("%20", " ");
607 s.replace("+", " ");
608 s.replace("%21", "!");
609 s.replace("%22", "\"");
610 s.replace("%23", "#");
611 s.replace("%24", "$");
612 s.replace("%25", "%");
613 s.replace("%26", "&");
614 s.replace("%27", "\'");
615 s.replace("%28", "(");
616 s.replace("%29", ")");
617 s.replace("%30", "*");
618 s.replace("%31", "+");
619 s.replace("%2C", ",");
620 s.replace("%2E", ".");
621 s.replace("%2F", "/");
622 s.replace("%2C", ",");
623 s.replace("%3A", ":");
624 s.replace("%3A", ";");
625 s.replace("%3C", "<");
626 s.replace("%3D", "=");
627 s.replace("%3E", ">");
628 s.replace("%3F", "?");
629 s.replace("%40", "@");
630 s.replace("%5B", "[");
631 s.replace("%5C", "\\");
632 s.replace("%5D", "]");
633 s.replace("%5E", "^");
634 s.replace("%5F", "-");
635 s.replace("%60", "`");
636 return s;
637}
638
639//!returns string for the header image. This was about the smallest image without incuring much bits in the size of the BIN file
641{
642 //#include "idogwatch.base64"
643
644 String imageString = "<img width=\"200\" src=\"data:image/png;base64,";
645 imageString +=
646 "iVBORw0KGgoAAAANSUhEUgAAAGQAAAAgCAYAAADkK90uAAAMbmlDQ1BJQ0MgUHJvZmlsZQAASImVVwdYU8kWnluSkJAQIHQpoTdBpAaQEkILIL0INkISSCgxJgQVO7qo4NpFFCu6KqLYVkDs2JVFsffFgoqyLupiQ+VNSEDXfeV75/vm3j9nzvyn3JncewCgf+BJpfmoNgAFkkJZYkQIc1R6BpP0FGDAANCBNjDk8eVSdnx8DIAycP+7vLsBEOX9qouS65/z/1V0BUI5HwBkDMRZAjm/AOLjAOBr+VJZIQBEpd56UqFUiWdBrCeDAUK8QolzVHi7Emep8OF+m+REDsSXAdCg8niyHAC07kE9s4ifA3m0PkPsJhGIJQDQh0IcyBfxBBArYx9aUDBBiSshdoD2UohhPICV9R1nzt/4swb5ebycQazKq180QsVyaT5vyv9Zmv8tBfmKAR92cFBFsshEZf6whrfyJkQrMRXiLklWbJyy1hB/EAtUdQcApYgUkSkqe9SUL+fA+sGnDlA3AS80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s93UqaTLpDkUKmrdpxMwd5ZsyiL77HT1qOZXY6uSO1a2X/ZZbrvctqc/z333VmNkx822Uf1UOX19OiGmfCOno6Wlha6uE9jtDoqLi7FarTgcDvwSj6i/YTnviMpZh6+0lFKfj7GxMW3A8vJyrd7f38/mzZvFDTTQ0dFBUVGRxAiTOCVmGZdAUm2kTjwzNaaqvxVRtYFn/+VyT+7zd2p9zu0dlQg8LMbN5yvl0KFDeDxuAoGgRuCCggKNqGH5PMhulzP2o0dxy3uz2JUpObq1WCza50PNzc2ivvQaeAMDA8zMzBAMSrJPgjsFqs1mY+HChX8WIFlRfqcCcPq+5lRWQL4cmZ6e1giruH5EDoKUlOzcuZMNGzZoHK++2VJFEVdxvnICYpJaMYtLa5f8VkhOCI2StldAuOTLEzWeuqrPhNRhl0kMvQLlz5GQ0xf8Tr+fA+TNNqpAUET+/yrvgvHWlPw/p9HXMyEUsSMAAAAASUVORK5CYII=";
647
648 imageString += "\">";
649
650
651 imageString += "<br>";
652
653 return imageString;
654
655//data:image/png;base64,iVBORWOKGgOAAAANSUhEUgAAAMgAAADICAYAAACtWK6EAA
656}
657
658//!create the javascript header to convert to lowercase, etc
660{
661 String s = "";
662
663 s += "<script type=\"text/javascript\">\n";
664
665 s += "var _validatedForm = true;\n";
666
667 s += "//!convert to lower case and strip spaces, using the valId, and setting valId if valid\n";
668 s += "function checkAndConvertText(valId, msg, toLower)\n";
669 s += "{\n";
670 s += "var val = document.getElementById(valId).value;\n";
671 s += "if (!val)\n";
672 s += "{\n";
673 s += "alert(msg + \" required\");\n";
674 s += " _validatedForm = false;\n";
675 s += " return;\n";
676 s += "}\n\n";
677
678 s += "//!strip all spaces\n";
679 //NOTE: the \ in front of \s
680 s += "var str = val.replace(/\\s+/g, '');\n";
681
682 s += "if (toLower)\n";
683 s += "{\n";
684 s += "//!convert to lower case\n";
685 s += "str = str.toLowerCase();\n";
686 s += "}\n\n";
687
688 s += "document.getElementById(valId).value = str;\n";
689 s += "return true;\n";
690 s += "}\n\n";
691
692 s += "//!checks a string to make sure a number..\n";
693 s += "function checkNumber(valId, msg)\n";
694 s += "{\n";
695 s += "var num = document.getElementById(valId).value;\n";
696 s += "if (isNaN(num) || num < 1)\n";
697 s += "{\n";
698 s += "alert(msg + \": \" + num + \" must be valid number\");\n";
699 s += "_validatedForm = false;\n";
700 s += "}\n\n";
701 s += "}\n\n";
702
703
704
705
706
707
708 s += "//!v8 confirms the values the user entered\n";
709 s += "//! set _validatedForm = false if not confirmed\n";
710 s += "function confirmValues()\n";
711 s += "{\n";
712 s += " var val;\n";
713 s += " var msg = \"Please confirm values\\n\";\n";
714 s += " val = document.getElementById(\"ssid_val\").value;\n";
715 s += " msg += \"WIFI SSID = '\" + val + \"'\\n\";\n";
716 s += " val = document.getElementById(\"pass\").value;\n";
717 s += " msg += \"WIFI PASS = '\" + val + \"'\\n\";\n";
718 s += " val = document.getElementById(\"mqtt_user\").value;\n";
719 s += " msg += \"MQTT USER = '\" + val + \"'\\n\";\n";
720 s += " val = document.getElementById(\"mqtt_password\").value;\n";
721 s += " msg += \"MQTT PASS = '\" + val + \"'\\n\";\n";
722 s += " val = document.getElementById(\"mqtt_guestPassword\").value;\n";
723 s += " msg += \"MQTT Guest PASS = '\" + val + \"'\\n\";\n";
724 s += " val = document.getElementById(\"deviceName\").value;\n";
725 s += " msg += \"Device Name = '\" + val + \"'\\n\";\n";
726 s += " _validatedForm = confirm(msg);\n";
727 s += "}\n\n";
728
729
730
731
732 s += "//! checks a few fields, and makes sure they are not null, and convert to lowerCase and strip spaces\n";
733 s += "function validateForm()\n";
734 s += "{\n";
735 s += "//! set default that alls good\n";
736 s += "_validatedForm = true;\n";
737 s += "var toLower = true;\n";
738 s += "var keepCase = false;\n";
739
740 s += "// These will set _validatedFrom to false if not bood\n";
741 s += "checkAndConvertText(\"ssid_val\",\"WIFI SSID\", keepCase);\n";
742 s += "checkAndConvertText(\"mqtt_user\",\"MQTT User Name\", toLower);\n";
743 s += "checkAndConvertText(\"mqtt_password\",\"MQTT Password\", toLower);\n";
744 s += "checkAndConvertText(\"mqtt_guestPassword\",\"MQTT Guest Password\", toLower);\n";
745 s += "checkAndConvertText(\"deviceName\",\"Device Name\", keepCase);\n";
746
747 s += "checkAndConvertText(\"mqtt_server\",\"MQTT Server Name\", toLower);\n";
748 s += "checkNumber(\"mqtt_port\",\"MQTT Port\");\n";
749 s += "\n";
750 s += "if (_validatedForm) confirmValues();\n";
751 s += "return _validatedForm;\n";
752
753 s += "}\n\n";
754
755 s += "</script>\n";
756
757 return s;
758}
759
760/*
761
762 */
763#endif //USE_WIFI_AP_MODULE
void addToTextMessages_displayModule(String text)
#define MQTT_GUEST_PASSWORD
String WIFI_APModule_JsonOutputString()
retrieves the JSON string
WiFiClient _WIFIClient
client of the web server??
const char * _apSSID
String _WIFI_ssid
boolean _doneWIFI_APModuleFlag
String WIFI_urlDecode(String input)
Decode the URL.
String getJavascriptString()
create the javascript header to convert to lowercase, etc
WebServer WIFI_webServer(80)
DNSServer dnsServer;. webServer的类, port 80.
void loop_WIFI_APModule()
main loop
void setup_WIFI_APModule()
sets the config in the EPPROM called wifi-config. NOTE: the _done isn't valid until after this code....
String _WIFI_mqttUser
#define MQTT_TOPIC
const char * _WIFIWirelessAP
#define MQTT_PASSWORD
#define WIFI_SSID
String _WIFI_mqttGuestPassword
#define MQTT_USER
const IPAddress _WIFIapIP(192, 168, 4, 1)
#define MQTT_DEVICE_NAME
void clean_SSID_WIFICredentials()
returns true if the SSID is set, false otherwise. If set, then just exit..
String _WIFISSIDList
String _WIFI_mqttPort
String _WIFI_mqttServer
void WIFI_APModule_ResetCredentials()
resets the credentials
Preferences _WIFIPreferences
wifi config store. wifi配置存储的类
void WIFI_APModule_updateMQTTInfo(char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char *host, char *port, char *locationString)
sets the MQTT user/password. It's up to the code to decide who needs to know
#define WIFI_PASSWORD
boolean doneWIFI_APModule_Credentials()
called to see if the WIFIModule has finished bootstrapping..
void cleanEPROM_WIFI_APModule()
cleans the eprom info
String _WIFI_locationString
#define AP_EPROM_NAME
EPROM INFO .. might be a length issue of the attribute name.
#define MQTT_SERVER
#define MQTT_PORT
String _WIFI_password
void WIFI_startWebServer()
String _WIFI_mqttPassword
void preSetup_WIFI_APModule()
#define WIFI_SSID_LAST
boolean _WIFI_SettingMode
String removeSpaces(String input)
remove spaces in a string
void setDoneWIFI_APModuleFlag(boolean flag)
called to set the done flag
boolean isSet_SSID_WIFICredentials()
returns true if the SSID is set, false otherwise. If set, then just exit..
String _jsonOutputString
the json output string that contain the credentials
String _WIFI_ssid_last
String WIFI_makePage(String title, String contents)
makes a webpage with the title, and contents, already in HTML
void rediscoverWIFIList()
rediscover (and prints) the WIFIlist .. scanning each time.. so a page refresh will look again....
String _WIFI_deviceName
#define MQTT_LOCATION_NAME
void WIFI_setupMode()
Setup the WIFI access point.
String _WIFI_mqttTopic
String headerImageString()
WIFI_APModule
WiFiClient client()
Definition: WebServer.h:93
void on(const String &uri, THandlerFunction handler)
Definition: WebServer.cpp:138
void begin()
Definition: WebServer.cpp:93
void handleClient()
Definition: WebServer.cpp:169
void send(int code, const char *content_type=NULL, const String &content=String(""))
Definition: WebServer.cpp:287
void onNotFound(THandlerFunction fn)
Definition: WebServer.cpp:452
String arg(String name)
Definition: WebServer.cpp:368