25 #ifndef SensorModels_h
26 #define SensorModels_h
65 red(red), green(green), blue(blue), alpha(alpha)
70 red(red), green(green), blue(blue),
alpha(0)
74 ARGB(
unsigned long color) : color(color) {}
76 ARGB(String
hex) :
ARGB((unsigned long)strtol(&hex[hex[0] ==
'#'], NULL, 16))
80 void hex(
char* hexSource)
85 green >> 4, green & 0x0F,
86 blue >> 4, blue & 0x0F };
88 for (
int i = 0; i < 8; i++)
90 hexSource[i] = hex[i] + (hex[i] > 0x09 ? 0x37 : 0x30);
137 EPtr(
EPtrType ptrType,
const char* key,
EPtr* eptrs,
int len) : ptrType(ptrType), key(key),
intValue(len), eptrs(eptrs), asText(true) {}
144 EPtr(
EPtrType ptrType,
const char* key) : ptrType(ptrType), key(key) {}
152 EPtr(
EPtrType ptrType,
const char* key,
const char*
value) : ptrType(ptrType), key(key), value(value), asText(true), length(-1) {}
159 EPtr(
const char* key,
const char*
value) : key(key), value(value), asText(true), ptrType(
ProgPtr) {}
168 this->value = value.c_str();
217 EPtr(
const char* key,
const char*
value,
int length) : key(key), value(value), ptrType(
MemPtr), length(length) {}
219 static int parse(
const char* text,
EPtr* eptrs,
int length,
const char separator =
'|',
int eptrStartIndex = 0)
224 while (text[index] || index>start)
226 if (!text[index] || text[index] == separator)
228 eptrs[eptrStartIndex++] =
EPtr(0, text + start, index - start);
231 if (++count == length || !text[index])
Definition: SensorModels.h:34
ARGB(byte red, byte green, byte blue)
Definition: SensorModels.h:69
EPtr(const char *key, const char *value)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:159
SensorAction
Definition: SensorModels.h:30
bool keyIsMem
Definition: SensorModels.h:117
ARGB(unsigned long color)
Definition: SensorModels.h:74
Definition: SensorModels.h:50
EPtr(const char *key, bool value)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:215
Definition: SensorModels.h:52
bool encoded
Definition: SensorModels.h:119
int length
Definition: SensorModels.h:116
const char * value
Definition: SensorModels.h:107
EPtr(EPtrType ptrType, const char *key)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:144
EPtr(const char *key, double value, bool asText=false)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:208
Definition: SensorModels.h:42
Definition: SensorModels.h:46
unsigned int UINT
Definition: SensorModels.h:28
double doubleValue
Definition: SensorModels.h:108
ARGB(byte alpha, byte red, byte green, byte blue)
Definition: SensorModels.h:64
EPtr(const char *key, const char value)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:176
uint8_t blue
Definition: SensorModels.h:61
Definition: SensorModels.h:43
EPtr * eptrs
Definition: SensorModels.h:120
const char * key
Definition: SensorModels.h:104
Definition: SensorModels.h:44
EPtr(const char *key, long value, EPtrType ptrType=Long)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:200
Definition: SensorModels.h:56
int intValue
Definition: SensorModels.h:110
char charValue
Definition: SensorModels.h:113
const bool AsText
Definition: SensorModels.h:99
EPtr(const char *key, uint32_t value, EPtrType ptrType=Uint)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:192
static int parse(const char *text, EPtr *eptrs, int length, const char separator= '|', int eptrStartIndex=0)
Definition: SensorModels.h:219
EPtr()
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:125
Definition: SensorModels.h:53
Definition: SensorModels.h:101
Definition: SensorModels.h:33
uint8_t green
Definition: SensorModels.h:61
Definition: SensorModels.h:47
Definition: SensorModels.h:40
uint32_t color
Definition: SensorModels.h:58
uint8_t alpha
Definition: SensorModels.h:61
EPtr(const char *key, int value, EPtrType ptrType=Int)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:184
EPtr(const char *key, String value)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:166
Definition: SensorModels.h:41
EPtr(EPtrType ptrType)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:131
long longValue
Definition: SensorModels.h:111
Definition: SensorModels.h:49
EPtrType ptrType
Definition: SensorModels.h:103
bool boolValue
Definition: SensorModels.h:112
Definition: SensorModels.h:48
EPtr(EPtrType ptrType, const char *key, const char *value)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:152
EPtr(EPtrType ptrType, const char *key, EPtr *eptrs, int len)
Initializes a new instance of the EPtr struct.
Definition: SensorModels.h:137
Definition: SensorModels.h:32
uint8_t red
Definition: SensorModels.h:61
Definition: SensorModels.h:51
Definition: SensorModels.h:45
Definition: SensorModels.h:35
EPtr(const char *key, const char *value, int length)
Definition: SensorModels.h:217
ARGB(String hex)
Definition: SensorModels.h:76
EPtrType
Definition: SensorModels.h:38
uint32_t uintValue
Definition: SensorModels.h:109
void hex(char *hexSource)
Definition: SensorModels.h:80
bool asText
Definition: SensorModels.h:118