проверка

This commit is contained in:
Dmitry Borisenko
2022-01-20 13:36:00 +01:00
parent c4a3dec67c
commit f893a3623d
13 changed files with 311 additions and 20 deletions

View File

@@ -1,18 +1,33 @@
#include "classes/SendJson.h"
#ifdef QUEUE_FROM_STR
SendJson::SendJson() {}
SendJson::SendJson() {
filesQueue = new QueueFromStruct;
}
SendJson::~SendJson() {}
void SendJson::sendFile(String path, uint8_t num) {
_path = path;
_num = num;
file = seekFile(path);
void SendJson::addFileToQueue(String path, uint8_t num) {
myItem.myword = path;
myItem.num = num;
filesQueue->push(myItem);
SerialPrint(F("i"), F("WS"), "file added to Queue " + path);
}
void SendJson::loop() {
if (!filesQueue->empty() && !sendingInProgress) {
Serial.println("Queue not empty");
myItem = filesQueue->front();
_path = myItem.myword;
_num = myItem.num;
file = seekFile(_path);
SerialPrint(F("i"), F("WS"), "seek File to WS " + _path);
sendingInProgress = true;
}
if (file.available()) {
String jsonArrayElement = _path + file.readStringUntil('}') + "}";
sendWs(jsonArrayElement);
} else {
sendingInProgress = false;
}
}
@@ -24,5 +39,5 @@ void SendJson::sendMqtt(String& jsonArrayElement) {
// mqtt send to do
}
SendJson* sendConfigJson;
SendJson* sendWigdetsJson;
SendJson* sendJsonFiles;
#endif