mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
более стандартные имена методов
This commit is contained in:
@@ -24,11 +24,6 @@ class IoTItem {
|
||||
virtual void regEvent(float value, String consoleInfo);
|
||||
|
||||
String getSubtype();
|
||||
virtual void sendChart();
|
||||
virtual void cleanChart();
|
||||
virtual void setPublishType(int type, int num);
|
||||
virtual void cleanData();
|
||||
virtual void setTodayDate();
|
||||
|
||||
String getID();
|
||||
virtual String getValue();
|
||||
@@ -53,6 +48,13 @@ class IoTItem {
|
||||
virtual void setValue(IoTValue Value);
|
||||
virtual void setValue(String valStr);
|
||||
|
||||
//методы для графиков
|
||||
virtual void publishValue();
|
||||
virtual void clearValue();
|
||||
virtual void setPublishDestination(int type, int num);
|
||||
virtual void clearHistory();
|
||||
virtual void setTodayDate();
|
||||
|
||||
protected:
|
||||
String _subtype;
|
||||
String _id;
|
||||
|
||||
@@ -137,8 +137,8 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) {
|
||||
//отправка данных графиков
|
||||
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
(*it)->setPublishType(1, -1);
|
||||
(*it)->sendChart();
|
||||
(*it)->setPublishDestination(1, -1);
|
||||
(*it)->publishValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
||||
// (*it)->setTodayDate();
|
||||
//}
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
(*it)->setPublishType(2, num);
|
||||
(*it)->sendChart();
|
||||
(*it)->setPublishDestination(2, num);
|
||||
(*it)->publishValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ String IoTItem::getSubtype() {
|
||||
return _subtype;
|
||||
}
|
||||
|
||||
void IoTItem::sendChart() {}
|
||||
void IoTItem::publishValue() {}
|
||||
|
||||
void IoTItem::cleanChart() {}
|
||||
void IoTItem::clearValue() {}
|
||||
|
||||
void IoTItem::setPublishType(int publishType, int wsNum){};
|
||||
void IoTItem::setPublishDestination(int publishType, int wsNum){};
|
||||
|
||||
void IoTItem::cleanData() {}
|
||||
void IoTItem::clearHistory() {}
|
||||
|
||||
void IoTItem::setTodayDate() {}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ class Loging : public IoTItem {
|
||||
return changed;
|
||||
}
|
||||
|
||||
void sendChart() {
|
||||
void publishValue() {
|
||||
String dir = "/lg/" + id;
|
||||
filesList = getFilesList(dir);
|
||||
|
||||
@@ -183,17 +183,17 @@ class Loging : public IoTItem {
|
||||
}
|
||||
//если данных нет отправляем пустой грфик
|
||||
if (noData) {
|
||||
cleanChart();
|
||||
clearValue();
|
||||
}
|
||||
}
|
||||
|
||||
void cleanChart() {
|
||||
void clearValue() {
|
||||
SerialPrint("i", F("Loging"), "clear chart");
|
||||
String cleanJson = createEmtyJson();
|
||||
publishJson(cleanJson);
|
||||
}
|
||||
|
||||
void cleanData() {
|
||||
void clearHistory() {
|
||||
String dir = "/lg/" + id;
|
||||
cleanDirectory(dir);
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class Loging : public IoTItem {
|
||||
}
|
||||
|
||||
// publishType 1 - в mqtt, 2 - в ws, 3 - mqtt и ws, wsNum = -1 => broadcast
|
||||
void setPublishType(int publishType, int wsNum) {
|
||||
void setPublishDestination(int publishType, int wsNum) {
|
||||
_publishType = publishType;
|
||||
_wsNum = wsNum;
|
||||
}
|
||||
@@ -342,9 +342,9 @@ class Date : public IoTItem {
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
//отправляем только свои данные
|
||||
if ((*it)->getID() == selectToMarker(id, "-")) {
|
||||
(*it)->setPublishType(3, -1);
|
||||
(*it)->cleanChart();
|
||||
(*it)->sendChart();
|
||||
(*it)->setPublishDestination(3, -1);
|
||||
(*it)->clearValue();
|
||||
(*it)->publishValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ void cleanLogs() {
|
||||
//очистка данных всех экземпляров графиков
|
||||
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||
if ((*it)->getSubtype() == "Loging") {
|
||||
(*it)->cleanData();
|
||||
(*it)->clearHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user