добавил очередь отправки файлов в сокеты

This commit is contained in:
Dmitry Borisenko
2022-01-19 22:54:33 +01:00
parent 003c130eef
commit 221ad5f5d4
14 changed files with 66 additions and 30 deletions

View File

@@ -1,39 +0,0 @@
#pragma once
#include "Global.h"
#define MAX_COMMAND_LENGTH 16
#define BUFFER 128
class QueueFromChar;
class QueueFromChar {
public:
QueueFromChar();
~QueueFromChar();
void addCommand(const char* command);
void printCommands();
String getLastCommand();
private:
struct CharBufferStruct {
char command[MAX_COMMAND_LENGTH + 1];
};
CharBufferStruct* commandList;
int commandCount = 0;
};
extern QueueFromChar* myBuf;
//========проверка очереди=====================
// myBuf = new QueueFromChar;
// myBuf->addCommand("zero");
// myBuf->addCommand("one");
// myBuf->addCommand("two");
// myBuf->printCommands();
// myBuf->getLastCommand();
// myBuf->getLastCommand();
// myBuf->getLastCommand();
// myBuf->printCommands();

View File

@@ -1,24 +0,0 @@
#pragma once
#include "classes/QueueInst.h"
#include "Global.h"
#include <queue>
#include <iostream>
using namespace std;
class QueueFromInstance;
class QueueFromInstance {
public:
QueueFromInstance();
~QueueFromInstance();
void push(QueueInstance instance);
void pop();
QueueInstance front();
private:
queue<QueueInstance> queue1;
};
extern QueueFromInstance* myQueue;

View File

@@ -1,5 +1,6 @@
#pragma once
#include "Global.h"
#ifdef QUEUE_FROM_STR
#include <queue>
#include <iostream>
@@ -7,6 +8,7 @@ using namespace std;
struct QueueItems {
String myword;
uint8_t num;
};
class QueueFromStruct;
@@ -19,13 +21,14 @@ class QueueFromStruct {
void push(QueueItems word);
void pop();
QueueItems front();
bool empty();
private:
queue<QueueItems> queue1;
QueueItems tmpItem;
};
extern QueueFromStruct* myQueueStruct;
extern QueueFromStruct* filesQueue;
//=======проверка очереди из структур=================
// myQueueStruct = new QueueFromStruct;
@@ -39,3 +42,5 @@ extern QueueFromStruct* myQueueStruct;
// Serial.println(myQueueStruct->front().myword);
// Serial.println(myQueueStruct->front().myword);
// Serial.println(myQueueStruct->front().myword);
#endif

View File

@@ -1,19 +0,0 @@
#pragma once
#include "Global.h"
#include <queue>
#include <iostream>
using namespace std;
class QueueInstance;
class QueueInstance {
public:
QueueInstance(String text);
~QueueInstance();
String get();
private:
String _text;
};

View File

@@ -1,5 +1,6 @@
#pragma once
#include "Global.h"
#include "classes/QueueFromStruct.h"
class SendJson;
@@ -8,7 +9,7 @@ class SendJson {
SendJson();
~SendJson();
void sendFile(String path, uint8_t num);
void addFileToQueue(String path, uint8_t num);
void loop();
@@ -16,12 +17,13 @@ class SendJson {
void sendMqtt(String& jsonArrayElement);
uint8_t _num;
QueueItems myItem;
private:
File file;
String _path;
uint8_t _num;
bool sendingInProgress = false;
};
extern SendJson* sendConfigJson;
extern SendJson* sendWigdetsJson;
extern SendJson* sendJsonFiles;