mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2026-01-27 12:50:39 +03:00
test1
This commit is contained in:
@@ -1,114 +1,192 @@
|
||||
#include "defines.h"
|
||||
|
||||
#include "ClassFlow.h"
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include "esp_log.h"
|
||||
#include "../../include/defines.h"
|
||||
|
||||
static const char *TAG = "CLASS";
|
||||
|
||||
|
||||
void ClassFlow::SetInitialParameter(void)
|
||||
{
|
||||
ListFlowControll = NULL;
|
||||
previousElement = NULL;
|
||||
previousElement = NULL;
|
||||
|
||||
disabled = false;
|
||||
}
|
||||
|
||||
bool ClassFlow::isNewParagraph(string input)
|
||||
{
|
||||
if ((input[0] == '[') || ((input[0] == ';') && (input[1] == '[')))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClassFlow::GetNextParagraph(FILE* pfile, string& aktparamgraph)
|
||||
{
|
||||
while (getNextLine(pfile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
|
||||
|
||||
if (isNewParagraph(aktparamgraph))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
ClassFlow::ClassFlow(void)
|
||||
{
|
||||
SetInitialParameter();
|
||||
}
|
||||
|
||||
ClassFlow::ClassFlow(std::vector<ClassFlow*> * lfc)
|
||||
ClassFlow::ClassFlow(std::vector<ClassFlow *> *lfc)
|
||||
{
|
||||
SetInitialParameter();
|
||||
SetInitialParameter();
|
||||
ListFlowControll = lfc;
|
||||
}
|
||||
|
||||
ClassFlow::ClassFlow(std::vector<ClassFlow*> * lfc, ClassFlow *_prev)
|
||||
ClassFlow::ClassFlow(std::vector<ClassFlow *> *lfc, ClassFlow *_prev)
|
||||
{
|
||||
SetInitialParameter();
|
||||
SetInitialParameter();
|
||||
ListFlowControll = lfc;
|
||||
previousElement = _prev;
|
||||
}
|
||||
}
|
||||
|
||||
bool ClassFlow::ReadParameter(FILE* pfile, string &aktparamgraph)
|
||||
bool ClassFlow::ReadParameter(FILE *pFile, std::string &aktparamgraph)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClassFlow::doFlow(string time)
|
||||
bool ClassFlow::doFlow(std::string time)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string ClassFlow::getHTMLSingleStep(string host){
|
||||
std::string ClassFlow::getHTMLSingleStep(std::string host)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string ClassFlow::GetParameterName(std::string _input)
|
||||
{
|
||||
string _param;
|
||||
int _pospunkt = _input.find_first_of(".");
|
||||
if (_pospunkt > -1)
|
||||
{
|
||||
_param = _input.substr(_pospunkt+1, _input.length() - _pospunkt - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_param = _input;
|
||||
}
|
||||
// ESP_LOGD(TAG, "Parameter: %s, Pospunkt: %d", _param.c_str(), _pospunkt);
|
||||
std::string _param;
|
||||
int _pospunkt = _input.find_first_of(".");
|
||||
if (_pospunkt > -1)
|
||||
{
|
||||
_param = _input.substr(_pospunkt + 1, _input.length() - _pospunkt - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_param = _input;
|
||||
}
|
||||
|
||||
return _param;
|
||||
}
|
||||
|
||||
|
||||
bool ClassFlow::getNextLine(FILE* pfile, string *rt)
|
||||
bool ClassFlow::isNewParagraph(std::string input)
|
||||
{
|
||||
char zw[1024];
|
||||
if (pfile == NULL)
|
||||
if ((input[0] == '[') || ((input[0] == ';') && (input[1] == '[')))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ClassFlow::GetNextParagraph(FILE *pFile, std::string &aktparamgraph)
|
||||
{
|
||||
while (getNextLine(pFile, &aktparamgraph) && !isNewParagraph(aktparamgraph));
|
||||
|
||||
if (isNewParagraph(aktparamgraph))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
bool ClassFlow::GetNextParagraph(FILE *pFile, std::string &aktparamgraph, bool &disabled, bool &eof)
|
||||
{
|
||||
while (getNextLine_new(pFile, &aktparamgraph, disabled, eof) && !isNewParagraph(aktparamgraph));
|
||||
|
||||
if (isNewParagraph(aktparamgraph))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
bool ClassFlow::getNextLine(FILE *pFile, std::string *rt)
|
||||
{
|
||||
char temp_char[1024];
|
||||
if (pFile == NULL)
|
||||
{
|
||||
*rt = "";
|
||||
return false;
|
||||
}
|
||||
if (!fgets(zw, 1024, pfile))
|
||||
|
||||
if (!fgets(temp_char, 1024, pFile))
|
||||
{
|
||||
*rt = "";
|
||||
ESP_LOGD(TAG, "END OF FILE");
|
||||
return false;
|
||||
}
|
||||
ESP_LOGD(TAG, "%s", zw);
|
||||
*rt = zw;
|
||||
*rt = trim(*rt);
|
||||
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '['))
|
||||
|
||||
ESP_LOGD(TAG, "%s", temp_char);
|
||||
*rt = temp_char;
|
||||
*rt = trim_string_left_right(*rt);
|
||||
|
||||
while ((temp_char[0] == ';' || temp_char[0] == '#' || (rt->size() == 0)) && !(temp_char[1] == '['))
|
||||
{
|
||||
*rt = "";
|
||||
if (!fgets(zw, 1024, pfile))
|
||||
if (!fgets(temp_char, 1024, pFile))
|
||||
{
|
||||
return false;
|
||||
ESP_LOGD(TAG, "%s", zw);
|
||||
*rt = zw;
|
||||
*rt = trim(*rt);
|
||||
}
|
||||
ESP_LOGD(TAG, "%s", temp_char);
|
||||
*rt = temp_char;
|
||||
*rt = trim_string_left_right(*rt);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool ClassFlow::getNextLine(FILE *pFile, std::string *rt, bool &disabled, bool &eof)
|
||||
{
|
||||
eof = false;
|
||||
char zw[1024] = "";
|
||||
|
||||
if (pFile == NULL)
|
||||
{
|
||||
*rt = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fgets(zw, 1024, pFile))
|
||||
{
|
||||
ESP_LOGD(TAG, "%s", zw);
|
||||
|
||||
if ((strlen(zw) == 0) && feof(pFile))
|
||||
{
|
||||
*rt = "";
|
||||
eof = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*rt = "";
|
||||
eof = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
*rt = zw;
|
||||
*rt = trim_string_left_right(*rt);
|
||||
|
||||
while ((zw[0] == ';' || zw[0] == '#' || (rt->size() == 0)) && !(zw[1] == '['))
|
||||
{
|
||||
fgets(zw, 1024, pFile);
|
||||
ESP_LOGD(TAG, "%s", zw);
|
||||
|
||||
if (feof(pFile))
|
||||
{
|
||||
*rt = "";
|
||||
eof = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
*rt = zw;
|
||||
*rt = trim_string_left_right(*rt);
|
||||
}
|
||||
|
||||
disabled = ((*rt)[0] == ';');
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user