Partially reverted one of the last commits to correct created value name.

This commit is contained in:
Martin Preuss
2023-10-03 13:47:19 +02:00
parent f56b25d06f
commit 0740378ad8

View File

@@ -52,6 +52,7 @@ static void _processSendStatsMessage(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _processRecvStatsMessage(AQHOMED *aqh, const GWEN_MSG *nodeMsg);
static void _publishInt(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUnits, const char *valuePath, int v);
static void _publishDouble(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUnits, const char *valuePath, double v);
static void _setValueNameForDriver(AQH_VALUE *value, int valueId, const char *valuePath);
static void _setDeviceName(AQH_VALUE *value, uint32_t uid);
@@ -173,7 +174,7 @@ void _publishDouble(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUn
arrayToSend[1]=u.i;
value=AQH_Value_new();
AQH_Value_SetName(value, valuePath);
_setValueNameForDriver(value, valueId, valuePath);
AQH_Value_SetValueUnits(value, valueUnits);
AQH_Value_SetValueType(value, 0);
_setDeviceName(value, uid);
@@ -188,6 +189,21 @@ void _publishDouble(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUn
void _setValueNameForDriver(AQH_VALUE *value, int valueId, const char *valuePath)
{
GWEN_BUFFER *buf;
buf=GWEN_Buffer_new(0, 64, 0, 1);
if (valueId>0)
GWEN_Buffer_AppendArgs(buf, "%d/%s", valueId, valuePath);
else
GWEN_Buffer_AppendArgs(buf, "%s", valuePath);
AQH_Value_SetName(value, GWEN_Buffer_GetStart(buf));
GWEN_Buffer_free(buf);
}
void _setDeviceName(AQH_VALUE *value, uint32_t uid)
{
GWEN_BUFFER *buf;
@@ -200,6 +216,3 @@ void _setDeviceName(AQH_VALUE *value, uint32_t uid)