mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 14:42:18 +03:00
добавил сценарии и класс сенсора
This commit is contained in:
46
src/Buffers.cpp
Normal file
46
src/Buffers.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "Buffers.h"
|
||||
|
||||
//генеирует событие
|
||||
void eventGen2(String eventName, String eventValue) {
|
||||
if (!jsonReadBool(settingsFlashJson, "scen")) {
|
||||
return;
|
||||
}
|
||||
String event = eventName + " " + eventValue + ",";
|
||||
eventBuf += event;
|
||||
|
||||
SerialPrint("I", "Event add", eventName + " " + eventValue);
|
||||
|
||||
if (jsonReadBool(settingsFlashJson, "MqttOut")) {
|
||||
if (eventName != "timenow") {
|
||||
publishEvent(eventName, eventValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void spaceCmdExecute(String& cmdStr) {
|
||||
cmdStr += "\r\n";
|
||||
cmdStr.replace("\r\n", "\n");
|
||||
cmdStr.replace("\r", "\n");
|
||||
while (cmdStr.length()) {
|
||||
String buf = selectToMarker(cmdStr, "\n");
|
||||
if (buf != "") {
|
||||
sCmd.readStr(buf);
|
||||
SerialPrint("I", F("Order done W"), buf);
|
||||
}
|
||||
cmdStr = deleteBeforeDelimiter(cmdStr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
String getValueJson(String& key) {
|
||||
String live = jsonReadStr(paramsHeapJson, key);
|
||||
String store = jsonReadStr(paramsFlashJson, key);
|
||||
if (live != nullptr) {
|
||||
return live;
|
||||
} else if (store != nullptr) {
|
||||
return store;
|
||||
} else if (store == nullptr && live == nullptr) {
|
||||
return "no value";
|
||||
} else {
|
||||
return "data error";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user