-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathstorage.hpp
57 lines (48 loc) · 1.31 KB
/
storage.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
// storage.hpp - Part of ESP32 Ruuvitag Collector
// Hannu Pirila 2019
#ifndef storage_hpp
#define storage_hpp
#include "config.hpp"
#include "Datahandler.hpp"
#include <vector>
#include <sstream>
#include <iomanip>
#include <SPIFFS.h>
#include <SD_MMC.h>
namespace storage{
enum OutputType {print,influx};
enum FileSystemType {spiffs,sd_mmc};
void begin();
void end();
void write(std::string fileName,std::string data);
namespace spif{
void begin();
void end();
bool read(std::string fileName,OutputType outputType);
void write(std::string fileName,std::string data);
void readAllFiles(OutputType outputType);
void deleteFile(std::string fileName);
void format();
void list();
void deleteOldestFile();
boolean exists(std::string fileName);
void sendToInflux(std::string fileName);
uint32_t getTotalBytes();
uint32_t getUsedBytes();
uint32_t getFreeBytes();
}
namespace sd{
extern bool sdMounted;
void begin();
void end();
bool read(std::string fileName,OutputType outputType);
void write(std::string fileName,std::string data);
void readAllFiles(OutputType outputType);
boolean exists(std::string fileName);
void list();
uint64_t getTotalBytes();
uint64_t getUsedBytes();
uint64_t getFreeBytes();
}
}
#endif