mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
Добавляем системную функцию отправки в MQTT
This commit is contained in:
@@ -292,12 +292,12 @@ enum SysOp {
|
|||||||
sysop_getSeconds, //
|
sysop_getSeconds, //
|
||||||
sysop_getMonth, //
|
sysop_getMonth, //
|
||||||
sysop_getDay,
|
sysop_getDay,
|
||||||
sysop_getIP
|
sysop_getIP,
|
||||||
|
sysop_mqttPub
|
||||||
};
|
};
|
||||||
|
|
||||||
IoTValue sysExecute(SysOp command, std::vector<IoTValue>& param) {
|
IoTValue sysExecute(SysOp command, std::vector<IoTValue>& param) {
|
||||||
IoTValue value;
|
IoTValue value;
|
||||||
Serial.printf("Call from sysExecute %d\n", command);
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case sysop_reboot:
|
case sysop_reboot:
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
@@ -374,6 +374,13 @@ IoTValue sysExecute(SysOp command, std::vector<IoTValue>& param) {
|
|||||||
value.isDecimal = false;
|
value.isDecimal = false;
|
||||||
return value;
|
return value;
|
||||||
break;
|
break;
|
||||||
|
case sysop_mqttPub:
|
||||||
|
if (param.size() == 2) {
|
||||||
|
//Serial.printf("Call from sysExecute %s %s\n", param[0].valS.c_str(), param[1].valS.c_str());
|
||||||
|
value.valD = mqtt.publish(param[0].valS.c_str(), param[1].valS.c_str(), false);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@@ -403,6 +410,7 @@ public:
|
|||||||
if (Callee == "getMonth") operation = sysop_getMonth; else
|
if (Callee == "getMonth") operation = sysop_getMonth; else
|
||||||
if (Callee == "getDay") operation = sysop_getDay; else
|
if (Callee == "getDay") operation = sysop_getDay; else
|
||||||
if (Callee == "getIP") operation = sysop_getIP; else
|
if (Callee == "getIP") operation = sysop_getIP; else
|
||||||
|
if (Callee == "mqttPub") operation = sysop_mqttPub; else
|
||||||
operation = sysop_notfound;
|
operation = sysop_notfound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user