4 else if (strcasecmp(setCmdString,
"buzz")==0)
8 SerialDebug.println(
"BUZZON via BLE");
11 else if (strcasecmp(cmd,
"buzzoff")==0)
13 SerialDebug.println(
"BUZZOFF via BLE");
20 else if (strcasecmp(setCmdString,
"bleclient")==0)
24 if (deviceNameSpecified)
26 SerialDebug.println(
"PREFERENCE_MAIN_BLE_CLIENT_VALUE ON via BLE");
34 if (deviceNameSpecified)
36 SerialDebug.println(
"PREFERENCE_MAIN_BLE_CLIENT_VALUE OFF via BLE");
44 else if (strcasecmp(setCmdString,
"bleserver")==0)
48 if (deviceNameSpecified)
50 SerialDebug.println(
"PREFERENCE_MAIN_BLE_SERVER_VALUE ON via BLE");
58 if (deviceNameSpecified)
60 SerialDebug.println(
"PREFERENCE_MAIN_BLE_SERVER_VALUE OFF via BLE");
68 else if (strcasecmp(setCmdString,
"tilt")==0)
72 SerialDebug.println(
"PREFERENCE_SENSOR_TILT_VALUE ON via BLE");
77 SerialDebug.println(
"PREFERENCE_SENSOR_TILT_VALUE OFF via BLE");
83 else if (strcasecmp(setCmdString,
"zoomSm")==0)
91 SerialDebug.println(
"PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE ON via BLE");
106 SerialDebug.println(
"PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE OFF via BLE");
135 else if (semanticMarkerCmd)
138 char* baseString = (
char*)
"https://SemanticMarker.org/bot/";
146 else if (setCmd && valCmd)
149 char* setCmdString =
const_cast<char*
>(setCmd);
150 char* valCmdString =
const_cast<char*
>(valCmd);
151 SerialTemp.print(
"Set: ");
152 SerialTemp.print(setCmdString);
153 SerialTemp.print(
", Val: ");
154 SerialTemp.println(valCmdString);
157 boolean flag =
false;
164 if (strcasecmp(setCmdString,
"hightemp")==0)
169 else if (strcasecmp(setCmdString,
"screentimeout")==0)
174 else if (strcasecmp(setCmdString,
"stepperangle")==0)
179 else if (strcasecmp(setCmdString,
"noclick")==0)
184 else if (strcasecmp(setCmdString,
"gateway")==0)
186 boolean flag =
false;
194 else if (strcasecmp(setCmdString,
"stepper")==0)
197 if (strcasecmp(valCmdString,
"mini")==0)
199 else if (strcasecmp(valCmdString,
"tumbler")==0)
205 else if (strcasecmp(setCmdString,
"otafile")==0)
211 else if (strcasecmp(setCmdString,
"location")==0)
218 else if (strcasecmp(setCmdString,
"device")==0)
229 else if (strcasecmp(setCmdString,
"pairdev")==0)
235 else if (strcasecmp(setCmdString,
"screencolor")==0)
238 int screenColor = atoi(valCmdString);
245 else if (strcasecmp(setCmdString,
"gen3only")==0)
255 else if (strcasecmp(setCmdString,
"bleusepaireddevicename")==0)
264 else if (strcasecmp(setCmdString,
"bleusedevicename")==0)
273 else if (strcasecmp(setCmdString,
"minMenu")==0)
275 SerialDebug.println(
"PREFERENCE_IS_MINIMAL_MENU_SETTING via BLE");
291 else if (strcasecmp(setCmdString,
"addwifi")==0)
296 strcpy(str,valCmdString);
299 char* ssid = strtok_r(rest,
":", &rest);
300 char* password = strtok_r(rest,
":", &rest);
301 SerialDebug.printf(
"addwifi %s, %s\n", ssid?ssid:
"null", password?password:
"");
308 char credentials[100];
310 sprintf(credentials,
"{'ssid':'%s','ssidPassword':'%s'}", ssid?ssid:
"NULL", password?password:
"");
312 SerialMin.println(credentials);
317 else if (strcasecmp(setCmdString,
"docfollow")==0)
319 SerialDebug.printf(
"PREFERENCE_USE_DOC_FOLLOW_SETTING %s\n", valCmdString);
330 char* sendCmdString =
const_cast<char*
>(sendCmd);
331 if (strcasecmp(sendCmdString,
"temp")==0)
333 SerialTemp.println(
"sendCmd == temp");
337 else if (strcasecmp(sendCmdString,
"status")==0)
339 SerialTemp.println(
"sendCmd == status");
343 else if (strcasecmp(sendCmdString,
"capture")==0)
345 SerialTemp.println(
"sendCmd == capture");
349 else if (strcasecmp(sendCmdString,
"volume")==0)
351 SerialTemp.println(
"sendCmd == volume (not implemented)");
357 SerialTemp.print(
"Unknown send request: ");
358 SerialTemp.println(sendCmdString);
396 const char* a1 = myObject[
"ssid"];
397 if (a1 && strlen(a1)>0)
405 SerialTemp.println(a1);
410 const char* a2 = myObject[
"ssidPassword"];
411 if (a2 && strlen(a2)>0)
428 const char* a3 = myObject[
"mqtt_server"];
438 const char* a4 = myObject[
"mqtt_port"];
449 const char* a5 = myObject[
"mqtt_password"];
460 const char* a6 = myObject[
"mqtt_user"];
470 const char* a7 = myObject[
"deviceName"];
471 if (a7 && strlen(a7)>0)
480 const char* a8 = myObject[
"uuid"];
490 const char* a9 = myObject[
"mqtt_topic"];
501 const char* a10 = myObject[
"mqtt_guestPassword"];
512 const char* a11 = myObject[
"location"];
513 if (a11 && strlen(a11)>0)
529 SerialDebug.println(
"Setting WIFI from JSON parameters");
540 SerialDebug.println(
" ***** ERROR .. no ssidString *** ");
551 SerialDebug.println(
"**** Not saving JSON in preferences ***");
575 SerialTemp.println(
"restartWIFI_MQTTState");
585 DynamicJsonDocument myObject(1024);
608 serializeJson(myObject, output2);
612 SerialDebug.print(
"MQTTNetworking.Writing EPROM JSON = '");
613 SerialDebug.print(output2);
614 SerialDebug.println(
"'");
628 SerialDebug.print(
"Reading.2 EPROM JSON = ");
635 SerialDebug.println(
"Write to MQTTNetworking.eprom done!");
void redrawSemanticMarker_displayModule(boolean startNew)
redraws the Semantic Marker image..
void setScreenColor_displayModule(int screenColor)
cache for getting the screen color 0..n. Will reset the cache as well
void showSemanticMarker_displayModule(String semanticMarkerAddress, String title)
displays the Semantic Marker (a super QR code) on the M5 screen (title = to display)
void processBarkletMessage(String message, String topic)
process an MQTT message looking for keywords (barklet language)
char * _jsonVersionString
boolean isTrueString(String valCmdString)
whether the string is TRUE, ON, 1
char * _jsonLocationString
#define ESP_EPROM_NAME
Ambers 22nd birthday.. 2.20.22.
char * _mqttPasswordString
void invokeCurrentSMModePage(char *topic)
send message to ourself to change to current specifed SM Mode
boolean processJSONMessageMQTT(char *ascii, char *topic)
process the JSON message (looking for FEED, etc). Note: topic can be nil, or if not,...
char _semanticMarkerString[MAX_MESSAGE]
Preferences _preferencesMQTTNetworking
3.3.22 Using the new JSON library which is supposed to catch syntax errors without blowing up
char * _mqttGuestPasswordString
#define _preferencesJSONName
Points to strings read from JSON (limited to 15 char key name)
String _fullJSONString
storage for the full JSON message string to send around..
#define MQTT_CALLBACK_SOLID_LIGHT
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 (below, maybe in future a register approach...
int minMenuModesMax_mainModule()
returns the current max of the MIN menu modes (using the setting of min or expanded) to determine
void main_dispatchAsyncCommandWithString(int asyncCallCommand, char *parameter)
boolean isEmptyString(char *stringA)
informs if null or empty string
void rebootDevice_mainModule()
int getCurrentSMMode_mainModule()
returns the current SM Mode
void setCurrentSMMode_mainModule(int whichSMMode)
sets the current screen mode .. which can be used by Button and Display processing
void main_dispatchAsyncCommand(int asyncCallCommand)
checks if any async commands are in 'dispatch' mode, and if so, invokes them, and sets their flag to ...
char * createCopy(char *stringA)
#define SM_status
//status
#define ASYNC_CALL_BUZZ_ON
sends a 'B' to the BLE end of the code (assuming a feeder is connected).
#define ASYNC_CALL_OTA_FILE_UPDATE_PARAMETER
these are the async with a string parameter
#define ASYNC_CALL_BUZZ_OFF
sends a 'b' to the BLE end of the code (assuming a feeder is connected).
void savePreferenceInt_mainModule(int preferenceID, int val)
sets an int preference
void savePreferenceBoolean_mainModule(int preferenceID, boolean flag)
save a boolean preference
void savePreferenceIntFromString_mainModule(int preferenceID, char *val)
sets an int, but only if a valid integer, and no signs. If bad, then a 0 is stored
void savePreference_mainModule(int preferenceID, String preferenceValue)
called to set a preference (which will be an identifier and a string, which can be converted to a num...
#define PREFERENCE_STEPPER_KIND_VALUE
uses STEPPER type
#define PREFERENCE_SENSOR_TILT_VALUE
Sensor preferences.
#define PREFERENCE_BLE_SERVER_USE_DEVICE_NAME_SETTING
if set, the BLE Server (like PTFeeder) will tack on the device name (or none if not defined).
#define PREFERENCE_ONLY_GEN3_CONNECT_SETTING
if true, only BLEClient connect to GEN3 feeders..
#define PREFERENCE_NO_BUTTON_CLICK_POWEROFF_SETTING
#define PREFERENCE_SEMANTIC_MARKER_ZOOMED_VALUE
Display preferences (SemanticMarker etc) - boolean.
#define PREFERENCE_MAIN_BLE_SERVER_VALUE
#define PREFERENCE_PAIRED_DEVICE_SETTING
the paired device for guest device feeding (6.6.22)
#define STEPPER_IS_TUMBLER
#define PREFERENCE_BLE_USE_DISCOVERED_PAIRED_DEVICE_SETTING
#define PREFERENCE_USE_DOC_FOLLOW_SETTING
for
#define PREFERENCE_DISPLAY_SCREEN_TIMEOUT_VALUE
sets the timeout value
#define PREFERENCE_IS_MINIMAL_MENU_SETTING
sets the max temp for a poweroff
#define PREFERENCE_HIGH_TEMP_POWEROFF_VALUE
sets the max temp for a poweroff
#define PREFERENCE_STEPPER_ANGLE_FLOAT_SETTING
#define PREFERENCE_MAIN_GATEWAY_VALUE
#define PREFERENCE_MAIN_BLE_CLIENT_VALUE
_WIFI_MQTTState
putting here .. time might have gone too fast..
_globalMQTTAttempts
reset the MQTT attempts
callCallbackMain(CALLBACKS_MQTT, MQTT_CALLBACK_SOLID_LIGHT,(char *)"solidLight")
call the callback specified from the caller (eg. NimBLE_PetTutor_Server .. or others)
updatePreferencesInEPROM()
NOTE: this writes over entire values, since it's a string vs an JSON object.
boolean saveJSONPreferences
main_credentialsUpdated()
new 4.8.22 .. trying to kick out of AP mode if the credentials are good..
startDelay_WIFI_MQTTState()
init the delay, this uses the array of delays so we can change easier..
void restartWIFI_MQTTState()
restart the WIFI and then MQTT connection