|
ESP_IOT v2.5
IOT ESP Coding
|


Go to the source code of this file.
Macros | |
| #define | MQTT_CALLBACK_FEED 0 |
| 8.16.25 MQTT More... | |
| #define | MQTT_CALLBACK_BLINK 1 |
| #define | MQTT_CALLBACK_TEMP 2 |
| #define | MQTT_CALLBACK_SOLID_LIGHT 3 |
| #define | MQTT_CLEAN_SSID_EPROM 4 |
| #define | MQTT_CALLBACK_TILT_MOTION_DETECTED 5 |
| #define | MQTT_CALLBACK_PIR_DETECTED 6 |
| #define | MQTT_MAX_CALLBACKS 7 |
| 8.18.25 take out until test ... More... | |
Functions | |
| void | setup_MQTTNetworking () |
| setup the MQTT part of networking More... | |
| void | loop_MQTTNetworking () |
| called for the loop() of this plugin More... | |
| char * | getDeviceNameMQTT () |
| NOTE: The following are only called from MainModule or ESP_IOT.ino (basically main) More... | |
| void | restartWIFI_MQTTState () |
| restart the WIFI and then MQTT connection More... | |
| boolean | processJSONMessageMQTT (char *ascii, char *topic) |
| process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not, it's an MQTT topic (so send replies if you want) More... | |
| void | sendMessageMQTT (char *message) |
| void | sendMessageMQTT_Topic (char *message, char *topic) |
| for now only send if it start message starts with "#" More... | |
| void | sendMessageNoChangeMQTT (char *message) |
| just send a message but without any extras More... | |
| void | sendMessageNoChangeMQTT_Topic (char *message, char *topic) |
| just send a message but without any extras, using a topic specified More... | |
| void | publishMQTTMessage (char *topic, char *message) |
| Wrapper of the mqttclient publish. More... | |
| void | publishMQTTMessageDefaultTopic (char *message) |
| Wrapper of the mqttclient publish. More... | |
| void | publishBinaryFile (char *topic, uint8_t *buf, size_t len, String fileExtension) |
| void | publishSMRunMessage (char *smrunMessage) |
| void | sendStatusMessageMQTT (const char *semanticMarker) |
| sends the semantic marker as a doc follow message #remoteMe (vs STATUS, as that triggers a status reply.. ) More... | |
| void | sendDocFollowMessageMQTT (const char *semanticMarker) |
| sends the semantic marker as a doc follow message DOCFOLLOW More... | |
| char * | getLastDocFollowSemanticMarker_MQTTNetworking () |
| void | setLastDocFollowSemanticMarker_MQTTNetworking (char *semanticMarker) |
| sets the last DocFollow SemanticMarker More... | |
| void | cleanEPROM_MQTTNetworking () |
| cleans the eprom info More... | |
| boolean | isConnectedWIFI_MQTTState () |
| value of WIFI connected More... | |
| boolean | isConnectedMQTT_MQTTState () |
| value of MQTT connected More... | |
| void | getChipInfo () |
| get the chip info More... | |
| void | restartDelayCheckWIFI_MQTTNetworking () |
| starts the delay for WIFI checking, called at startup, and each time the timer finished.. More... | |
| void | checkDelaySinceWIFICheck_MQTTNetworking () |
| checks delay for the WIFI connectivity More... | |
| void | checkAndReconnectWIFI_MQTTNetworking () |
| checks if the WIFI is off (or not reachable) and tries consecting again (the 'W' command) More... | |
| String | getJSONConfigString () |
| retrieve the Configuration JSON string in JSON format.. More... | |
| String | get_WIFIInfoString () |
| retrieve the WIFIInfoString More... | |
| void | cleanMQTTpasswordsUpdateInEPROM () |
| 9.18.23 LA (after Eagle Rock bike ride, Van Morrison tomorrow) More... | |
| String | MQTT_urlDecode (String input) |
| Decode the URL (exposed 12.17.23 for the scanner. More... | |
| String | get_WIFI_SSID () |
| 3.22.24 get the WIFI SSID for the status More... | |
| void | publishSPIFFFile_MQTT (char *topic, char *path, int len) |
| #define MQTT_CALLBACK_BLINK 1 |
Definition at line 32 of file MQTTNetworking.h.
| #define MQTT_CALLBACK_FEED 0 |
8.16.25 MQTT
The MQTT + WIFI part
Created: on Jan 1, 2022, iDogWatch.com Author: Scott Moody callback with the message if required (like sending the FEED message) !function pointers: https://www.cprogramming.com/tutorial/function-pointers.html define as: void callback(char* message) call processMessage(message, &callback); This must be called first before the setup or loop eg: void myCallback(char* message) { } setMessageCallback(&myCallback)
Definition at line 31 of file MQTTNetworking.h.
| #define MQTT_CALLBACK_PIR_DETECTED 6 |
Definition at line 39 of file MQTTNetworking.h.
| #define MQTT_CALLBACK_SOLID_LIGHT 3 |
Definition at line 35 of file MQTTNetworking.h.
| #define MQTT_CALLBACK_TEMP 2 |
Definition at line 33 of file MQTTNetworking.h.
| #define MQTT_CALLBACK_TILT_MOTION_DETECTED 5 |
Definition at line 38 of file MQTTNetworking.h.
| #define MQTT_CLEAN_SSID_EPROM 4 |
Definition at line 36 of file MQTTNetworking.h.
| #define MQTT_MAX_CALLBACKS 7 |
8.18.25 take out until test ...
MAX must be updated to 1 more than last item..
Definition at line 44 of file MQTTNetworking.h.
| void checkAndReconnectWIFI_MQTTNetworking | ( | ) |
checks if the WIFI is off (or not reachable) and tries consecting again (the 'W' command)
checks if the WIFI is off (or not reachable) and tries consecting again (the 'W' command)
The setup() will call restartDelay_MQTTNetworking Each loop will call checkDelaySinceButtonTouched_MQTTNetworking checks if the WIFI is off (or not reachable) and tries consecting again (the 'W' command)
start outputing SPIFF info
it seems the WIFI can reconnect – but all the MQTT isn't restarted.. So if our internal state things WIFI is off, reconnect anyway..
try reconnecting if not connected (and ssid is available)
start outputing SPIFF info
restart the WIFI and then MQTT connection
Definition at line 1206 of file MQTTNetworking.cpp.


| void checkDelaySinceWIFICheck_MQTTNetworking | ( | ) |
checks delay for the WIFI connectivity
check and reconnect to the WIFI is not connected
restart the timer
Definition at line 1188 of file MQTTNetworking.cpp.


| void cleanEPROM_MQTTNetworking | ( | ) |
cleans the eprom info
Definition at line 2050 of file MQTTNetworking.cpp.

| void cleanMQTTpasswordsUpdateInEPROM | ( | ) |
9.18.23 LA (after Eagle Rock bike ride, Van Morrison tomorrow)
now update the eprom with these null values
Definition at line 5211 of file MQTTNetworking.cpp.


| String get_WIFI_SSID | ( | ) |
3.22.24 get the WIFI SSID for the status
Definition at line 1472 of file MQTTNetworking.cpp.

| String get_WIFIInfoString | ( | ) |
retrieve the WIFIInfoString
Definition at line 1463 of file MQTTNetworking.cpp.
| void getChipInfo | ( | ) |
get the chip info
get the chip info
Definition at line 681 of file MQTTNetworking.cpp.


| char * getDeviceNameMQTT | ( | ) |
NOTE: The following are only called from MainModule or ESP_IOT.ino (basically main)
called for things like the advertisement
NOTE: The following are only called from MainModule or ESP_IOT.ino (basically main)
callback with the message if required (like sending the FEED message) !function pointers: https://www.cprogramming.com/tutorial/function-pointers.html define as: void callback(char* message) call processMessage(message, &callback);
5.3.25 notset for somereason ..
Definition at line 663 of file MQTTNetworking.cpp.


| String getJSONConfigString | ( | ) |
retrieve the Configuration JSON string in JSON format..
9.16.23 some debug information retrieve the Configuration JSON string in JSON format..
NEW: 2.21.22 TRY: reading back..
check ... _fullMessageOut Close the Preferences
Definition at line 637 of file MQTTNetworking.cpp.

| char * getLastDocFollowSemanticMarker_MQTTNetworking | ( | ) |
retrieves the last DocFollow SemanticMarker (from the message DOCFOLLOW | #followMe {AVM=<SM>} Or the JSON: {'set':'semanticMarker','val','<URL>}
Definition at line 731 of file MQTTNetworking.cpp.

| boolean isConnectedMQTT_MQTTState | ( | ) |
value of MQTT connected
Definition at line 1046 of file MQTTNetworking.cpp.

| boolean isConnectedWIFI_MQTTState | ( | ) |
value of WIFI connected
Definition at line 1032 of file MQTTNetworking.cpp.


| void loop_MQTTNetworking | ( | ) |
called for the loop() of this plugin
State: 0 .
waitingForWIFI (delaying when Nice writeup: https://microcontrollerslab.com/esp32-mqtt-publish-multiple-sensor-readings-node-red/
called for the loop() of this plugin
check if should try to reconnect to WIF
check if a delay was running.. for the STATE..
Definition at line 1058 of file MQTTNetworking.cpp.


| String MQTT_urlDecode | ( | String | input | ) |
Decode the URL (exposed 12.17.23 for the scanner.
Decode the URL (exposed 12.17.23 for the scanner.
Decode the URL
Definition at line 5297 of file MQTTNetworking.cpp.

| boolean processJSONMessageMQTT | ( | char * | ascii, |
| char * | topic | ||
| ) |
process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not, it's an MQTT topic (so send replies if you want)
process the JSON message, which can be configuration information. This is called from outside on things like a Bluetooth message.. return true if valid JSON, and false otherwise. This looks for '{' as the starting character (after possible spaces in front). A topic can be sent, or nil
process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not, it's an MQTT topic (so send replies if you want) 1.14.24 THIS is the main JSON processor of messages. But now that groups can send almost any message, there needs to be a way define a subset of messages that groups can send on.. 6.20.25 added Serial Monitor input, API Manual described:
6.16.25 Nice out, yellow field set below when looking at whether a command was found if false then continue the if/else
use the default user topic if not specified...
sets the global so isGroupTopic() will work
7.26.23 don't process if a group message and FLAG not set
called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean)
8.2.24 support the not receiving message on some topics (such as a users GuestTopic) Idea would be some devices won't listen to the guest topic (instead only the user safe ones)
empty the status for the last message. Then various places the feed or status, etc are set
Basically processing as a JSON if the "{" is somewhere.. could still be invalid code
9.18.23 add this .. so it doesnt' fall through
devName is if a dev=<NAME> was specified, then dissregard if not our device
this is to ensure that the credentials are not processed.. there is a return 'true' after processing commands
for dawgPack, only support the DOCFOLLOW message for now 8.19.22
a couple commands, like bleserveron require a device name to be specified (so everyone listening doesn't perform operation)
if a dev:<dev> is specified, then only process if the device name is that same
parses a line of text, The caller then uses queryMatchesName() to see if their name matches
per #314 support the chipId as well as the name.. 3.17.24
we are in gateway mode, and the paired device isn't ours..
basically, processMessageOrGateway is set to TRUE if the device isn't mentioned, OR the dev is mentioned, and the wildcard works (or is paired) In either case, the deviceNameSpecified will be true if "dev" was specified (even with wildcard) So code below that only work if "dev" specified will work and know it's their device For the SemanticMarker, if the onlyDevSM==true, then look for deviceNameSpecified
after this, if true, then ifDeviceNameSpecified .. then it's a good name..
as per issue #122, if a device is in gateway mode, and paired with a device name specified, then the message can be sent
{"cmd", <cmd>)
1.14.24 use the isGroupTopic() where needed..
per #206 .. only change the page when not in doc_follow 1.22.24 if switching to mode 0 then it's ok.. 11.9.22
Issue: #222 for #206, this sets the current mode to SM_doc_follow, but when at that page in the the current mode (which is now SM_doc_follow) won't let the page go somewhere else (except in this case we are the same page). Only but a physical button click. I THINK THE ANSWER: if current and next are the same an SM_doc_follow, then do the page change..
the 4th page, start of smart clicker
create the SemanticMarker address
call the displayModuleFunc passing our dynamic status fund
create the SemanticMarker address
tack on the device name..
call the displayModuleFunc passing our dynamic status fund
NOTE this could be "NONE" the "P:" is so the display knows this is a paired device command
#issue 136 create a SM for the WIFI syntax WIFI:S:<SSID>;T:<WEP|WPA|blank>;P:<PASSWORD>;H:<true|false|blank>;
turn this OFF if it came in via a SemanticMarker command ... ???
calls the OTA update method (this doesn't return as device is rebooted...)
add click to any device, and to a group 5.14.25 (Dead 5.14.74 3rd wall of sound)
click call
calls the method for cleaning the SSID eprom. This calls the WIFI_APModule callback
print status of the WIFI and MQTT
send SPIFF status 4.4.24
request a STATUS be sent.
TODO: duplicate and depreciate these and replace with set:buzz,val:on
resetFirstTime
for now just reboot which will use this perference
for now just reboot which will use this perference
for now just reboot which will use this perference
for now just reboot which will use this perference
for now just reboot which will use this perference
for now just reboot which will use this perference
zoom == the NON semantic marker version.. so min menu is true
zoom only if in the max menu set..
zoom only if in the max menu set..
send message to ourself to process the current mode..
These are the ASYNC_CALL_PARAMETERS_MAX NO: just change our credentials ...
request a CAPTURE be sent.
and print any preferences to show
publich back on topic
12.27.23 pass this onto those registered (which mainModule is handling..) 1.14.24 .. what about groups?? 8.16.25 Gods of War (Hawaii) send this .. and let the caller decide if deviceNameSpecified needed..
12.28.23, 8.28.23 Tell Main about the set,val and if others are registered .. then get informed
{'guest':'guest password'}
9.28.29 devOnlySM if set, then
use the name/cat/uuid ..
5.12.22 {set:<set>,"val":val, device?)
options: hightemp, feedcount, timeout
12.27.23 pass this onto those registered (which mainModule is handling..) 8.28.23 Tell Main about the set,val and if others are registered .. then get informed 1.10.24 if deviceNameSpecified then this matches this device, otherwise for all. It's up to the receiver to decide if it has to be specified 1.14.24 for now, setVal in the ATOM will support GROUP commands if turned on (and if off it doesn't get here)
set flag (if a boolean command)
try 5.12.22 {'set':'item'},{'val':'value'} eg. set:hightemp, val:80) TODO: confirm valid integer values...
set the high temp value..
9.29.22 duplicating a couple of 'set':'cmd', 'val':'feed", since the QUERY for a device is sent that way sometimes.. request a STATUS be sent. 7.31.25 copied from below .. so it doesn't need 'dev' name in message eg: 7.31.25 make this without DEV to make it easier.. set the stepperangle. 8.14.25 Dead Movie from 10.19.1974 tonight.. issue #394 stepperRPM stepper RPM set the stepperangle. issue #338 sensor definition (in work) This will be a string in JSON format with various PIN and BUS information reboot the device to set subscribe or not for groups issue #365 sensors 5.14.25 (Dead 5.14.74 3rd wall of sound) currently not rebooting the device, but letting the user do that.. this way multiple can be done, and a "" will reset 5.17.25 plowing field Mark and Bud this is now a full set, and resets first.. new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner). MQTT message "set":"M5AtomKind", val= for now just reboot which will use this perference if not found .. keep searching 9.28.23 #272 devOnlySM only show a SM if sent to this device 8.2.24 to let older Tumbler NOT do the auto direction (back and forth) Isue #332 it will set via message: autoMotorDirection {"set":"autoMotorDirection","val":"true"} 8.2.24 add includeGroups Isue #332 it will set via message: includeGroups {"set":"includeGroups","val":"group1,group2"} 8.2.24 set the include group (and cache it), called from MQTT 11.9.22 restarts all the menu states to the first one .. useful for getting a clean start. This doesn't care if the menu is being shown set the stepperangle. 8.14.25 Dead Movie from 10.19.1974 tonight.. issue #394 stepperRPM stepper RPM set the stepperangle. set the timeout from no click to poweroff called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) 10.4.22 called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) the setup for this module 4.4.24 called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) NOTE: thes PIR and ATOM settings could be done in their modules AtomSocket but the LUX is in the butto 1.10.24 per issue#289 support PIR calling a SM in JSON (not just the FEED) 1.12.24 AtomSocketGlobalOnOff to turn on/off global onoff set global on/off is supported.. 1.12.24 set the value for the LUX sepearator from light and dark save temporally .. 1.13.24 scannedGroup temporary setting of the group name save temporally .. 1.13.24 scannedDevice temporary setting of the group name save temporally .. MQTT: set: timerdelay, val:seconds set the timer delay (0 == stop). start or stop the timer.. MQTT: set: timerdelay, val:seconds set the timer delay (0 == stop). start or stop the timer.. MQTT: set: starttimer, val: true/false (true == start timer, false = stop timer) start or stop the timer.. start or stop the timer.. issue #338 sensor definition (in work) This will be a string in JSON format with various PIN and BUS information reboot the device to set subscribe or not for groups issue #365 sensors 5.14.25 (Dead 5.14.74 3rd wall of sound) currently not rebooting the device, but letting the user do that.. this way multiple can be done, and a "" will reset 5.17.25 plowing field Mark and Bud this is now a full set, and resets first.. add stepper type set the stepperAngle as well for a default value as of 8l18.24, the stepperAngle isn't used by the MINI (only the Tumbler) NOTE: 'mini' is deprecated mini will be backdoor to set the angle to 45 set autoRotoate as well.. set autoRotoate as well.. called to set a preference (which will be an identifier and a string, which can be converted to a number or boolean) set stepperAngle default as well (int or float ok..) Issue #332 8.17.2024 default to clockwise == 1 8.18.24 setting this will check for the factory setting.. note since clockwise == 0 we set the opposite of the value.. 8.18.24 setting this will check for the factory setting.. 8.18.24 setting this will check for the factory setting.. 8.18.24 (back deck with Tyler - Maggie - stormy lightning last night and rain toggleMotor the 'Q' 'set':'toggleMotor':'val':'on/off" TODO: call the 'Q' code ..
9.30.23 reverse direction
note: reboot not needed as the next time a feed happens, it reads this value
add stepper type
set the location
pairnow is for invoking the pair when there isn't a user interface. Basically once an ESP32 gets connected, especially to a GEN3, the pairnow will make it paired for future. 10.24.22
TRUE will pair, FALSE will unpair
performs the pairing.. to whatever is currently connected, this means a message could make that happen for a device (ESP-32) with no user interface.
just unpair .. don't skip performs the unpairing
paireddev the paired device (used with BLEUsePairedDeviceName and gen3Only
saves the pair device name TODO: the feed device should use the pair as well.. (DONE..)
paired address is null until found.. Keep whatever is set ...??? 8.16.25 BLE CLIENT if BLE connected, then we keep the address if any and GEN3
erase the ADDRESS (as well as new name) .. and disconnect if connected..
try to disconnect..
sets the PREFERENCE_SUPPORT_GROUPS_SETTING
sets the PREFERENCE_SUPPORT_GROUPS_SETTING flag
reboot the device to set subscribe or not for groups
sets the PREFERENCE_GROUP_NAMES_SETTING
sets the PREFERENCE_GROUP_NAMES_SETTING val (eg. atlasDogs, houndDogs) or (#) or ""
reboot the device to set subscribe or not for groups
if not found, continue BNF options..
rename device
since renaming, lets set a STATUS out.. request a STATUS be sent.
set the screen color 0..n
sets the gen3only flag (only look for BLEServers that are GEN3)
sets the gen3only flag
for now just reboot which will use this perference
BLEUsePairedDeviceName (Says to only look for BLEServers with the paired name..
sets the BLEUseDeviceName flag == the BLEServer will add the name, eg PTFeeder:ScoobyDoo
sets the bleusedevicename flag
for now just reboot which will use this perference and re-create the service name..
8.16.25 BLE CLIENT try to disconnect..
send message to ourself to process the current mode..
send message to ourself to process the current mode..
store the JSON version of these credentials..
per #224 this will also set WIFI_CREDENTIAL_2 (even if it's also setting #1) NOTE: this saving has to be done before calling processJSON (since the string is goofed upand == 'ssid' not the full string
now process the credentials, which will set CREDENTIAL_1
print the preferences to SerialDebug
9.28.29 devOnlySM if set, then
use the name/cat/uuid ..
if flag then blankscreen, otherwise wake the screen..
blanks the screen
wakes up the screen
8.17.22 SubDawgpack
for now just reboot which will use this perference
start a dawgpack subscription 8.15.22 Also subscribe to the dawgpack .. but restrict what it can effect. For example, start with STATUS and DOCFOLLOW
TODO: duplicate and depreciate these and replace with set:buzz,val:on
this uses the ASYNC since it involves a BLE command, and has to be done outside of this WIFI (MQTT) operation..
for now just reboot which will use this perference
for now just reboot which will use this perference
zoom == the NON semantic marker version.. so min menu is true
zoom only if in the max menu set..
zoom only if in the max menu set..
send message to ourself to process the current mode..
9.22.22 added button press from messages..
new 1.4.24 setting ATOM kind (eg. M5AtomSocket, M5AtomScanner). MQTT message "set":"M5AtomKind", val=
for now just reboot which will use this perference
5.24.22 send:<request> .. Note these are for cmd without an argument..
NOTE: This will be calling ourself
8.16.25 call the main to pass onto plugs
request a TEMP be sent.
request a STATUS be sent.
request a CAPTURE be sent.
request a VOLUME be sent.
9.18.23 set64 with a val
currently 9.28.23 no reason for feeder to decode base64 messages. That could change if a stored procedure..
1.11.24 the decoded value might have URL encoded like %7B for '{' and %7D } ACTUALLY the MQTT_urlDecode is missing the 7's https://www.arduino.cc/reference/en/language/variables/data-types/string/functions/indexof/
see if docFollow .. if not then don't show it
9.28.29 devOnlySM if set, then set to whether the deviceNameSpecified (eg. dev=...)
1.11.24 NOTE: this changes the page on the M5 (and I'm sending this message often for a demo of the watch – SO: maybe there should be a mode to NOT accept the SM ??
displays the Semantic Marker (a super QR code) on the M5 screen (title = to display)
1.11.24 support setting the SM to use with the PIR (and eventually other commands)
let others know ??
1.11.24 support setting the SM to use with the PIR (and eventually other commands)
let others know ??
3.22.25 Returned stranded from space station if ScannedSemanticMarker .. call the set
12.27.23 pass this onto those registered (which mainModule is handling..) 8.28.23 Tell Main about the set,val and if others are registered .. then get informed 1.10.24 if deviceNameSpecified then this matches this device, otherwise for all. It's up to the receiver to decide if it has to be specified 1.14.24 for now, setVal in the ATOM will support GROUP commands if turned on (and if off it doesn't get here)
NOTE: if teh command isn't recognized .. then it slips through.. and is treaded like this return is important!!!
end process commands..
ISSUE: when new JSON shows up that isn't process above, it's thought to be setting the credentials. Thus the {set64} continues below..
TRY without 1.30.22 (RAMS win) and it works.. 9.17.23 .. RAMS loose to 49rs in LA (we are in LA) if can talk BLE, then reboot.. 2.2.22
{
"ssid" : "SunnyWhiteriver",
"ssidPassword" : "sunny2021",
"mqtt_topic": "usersP/bark/test",
"mqtt_user" : "test",
"deviceName" : "HowieFeeder",
"mqtt_password" : "password..",
"mqtt_guestPassword" : "password",
"uuid" : "scott",
"mqtt_port" : "1883",
"mqtt_server" : "idogwatch.com",
"mqtt_status" : "Success",
"location": "whatever to reply with, GPS, state, city, etc.."
}
todo pass the guest password too
! Store wifi config. 存储wifi配置信息
THE CHALLENGE: if send use {ssid, ssidPassword} .. it will assume others SO .. only null out the value if (1) there is an attributed {ssid} and empty string..
5.25.22 (50 years since Grateful Dead London Show
To support just setting the ssid and password, a JSON of {ssid:s,ssidPassword:p} is supported, so don't null out if mqtt aren't provided.. this should work (since the SSID is what's checked to go to the AP mode)
the MQTT host/port/user/password (topic is created in this code...)
This should keep the deviceName to whatever was specified
reset the MQTT attempts
setup the WIFI if the ssid string (at least) is specified
new: go out and let the process work... set the state, then the 'loop' will call setupWIF(...)
call the callback specified from the caller (eg. NimBLE_PetTutor_Server .. or others)
don't save the preferences, since it didn't have enough information..
NOTE: this writes over entire values, since it's a string vs an JSON object
new 4.8.22 .. trying to kick out of AP mode if the credentials are good..
putting here .. time might have gone too fast..
Definition at line 3226 of file MQTTNetworking.cpp.

| void publishBinaryFile | ( | char * | topic, |
| uint8_t * | buf, | ||
| size_t | len, | ||
| String | fileExtension | ||
| ) |
publish a binary file.. fileExtension is .jpg, .json, .txt etc
https://randomnerdtutorials.com/esp32-http-get-post-arduino/ https://randomnerdtutorials.com/esp32-cam-post-image-photo-server/ https://raw.githubusercontent.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE/master/ESP32-CAM-HTTP-POST-Image/ESP32-CAM-HTTP-POST-Image.ino Lets do a POSt to my whats-this site..
create a WIFI client that talks to just our upload servlet
tomcat server.. 8080
stop this client (it's recreated each publish)
WORKS FIRST TIME FROM M5 Camera, to tomcat on KnowledgeShark: 9.17.22 publish location of this file.
send this out as a DOCFOLLOW message (but different syntax)
1.20.24 There is an alias on KnowledgeShark.me that points to the http upload location /home/ec2-user/httpd/conf/httpd.conf Alias /uploads "/var/lib/tomcat8/webapps/examples/uploads"
for now only send if it start message starts with "#"
Definition at line 415 of file MQTTNetworking.cpp.


| void publishMQTTMessage | ( | char * | topic, |
| char * | message | ||
| ) |
Wrapper of the mqttclient publish.
Wrapper of the mqttclient publish.
publish on the mqttClient object
see if this pushs the publish out.. (otherwise a reply might occure .. an break our _fullMessage)
Definition at line 299 of file MQTTNetworking.cpp.


| void publishMQTTMessageDefaultTopic | ( | char * | message | ) |
Wrapper of the mqttclient publish.
Definition at line 319 of file MQTTNetworking.cpp.


| void publishSMRunMessage | ( | char * | smrunMessage | ) |
8.17.25 for use by others, like RTSP return the WiFi Client send semantic /smrun 3.25.24 this is an HTTP not https
send semantic /smrun 3.25.24 this is an HTTP not https
https://randomnerdtutorials.com/esp32-http-get-post-arduino/ https://randomnerdtutorials.com/esp32-cam-post-image-photo-server/ https://raw.githubusercontent.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE/master/ESP32-CAM-HTTP-POST-Image/ESP32-CAM-HTTP-POST-Image.ino Lets do a POSt to my whats-this site..
create a WIFI client that talks to just our upload servlet
tomcat server.. 8080
change the & to the %26
also look for "smart" or "smflowinfo" and change to "smrun"
stop this client (it's recreated each publish)
WORKS FIRST TIME FROM M5 Camera, to tomcat on KnowledgeShark: 3.25.24 (previosuly the image was 9.17.22)
Definition at line 327 of file MQTTNetworking.cpp.


| void publishSPIFFFile_MQTT | ( | char * | topic, |
| char * | path, | ||
| int | len | ||
| ) |
publish a binary file.. fileExtension is .jpg, .json, .txt etc
https://randomnerdtutorials.com/esp32-http-get-post-arduino/ https://randomnerdtutorials.com/esp32-cam-post-image-photo-server/ https://raw.githubusercontent.com/RuiSantosdotme/ESP32-CAM-Arduino-IDE/master/ESP32-CAM-HTTP-POST-Image/ESP32-CAM-HTTP-POST-Image.ino Lets do a POSt to my whats-this site..
create a WIFI client that talks to just our upload servlet
tomcat server.. 8080
to make this json, need to add '[' at front and {}] on back so ..
PROBLEM: if only N lines fit into buffer .. how to delete only up to those lines?
7.25.25 (rainiy TDF last mt stage. remove any single quote with double quote
output the tail
stop this client (it's recreated each publish)
1.20.24 There is an alias on KnowledgeShark.me that points to the http upload location /home/ec2-user/httpd/conf/httpd.conf Alias /uploads "/var/lib/tomcat8/webapps/examples/uploads"
7.25.25 print on serial monitor too..
for now only send if it start message starts with "#"
Definition at line 512 of file MQTTNetworking.cpp.


| void restartDelayCheckWIFI_MQTTNetworking | ( | ) |
starts the delay for WIFI checking, called at startup, and each time the timer finished..
timed events starts the delay for WIFI checking, called at startup, and each time the timer finished..
Definition at line 1161 of file MQTTNetworking.cpp.


| void restartWIFI_MQTTState | ( | ) |
restart the WIFI and then MQTT connection
Definition at line 5187 of file MQTTNetworking.cpp.


| void sendDocFollowMessageMQTT | ( | const char * | semanticMarker | ) |
sends the semantic marker as a doc follow message DOCFOLLOW
sends the semantic marker as a doc follow message DOCFOLLOW
using the followme syntax for now..
Definition at line 2185 of file MQTTNetworking.cpp.


| void sendMessageMQTT | ( | char * | message | ) |
process an MQTT message looking for keywords (barklet language) NOT exposed yet... just send a message (let the internals to figure out topics, etc.. so the BLE can send something on the MQTT for now only send if it start message starts with "#"
just send a message (let the internals to figure out topics, etc.. so the BLE can send something on the MQTT for now only send if it start message starts with "#"
Definition at line 2061 of file MQTTNetworking.cpp.


| void sendMessageMQTT_Topic | ( | char * | message, |
| char * | topic | ||
| ) |
for now only send if it start message starts with "#"
Definition at line 2089 of file MQTTNetworking.cpp.


| void sendMessageNoChangeMQTT | ( | char * | message | ) |
just send a message but without any extras
Definition at line 2136 of file MQTTNetworking.cpp.


| void sendMessageNoChangeMQTT_Topic | ( | char * | message, |
| char * | topic | ||
| ) |
just send a message but without any extras, using a topic specified
just send a message but without any extras, using a topic specified
Definition at line 2113 of file MQTTNetworking.cpp.


| void sendStatusMessageMQTT | ( | const char * | semanticMarker | ) |
sends the semantic marker as a doc follow message #remoteMe (vs STATUS, as that triggers a status reply.. )
Definition at line 2180 of file MQTTNetworking.cpp.


| void setLastDocFollowSemanticMarker_MQTTNetworking | ( | char * | semanticMarker | ) |
sets the last DocFollow SemanticMarker
Definition at line 737 of file MQTTNetworking.cpp.

| void setup_MQTTNetworking | ( | ) |
setup the MQTT part of networking
THIS IS the setup() and loop() but using the "component" name, eg MQTTNetworking() called from the setup()
init variables..
starts the delay for WIFI checking, called at startup, and each time the timer finished..
Definition at line 990 of file MQTTNetworking.cpp.

