-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDataAbstract.hpp
61 lines (48 loc) · 1.44 KB
/
DataAbstract.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef DATA_ABSTRACT_HPP
#define DATA_ABSTRACT_HPP
#include <iostream>
#include <typeinfo>
#include <cxxabi.h>
#include <atomic>
#include <memory>
#include <cstdlib>
#include <string>
#include <vector>
#include <sstream>
#include "esp_vfs.h"
#include "esp_vfs_fat.h"
#include "esp_system.h"
#include "IDataAbstract.hpp"
#include "DataStorage.hpp"
#include "DataManager.hpp"
#include "esp_log.h"
template <class T>
class DataAbstract : public IDataAbstract
{
public:
DataAbstract(std::string name, std::string parentObjectName);
DataAbstract(std::string name, std::string parentObjectName, T value);
virtual ~DataAbstract();
T getData();
void setData(T data);
void setData(std::string data);
void saveData();
void loadData();
void setStreamInterval(uint32_t interval);
uint32_t getStreamInterval();
void setStreamTime(uint32_t streamTime);
uint32_t getStreamTime();
uint32_t getLastChange();
std::string getName();
std::string getDataString(std::string ctrl);
protected:
private:
std::atomic<T> *data;
std::atomic<uint32_t> time_last_change; // Tempo de execução em que o dado foi alterado pela última vez
std::atomic<uint32_t> stream_interval; // Intervalo que o stream do atributo será feito
std::atomic<uint32_t> stream_time; // momento em que o stream do atributo deve ser feito
DataStorage *dataStorage;
DataManager *dataManager;
};
#include "DataAbstract.cpp"
#endif