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 | 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 |
Functions | |
String | headerImageString () |
WIFI_APModule 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 61 of file WIFI_APModule.cpp.
#define MQTT |
Definition at line 68 of file WIFI_APModule.cpp.
#define MQTT_DEVICE_NAME "10md" |
Definition at line 77 of file WIFI_APModule.cpp.
#define MQTT_GUEST_PASSWORD "8mg" |
Definition at line 74 of file WIFI_APModule.cpp.
#define MQTT_LOCATION_NAME "11ml" |
Definition at line 78 of file WIFI_APModule.cpp.
#define MQTT_PASSWORD "7mp" |
Definition at line 73 of file WIFI_APModule.cpp.
#define MQTT_PORT "4pt" |
Definition at line 70 of file WIFI_APModule.cpp.
#define MQTT_SERVER "5sv" |
Definition at line 71 of file WIFI_APModule.cpp.
#define MQTT_TOPIC "9mt" |
Definition at line 76 of file WIFI_APModule.cpp.
#define MQTT_USER "6mu" |
Definition at line 72 of file WIFI_APModule.cpp.
#define TRY_DATA_LIST |
#define WIFI_PASSWORD "2wp" |
Definition at line 63 of file WIFI_APModule.cpp.
#define WIFI_SSID "1ws" |
Definition at line 62 of file WIFI_APModule.cpp.
#define WIFI_SSID_LAST "3sl" |
Definition at line 66 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
Definition at line 171 of file WIFI_APModule.cpp.
void cleanEPROM_WIFI_APModule | ( | ) |
cleans the eprom info
Definition at line 189 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 131 of file WIFI_APModule.cpp.
String getJavascriptString | ( | ) |
create the javascript header to convert to lowercase, etc
Definition at line 659 of file WIFI_APModule.cpp.
String headerImageString | ( | ) |
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/ returns string for the header image
Definition at line 640 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 153 of file WIFI_APModule.cpp.
void loop_WIFI_APModule | ( | ) |
main loop
Definition at line 256 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 222 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 527 of file WIFI_APModule.cpp.
String removeSpaces | ( | String | input | ) |
remove spaces in a string
Definition at line 102 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 125 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 235 of file WIFI_APModule.cpp.
String WIFI_APModule_JsonOutputString | ( | ) |
retrieves the JSON string
Definition at line 146 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 137 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 198 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 588 of file WIFI_APModule.cpp.
void WIFI_setupMode | ( | ) |
Setup the WIFI access point.
Definition at line 558 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..
Definition at line 266 of file WIFI_APModule.cpp.
String WIFI_urlDecode | ( | String | input | ) |
Decode the URL.
Definition at line 604 of file WIFI_APModule.cpp.
const char* _apSSID = "PetTutorSetup_192_168_4_1" |
Definition at line 49 of file WIFI_APModule.cpp.
boolean _doneWIFI_APModuleFlag = false |
Definition at line 123 of file WIFI_APModule.cpp.
String _jsonOutputString |
the json output string that contain the credentials
Definition at line 143 of file WIFI_APModule.cpp.
String _WIFI_deviceName |
Definition at line 86 of file WIFI_APModule.cpp.
String _WIFI_locationString |
Definition at line 89 of file WIFI_APModule.cpp.
String _WIFI_mqttGuestPassword |
Definition at line 84 of file WIFI_APModule.cpp.
String _WIFI_mqttPassword |
Definition at line 83 of file WIFI_APModule.cpp.
String _WIFI_mqttPort |
Definition at line 80 of file WIFI_APModule.cpp.
String _WIFI_mqttServer |
Definition at line 81 of file WIFI_APModule.cpp.
String _WIFI_mqttTopic |
Definition at line 88 of file WIFI_APModule.cpp.
String _WIFI_mqttUser |
Definition at line 82 of file WIFI_APModule.cpp.
String _WIFI_password |
Definition at line 56 of file WIFI_APModule.cpp.
boolean _WIFI_SettingMode |
Definition at line 51 of file WIFI_APModule.cpp.
String _WIFI_ssid |
Definition at line 54 of file WIFI_APModule.cpp.
String _WIFI_ssid_last |
Definition at line 58 of file WIFI_APModule.cpp.
WiFiClient _WIFIClient |
client of the web server??
Definition at line 118 of file WIFI_APModule.cpp.
Preferences _WIFIPreferences |
wifi config store. wifi配置存储的类
Definition at line 121 of file WIFI_APModule.cpp.
String _WIFISSIDList |
Definition at line 52 of file WIFI_APModule.cpp.
const char* _WIFIWirelessAP = "192.168.4.1" |
Definition at line 40 of file WIFI_APModule.cpp.
WebServer WIFI_webServer(80) | ( | 80 | ) |
DNSServer dnsServer;. webServer的类, port 80.