forked from arduino-libraries/MKRGSM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGSMFileUtils.h
44 lines (29 loc) · 1.47 KB
/
GSMFileUtils.h
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
#pragma once
#include <Arduino.h>
class GSMFileUtils {
public:
GSMFileUtils(bool debug = false);
bool begin(const bool restart);
bool begin() { return begin(true); };
uint32_t fileCount() const { return _count; };
size_t listFiles(String list[]) const;
uint32_t listFile(const String filename) const;
uint32_t downloadFile(const String filename, const char buf[], const uint32_t size, const bool append);
uint32_t downloadFile(const String filename, const char buf[], const uint32_t size) { return downloadFile(filename, buf, size, false); };
uint32_t downloadFile(const String filename, const String& buf) { return downloadFile(filename, buf.c_str(), buf.length(), false); }
uint32_t appendFile(const String filename, const String& buf) { return downloadFile(filename, buf.c_str(), buf.length(), true); }
uint32_t appendFile(const String filename, const char buf[], const uint32_t size) { return downloadFile(filename, buf, size, true); }
bool deleteFile(const String filename);
int deleteFiles();
uint32_t readFile(const String filename, String* content);
uint32_t readFile(const String filename, uint8_t* content);
uint32_t readBlock(const String filename, const uint32_t offset, const uint32_t len, uint8_t* content);
uint32_t freeSpace();
private:
int _count;
String _files;
bool _debug;
void _countFiles();
int _getFileList();
};
void printFiles(const GSMFileUtils fileUtils);