ESP_IOT v2.5
IOT ESP Coding
WIFI_APModule.cpp File Reference
#include "WIFI_APModule.h"
#include <ArduinoJson.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiClient.h>
#include "WebServer.h"
#include <Preferences.h>
Include dependency graph for WIFI_APModule.cpp:

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...
 

Macro Definition Documentation

◆ AP_EPROM_NAME

#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.

◆ MQTT

#define MQTT

Definition at line 68 of file WIFI_APModule.cpp.

◆ MQTT_DEVICE_NAME

#define MQTT_DEVICE_NAME   "10md"

Definition at line 77 of file WIFI_APModule.cpp.

◆ MQTT_GUEST_PASSWORD

#define MQTT_GUEST_PASSWORD   "8mg"

Definition at line 74 of file WIFI_APModule.cpp.

◆ MQTT_LOCATION_NAME

#define MQTT_LOCATION_NAME   "11ml"

Definition at line 78 of file WIFI_APModule.cpp.

◆ MQTT_PASSWORD

#define MQTT_PASSWORD   "7mp"

Definition at line 73 of file WIFI_APModule.cpp.

◆ MQTT_PORT

#define MQTT_PORT   "4pt"

Definition at line 70 of file WIFI_APModule.cpp.

◆ MQTT_SERVER

#define MQTT_SERVER   "5sv"

Definition at line 71 of file WIFI_APModule.cpp.

◆ MQTT_TOPIC

#define MQTT_TOPIC   "9mt"

Definition at line 76 of file WIFI_APModule.cpp.

◆ MQTT_USER

#define MQTT_USER   "6mu"

Definition at line 72 of file WIFI_APModule.cpp.

◆ TRY_DATA_LIST

#define TRY_DATA_LIST

◆ WIFI_PASSWORD

#define WIFI_PASSWORD   "2wp"

Definition at line 63 of file WIFI_APModule.cpp.

◆ WIFI_SSID

#define WIFI_SSID   "1ws"

Definition at line 62 of file WIFI_APModule.cpp.

◆ WIFI_SSID_LAST

#define WIFI_SSID_LAST   "3sl"

Definition at line 66 of file WIFI_APModule.cpp.

Function Documentation

◆ _WIFIapIP()

const IPAddress _WIFIapIP ( 192  ,
168  ,
,
 
)
Here is the caller graph for this function:

◆ clean_SSID_WIFICredentials()

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.

Here is the caller graph for this function:

◆ cleanEPROM_WIFI_APModule()

void cleanEPROM_WIFI_APModule ( )

cleans the eprom info

Definition at line 189 of file WIFI_APModule.cpp.

Here is the caller graph for this function:

◆ doneWIFI_APModule_Credentials()

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.

Here is the caller graph for this function:

◆ getJavascriptString()

String getJavascriptString ( )

create the javascript header to convert to lowercase, etc

Definition at line 659 of file WIFI_APModule.cpp.

Here is the caller graph for this function:

◆ headerImageString()

String headerImageString ( )

WIFI_APModule

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.

Here is the caller graph for this function:

◆ isSet_SSID_WIFICredentials()

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.

Here is the caller graph for this function:

◆ loop_WIFI_APModule()

void loop_WIFI_APModule ( )

main loop

Definition at line 256 of file WIFI_APModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ preSetup_WIFI_APModule()

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rediscoverWIFIList()

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.

Here is the caller graph for this function:

◆ removeSpaces()

String removeSpaces ( String  input)

remove spaces in a string

Definition at line 102 of file WIFI_APModule.cpp.

Here is the caller graph for this function:

◆ setDoneWIFI_APModuleFlag()

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.

Here is the caller graph for this function:

◆ setup_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...

Exit setup(). 退出setup()

Definition at line 235 of file WIFI_APModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WIFI_APModule_JsonOutputString()

String WIFI_APModule_JsonOutputString ( )

retrieves the JSON string

Definition at line 146 of file WIFI_APModule.cpp.

Here is the caller graph for this function:

◆ WIFI_APModule_ResetCredentials()

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.

Here is the caller graph for this function:

◆ WIFI_APModule_updateMQTTInfo()

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.

Here is the caller graph for this function:

◆ WIFI_makePage()

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.

Here is the caller graph for this function:

◆ WIFI_setupMode()

void WIFI_setupMode ( )

Setup the WIFI access point.

Definition at line 558 of file WIFI_APModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WIFI_startWebServer()

void WIFI_startWebServer ( )

starts the web server Open the web service. 打开Web服务

add the javascript

this re-calculates the WIFI list

47 https://github.com/konacurrents/ESP_IOT/issues/47

so referting back to this..

Definition at line 266 of file WIFI_APModule.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ WIFI_urlDecode()

String WIFI_urlDecode ( String  input)

Decode the URL.

Definition at line 604 of file WIFI_APModule.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ _apSSID

const char* _apSSID = "PetTutorSetup_192_168_4_1"

Definition at line 49 of file WIFI_APModule.cpp.

◆ _doneWIFI_APModuleFlag

boolean _doneWIFI_APModuleFlag = false

Definition at line 123 of file WIFI_APModule.cpp.

◆ _jsonOutputString

String _jsonOutputString

the json output string that contain the credentials

Definition at line 143 of file WIFI_APModule.cpp.

◆ _WIFI_deviceName

String _WIFI_deviceName

Definition at line 86 of file WIFI_APModule.cpp.

◆ _WIFI_locationString

String _WIFI_locationString

Definition at line 89 of file WIFI_APModule.cpp.

◆ _WIFI_mqttGuestPassword

String _WIFI_mqttGuestPassword

Definition at line 84 of file WIFI_APModule.cpp.

◆ _WIFI_mqttPassword

String _WIFI_mqttPassword

Definition at line 83 of file WIFI_APModule.cpp.

◆ _WIFI_mqttPort

String _WIFI_mqttPort

Definition at line 80 of file WIFI_APModule.cpp.

◆ _WIFI_mqttServer

String _WIFI_mqttServer

Definition at line 81 of file WIFI_APModule.cpp.

◆ _WIFI_mqttTopic

String _WIFI_mqttTopic

Definition at line 88 of file WIFI_APModule.cpp.

◆ _WIFI_mqttUser

String _WIFI_mqttUser

Definition at line 82 of file WIFI_APModule.cpp.

◆ _WIFI_password

String _WIFI_password

Definition at line 56 of file WIFI_APModule.cpp.

◆ _WIFI_SettingMode

boolean _WIFI_SettingMode

Definition at line 51 of file WIFI_APModule.cpp.

◆ _WIFI_ssid

String _WIFI_ssid

Definition at line 54 of file WIFI_APModule.cpp.

◆ _WIFI_ssid_last

String _WIFI_ssid_last

Definition at line 58 of file WIFI_APModule.cpp.

◆ _WIFIClient

WiFiClient _WIFIClient

client of the web server??

Definition at line 118 of file WIFI_APModule.cpp.

◆ _WIFIPreferences

Preferences _WIFIPreferences

wifi config store. wifi配置存储的类

Definition at line 121 of file WIFI_APModule.cpp.

◆ _WIFISSIDList

String _WIFISSIDList

Definition at line 52 of file WIFI_APModule.cpp.

◆ _WIFIWirelessAP

const char* _WIFIWirelessAP = "192.168.4.1"

Definition at line 40 of file WIFI_APModule.cpp.

◆ WIFI_webServer

WebServer WIFI_webServer(80) ( 80  )

DNSServer dnsServer;. webServer的类, port 80.