aqhome: fixed handling of AQH_ValueDataTyp

This commit is contained in:
Martin Preuss
2024-11-03 15:35:08 +01:00
parent a520b37089
commit f002587aee

View File

@@ -219,11 +219,11 @@ int AQH_ValueDataType_fromString(const char *s)
return AQH_ValueDataType_Uint32;
else if (strcasecmp(s, "rational")==0)
return AQH_ValueDataType_Rational;
else if (strcasecmp(s, "AQH_ValueDataType_Uint8")==0)
else if (strcasecmp(s, "uint8")==0)
return AQH_ValueDataType_Uint8;
else if (strcasecmp(s, "AQH_ValueDataType_Uint16")==0)
else if (strcasecmp(s, "uint16")==0)
return AQH_ValueDataType_Uint16;
else if (strcasecmp(s, "AQH_ValueDataType_Uint32")==0)
else if (strcasecmp(s, "uint32")==0)
return AQH_ValueDataType_Uint32;
}
return AQH_ValueDataType_Unknown;
@@ -454,10 +454,10 @@ GWEN_BUFFER *_findFileinPath(const char *pathName, const char *sFilename)
int AQH_ReadDataFromString(int dataType, const char *s, uint16_t *pDataVal, uint16_t *pDataDenom)
{
if (s && *s) {
//DBG_ERROR(NULL, "Reading \"%s\" as datatype %d (%s)", s?s:"<NULL>", dataType, AQH_ValueDataType_toString(dataType));
switch(dataType) {
case AQH_ValueDataType_Int:
case AQH_ValueDataType_Uint8: return _readUint8DataFromString(s, pDataVal, pDataDenom);
case AQH_ValueDataType_Int:
case AQH_ValueDataType_Uint16: return _readUint16DataFromString(s, pDataVal, pDataDenom);
case AQH_ValueDataType_Uint32: return _readUint32DataFromString(s, pDataVal, pDataDenom);
case AQH_ValueDataType_Rational: break;
@@ -472,7 +472,7 @@ int AQH_ReadDataFromString(int dataType, const char *s, uint16_t *pDataVal, uint
int _readUint8DataFromString(const char *s, uint16_t *pDataVal, uint16_t *pDataDenom)
{
unsigned int v=0;
int v=0;
if (1==sscanf(s, "%i", &v)) {
*pDataVal=v & 0xff;
@@ -486,7 +486,7 @@ int _readUint8DataFromString(const char *s, uint16_t *pDataVal, uint16_t *pDataD
int _readUint16DataFromString(const char *s, uint16_t *pDataVal, uint16_t *pDataDenom)
{
unsigned int v=0;
int v=0;
if (1==sscanf(s, "%i", &v)) {
*pDataVal=v & 0xffff;
@@ -500,7 +500,7 @@ int _readUint16DataFromString(const char *s, uint16_t *pDataVal, uint16_t *pData
int _readUint32DataFromString(const char *s, uint16_t *pDataVal, uint16_t *pDataDenom)
{
unsigned long int v=0;
long int v=0;
if (1==sscanf(s, "%li", &v)) {
*pDataVal=(v>>16) & 0xffff;