|
ESP_IOT v2.5
IOT ESP Coding
|
#include "WIFI_APModule.h"#include <ArduinoJson.h>#include <WiFi.h>#include <ESPmDNS.h>#include <WiFiClient.h>#include <WebServer.h>#include <Preferences.h>
Go to the source code of this file.
Macros | |
| #define | TRY_FEED_FROM_AP |
| WIFI_APModule More... | |
| #define | AP_EPROM_NAME "ap_wifi" |
| EPROM INFO .. might be a length issue of the attribute name. More... | |
| #define | WIFI_SSID "1ws" |
| #define | WIFI_PASSWORD "2wp" |
| #define | WIFI_SSID_LAST "3sl" |
| #define | MQTT |
| #define | MQTT_PORT "4pt" |
| #define | MQTT_SERVER "5sv" |
| #define | MQTT_USER "6mu" |
| #define | MQTT_PASSWORD "7mp" |
| #define | MQTT_GUEST_PASSWORD "8mg" |
| #define | MQTT_TOPIC "9mt" |
| #define | MQTT_DEVICE_NAME "10md" |
| #define | MQTT_LOCATION_NAME "11ml" |
| #define | ANDROID_WEB_TEST |
| #define | TRY_DATA_LIST |
| #define | AP_DEBUG_MODE (defined in Perferences..) |
| #define | FORCE_ON |
| #define | DOIT_IMAGE_not_working |
| #define | TRY_SSID_AMPER |
Functions | |
| String | headerImageString () |
| 7.16.26 try included one.. see if fixed M5Atom AP webpage not working.. only the header More... | |
| void | WIFI_startWebServer () |
| void | WIFI_setupMode () |
| Setup the WIFI access point. More... | |
| String | WIFI_makePage (String title, String contents) |
| makes a webpage with the title, and contents, already in HTML More... | |
| String | WIFI_urlDecode (String input) |
| Decode the URL. More... | |
| const IPAddress | _WIFIapIP (192, 168, 4, 1) |
| void | rediscoverWIFIList () |
| rediscover (and prints) the WIFIlist .. scanning each time.. so a page refresh will look again... More... | |
| String | getJavascriptString () |
| create the javascript header to convert to lowercase, etc More... | |
| String | removeSpaces (String input) |
| remove spaces in a string More... | |
| WebServer | WIFI_webServer (80) |
| DNSServer dnsServer;. webServer的类, port 80. More... | |
| void | setDoneWIFI_APModuleFlag (boolean flag) |
| called to set the done flag More... | |
| boolean | doneWIFI_APModule_Credentials () |
| called to see if the WIFIModule has finished bootstrapping.. More... | |
| void | WIFI_APModule_ResetCredentials () |
| resets the credentials More... | |
| String | WIFI_APModule_JsonOutputString () |
| retrieves the JSON string More... | |
| boolean | isSet_SSID_WIFICredentials () |
| returns true if the SSID is set, false otherwise. If set, then just exit.. More... | |
| void | clean_SSID_WIFICredentials () |
| returns true if the SSID is set, false otherwise. If set, then just exit.. More... | |
| void | cleanEPROM_WIFI_APModule () |
| cleans the eprom info More... | |
| 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 More... | |
| void | preSetup_WIFI_APModule () |
| void | setup_WIFI_APModule () |
| sets the config in the EPPROM called wifi-config. NOTE: the _done isn't valid until after this code... More... | |
| void | loop_WIFI_APModule () |
| main loop More... | |
Variables | |
| const char * | _WIFIWirelessAP = "192.168.4.1" |
| const char * | _apSSID = "PetTutorSetup_192_168_4_1" |
| boolean | _WIFI_SettingMode |
| String | _WIFISSIDList |
| String | _WIFI_ssid |
| String | _WIFI_password |
| String | _WIFI_ssid_last |
| String | _WIFI_mqttPort |
| String | _WIFI_mqttServer |
| String | _WIFI_mqttUser |
| String | _WIFI_mqttPassword |
| String | _WIFI_mqttGuestPassword |
| String | _WIFI_deviceName |
| String | _WIFI_mqttTopic |
| String | _WIFI_locationString |
| WiFiClient | _WIFIClient |
| client of the web server?? More... | |
| Preferences | _WIFIPreferences |
| wifi config store. wifi配置存储的类 More... | |
| boolean | _doneWIFI_APModuleFlag = false |
| String | _jsonOutputString |
| the json output string that contain the credentials More... | |
| #define ANDROID_WEB_TEST |
| #define AP_DEBUG_MODE (defined in Perferences..) |
| #define AP_EPROM_NAME "ap_wifi" |
EPROM INFO .. might be a length issue of the attribute name.
Definition at line 76 of file WIFI_APModule.cpp.
| #define DOIT_IMAGE_not_working |
| #define FORCE_ON |
| #define MQTT |
Definition at line 83 of file WIFI_APModule.cpp.
| #define MQTT_DEVICE_NAME "10md" |
Definition at line 92 of file WIFI_APModule.cpp.
| #define MQTT_GUEST_PASSWORD "8mg" |
Definition at line 89 of file WIFI_APModule.cpp.
| #define MQTT_LOCATION_NAME "11ml" |
Definition at line 93 of file WIFI_APModule.cpp.
| #define MQTT_PASSWORD "7mp" |
Definition at line 88 of file WIFI_APModule.cpp.
| #define MQTT_PORT "4pt" |
Definition at line 85 of file WIFI_APModule.cpp.
| #define MQTT_SERVER "5sv" |
Definition at line 86 of file WIFI_APModule.cpp.
| #define MQTT_TOPIC "9mt" |
Definition at line 91 of file WIFI_APModule.cpp.
| #define MQTT_USER "6mu" |
Definition at line 87 of file WIFI_APModule.cpp.
| #define TRY_DATA_LIST |
| #define TRY_FEED_FROM_AP |
| #define TRY_SSID_AMPER |
| #define WIFI_PASSWORD "2wp" |
Definition at line 78 of file WIFI_APModule.cpp.
| #define WIFI_SSID "1ws" |
Definition at line 77 of file WIFI_APModule.cpp.
| #define WIFI_SSID_LAST "3sl" |
Definition at line 81 of file WIFI_APModule.cpp.
| const IPAddress _WIFIapIP | ( | 192 | , |
| 168 | , | ||
| 4 | , | ||
| 1 | |||
| ) |

| void clean_SSID_WIFICredentials | ( | ) |
returns true if the SSID is set, false otherwise. If set, then just exit..
cleans credentials
8.16.25 MQTT
9.18.23 LA (after Eagle Rock bike ride, Van Morrison tomorrow)
Definition at line 186 of file WIFI_APModule.cpp.


| void cleanEPROM_WIFI_APModule | ( | ) |
cleans the eprom info
Definition at line 209 of file WIFI_APModule.cpp.

| boolean doneWIFI_APModule_Credentials | ( | ) |
called to see if the WIFIModule has finished bootstrapping..
The rest are custom methods ..
called to see if the WIFIModule has finished bootstrapping..
Definition at line 146 of file WIFI_APModule.cpp.

| String getJavascriptString | ( | ) |
create the javascript header to convert to lowercase, etc
issue #248 support full SSID name syntax (or at least let the user type anything.)
Definition at line 883 of file WIFI_APModule.cpp.

| String headerImageString | ( | ) |
7.16.26 try included one.. see if fixed M5Atom AP webpage not working.. only the header
returns string for the header image. This was about the smallest image without incuring much bits in the size of the BIN file
Will spif up the web page with some small images.. https://randomnerdtutorials.com/display-images-esp32-esp8266-web-server/ NOTE: 12.15.23 The WiFiClientSecure does NOT work with the access point shown below. So we will go back to the WiFi.h returns string for the header image
Definition at line 857 of file WIFI_APModule.cpp.

| boolean isSet_SSID_WIFICredentials | ( | ) |
returns true if the SSID is set, false otherwise. If set, then just exit..
Definition at line 168 of file WIFI_APModule.cpp.

| void loop_WIFI_APModule | ( | ) |
main loop
Definition at line 289 of file WIFI_APModule.cpp.


| void preSetup_WIFI_APModule | ( | ) |
4.8.22. Called to do any state variables. a presetup() approach ..
Exit setup(). 退出setup()
Definition at line 249 of file WIFI_APModule.cpp.


| void rediscoverWIFIList | ( | ) |
rediscover (and prints) the WIFIlist .. scanning each time.. so a page refresh will look again...
print the WIFIlist .. scanning each time..
try debug
try debug
try debug\
Definition at line 684 of file WIFI_APModule.cpp.


| String removeSpaces | ( | String | input | ) |
remove spaces in a string
Definition at line 117 of file WIFI_APModule.cpp.

| void setDoneWIFI_APModuleFlag | ( | boolean | flag | ) |
called to set the done flag
called to set the done flag (this could be from outside like if BLE updated credentials..)
Definition at line 140 of file WIFI_APModule.cpp.

| void setup_WIFI_APModule | ( | ) |
sets the config in the EPPROM called wifi-config. NOTE: the _done isn't valid until after this code...
Exit setup(). 退出setup()
Definition at line 268 of file WIFI_APModule.cpp.


| String WIFI_APModule_JsonOutputString | ( | ) |
retrieves the JSON string
Definition at line 161 of file WIFI_APModule.cpp.

| void WIFI_APModule_ResetCredentials | ( | ) |
resets the credentials
resets the credentials (maybe only the SSID .. keep the other)
Definition at line 152 of file WIFI_APModule.cpp.

| 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
Definition at line 218 of file WIFI_APModule.cpp.

| String WIFI_makePage | ( | String | title, |
| String | contents | ||
| ) |
makes a webpage with the title, and contents, already in HTML
see what's up..
Definition at line 794 of file WIFI_APModule.cpp.

| void WIFI_setupMode | ( | ) |
Setup the WIFI access point.
8.8.26 not working with Android, try a passord 9.7.26 try withoiut password as those on() methods hopefully were the AP fix for android
add the password
Definition at line 729 of file WIFI_APModule.cpp.


| void WIFI_startWebServer | ( | ) |
starts the web server Open the web service. 打开Web服务
8.10.26 Turning OFF BLE client
8.18.16 some mroe to test WIFI not working on Android
get the header string
add the javascript
so referting back to this..
invokes the web server with "feed" which will be the "/feed" below
8.2.26 turn this on .. for debugging .. OR keep it on.
show some information...
8.16.25 MQTT 9.16.23 some debug information retrieve the Configuration JSON string in JSON format..
retrieve the WIFIInfoString
empty it now.
as per #248 support SSID syntax (first will remove the spaces at start and end)
Issue #305 don't remove spaces...
9.18.26 For now, will force this ON
send a feed command 's'
Definition at line 299 of file WIFI_APModule.cpp.


| String WIFI_urlDecode | ( | String | input | ) |
Decode the URL.
Definition at line 821 of file WIFI_APModule.cpp.

| WebServer WIFI_webServer | ( | 80 | ) |
DNSServer dnsServer;. webServer的类, port 80.

| const char* _apSSID = "PetTutorSetup_192_168_4_1" |
Definition at line 64 of file WIFI_APModule.cpp.
| boolean _doneWIFI_APModuleFlag = false |
Definition at line 138 of file WIFI_APModule.cpp.
| String _jsonOutputString |
the json output string that contain the credentials
Definition at line 158 of file WIFI_APModule.cpp.
| String _WIFI_deviceName |
Definition at line 101 of file WIFI_APModule.cpp.
| String _WIFI_locationString |
Definition at line 104 of file WIFI_APModule.cpp.
| String _WIFI_mqttGuestPassword |
Definition at line 99 of file WIFI_APModule.cpp.
| String _WIFI_mqttPassword |
Definition at line 98 of file WIFI_APModule.cpp.
| String _WIFI_mqttPort |
Definition at line 95 of file WIFI_APModule.cpp.
| String _WIFI_mqttServer |
Definition at line 96 of file WIFI_APModule.cpp.
| String _WIFI_mqttTopic |
Definition at line 103 of file WIFI_APModule.cpp.
| String _WIFI_mqttUser |
Definition at line 97 of file WIFI_APModule.cpp.
| String _WIFI_password |
Definition at line 71 of file WIFI_APModule.cpp.
| boolean _WIFI_SettingMode |
Definition at line 66 of file WIFI_APModule.cpp.
| String _WIFI_ssid |
Definition at line 69 of file WIFI_APModule.cpp.
| String _WIFI_ssid_last |
Definition at line 73 of file WIFI_APModule.cpp.
| WiFiClient _WIFIClient |
client of the web server??
Definition at line 133 of file WIFI_APModule.cpp.
| Preferences _WIFIPreferences |
wifi config store. wifi配置存储的类
Definition at line 136 of file WIFI_APModule.cpp.
| String _WIFISSIDList |
Definition at line 67 of file WIFI_APModule.cpp.
| const char* _WIFIWirelessAP = "192.168.4.1" |
Definition at line 55 of file WIFI_APModule.cpp.