ESP_IOT v2.5
IOT ESP Coding
|
Go to the source code of this file.
Macros | |
#define | PT_SERVICE_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f0" |
#define | PT_CHARACTERISTIC_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f1" |
#define | TOPIC_TO_SEND (char*)"usersP/bark" |
#define | NO_POWEROFF_AMOUNT_MAIN 10000 |
10000 == no poweroff More... | |
#define | NO_POWEROFF_AMOUNT_STRING_MAIN (char*)"10000" |
#define | CALLBACKS_MQTT 0 |
#define | CALLBACKS_BUTTON_MODULE 1 |
#define | CALLBACKS_BLE_CLIENT 2 |
#define | CALLBACKS_BLE_SERVER 3 |
#define | CALLBACKS_MODULE_MAX 4 |
#define | ASYNC_CALL_OTA_UPDATE 0 |
TODO: make this a registeration approach. More... | |
#define | ASYNC_CALL_CLEAN_CREDENTIALS 1 |
cleans out the credentials and restarts in AP (Access Point) mode. More... | |
#define | ASYNC_CALL_CLEAN_EPROM 2 |
cleans the EPROM totally, and reboots More... | |
#define | ASYNC_CALL_FEED_COMMAND 3 |
sends a 'c' to the BLE end of the code (assuming a feeder is connected). Need to morph if a real feeder More... | |
#define | ASYNC_CALL_BUZZ_ON 4 |
sends a 'B' to the BLE end of the code (assuming a feeder is connected). More... | |
#define | ASYNC_CALL_BUZZ_OFF 5 |
sends a 'b' to the BLE end of the code (assuming a feeder is connected). More... | |
#define | ASYNC_SEND_MQTT_FEED_MESSAGE 6 |
sends a message (like FEED) on the users topic More... | |
#define | ASYNC_SEND_MQTT_STATUS_URL_MESSAGE 7 |
sends the status from the main module URL More... | |
#define | ASYNC_SET_GATEWAY_ON 8 |
sets the GATEWAY mode on More... | |
#define | ASYNC_SET_GATEWAY_OFF 9 |
sets the GATEWAY mode off More... | |
#define | ASYNC_REBOOT 10 |
sets the GATEWAY mode off More... | |
#define | ASYNC_POWEROFF 11 |
sets the GATEWAY mode off More... | |
#define | ASYNC_BLANKSCREEN 12 |
blank the screen More... | |
#define | ASYNC_SWAP_WIFI 13 |
swaps WIFI 'w' More... | |
#define | ASYNC_NEXT_WIFI 14 |
next WIFI 'n' More... | |
#define | ASYNC_RESTART_WIFI_MQTT 15 |
restarts the WIFI (after BLE interrupt over) More... | |
#define | ASYNC_CALL_MAX 16 |
the max one greater than last one More... | |
#define | ASYNC_CALL_BLE_CLIENT_PARAMETER 0 |
these are the async with a string parameter. This sends a BLE command More... | |
#define | ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER 1 |
these are the async with a string parameter More... | |
#define | ASYNC_JSON_MESSAGE_PARAMETER 2 |
these are the async with a string parameter More... | |
#define | ASYNC_CALL_PARAMETERS_MAX 3 |
the max one greater than last one More... | |
#define | SM_home_simple 0 |
#define | SM_home_simple_1 1 |
#define | SM_home_simple_2 2 |
#define | SM_home_simple_3 3 |
#define | SM_HOME_SIMPLE_LAST SM_home_simple_3 |
#define | SM_smart_clicker_homepage 4 |
//! homepage More... | |
#define | SM_status 5 |
//status More... | |
#define | SM_WIFI_ssid 6 |
WIFI ssid. More... | |
#define | SM_guest_page 7 |
guest page More... | |
#define | SM_ap_mode 8 |
AP MODE. More... | |
#define | SM_guest_feed 9 |
guest feed More... | |
#define | SM_pair_dev 10 |
guest feed device More... | |
#define | SM_help 11 |
HELP. More... | |
#define | SM_doc_follow 12 |
docfollow More... | |
#define | SM_timer 13 |
timer .. todo More... | |
#define | SM_reboot 14 |
REboot. More... | |
#define | SM_LAST SM_reboot |
#define | MAX_SM_MIN_MODES (SM_HOME_SIMPLE_LAST + 1) |
note for now, heep the max the same – so only goes through zoom or not zoom More... | |
#define | MAX_SM_EXPANDED_MODES (SM_LAST + 1) |
Functions | |
void | setup_mainModule () |
added 9.29.22 to support wildcards #196 More... | |
void | loop_mainModule () |
called for the loop() of this plugin More... | |
void | cleanEPROM_mainModule () |
cleans the main module EPROM More... | |
void | stopProcessesForOTAUpdate_mainModule () |
stop all loops... while OTA working.. More... | |
boolean | stopAllProcesses_mainModule () |
if stopped More... | |
void | restartProcessesForOTAUpdate_mainModule () |
restart all loops... while OTA working.. More... | |
void | processClientCommandChar_mainModule (char cmd) |
single character version of processClientCommand (since many used that already) More... | |
void | registerCallbackMain (int callbacksModuleId, int callbackType, void(*callback)(char *)) |
register the callback based on the callbackType. use the callbacksModuleId for which one.. More... | |
void | callCallbackMain (int callbacksModuleId, int callbackType, char *message) |
performs the indirect callback based on the callbackType More... | |
void | sendMessageString_mainModule (char *messageString) |
adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time} More... | |
void | feedMessageCallback (char *message) |
void | solidLightOnOff (boolean flag) |
supports turning on the solid light.. More... | |
void | onWriteBLEServerCallback (char *message) |
The callback for "onWrite" of the bluetooth "onWrite'. More... | |
void | onBLEServerCallback (char *message) |
The callback for "onWrite" of the bluetooth "onWrite'. More... | |
void | onStatusMessageBLEServerCallback (char *message) |
** The callback for "status messages" of the bluetooth More... | |
void | main_printModuleConfiguration () |
void | singleClickTouched (char *whichButton) |
void | solidLight (char *message) |
callback for SOLID blinking led More... | |
void | blinkMessageCallback (char *message) |
callback for blinking led More... | |
void | takePicture_MainModule () |
take a picture (calls the camera module).. what to do with picture??? TODO More... | |
void | cleanSSID_EPROM_MessageCallback (char *message) |
clean the SSID eprom (MQTT_CLEAN_SSID_EPROM) More... | |
void | solidLightMessageCallback (char *message) |
callback for SOLID blinking led More... | |
void | main_cleanSavedWIFICredentials () |
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22) More... | |
void | main_credentialsUpdated () |
moved here 4.25.22 (entirely from ESP_IOT.ino) More... | |
char * | main_JSONStringForWIFICredentials () |
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"} More... | |
char * | main_nextJSONWIFICredential () |
! cycle through the next WIFI saved credential - return next one that isn't our current one.. More... | |
void | main_updateMQTTInfo (char *ssid, char *ssid_password, char *username, char *password, char *guestPassword, char *deviceName, char *host, char *port, char *locationString) |
sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this calls APmodule..) More... | |
void | main_dispatchAsyncCommand (int asyncCallCommand) |
dispatches a call to the command specified. This is run on the next loop() More... | |
void | main_dispatchAsyncCommandWithString (int asyncCallCommand, char *parameter) |
void | initAsyncCallFlags () |
storage for asyncCallCommands More... | |
void | invokeAsyncCommands () |
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false More... | |
char * | createCopy (char *stringA) |
boolean | startsWithChar (char *str, char c) |
a char* version of startsWith (after skipping spaces) More... | |
boolean | isEmptyString (char *stringA) |
if an empty string More... | |
bool | containsSubstring (String message, String substring) |
check if the string contains the other string (if substring is "" then no match) More... | |
bool | stringMatch (String message, String substring) |
check if the string matches More... | |
int | getTimeStamp_mainModule () |
char * | main_currentStatusJSON () |
returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc More... | |
char * | main_currentStatusURL () |
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc More... | |
float | getTemperature_mainModule () |
retrieves the temperature in F. More... | |
float | getBatPercentage_mainModule () |
start of the sensor updates ... TODO: tie these to the MQTT messaging as well.. More... | |
int | getFeedCount_mainModule () |
feedcount info.. More... | |
void | incrementFeedCount_mainModule () |
increments .. and if MAX goes to 0 – and sends a message on MQTT More... | |
void | resetFeedCount_mainModule () |
sets the feed count max More... | |
void | refreshDelayButtonTouched_MainModule () |
called by the feed operation to say the device is still running.. and count it as a button click. More... | |
int | getFeederType_mainModule () |
get the feeder type (Sepper 1,2,3 ...) More... | |
int | feedCountMax_mainModule () |
returns the max for this feeder More... | |
void | setSemanticMarkerDocFollow_mainModule (char *SMDocFollowAddress) |
sed the address to follow More... | |
char * | getSemanticMarkerDocFollow_mainModule () |
get the latest semantic marker for doc follow More... | |
void | sendSemanticMarkerDocFollow_mainModule (const char *SMDocFollowAddress) |
sends the SM on the DOCFOLLOW channel (publish it..) More... | |
char * | deviceName_mainModule () |
gets the device name More... | |
void | rebootDevice_mainModule () |
void | poweroff_mainModule () |
power off More... | |
void | setCurrentSMMode_mainModule (int whichSMMode) |
sets the current screen mode .. which can be used by Button and Display processing More... | |
int | getCurrentSMMode_mainModule () |
returns the current SM Mode More... | |
void | incrementSMMode_mainModule () |
increment the currentSMMode, wrapping and using the max menu More... | |
void | decrementSMMode_mainModule () |
increment the currentSMMode, wrapping and using the max menu More... | |
int | maxMenuModes_mainModule () |
returns the current max of the menu modes (using the setting of min or expanded) to determine More... | |
int | minMenuModesMax_mainModule () |
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine More... | |
int | whichSMMode_mainModule (char *cmd) |
returns an index from 0..max of SM matching cmd, or -1 if none More... | |
boolean | matchesSMMode_mainModule (char *cmd, int whichSMMode) |
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn More... | |
char * | charSMMode_mainModule (int whichSMMode) |
returns string form whichSMMode, sg "sm0", sm1 ... More... | |
boolean | isMinimalMenuMode_mainModule () |
returns which mode in (min or expanded) More... | |
void | toggleMinimalMenuMode_mainModule () |
toggles the menu mode More... | |
void | setConnectedBLEDevice_mainModule (char *deviceName, boolean isGEN3) |
boolean | connectedBLEDeviceIsGEN3_mainModule () |
whether the connected is a GEN3 (so the name isn't valid). More... | |
char * | connectedBLEDeviceName_mainModule () |
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name, or "" if nothing (not null) More... | |
char * | getFullBLEDeviceName_mainModule () |
returns full name and address, and service. More... | |
char * | connectedBLEDeviceNameAddress_mainModule () |
returns address part of name. More... | |
void | buttonA_ShortPress_mainModule () |
void | buttonA_LongPress_mainModule () |
long press on buttonA (top button) More... | |
void | buttonB_LongPress_mainModule () |
the long press of the side button More... | |
void | buttonB_ShortPress_mainModule () |
the short press of the side button More... | |
void | restartAllMenuStates_mainModule () |
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 More... | |
#define ASYNC_BLANKSCREEN 12 |
blank the screen
Definition at line 167 of file MainModule.h.
#define ASYNC_CALL_BLE_CLIENT_PARAMETER 0 |
these are the async with a string parameter. This sends a BLE command
Definition at line 179 of file MainModule.h.
#define ASYNC_CALL_BUZZ_OFF 5 |
sends a 'b' to the BLE end of the code (assuming a feeder is connected).
Definition at line 151 of file MainModule.h.
#define ASYNC_CALL_BUZZ_ON 4 |
sends a 'B' to the BLE end of the code (assuming a feeder is connected).
Definition at line 149 of file MainModule.h.
#define ASYNC_CALL_CLEAN_CREDENTIALS 1 |
cleans out the credentials and restarts in AP (Access Point) mode.
Definition at line 143 of file MainModule.h.
#define ASYNC_CALL_CLEAN_EPROM 2 |
cleans the EPROM totally, and reboots
Definition at line 145 of file MainModule.h.
#define ASYNC_CALL_FEED_COMMAND 3 |
sends a 'c' to the BLE end of the code (assuming a feeder is connected). Need to morph if a real feeder
Definition at line 147 of file MainModule.h.
#define ASYNC_CALL_MAX 16 |
the max one greater than last one
Definition at line 176 of file MainModule.h.
#define ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER 1 |
these are the async with a string parameter
Definition at line 181 of file MainModule.h.
#define ASYNC_CALL_OTA_UPDATE 0 |
TODO: make this a registeration approach.
3.21.22 these are to setup for the next time the main loop() runs to call these commands.. The implementation is hard coded in the ESP_IO.ino
Definition at line 141 of file MainModule.h.
#define ASYNC_CALL_PARAMETERS_MAX 3 |
the max one greater than last one
Definition at line 185 of file MainModule.h.
#define ASYNC_JSON_MESSAGE_PARAMETER 2 |
these are the async with a string parameter
Definition at line 183 of file MainModule.h.
#define ASYNC_NEXT_WIFI 14 |
next WIFI 'n'
Definition at line 172 of file MainModule.h.
#define ASYNC_POWEROFF 11 |
sets the GATEWAY mode off
Definition at line 165 of file MainModule.h.
#define ASYNC_REBOOT 10 |
sets the GATEWAY mode off
Definition at line 163 of file MainModule.h.
#define ASYNC_RESTART_WIFI_MQTT 15 |
restarts the WIFI (after BLE interrupt over)
Definition at line 174 of file MainModule.h.
#define ASYNC_SEND_MQTT_FEED_MESSAGE 6 |
sends a message (like FEED) on the users topic
Definition at line 153 of file MainModule.h.
#define ASYNC_SEND_MQTT_STATUS_URL_MESSAGE 7 |
sends the status from the main module URL
Definition at line 155 of file MainModule.h.
#define ASYNC_SET_GATEWAY_OFF 9 |
sets the GATEWAY mode off
Definition at line 160 of file MainModule.h.
#define ASYNC_SET_GATEWAY_ON 8 |
sets the GATEWAY mode on
Definition at line 158 of file MainModule.h.
#define ASYNC_SWAP_WIFI 13 |
swaps WIFI 'w'
Definition at line 170 of file MainModule.h.
#define CALLBACKS_BLE_CLIENT 2 |
Definition at line 59 of file MainModule.h.
#define CALLBACKS_BLE_SERVER 3 |
Definition at line 60 of file MainModule.h.
#define CALLBACKS_BUTTON_MODULE 1 |
Definition at line 58 of file MainModule.h.
#define CALLBACKS_MODULE_MAX 4 |
Definition at line 61 of file MainModule.h.
#define CALLBACKS_MQTT 0 |
New RegisterCallback that works across a number of callback modules
callbacksModuleId
Definition at line 57 of file MainModule.h.
#define MAX_SM_EXPANDED_MODES (SM_LAST + 1) |
Definition at line 323 of file MainModule.h.
#define MAX_SM_MIN_MODES (SM_HOME_SIMPLE_LAST + 1) |
note for now, heep the max the same – so only goes through zoom or not zoom
Definition at line 322 of file MainModule.h.
#define NO_POWEROFF_AMOUNT_MAIN 10000 |
10000 == no poweroff
Definition at line 44 of file MainModule.h.
#define NO_POWEROFF_AMOUNT_STRING_MAIN (char*)"10000" |
Definition at line 45 of file MainModule.h.
#define PT_CHARACTERISTIC_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f1" |
Definition at line 35 of file MainModule.h.
#define PT_SERVICE_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f0" |
Definition at line 34 of file MainModule.h.
#define SM_ap_mode 8 |
AP MODE.
Definition at line 302 of file MainModule.h.
#define SM_doc_follow 12 |
docfollow
Definition at line 313 of file MainModule.h.
#define SM_guest_feed 9 |
guest feed
Definition at line 306 of file MainModule.h.
#define SM_guest_page 7 |
guest page
Definition at line 299 of file MainModule.h.
#define SM_help 11 |
HELP.
Definition at line 310 of file MainModule.h.
#define SM_home_simple 0 |
Semantic Marker definitions defines the semantic markers for now.. Minimal 0..6 (max = 7)
Definition at line 284 of file MainModule.h.
#define SM_home_simple_1 1 |
Definition at line 285 of file MainModule.h.
#define SM_home_simple_2 2 |
Definition at line 286 of file MainModule.h.
#define SM_home_simple_3 3 |
Definition at line 287 of file MainModule.h.
#define SM_HOME_SIMPLE_LAST SM_home_simple_3 |
Definition at line 288 of file MainModule.h.
#define SM_LAST SM_reboot |
Definition at line 318 of file MainModule.h.
#define SM_pair_dev 10 |
guest feed device
Definition at line 308 of file MainModule.h.
#define SM_reboot 14 |
REboot.
Definition at line 317 of file MainModule.h.
#define SM_smart_clicker_homepage 4 |
//! homepage
Definition at line 293 of file MainModule.h.
#define SM_status 5 |
//status
Definition at line 295 of file MainModule.h.
#define SM_timer 13 |
timer .. todo
Definition at line 315 of file MainModule.h.
#define SM_WIFI_ssid 6 |
WIFI ssid.
Definition at line 297 of file MainModule.h.
#define TOPIC_TO_SEND (char*)"usersP/bark" |
Definition at line 41 of file MainModule.h.
void blinkMessageCallback | ( | char * | message | ) |
callback for blinking led
Definition at line 1226 of file MainModule.cpp.
void buttonA_LongPress_mainModule | ( | ) |
long press on buttonA (top button)
Definition at line 2245 of file MainModule.cpp.
void buttonA_ShortPress_mainModule | ( | ) |
BUTOTN PROCESSING abstraction short press on buttonA (top button)
BUTTON PROCESSING abstraction short press on buttonA (top button)
Definition at line 2238 of file MainModule.cpp.
void buttonB_LongPress_mainModule | ( | ) |
the long press of the side button
Definition at line 2252 of file MainModule.cpp.
void buttonB_ShortPress_mainModule | ( | ) |
the short press of the side button
Definition at line 2259 of file MainModule.cpp.
void callCallbackMain | ( | int | callbacksModuleId, |
int | callbackType, | ||
char * | message | ||
) |
performs the indirect callback based on the callbackType
Definition at line 333 of file MainModule.cpp.
char * charSMMode_mainModule | ( | int | whichSMMode | ) |
returns string form whichSMMode, sg "sm0", sm1 ...
returns string form whichSMMode, sg "sm0", sm1 ... This can (and is) called by multiple places (like ButtonProcessing and MainModule
Definition at line 2010 of file MainModule.cpp.
void cleanEPROM_mainModule | ( | ) |
cleans the main module EPROM
cleans the main module EPROM
Definition at line 276 of file PreferencesController.cpp.
void cleanSSID_EPROM_MessageCallback | ( | char * | message | ) |
clean the SSID eprom (MQTT_CLEAN_SSID_EPROM)
call the already defined solid led defined in Dispense.cpp
clean_SSID_WIFICredentials(); now register an async call..
Definition at line 1260 of file MainModule.cpp.
boolean connectedBLEDeviceIsGEN3_mainModule | ( | ) |
whether the connected is a GEN3 (so the name isn't valid).
whether the connected is a GEN3 (so the name isn't valid).
Definition at line 2109 of file MainModule.cpp.
char * connectedBLEDeviceName_mainModule | ( | ) |
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name, or "" if nothing (not null)
ISSUE: if BLE, can only return the address.. it's up to the caller to know it might not match the Paired Name (eg DukeGEN3) returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name
Definition at line 2194 of file MainModule.cpp.
char * connectedBLEDeviceNameAddress_mainModule | ( | ) |
returns address part of name.
Definition at line 2219 of file MainModule.cpp.
bool containsSubstring | ( | String | message, |
String | substring | ||
) |
check if the string contains the other string (if substring is "" then no match)
check if the string contains the other string (if substring is "" then no match)
Definition at line 196 of file MainModule.cpp.
char * createCopy | ( | char * | stringA | ) |
If nil it create one with just the null, so strlen = 0 NOTE: the strdup() might be used later..
Definition at line 1431 of file MainModule.cpp.
void decrementSMMode_mainModule | ( | ) |
increment the currentSMMode, wrapping and using the max menu
Definition at line 2083 of file MainModule.cpp.
char * deviceName_mainModule | ( | ) |
gets the device name
Definition at line 607 of file MainModule.cpp.
int feedCountMax_mainModule | ( | ) |
returns the max for this feeder
Definition at line 137 of file MainModule.cpp.
void feedMessageCallback | ( | char * | message | ) |
example callback: but the scope would have the pCharacteristic defined, etc.. This is pased just before the setupMQTTNetworking() is called..
example callback: but the scope would have the pCharacteristic defined, etc.. This is passed just before the setupMQTTNetworking() is called..
sends this single character to the StepperModule
increment the feed count .. TODO .. see if this is good place..
the FEED was send over MQTT, now what to do? WIth the StepperModule – it just performs the feeding internalls if using the BLE_CLIENT then we have the potential to send to over BLE to the server (another feeder, GEN3 or ESP32). The issue is that ESP32 feeders are receiving the same MQTT message (usually unless MQTT turned off So the gatewayMode can be set (or in the EPROM) using {'cmd':'gatewayOn'}
Definition at line 352 of file MainModule.cpp.
float getBatPercentage_mainModule | ( | ) |
start of the sensor updates ... TODO: tie these to the MQTT messaging as well..
Definition at line 1475 of file MainModule.cpp.
int getCurrentSMMode_mainModule | ( | ) |
returns the current SM Mode
Definition at line 2065 of file MainModule.cpp.
int getFeedCount_mainModule | ( | ) |
feedcount info..
Definition at line 155 of file MainModule.cpp.
int getFeederType_mainModule | ( | ) |
get the feeder type (Sepper 1,2,3 ...)
Definition at line 161 of file MainModule.cpp.
char * getFullBLEDeviceName_mainModule | ( | ) |
returns full name and address, and service.
returns full name and address, and service.
Definition at line 2093 of file MainModule.cpp.
char * getSemanticMarkerDocFollow_mainModule | ( | ) |
get the latest semantic marker for doc follow
get the latest semantic marker for doc follow
Definition at line 1706 of file MainModule.cpp.
float getTemperature_mainModule | ( | ) |
retrieves the temperature in F.
retrieves the temperature in F.
Definition at line 1514 of file MainModule.cpp.
int getTimeStamp_mainModule | ( | ) |
On the esp32, sec is all we can handle. We can return as a double if milisecond resolution is needed. This is the time since app started.. https://randomnerdtutorials.com/epoch-unix-time-esp32-arduino/
Definition at line 1965 of file MainModule.cpp.
void incrementFeedCount_mainModule | ( | ) |
increments .. and if MAX goes to 0 – and sends a message on MQTT
NOTE: don't send "feed" as it might trigger a FEED ...
called by the feed operation to say the device is still running.. and count it as a button click. Issue #145 8.8.22
Definition at line 168 of file MainModule.cpp.
void incrementSMMode_mainModule | ( | ) |
increment the currentSMMode, wrapping and using the max menu
Definition at line 2071 of file MainModule.cpp.
void initAsyncCallFlags | ( | ) |
storage for asyncCallCommands
storage for asyncCallCommands
Definition at line 770 of file MainModule.cpp.
void invokeAsyncCommands | ( | ) |
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to false
The FINISH of callback for "onWrite" of the bluetooth "onWrite'
now process those that don't have a string parameter
register the 2 callbacks for now..
this is a sending of the message
9.30.22 IF SET .. send a feed but to all devices except ours and our pair (if any) uses new wildcard syntax either ! OUR NAME [ & ! OUR_CONNECTED_NAME
set the persistence (Note, this is locally saved. If sending elsewhere .. then they have to set their value)
OK: issue. if we are an ESP feeder, the STEPPER is on .. so we're good, if an M5 - then either send over BLE or MQTT
we are not BLE_CLIENT .. so local
setGatewayOn/Off called from the processJSON message in MQTT or via the EPROM setting (TODO)
sends the status from the main module URL
NO MORE: sendDocFollowMessageMQTT(statusURL);
These are the ASYNC_CALL_PARAMETERS_MAX NO: just change our credentials ...
Restarts (or attempts) a restart of the WIFI using the existing credentials – vs the 'n' command
Definition at line 829 of file MainModule.cpp.
boolean isEmptyString | ( | char * | stringA | ) |
if an empty string
if an empty string
Definition at line 1440 of file MainModule.cpp.
boolean isMinimalMenuMode_mainModule | ( | ) |
returns which mode in (min or expanded)
Definition at line 2020 of file MainModule.cpp.
void loop_mainModule | ( | ) |
called for the loop() of this plugin
only do this menu update if there is no DisplayModule running the MVC loop
9.2.22 new .. update the timer. This is on blank screen as well .. so don't check _semanticMarkerShown
Definition at line 114 of file MainModule.cpp.
void main_cleanSavedWIFICredentials | ( | ) |
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
go through the saved WIFI credentials and empty them with "" (vs null)
cannot null but can make stringlen=0
Definition at line 726 of file MainModule.cpp.
void main_credentialsUpdated | ( | ) |
moved here 4.25.22 (entirely from ESP_IOT.ino)
TESTING for saying credentials are filled in via BLE (while in AP mode), so kick out of AP and continue.. set that the credentials are set. Called from the MQTT after processJSONMessage() found things were good.. April 8, 2022
April 8, 2022 set that the credentials are set. Called from the MQTT after processJSONMessage() found things were good..
Definition at line 392 of file MainModule.cpp.
char * main_currentStatusJSON | ( | ) |
returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
Sample format: {"status": [ { "BLE": "on" }, { "numfeeds": "8", "maxfeeds": "16" }, { "battery": "87" }, { "buzzon": "on" }, { "MQTT": "on" }, { "WIFI": "on" }, { "AP": "off" }, { "tilt": "55" } ] }
Definition at line 1577 of file MainModule.cpp.
char * main_currentStatusURL | ( | ) |
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc
TODO: make sure no spaces ... unless escaped
TODO: put these somewhere somehow (expandable easily..architecturally. eg. setStatus("battery","87") key,val the JSON DB supports db["battery"]=87 like syntax..
Definition at line 1655 of file MainModule.cpp.
void main_dispatchAsyncCommand | ( | int | asyncCallCommand | ) |
dispatches a call to the command specified. This is run on the next loop()
dispatches a call to the command specified. This is run on the next loop()
this just sets the flag, it's the next loop that makes the call
Definition at line 789 of file MainModule.cpp.
void main_dispatchAsyncCommandWithString | ( | int | asyncCallCommand, |
char * | parameter | ||
) |
send an async call with a string parameter. This will set store the value and then async call the command (passing the parameter) These are the ASYNC_CALL_PARAMETERS_MAX
store in the parameter mailbox
this just sets the flag, it's the next loop that makes the call
Definition at line 807 of file MainModule.cpp.
char * main_JSONStringForWIFICredentials | ( | ) |
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
Definition at line 663 of file MainModule.cpp.
char * main_nextJSONWIFICredential | ( | ) |
! cycle through the next WIFI saved credential - return next one that isn't our current one..
! cycle through the next WIFI saved credential - return next one that isn't our current one..
WIFI_CREDENTIALS_MAX
jump out of loop if no match.. so index is valid
Definition at line 669 of file MainModule.cpp.
void main_printModuleConfiguration | ( | ) |
prints the module configuration by looking at defines Eventually this might be an object returned letting the code know a capability is included for runtime (vs compile time) decisions
prints the module configuration by looking at #defines Eventually this might be an object returned letting the code know a capability is included for runtime (vs compile time) decisions
Module Configuration
[x] ESP_32
[x] USE_MQTT_NETWORKING
[x] USE_BLE_SERVER_NETWORKING
[x] USE_WIFI_AP_MODULE
and print any preferences to show
Definition at line 1316 of file MainModule.cpp.
void main_updateMQTTInfo | ( | char * | ssid, |
char * | ssid_password, | ||
char * | username, | ||
char * | password, | ||
char * | guestPassword, | ||
char * | deviceName, | ||
char * | host, | ||
char * | port, | ||
char * | locationString | ||
) |
sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this calls APmodule..)
sets the WIFI and MQTT user/password. It's up to the code to decide who needs to know (currently this calls APmodule..)
store the device name
store the JSON version of these credentials..
Definition at line 741 of file MainModule.cpp.
boolean matchesSMMode_mainModule | ( | char * | cmd, |
int | whichSMMode | ||
) |
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
Definition at line 2003 of file MainModule.cpp.
int maxMenuModes_mainModule | ( | ) |
returns the current max of the menu modes (using the setting of min or expanded) to determine
Definition at line 2038 of file MainModule.cpp.
int minMenuModesMax_mainModule | ( | ) |
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
Definition at line 2032 of file MainModule.cpp.
void onBLEServerCallback | ( | char * | message | ) |
The callback for "onWrite" of the bluetooth "onWrite'.
Definition at line 404 of file MainModule.cpp.
void onStatusMessageBLEServerCallback | ( | char * | message | ) |
** The callback for "status messages" of the bluetooth
** The callback for "status messages" of the bluetooth
2.2.22 send this over bluetooth.. TODO.
Definition at line 411 of file MainModule.cpp.
void onWriteBLEServerCallback | ( | char * | message | ) |
The callback for "onWrite" of the bluetooth "onWrite'.
send an async call with a string parameter. This will set store the value and then async call the command (passing the parameter) These are the ASYNC_CALL_PARAMETERS_MAX
Definition at line 511 of file MainModule.cpp.
void poweroff_mainModule | ( | ) |
power off
Definition at line 623 of file MainModule.cpp.
void processClientCommandChar_mainModule | ( | char | cmd | ) |
single character version of processClientCommand (since many used that already)
processes a message that might save in the EPROM.. the cmd is still passed onto other (like the stepper module) returns true if finished processing, otherwise this can be sent onto other modules (like stepper)
Keep ProcessClientCmd short to let the callback run. instead change the feeder state flag processes a message that might save in the EPROM.. the cmd is still passed onto other (like the stepper module)
the sentToStepper is only needed if there are 'actions' on the command, versus just setting persistent EPROM data. Like feed, buzzer, etc.. Thus we don't need to know much of their implementation.. or we just pass anyway!
only process things that are stored persistently..
start timer..
start timer..
dispatches a call to the command specified. This is run on the next loop()
dispatches a call to the command specified. This is run on the next loop()
dispatches a call to the command specified. This is run on the next loop()
NOTE: the gateway is auto selected for now. A future version might manually set it in other situations (eg. my iPhone app should have a flag to not be a gateway at time)
These are the ASYNC_CALL_PARAMETERS_MAX
NOTE: this is almost the same as 'w' except there might be more WIFI than 2 (so swap is different).
Restarts (or attempts) a restart of the WIFI using the existing credentials – vs the 'n' command
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
print out stuff
Definition at line 1723 of file MainModule.cpp.
void rebootDevice_mainModule | ( | ) |
power of devices reboot
Definition at line 616 of file MainModule.cpp.
void refreshDelayButtonTouched_MainModule | ( | ) |
called by the feed operation to say the device is still running.. and count it as a button click.
called by the feed operation to say the device is still running.. and count it as a button click. Issue #145 8.8.22
calls the button processing control
Definition at line 536 of file MainModule.cpp.
void registerCallbackMain | ( | int | callbacksModuleId, |
int | callbackType, | ||
void(*)(char *) | callback | ||
) |
register the callback based on the callbackType. use the callbacksModuleId for which one..
Definition at line 316 of file MainModule.cpp.
void resetFeedCount_mainModule | ( | ) |
sets the feed count max
Definition at line 190 of file MainModule.cpp.
void restartAllMenuStates_mainModule | ( | ) |
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
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
Definition at line 2267 of file MainModule.cpp.
void restartProcessesForOTAUpdate_mainModule | ( | ) |
restart all loops... while OTA working..
Definition at line 16 of file MainModule.cpp.
void sendMessageString_mainModule | ( | char * | messageString | ) |
adding a synchronous call to send a message over the network (assuming MQTT but not specified), this tacks on {device} and {t:time}
NOTE: the # has to be there, otherwise the sendMessageMQTT ignores it..
send this message over MQTT
Definition at line 1500 of file MainModule.cpp.
void sendSemanticMarkerDocFollow_mainModule | ( | const char * | SMDocFollowAddress | ) |
sends the SM on the DOCFOLLOW channel (publish it..)
Definition at line 1713 of file MainModule.cpp.
void setConnectedBLEDevice_mainModule | ( | char * | deviceName, |
boolean | isGEN3 | ||
) |
BLE Discovery Methods Connected to a BLE device with the advertised name. The syntax can include (PTFeeder:NAME) or just PTFeeder Being disconnected is already a flag isConnectedBLE ...
set the isGEN3 flag
now set the gateway based on if GEN3
seems device name = "Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead Note: the Address, eg "7c:9e:bd:48:af:92" is unique somehow.. lets use that to skip one.. parse out the 2nd half of name go past the : empty name (just PTFeeder) parse for the address too.. strcpy(_fullBLEDeviceName, deviceName); seems device name = "Name: PTFeeder:HowieFeeder, Address: 7c:9e:bd:48:af:92, serviceUUID: 0xdead Note: the Address, eg "7c:9e:bd:48:af:92" is unique somehow.. lets use that to skip one..
parse out the 2nd half of name
empty name (just PTFeeder)
Definition at line 2117 of file MainModule.cpp.
void setCurrentSMMode_mainModule | ( | int | whichSMMode | ) |
sets the current screen mode .. which can be used by Button and Display processing
This is needed now as message from external (not button pressing) causes a state change, but the button processing isn't knowing about it... sets the current screen mode .. which can be used by Button and Display processing whichSMMode 0..SM_LAST
Definition at line 2051 of file MainModule.cpp.
void setSemanticMarkerDocFollow_mainModule | ( | char * | SMDocFollowAddress | ) |
sed the address to follow
SemanticMarker events This would see a DOCFollow message, and set the value.. then SM10 can display it..
Definition at line 1699 of file MainModule.cpp.
void setup_mainModule | ( | ) |
added 9.29.22 to support wildcards #196
always avaialble to others.. the model controller part of MVC. The View is in DisplayModule. The other part of Controller is the button clicks in ButtonProcess.h (but with this, there is no logic there..) preferences THIS IS the setup() and loop() but using the "component" name, eg MQTTNetworking() This will perform preference initializtion as well called from the setup()
added 9.29.22 to support wildcards #196
setup for the token parser (really just for testing) – an
init globals like strings (but nothing that needs preferences)
read the preferences from EPROM
must initialize the structs NOTE: this has to ber AFTER the preferences are read in..
a first time feature .. to get EPROM changed to a different default
7.12.22 {'dev':'m5",'cmd':'bleserveron'} or bleserveroff will work later.. #issue 117 .. turn off the BLE_Server for the M5
Definition at line 72 of file MainModule.cpp.
void singleClickTouched | ( | char * | whichButton | ) |
called on single click NOTE: with BLE_CLIENT_NETWORKING, the right button and top button send a BLE command for feeding..
for now, only send the FEED command via BLE_CLIENT if turned on. No reboot to AP mode yet..
Definition at line 1274 of file MainModule.cpp.
void solidLight | ( | char * | message | ) |
callback for SOLID blinking led
void solidLightMessageCallback | ( | char * | message | ) |
callback for SOLID blinking led
call the already defined solid led defined in Dispense.cpp
Definition at line 1246 of file MainModule.cpp.
void solidLightOnOff | ( | boolean | onOff | ) |
supports turning on the solid light..
supports turning on the solid light..
call the already defined solid led defined in Dispense.cpp
Definition at line 1299 of file MainModule.cpp.
boolean startsWithChar | ( | char * | str, |
char | c | ||
) |
a char* version of startsWith (after skipping spaces)
find first non space character, and if not '{' then return false
jump out if not a space, and 'i' will be the thing to look for
Definition at line 1455 of file MainModule.cpp.
boolean stopAllProcesses_mainModule | ( | ) |
if stopped
try to disconnect..
Definition at line 21 of file MainModule.cpp.
void stopProcessesForOTAUpdate_mainModule | ( | ) |
stop all loops... while OTA working..
Definition at line 11 of file MainModule.cpp.
bool stringMatch | ( | String | message, |
String | substring | ||
) |
check if the string matches
Definition at line 1336 of file MQTTNetworking.cpp.
void takePicture_MainModule | ( | ) |
take a picture (calls the camera module).. what to do with picture??? TODO
Definition at line 528 of file MainModule.cpp.
void toggleMinimalMenuMode_mainModule | ( | ) |
toggles the menu mode
Definition at line 2026 of file MainModule.cpp.
int whichSMMode_mainModule | ( | char * | cmd | ) |
returns an index from 0..max of SM matching cmd, or -1 if none
returns an index from 0..max of SM matching cmd, or -1 if none
Definition at line 1979 of file MainModule.cpp.