mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
убираем баги окна ввода даты
This commit is contained in:
@@ -17,7 +17,7 @@ void mqttSubscribe();
|
||||
|
||||
boolean publish(const String& topic, const String& data);
|
||||
boolean publishData(const String& topic, const String& data);
|
||||
boolean publishChart(const String& topic, const String& data);
|
||||
boolean publishChartMqtt(const String& topic, const String& data);
|
||||
boolean publishControl(String id, String topic, String state);
|
||||
boolean publishChart_test(const String& topic, const String& data);
|
||||
boolean publishStatusMqtt(const String& topic, const String& data);
|
||||
|
||||
@@ -15,7 +15,7 @@ extern void hexdump(const void* mem, uint32_t len, uint8_t cols);
|
||||
|
||||
void sendFileToWs(const char* filename, uint8_t num, size_t frameSize);
|
||||
void publishStatusWs(const String& topic, const String& data);
|
||||
void publishStatusWsJson(String& json);
|
||||
void publishChartWs(String& json);
|
||||
void periodicWsSend();
|
||||
void sendStringToWs(const String& msg, uint8_t num, String name);
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ boolean publishData(const String& topic, const String& data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean publishChart(const String& topic, const String& data) {
|
||||
boolean publishChartMqtt(const String& topic, const String& data) {
|
||||
String path = mqttRootDevice + "/" + topic + "/status";
|
||||
if (!publish(path, data)) {
|
||||
SerialPrint("E", F("MQTT"), F("on publish chart"));
|
||||
|
||||
@@ -59,7 +59,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
||||
sendFileToWs("/layout.json", num, 1024);
|
||||
String json = getParamsJson();
|
||||
standWebSocket.sendTXT(num, json);
|
||||
//отправка данных графиков
|
||||
//отправка данных графиков (нехватает передачи номера сокетов)
|
||||
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
(*it)->sendChart(2);
|
||||
@@ -250,8 +250,8 @@ void publishStatusWs(const String& topic, const String& data) {
|
||||
}
|
||||
|
||||
//публикация статус сообщений уже готовых
|
||||
void publishStatusWsJson(String& json) {
|
||||
standWebSocket.broadcastTXT(json);
|
||||
void publishChartWs(String& data) {
|
||||
standWebSocket.broadcastTXT(data);
|
||||
}
|
||||
|
||||
//данные которые мы отправляем в сокеты переодически
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
void *getAPI_Date(String params);
|
||||
|
||||
String date;
|
||||
class Loging : public IoTItem {
|
||||
private:
|
||||
String logid;
|
||||
@@ -158,7 +157,7 @@ class Loging : public IoTItem {
|
||||
// SerialPrint("i", F("Loging"), "file '" + buf + "' too old, deleted");
|
||||
// removeFile(buf);
|
||||
//} else {
|
||||
unsigned long reqUnixTime = strDateToUnix(date);
|
||||
unsigned long reqUnixTime = strDateToUnix(getItemValue(id + "-date"));
|
||||
if (fileUnixTimeLocal > reqUnixTime && fileUnixTimeLocal < reqUnixTime + 86400) {
|
||||
noData = false;
|
||||
createJson(buf, i, type);
|
||||
@@ -229,12 +228,12 @@ class Loging : public IoTItem {
|
||||
|
||||
void publishJson(String &oneSingleJson, int type) {
|
||||
if (type == 1) {
|
||||
publishChart(id, oneSingleJson);
|
||||
publishChartMqtt(id, oneSingleJson);
|
||||
} else if (type == 2) {
|
||||
publishStatusWsJson(oneSingleJson);
|
||||
publishChartWs(oneSingleJson);
|
||||
} else if (type == 3) {
|
||||
publishChart(id, oneSingleJson);
|
||||
publishStatusWsJson(oneSingleJson);
|
||||
publishChartMqtt(id, oneSingleJson);
|
||||
publishChartWs(oneSingleJson);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +256,7 @@ class Loging : public IoTItem {
|
||||
generateEvent(_id, value);
|
||||
publishStatusMqtt(_id, value);
|
||||
String json = createSingleJson(_id, value);
|
||||
publishStatusWsJson(json);
|
||||
publishChartWs(json);
|
||||
SerialPrint("i", "Sensor " + consoleInfo, "'" + _id + "' data: " + value + "'");
|
||||
}
|
||||
|
||||
@@ -298,16 +297,19 @@ class Date : public IoTItem {
|
||||
|
||||
void setValue(String valStr) {
|
||||
value.valS = valStr;
|
||||
date = valStr;
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
void setValue(IoTValue Value) {
|
||||
value = Value;
|
||||
regEvent(value.valS, "");
|
||||
//отправка данных при изменении даты
|
||||
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
(*it)->sendChart(3);
|
||||
//отправляем только свои данные
|
||||
if ((*it)->getID() == selectToMarker(id, "-")) {
|
||||
(*it)->sendChart(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user