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;
|
const char *serviceName;
|
||||||
AQH_VALUE *v;
|
AQH_VALUE *v;
|
||||||
GWEN_BUFFER *buf;
|
GWEN_BUFFER *buf;
|
||||||
const char *nameForDriver;
|
const char *valueName;
|
||||||
const char *deviceNameForDriver;
|
const char *deviceName;
|
||||||
|
|
||||||
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
||||||
nameForDriver=AQH_Value_GetName(valueTemplate);
|
valueName=AQH_Value_GetName(valueTemplate);
|
||||||
deviceNameForDriver=AQH_Value_GetDeviceNameForDriver(valueTemplate);
|
deviceName=AQH_Value_GetDeviceName(valueTemplate);
|
||||||
|
|
||||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
||||||
if (deviceNameForDriver && *deviceNameForDriver)
|
if (deviceName && *deviceName)
|
||||||
GWEN_Buffer_AppendArgs(buf, "%s/%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceNameForDriver, nameForDriver);
|
GWEN_Buffer_AppendArgs(buf, "%s/%s/%s", (serviceName && *serviceName)?serviceName:"unknown", deviceName, valueName);
|
||||||
else
|
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));
|
v=AQH_Storage_GetValueByNameForSystem(aqh->storage, GWEN_Buffer_GetStart(buf));
|
||||||
if (v==NULL) {
|
if (v==NULL) {
|
||||||
@@ -126,7 +126,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
|||||||
AQH_DEVICE *device;
|
AQH_DEVICE *device;
|
||||||
|
|
||||||
DBG_INFO(AQH_LOGDOMAIN, "Creating value \"%s\"", GWEN_Buffer_GetStart(buf));
|
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();
|
v=AQH_Value_new();
|
||||||
AQH_Value_SetDriver(v, serviceName);
|
AQH_Value_SetDriver(v, serviceName);
|
||||||
@@ -137,7 +137,7 @@ AQH_VALUE *AqHomeData_GetOrCreateValueForDriverWithTemplate(AQHOME_DATA *aqh,
|
|||||||
AQH_Value_SetTimestampCreation(v, (uint64_t) time(NULL));
|
AQH_Value_SetTimestampCreation(v, (uint64_t) time(NULL));
|
||||||
if (device) {
|
if (device) {
|
||||||
AQH_Value_SetDeviceNameForSystem(v, AQH_Device_GetNameForSystem(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);
|
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;
|
const char *serviceName;
|
||||||
AQH_DEVICE *device;
|
AQH_DEVICE *device;
|
||||||
@@ -162,7 +162,7 @@ AQH_DEVICE *_getOrCreateDeviceForDriver(AQHOME_DATA *aqh, GWEN_MSG_ENDPOINT *epD
|
|||||||
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
serviceName=AQH_IpcEndpoint_GetServiceName(epDriver);
|
||||||
|
|
||||||
buf=GWEN_Buffer_new(0, 256, 0, 1);
|
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));
|
device=AQH_Storage_GetDeviceByNameForSystem(aqh->storage, GWEN_Buffer_GetStart(buf));
|
||||||
if (device==NULL) {
|
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));
|
DBG_INFO(AQH_LOGDOMAIN, "Creating device \"%s\"", GWEN_Buffer_GetStart(buf));
|
||||||
device=AQH_Device_new();
|
device=AQH_Device_new();
|
||||||
AQH_Device_SetDriver(device, serviceName);
|
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_SetNameForSystem(device, GWEN_Buffer_GetStart(buf));
|
||||||
AQH_Device_SetTimestampCreation(device, (uint64_t) time(NULL));
|
AQH_Device_SetTimestampCreation(device, (uint64_t) time(NULL));
|
||||||
AQH_Storage_AddDevice(aqh->storage, device);
|
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);
|
buf=GWEN_Buffer_new(0, 64, 0, 1);
|
||||||
GWEN_Buffer_AppendArgs(buf, "%08x", uid);
|
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);
|
GWEN_Buffer_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<flags>own</flags>
|
<flags>own</flags>
|
||||||
</member>
|
</member>
|
||||||
|
|
||||||
<member name="nameForDriver" type="char_ptr" maxlen="128">
|
<member name="name" type="char_ptr" maxlen="128">
|
||||||
<default>0</default>
|
<default>0</default>
|
||||||
<preset>0</preset>
|
<preset>0</preset>
|
||||||
<access>public</access>
|
<access>public</access>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
<flags>own with_getbymember</flags>
|
<flags>own with_getbymember</flags>
|
||||||
</member>
|
</member>
|
||||||
|
|
||||||
<member name="deviceNameForDriver" type="char_ptr" maxlen="128">
|
<member name="deviceName" type="char_ptr" maxlen="128">
|
||||||
<default>0</default>
|
<default>0</default>
|
||||||
<preset>0</preset>
|
<preset>0</preset>
|
||||||
<access>public</access>
|
<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);
|
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)
|
if (s && *s)
|
||||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_VALUE_TAGS_DEVFORDRIVER, s, buf);
|
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;
|
break;
|
||||||
case AQH_IPCDATA_VALUE_TAGS_DEVFORDRIVER:
|
case AQH_IPCDATA_VALUE_TAGS_DEVFORDRIVER:
|
||||||
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
||||||
AQH_Value_SetDeviceNameForDriver(value, s);
|
AQH_Value_SetDeviceName(value, s);
|
||||||
free(s);
|
free(s);
|
||||||
break;
|
break;
|
||||||
case AQH_IPCDATA_VALUE_TAGS_DEVFORSYSTEM:
|
case AQH_IPCDATA_VALUE_TAGS_DEVFORSYSTEM:
|
||||||
@@ -376,7 +376,7 @@ void _writeDeviceFieldsAsTagsToBuffer(const AQH_DEVICE *device, GWEN_BUFFER *buf
|
|||||||
if (s && *s)
|
if (s && *s)
|
||||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_DEVICE_TAGS_ROOMNAME, s, buf);
|
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_DEVICE_TAGS_ROOMNAME, s, buf);
|
||||||
|
|
||||||
s=AQH_Device_GetNameForDriver(device);
|
s=AQH_Device_GetName(device);
|
||||||
if (s && *s)
|
if (s && *s)
|
||||||
GWEN_Tag16_WriteStringTagToBuffer(AQH_IPCDATA_DEVICE_TAGS_NAMEFORDRIVER, s, buf);
|
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;
|
break;
|
||||||
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORDRIVER:
|
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORDRIVER:
|
||||||
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
s=GWEN_Tag16_GetTagDataAsNewString(tag, NULL);
|
||||||
AQH_Device_SetNameForDriver(device, s);
|
AQH_Device_SetName(device, s);
|
||||||
free(s);
|
free(s);
|
||||||
break;
|
break;
|
||||||
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORSYSTEM:
|
case AQH_IPCDATA_DEVICE_TAGS_NAMEFORSYSTEM:
|
||||||
|
|||||||
Reference in New Issue
Block a user