34#define PT_SERVICE_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f0"
35#define PT_CHARACTERISTIC_UUID "b0e6a4bf-cccc-ffff-330c-0000000000f1"
41#define TOPIC_TO_SEND (char*)"usersP/bark"
44#define NO_POWEROFF_AMOUNT_MAIN 10000
45#define NO_POWEROFF_AMOUNT_STRING_MAIN (char*)"10000"
57#define CALLBACKS_MQTT 0
58#define CALLBACKS_BUTTON_MODULE 1
59#define CALLBACKS_BLE_CLIENT 2
60#define CALLBACKS_BLE_SERVER 3
61#define CALLBACKS_MODULE_MAX 4
66void callCallbackMain(
int callbacksModuleId,
int callbackType,
char *message);
71#ifdef USE_MQTT_NETWORKING
135void main_updateMQTTInfo(
char *ssid,
char *ssid_password,
char *username,
char *password,
char *guestPassword,
char *deviceName,
char * host,
char * port,
char *locationString);
141#define ASYNC_CALL_OTA_UPDATE 0
143#define ASYNC_CALL_CLEAN_CREDENTIALS 1
145#define ASYNC_CALL_CLEAN_EPROM 2
147#define ASYNC_CALL_FEED_COMMAND 3
149#define ASYNC_CALL_BUZZ_ON 4
151#define ASYNC_CALL_BUZZ_OFF 5
153#define ASYNC_SEND_MQTT_FEED_MESSAGE 6
155#define ASYNC_SEND_MQTT_STATUS_URL_MESSAGE 7
158#define ASYNC_SET_GATEWAY_ON 8
160#define ASYNC_SET_GATEWAY_OFF 9
163#define ASYNC_REBOOT 10
165#define ASYNC_POWEROFF 11
167#define ASYNC_BLANKSCREEN 12
170#define ASYNC_SWAP_WIFI 13
172#define ASYNC_NEXT_WIFI 14
174#define ASYNC_RESTART_WIFI_MQTT 15
176#define ASYNC_CALL_MAX 16
179#define ASYNC_CALL_BLE_CLIENT_PARAMETER 0
181#define ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER 1
183#define ASYNC_JSON_MESSAGE_PARAMETER 2
185#define ASYNC_CALL_PARAMETERS_MAX 3
223void main_setStatusJSON(
const char* JSONString);
225void main_setStatusKeyValue(
const char* key,
const char* value);
284#define SM_home_simple 0
285#define SM_home_simple_1 1
286#define SM_home_simple_2 2
287#define SM_home_simple_3 3
288#define SM_HOME_SIMPLE_LAST SM_home_simple_3
293#define SM_smart_clicker_homepage 4
297#define SM_WIFI_ssid 6
299#define SM_guest_page 7
306#define SM_guest_feed 9
308#define SM_pair_dev 10
313#define SM_doc_follow 12
318#define SM_LAST SM_reboot
322#define MAX_SM_MIN_MODES (SM_HOME_SIMPLE_LAST + 1)
323#define MAX_SM_EXPANDED_MODES (SM_LAST + 1)
void sendSemanticMarkerDocFollow_mainModule(const char *SMDocFollowAddress)
sends the SM on the DOCFOLLOW channel (publish it..)
void cleanEPROM_mainModule()
cleans the main module EPROM
void main_cleanSavedWIFICredentials()
clean the saved WIFI credential, otherwise the AP mode doesn't work (6.3.22)
void takePicture_MainModule()
take a picture (calls the camera module).. what to do with picture??? TODO
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...
void setConnectedBLEDevice_mainModule(char *deviceName, boolean isGEN3)
char * connectedBLEDeviceNameAddress_mainModule()
returns address part of name.
void cleanSSID_EPROM_MessageCallback(char *message)
clean the SSID eprom (MQTT_CLEAN_SSID_EPROM)
void toggleMinimalMenuMode_mainModule()
toggles the menu mode
char * charSMMode_mainModule(int whichSMMode)
returns string form whichSMMode, sg "sm0", sm1 ...
bool stringMatch(String message, String substring)
check if the string matches
void loop_mainModule()
called for the loop() of this plugin
char * getSemanticMarkerDocFollow_mainModule()
get the latest semantic marker for doc follow
void registerCallbackMain(int callbacksModuleId, int callbackType, void(*callback)(char *))
register the callback based on the callbackType. use the callbacksModuleId for which one....
char * deviceName_mainModule()
gets the device name
boolean connectedBLEDeviceIsGEN3_mainModule()
whether the connected is a GEN3 (so the name isn't valid).
int minMenuModesMax_mainModule()
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
void processClientCommandChar_mainModule(char cmd)
single character version of processClientCommand (since many used that already)
int getFeedCount_mainModule()
feedcount info..
void onStatusMessageBLEServerCallback(char *message)
** The callback for "status messages" of the bluetooth
char * main_currentStatusURL()
returns a string in in URL so: status&battery=84'&buzzon='off' } .. etc
char * main_JSONStringForWIFICredentials()
retrieve a JSON string for the ssid and ssid_password: {'ssid':<ssid>,'ssidPassword':<pass>"}
int feedCountMax_mainModule()
returns the max for this feeder
void solidLight(char *message)
callback for SOLID blinking led
void main_credentialsUpdated()
moved here 4.25.22 (entirely from ESP_IOT.ino)
void setup_mainModule()
added 9.29.22 to support wildcards #196
boolean stopAllProcesses_mainModule()
if stopped
void restartAllMenuStates_mainModule()
restarts all the menu states to the first one .. useful for getting a clean start....
void setSemanticMarkerDocFollow_mainModule(char *SMDocFollowAddress)
sed the address to follow
int whichSMMode_mainModule(char *cmd)
returns an index from 0..max of SM matching cmd, or -1 if none
void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter)
void initAsyncCallFlags()
storage for asyncCallCommands
void solidLightMessageCallback(char *message)
callback for SOLID blinking led
boolean isEmptyString(char *stringA)
if an empty string
void rebootDevice_mainModule()
void poweroff_mainModule()
power off
int maxMenuModes_mainModule()
returns the current max of the menu modes (using the setting of min or expanded) to determine
void buttonB_ShortPress_mainModule()
the short press of the side button
bool containsSubstring(String message, String substring)
check if the string contains the other string (if substring is "" then no match)
void decrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
void callCallbackMain(int callbacksModuleId, int callbackType, char *message)
performs the indirect callback based on the callbackType
int getCurrentSMMode_mainModule()
returns the current SM Mode
void stopProcessesForOTAUpdate_mainModule()
stop all loops... while OTA working..
void feedMessageCallback(char *message)
void resetFeedCount_mainModule()
sets the feed count max
void sendMessageString_mainModule(char *messageString)
adding a synchronous call to send a message over the network (assuming MQTT but not specified),...
char * main_currentStatusJSON()
returns a string in JSON format, such that {'battery':'84'}, {'buzzon':'off'} .. etc
char * getFullBLEDeviceName_mainModule()
returns full name and address, and service.
int getFeederType_mainModule()
get the feeder type (Sepper 1,2,3 ...)
void buttonA_LongPress_mainModule()
long press on buttonA (top button)
void invokeAsyncCommands()
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
boolean startsWithChar(char *str, char c)
a char* version of startsWith (after skipping spaces)
void setCurrentSMMode_mainModule(int whichSMMode)
sets the current screen mode .. which can be used by Button and Display processing
void onWriteBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
void main_dispatchAsyncCommand(int asyncCallCommand)
dispatches a call to the command specified. This is run on the next loop()
boolean matchesSMMode_mainModule(char *cmd, int whichSMMode)
returns if a match the mode. whichSMMode is 0..12 and == sm0 .. smn
void refreshDelayButtonTouched_MainModule()
called by the feed operation to say the device is still running.. and count it as a button click.
char * connectedBLEDeviceName_mainModule()
returns the connected BLE Device name (the :NAME of advertisment, Address: 01:39:3f:33 part of name,...
boolean isMinimalMenuMode_mainModule()
returns which mode in (min or expanded)
int getTimeStamp_mainModule()
void buttonB_LongPress_mainModule()
the long press of the side button
void blinkMessageCallback(char *message)
callback for blinking led
void restartProcessesForOTAUpdate_mainModule()
restart all loops... while OTA working..
char * createCopy(char *stringA)
void main_printModuleConfiguration()
void solidLightOnOff(boolean flag)
supports turning on the solid light..
void singleClickTouched(char *whichButton)
float getTemperature_mainModule()
retrieves the temperature in F.
void buttonA_ShortPress_mainModule()
char * main_nextJSONWIFICredential()
! cycle through the next WIFI saved credential - return next one that isn't our current one....
void onBLEServerCallback(char *message)
The callback for "onWrite" of the bluetooth "onWrite'.
void incrementSMMode_mainModule()
increment the currentSMMode, wrapping and using the max menu
void incrementFeedCount_mainModule()
increments .. and if MAX goes to 0 – and sends a message on MQTT
float getBatPercentage_mainModule()
start of the sensor updates ... TODO: tie these to the MQTT messaging as well..