mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
добавил посылку событий в сокеты
This commit is contained in:
@@ -10,6 +10,7 @@ extern void hexdump(const void* mem, uint32_t len, uint8_t cols);
|
||||
#endif
|
||||
|
||||
void sendFileToWs5(const char* filename, uint8_t num, size_t frameSize);
|
||||
void publishStatusWs(const String& topic, const String& data);
|
||||
// void sendMark(const char* filename, const char* mark, uint8_t num);
|
||||
// void sendFileToWs3(const String& filename, uint8_t num);
|
||||
// void sendFileToWs4(const String& filename, uint8_t num);
|
||||
@@ -127,8 +127,8 @@ void publishStatusWs(const String& topic, const String& data) {
|
||||
String path = mqttRootDevice + "/" + topic + "/status";
|
||||
String json = "{}";
|
||||
jsonWriteStr(json, "status", data);
|
||||
// standWebSocket.sendTXT(num, json);
|
||||
// mqtt.publish(path.c_str(), json.c_str(), false);
|
||||
jsonWriteStr(json, "topic", path);
|
||||
standWebSocket.broadcastTXT(json);
|
||||
}
|
||||
|
||||
// void sendMark(const char* filename, const char* mark, uint8_t num) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "Utils/SerialPrint.h"
|
||||
#include "Classes/ScenarioClass3.h"
|
||||
#include "Classes/IoTSensor.h"
|
||||
#include "WsServer.h"
|
||||
|
||||
IoTSensor::IoTSensor(String parameters) {
|
||||
jsonRead(parameters, "int", _interval);
|
||||
@@ -44,6 +45,7 @@ void IoTSensor::regEvent(String value, String consoleInfo = "") {
|
||||
eventGen2(_id, value);
|
||||
jsonWriteStr(paramsFlashJson, _id, value);
|
||||
publishStatusMqtt(_id, value);
|
||||
publishStatusWs(_id, value);
|
||||
SerialPrint("I", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user