More work on aqhome-cgi.
This commit is contained in:
@@ -312,29 +312,10 @@ const char *_readValueAndProbablyRange(const char *s, uint64_t *ptrBitField, int
|
||||
{
|
||||
int v=0;
|
||||
|
||||
if (*s=='#') {
|
||||
while(*s) {
|
||||
unsigned char c;
|
||||
|
||||
c=tolower(*s);
|
||||
if ((c>='0' && c<='9') || (c>='a' && c<='f')) {
|
||||
c-='0';
|
||||
if (c>9)
|
||||
c-=7;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
else
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while(isdigit(*s)) {
|
||||
v*=10;
|
||||
v+=(*s)-'0';
|
||||
s++;
|
||||
}
|
||||
while(isdigit(*s)) {
|
||||
v*=10;
|
||||
v+=(*s)-'0';
|
||||
s++;
|
||||
}
|
||||
if (!_valueOkay(v, minValue, maxValue)) {
|
||||
DBG_INFO(NULL, "here");
|
||||
@@ -368,13 +349,35 @@ const char *_readDouble(const char *s, double *ptrDouble)
|
||||
while(*s && isspace(*s))
|
||||
s++;
|
||||
sStart=s;
|
||||
while(*s && (isdigit(*s) || *s=='.' || *s=='+' || *s=='-'))
|
||||
s++;
|
||||
if (*s=='#') {
|
||||
uint32_t v=0;
|
||||
|
||||
rv=GWEN_Text_StringToDouble(sStart, ptrDouble);
|
||||
if (rv<0) {
|
||||
DBG_ERROR(NULL, "Error reading double: %d", rv);
|
||||
return NULL;
|
||||
s++;
|
||||
while(*s) {
|
||||
unsigned char c;
|
||||
|
||||
c=tolower(*s);
|
||||
if ((c>='0' && c<='9') || (c>='a' && c<='f')) {
|
||||
c-='0';
|
||||
if (c>9)
|
||||
c-=7;
|
||||
v<<=4;
|
||||
v+=c;
|
||||
}
|
||||
else
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
*ptrDouble=(double) v;
|
||||
}
|
||||
else {
|
||||
while(*s && (isdigit(*s) || *s=='.' || *s=='+' || *s=='-'))
|
||||
s++;
|
||||
rv=GWEN_Text_StringToDouble(sStart, ptrDouble);
|
||||
if (rv<0) {
|
||||
DBG_ERROR(NULL, "Error reading double: %d", rv);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return s;
|
||||
|
||||
@@ -66,7 +66,7 @@ AQHREACT_UNIT *AqHomeReact_UnitValueSet_new(AQH_OBJECT *aqh)
|
||||
|
||||
param=AQHREACT_Param_new();
|
||||
AQHREACT_Param_SetName(param, AQHOMEREACT_UNIT_VALUESET_PARAM_VALUENAME);
|
||||
AQHREACT_Param_SetDataType(param, AQHREACT_DATAOBJECTTYPE_DOUBLE);
|
||||
AQHREACT_Param_SetDataType(param, AQHREACT_DATAOBJECTTYPE_STRING);
|
||||
AQHREACT_Unit_AddParam(unit, param);
|
||||
|
||||
return unit;
|
||||
@@ -131,7 +131,6 @@ AQH_MESSAGE *_mkSetDataMsgDouble(AQH_OBJECT *brokerEndpoint, const char *sValueN
|
||||
AQH_MESSAGE *msgOut;
|
||||
AQH_VALUE *v;
|
||||
double data;
|
||||
int rv;
|
||||
|
||||
v=AQH_Value_new();
|
||||
AQH_Value_SetNameForSystem(v, sValueName);
|
||||
|
||||
Reference in New Issue
Block a user