added support for using hex values in value list
This commit is contained in:
@@ -211,7 +211,11 @@ result_t DataField::create(vector<string>::iterator& it,
|
||||
while (getline(stream, token, VALUE_SEPARATOR) != 0) {
|
||||
const char* str = token.c_str();
|
||||
char* strEnd = NULL;
|
||||
unsigned int id = strtoul(str, &strEnd, 10);
|
||||
unsigned int id;
|
||||
if (strncasecmp(str, "0x", 2) == 0)
|
||||
id = strtoul(str+2, &strEnd, 16); // hexadecimal
|
||||
else
|
||||
id = strtoul(str, &strEnd, 10); // decimal
|
||||
if (strEnd == NULL || strEnd == str || *strEnd != '=') {
|
||||
result = RESULT_ERR_INVALID_LIST;
|
||||
break;
|
||||
|
||||
@@ -185,7 +185,7 @@ int main()
|
||||
{"x,,bi3:2,0=off;1=on;2=auto;3=eco","auto", "10feffff0110", "00", ""},
|
||||
{"x,,bi3:2,0=off;1=on","on", "10feffff0108", "00", ""},
|
||||
{"x,,bi3:2,0=off;1=on","off","10feffff0100", "00", ""},
|
||||
{"x,,uch,1=test;2=high;3=off;4=on","on","10feffff0104", "00", ""},
|
||||
{"x,,uch,1=test;2=high;3=off;0x10=on","on","10feffff0110", "00", ""},
|
||||
{"x,s,uch","3","1050ffff00", "0103", ""},
|
||||
{"x,,d2b,,°C,Aussentemperatur","x=18.004 °C [Aussentemperatur]","10fe0700090112", "00", "v"},
|
||||
{"x,,bti,,,,y,,bda,,,,z,,bdy", "21:04:58;26.10.2014;Sun","10fe0700085804212610061406", "00", ""}, // combination
|
||||
|
||||
Reference in New Issue
Block a user