renamed deviceNameForDriver of AQH_VALUE and nameForDriver of AQH_DEVICE.
This commit is contained in:
@@ -107,18 +107,18 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
||||
const char *serviceName;
|
||||
AQH_VALUE *v;
|
||||
GWEN_BUFFER *buf;
|
||||
const char *nameForDriver;
|
||||
const char *deviceNameForDriver;
|
||||
const char *valueName;
|
||||
const char *deviceName;
|
||||
|
||||
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
||||
nameForDriver=AQH_Value_GetName(valueTemplate);
|
||||
deviceNameForDriver=AQH_Value_GetDeviceNameForDriver(valueTemplate);
|
||||
valueName=AQH_Value_GetName(valueTemplate);
|
||||
deviceName=AQH_Value_GetDeviceName(valueTemplate);
|
||||
|
||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||
if (deviceNameForDriver && *deviceNameForDriver)
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceNameForDriver, nameForDriver);
|
||||
if (deviceName && *deviceName)
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceName, valueName);
|
||||
else
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", nameForDriver);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", valueName);
|
||||
|
||||
v=AQH_Storage_GetValueByNameForSystem(aqh->storage, GWEN_Buffer_GetStart(buf));
|
||||
if (v==NULL) {
|
||||
@@ -126,7 +126,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
||||
AQH_DEVICE *device;
|
||||
|
||||
DBG_INFO(AQH_LOGDOMAIN, "Creating value \"%s\"", GWEN_Buffer_GetStart(buf));
|
||||
device=(deviceNameForDriver && *deviceNameForDriver)?_getOrCreateDeviceForDriver(aqh, epDriver, deviceNameForDriver):NULL;
|
||||
device=(deviceName && *deviceName)?_getOrCreateDeviceForDriver(aqh, epDriver, deviceName):NULL;
|
||||
|
||||
v=AQH_Value_new();
|
||||
AQH_Value_SetDriver(v, serviceName);
|
||||
@@ -137,7 +137,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
||||
AQH_Value_SetTimestampCreation(v, (uint64_t) time(NULL));
|
||||
if (device) {
|
||||
AQH_Value_SetDeviceNameForSystem(v, AQH_Device_GetNameForSystem(device));
|
||||
AQH_Value_SetDeviceNameForDriver(v, AQH_Device_GetNameForDriver(device));
|
||||
AQH_Value_SetDeviceName(v, AQH_Device_GetName(device));
|
||||
}
|
||||
AQH_Storage_AddValue(aqh->storage, v);
|
||||
}
|
||||
@@ -153,7 +153,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
||||
|
||||
|
||||
|
||||
AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epDriver, const char *nameForDriver)
|
||||
AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epDriver, const char *deviceName)
|
||||
{
|
||||
const char *serviceName;
|
||||
AQH_DEVICE *device;
|
||||
@@ -162,7 +162,7 @@ AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epD
|
||||
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
||||
|
||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", nameForDriver);
|
||||
GWEN_Buffer_AppendArgs(buf, "%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceName);
|
||||
|
||||
device=AQH_Storage_GetDeviceByNameForSystem(aqh->storage, GWEN_Buffer_GetStart(buf));
|
||||
if (device==NULL) {
|
||||
@@ -170,7 +170,7 @@ AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epD
|
||||
DBG_INFO(AQH_LOGDOMAIN, "Creating device \"%s\"", GWEN_Buffer_GetStart(buf));
|
||||
device=AQH_Device_new();
|
||||
AQH_Device_SetDriver(device, serviceName);
|
||||
AQH_Device_SetNameForDriver(device, nameForDriver);
|
||||
AQH_Device_SetName(device, deviceName);
|
||||
AQH_Device_SetNameForSystem(device, GWEN_Buffer_GetStart(buf));
|
||||
AQH_Device_SetTimestampCreation(device, (uint64_t) time(NULL));
|
||||
AQH_Storage_AddDevice(aqh->storage, device);
|
||||
|
||||
@@ -194,7 +194,7 @@ void _setDeviceName(AQH_VALUE *value, uint32_t uid)
|
||||
|
||||
buf=GWEN_Buffer_new(0, 64, 0, 1);
|
||||
GWEN_Buffer_AppendArgs(buf, "%08x", uid);
|
||||
AQH_Value_SetDeviceNameForDriver(value, GWEN_Buffer_GetStart(buf));
|
||||
AQH_Value_SetDeviceName(value, GWEN_Buffer_GetStart(buf));
|
||||
GWEN_Buffer_free(buf);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<flags>own</flags>
|
||||
</member>
|
||||
|
||||
<member name="nameForDriver" type="char_ptr" maxlen="128">
|
||||
<member name="name" type="char_ptr" maxlen="128">
|
||||
<default>0</default>
|
||||
<preset>0</preset>
|
||||
<access>public</access>
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
<flags>own with_getbymember</flags>
|
||||
</member>
|
||||
|
||||
<member name="deviceNameForDriver" type="char_ptr" maxlen="128">
|
||||
<member name="deviceName" type="char_ptr" maxlen="128">
|
||||
<default>0</default>
|
||||
<preset>0</preset>
|
||||
<access>public</access>
|
||||
|
||||
@@ -189,7 +189,7 @@ void _writeValueFieldsAsTagsToBuffer(const AQH_VALUE *value, GWEN_BUFFER *buf)
|
||||
|
||||
GWEN_Tag16_WriteUint64TagToBuffer(AQH_IPCDATA_VALUE_TAGS_TIMEOFCREATION, AQH_Value_GetTimestampCreation(value), buf);
|
||||
|
||||
s=AQH_Value_GetDeviceNameForDriver(value);
|
||||
s=AQH_Value_GetDeviceName(value);
|
||||
if (s && *s)
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_VALUE_TAGS_DEVFORDRIVER, s, buf);
|
||||
|
||||
@@ -339,7 +339,7 @@ AQH_VALUE *_readValueFromTag(const uint8_t *ptr, uint32_t len)
|
||||
break;
|
||||
case AQH_IPCDATA_VALUE_TAGS_DEVFORDRIVER:
|
||||
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
||||
AQH_Value_SetDeviceNameForDriver(value, s);
|
||||
AQH_Value_SetDeviceName(value, s);
|
||||
free(s);
|
||||
break;
|
||||
case AQH_IPCDATA_VALUE_TAGS_DEVFORSYSTEM:
|
||||
@@ -376,7 +376,7 @@ void _writeDeviceFieldsAsTagsToBuffer(const AQH_DEVICE *device, GWEN_BUFFER *buf
|
||||
if (s && *s)
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_DEVICE_TAGS_ROOMNAME, s, buf);
|
||||
|
||||
s=AQH_Device_GetNameForDriver(device);
|
||||
s=AQH_Device_GetName(device);
|
||||
if (s && *s)
|
||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_DEVICE_TAGS_NAMEFORDRIVER, s, buf);
|
||||
|
||||
@@ -441,7 +441,7 @@ AQH_DEVICE *_readDeviceFromTag(const uint8_t *ptr, uint32_t len)
|
||||
break;
|
||||
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORDRIVER:
|
||||
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
||||
AQH_Device_SetNameForDriver(device, s);
|
||||
AQH_Device_SetName(device, s);
|
||||
free(s);
|
||||
break;
|
||||
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORSYSTEM:
|
||||
|
||||
Reference in New Issue
Block a user