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

@@ -121,7 +121,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriver(AQHOME_DATA *aqh,
DBG_INFO(AQH_LOGDOMAIN, "Creating value \"%s\"", GWEN_Buffer_GetStart(buf));
v=AQH_Value_new();
AQH_Value_SetDriver(v, serviceName);
AQH_Value_SetNameForDriver(v, nameForDriver);
AQH_Value_SetName(v, nameForDriver);
AQH_Value_SetNameForSystem(v, GWEN_Buffer_GetStart(buf));
AQH_Value_SetValueUnits(v, units);
AQH_Value_SetValueType(v, valueType);
@@ -150,11 +150,14 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
const char *deviceNameForDriver;
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
nameForDriver=AQH_Value_GetNameForDriver(valueTemplate);
nameForDriver=AQH_Value_GetName(valueTemplate);
deviceNameForDriver=AQH_Value_GetDeviceNameForDriver(valueTemplate);
buf=GWEN_Buffer_new(0, 256, 0, 1);
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", nameForDriver);
if (deviceNameForDriver && *deviceNameForDriver)
GWEN_Buffer_AppendArgs(buf, "%s/%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceNameForDriver, nameForDriver);
else
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", nameForDriver);
v=AQH_Storage_GetValueByNameForSystem(aqh->storage, GWEN_Buffer_GetStart(buf));
if (v==NULL) {
@@ -166,7 +169,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
v=AQH_Value_new();
AQH_Value_SetDriver(v, serviceName);
AQH_Value_SetNameForDriver(v, AQH_Value_GetNameForDriver(valueTemplate));
AQH_Value_SetName(v, AQH_Value_GetName(valueTemplate));
AQH_Value_SetNameForSystem(v, GWEN_Buffer_GetStart(buf));
AQH_Value_SetValueUnits(v, AQH_Value_GetValueUnits(valueTemplate));
AQH_Value_SetValueType(v, AQH_Value_GetValueType(valueTemplate));