|
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 | TRY_DATA_LIST |
| #define | TRY_SSID_AMPER |
Functions | |
| String | headerImageString () |
| returns string for the header image 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... | |
| 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 |
| WebServer | WIFI_webServer (80) |
| DNSServer dnsServer;. webServer的类, port 80. More... | |
| 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 AP_EPROM_NAME "ap_wifi" |
EPROM INFO .. might be a length issue of the attribute name.
Definition at line 69 of file WIFI_APModule.cpp.
| #define MQTT |
Definition at line 76 of file WIFI_APModule.cpp.
| #define MQTT_DEVICE_NAME "10md" |
Definition at line 85 of file WIFI_APModule.cpp.
| #define MQTT_GUEST_PASSWORD "8mg" |
Definition at line 82 of file WIFI_APModule.cpp.
| #define MQTT_LOCATION_NAME "11ml" |
Definition at line 86 of file WIFI_APModule.cpp.
| #define MQTT_PASSWORD "7mp" |
Definition at line 81 of file WIFI_APModule.cpp.
| #define MQTT_PORT "4pt" |
Definition at line 78 of file WIFI_APModule.cpp.
| #define MQTT_SERVER "5sv" |
Definition at line 79 of file WIFI_APModule.cpp.
| #define MQTT_TOPIC "9mt" |
Definition at line 84 of file WIFI_APModule.cpp.
| #define MQTT_USER "6mu" |
Definition at line 80 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 71 of file WIFI_APModule.cpp.
| #define WIFI_SSID "1ws" |
Definition at line 70 of file WIFI_APModule.cpp.
| #define WIFI_SSID_LAST "3sl" |
Definition at line 74 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 179 of file WIFI_APModule.cpp.


| void cleanEPROM_WIFI_APModule | ( | ) |
cleans the eprom info
Definition at line 202 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 139 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 771 of file WIFI_APModule.cpp.

| String headerImageString | ( | ) |
returns string for the header image
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
Definition at line 752 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 161 of file WIFI_APModule.cpp.

| void loop_WIFI_APModule | ( | ) |
main loop
Definition at line 275 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 235 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..
Definition at line 625 of file WIFI_APModule.cpp.


| String removeSpaces | ( | String | input | ) |
remove spaces in a string
Definition at line 110 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 133 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 254 of file WIFI_APModule.cpp.


| String WIFI_APModule_JsonOutputString | ( | ) |
retrieves the JSON string
Definition at line 154 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 145 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 211 of file WIFI_APModule.cpp.

| String WIFI_makePage | ( | String | title, |
| String | contents | ||
| ) |
makes a webpage with the title, and contents, already in HTML
Definition at line 700 of file WIFI_APModule.cpp.

| void WIFI_setupMode | ( | ) |
Setup the WIFI access point.
Definition at line 670 of file WIFI_APModule.cpp.


| void WIFI_startWebServer | ( | ) |
starts the web server Open the web service. 打开Web服务
add the javascript
this re-calculates the WIFI list
so referting back to this..
called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
invokes the web server with "feed" which will be the "/feed" below
as per #248 support SSID syntax (first will remove the spaces at start and end)
Issue #305 don't remove spaces...
send a feed command 's'
Definition at line 285 of file WIFI_APModule.cpp.


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

| const char* _apSSID = "PetTutorSetup_192_168_4_1" |
Definition at line 57 of file WIFI_APModule.cpp.
| boolean _doneWIFI_APModuleFlag = false |
Definition at line 131 of file WIFI_APModule.cpp.
| String _jsonOutputString |
the json output string that contain the credentials
Definition at line 151 of file WIFI_APModule.cpp.
| String _WIFI_deviceName |
Definition at line 94 of file WIFI_APModule.cpp.
| String _WIFI_locationString |
Definition at line 97 of file WIFI_APModule.cpp.
| String _WIFI_mqttGuestPassword |
Definition at line 92 of file WIFI_APModule.cpp.
| String _WIFI_mqttPassword |
Definition at line 91 of file WIFI_APModule.cpp.
| String _WIFI_mqttPort |
Definition at line 88 of file WIFI_APModule.cpp.
| String _WIFI_mqttServer |
Definition at line 89 of file WIFI_APModule.cpp.
| String _WIFI_mqttTopic |
Definition at line 96 of file WIFI_APModule.cpp.
| String _WIFI_mqttUser |
Definition at line 90 of file WIFI_APModule.cpp.
| String _WIFI_password |
Definition at line 64 of file WIFI_APModule.cpp.
| boolean _WIFI_SettingMode |
Definition at line 59 of file WIFI_APModule.cpp.
| String _WIFI_ssid |
Definition at line 62 of file WIFI_APModule.cpp.
| String _WIFI_ssid_last |
Definition at line 66 of file WIFI_APModule.cpp.
| WiFiClient _WIFIClient |
client of the web server??
Definition at line 126 of file WIFI_APModule.cpp.
| Preferences _WIFIPreferences |
wifi config store. wifi配置存储的类
Definition at line 129 of file WIFI_APModule.cpp.
| String _WIFISSIDList |
Definition at line 60 of file WIFI_APModule.cpp.
| const char* _WIFIWirelessAP = "192.168.4.1" |
Definition at line 48 of file WIFI_APModule.cpp.
| WebServer WIFI_webServer(80) | ( | 80 | ) |
DNSServer dnsServer;. webServer的类, port 80.