Change AQH_Value field NameForDriver to Name and make it only contain the value name.

Previously this field contained the device name, too. This would make it
necessary for drivers to remove the device part of the name when SetValue
is called. Instead the device name is now always provided by the driver in
the appropriate field DeviceNameForDriver.
This commit is contained in:
Martin Preuss
2023-10-03 13:31:05 +02:00
parent 253b3862da
commit 17d4ce5125
7 changed files with 15 additions and 28 deletions

View File

@@ -52,7 +52,6 @@ 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, uint32_t uid, int valueId, const char *valuePath);
static void _setDeviceName(AQH_VALUE *value, uint32_t uid);
@@ -174,14 +173,14 @@ void _publishDouble(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUn
arrayToSend[1]=u.i;
value=AQH_Value_new();
_setValueNameForDriver(value, uid, valueId, valuePath);
AQH_Value_SetName(value, valuePath);
AQH_Value_SetValueUnits(value, valueUnits);
AQH_Value_SetValueType(value, 0);
_setDeviceName(value, uid);
pubMsg=AQH_MultiDataDataIpcMsg_new(AQH_MSGTYPE_IPC_DATA_UPDATEDATA, value, arrayToSend, 1);
if (pubMsg) {
DBG_INFO(AQH_LOGDOMAIN, "BROKER PUBLISH %s: %f", AQH_Value_GetNameForDriver(value), v);
DBG_INFO(AQH_LOGDOMAIN, "BROKER PUBLISH %s: %f", AQH_Value_GetName(value), v);
GWEN_MsgEndpoint_AddSendMessage(aqh->brokerEndpoint, pubMsg);
}
AQH_Value_free(value);
@@ -189,21 +188,6 @@ void _publishDouble(AQHOMED *aqh, uint32_t uid, int valueId, const char *valueUn
void _setValueNameForDriver(AQH_VALUE *value, uint32_t uid, int valueId, const char *valuePath)
{
GWEN_BUFFER *buf;
buf=GWEN_Buffer_new(0, 64, 0, 1);
if (valueId>0)
GWEN_Buffer_AppendArgs(buf, "%08x/%d/%s", uid, valueId, valuePath);
else
GWEN_Buffer_AppendArgs(buf, "%08x/%s", uid, valuePath);
AQH_Value_SetNameForDriver(value, GWEN_Buffer_GetStart(buf));
GWEN_Buffer_free(buf);
}
void _setDeviceName(AQH_VALUE *value, uint32_t uid)
{
GWEN_BUFFER *buf;