-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeviceConfigJSON.h
More file actions
50 lines (37 loc) · 1.53 KB
/
DeviceConfigJSON.h
File metadata and controls
50 lines (37 loc) · 1.53 KB
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
/*
Device Config JSON
Written by Marcin Filipiak
http://NoweEnergie.org
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
the Free Software Foundation, either version 2.1 of the License.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU LESSER GENERAL PUBLIC LICENSE for more details.
*/
#ifndef DeviceConfigJSON_h
#define DeviceConfigJSON_h
#include <Arduino.h>
#define ARRAY_SIZE(array) ((sizeof(array))/(sizeof(array[0])))
class DeviceConfigJSON {
public:
DeviceConfigJSON(const String& formn, const String& formt);
void label(const String& name, const String value);
void text(const String& label, const String& name, String value);
void password(const String& label, const String& name, String value);
void state(const String& label, const String& name, bool value);
void binswitch(const String& label, const String& name, bool set, bool autosend);
void select(const String& label, const String& name, int set, String values[][2], int numValues);
String getJSON();
void clear();
String getValue(String& js, const String& searchString);
template <typename T>
T getSet(String& js, const String& searchString);
private:
String formname;
String formtitle;
String jsonMembers;
bool firstItemMembers;
};
#endif