-
Notifications
You must be signed in to change notification settings - Fork 5
/
EzData.hpp
61 lines (37 loc) · 1.31 KB
/
EzData.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 _EZDATA_H_
#define _EZDATA_H_
#include <WString.h>
#include <type_traits>
class EzData
{
public:
EzData(const char *dev_token, const char *key);
EzData(const String dev_token, const char *key);
EzData(const String dev_token, const String key);
EzData(const char *dev_token, const String key);
EzData(const char *data_token);
EzData(const String data_token);
~EzData();
void setDeviceToken(const String &dev_token);
void setServer(const String &server);
template<typename T, typename std::enable_if<std::is_integral<T>::value, T> :: type* = nullptr>
bool set(T value);
bool set(const float value);
bool set(const double value);
bool set(const String value);
bool set(const char *value, size_t len);
bool _set(uint8_t *payload, size_t size);
template <typename T>
bool _get(T &retValue);
template <typename T>
bool get(T &retValue);
bool del();
private:
String _server = "ezdata2.m5stack.com";
bool _public = false;
String _device_token = "";
String _key = "";
};
bool registeredDevice(const String &mac, String &loginName, String &password, String &devToken);
bool login(const String &loginName, const String &password, String &deviceToken);
#endif