aqhome-react: rename "name" to "typeName" in AQHREACT_Unit

This commit is contained in:
Martin Preuss
2024-04-18 23:28:27 +02:00
parent e486a7e69d
commit 7ee7edffec
16 changed files with 39 additions and 39 deletions

View File

@@ -180,7 +180,7 @@ AQHREACT_UNIT *AqHomeReact_CreateUnitByName(AQHOME_REACT *aqh, const char *unitT
else {
const char *s;
s=AQHREACT_Unit_GetName(unit);
s=AQHREACT_Unit_GetTypeName(unit);
if (!(s && *s && strcasecmp(s, unitType)==0)) {
DBG_ERROR(NULL, "ERROR: Network file for type \"%s\" contains type \"%s\" instead", unitType, s?s:"<no name>");
AQHREACT_Unit_free(unit);

View File

@@ -78,7 +78,7 @@ void AQHREACT_Link_Dump(const AQHREACT_LINK *lnk, GWEN_BUFFER *buf, int indent)
const char *unitId;
const char *portName;
unitName=(lnk->targetUnit)?AQHREACT_Unit_GetName(lnk->targetUnit):NULL;
unitName=(lnk->targetUnit)?AQHREACT_Unit_GetTypeName(lnk->targetUnit):NULL;
unitId=(lnk->targetUnit)?AQHREACT_Unit_GetId(lnk->targetUnit):NULL;
portName=(lnk->targetPort)?AQHREACT_Port_GetName(lnk->targetPort):NULL;
if (indent)

View File

@@ -44,7 +44,7 @@ void AQHREACT_Unit_free(AQHREACT_UNIT *unit)
if (unit) {
GWEN_LIST_FINI(AQHREACT_UNIT, unit);
GWEN_INHERIT_FINI(AQHREACT_UNIT, unit);
free(unit->name);
free(unit->typeName);
free(unit->description);
AQHREACT_Port_List_free(unit->outputPortList);
AQHREACT_Port_List_free(unit->inputPortList);
@@ -62,18 +62,18 @@ AQHOME_REACT *AQHREACT_Unit_GetAqHomeReact(const AQHREACT_UNIT *unit)
const char *AQHREACT_Unit_GetName(const AQHREACT_UNIT *unit)
const char *AQHREACT_Unit_GetTypeName(const AQHREACT_UNIT *unit)
{
return unit?unit->name:NULL;
return unit?unit->typeName:NULL;
}
void AQHREACT_Unit_SetName(AQHREACT_UNIT *unit, const char *s)
void AQHREACT_Unit_SetTypeName(AQHREACT_UNIT *unit, const char *s)
{
if (unit) {
free(unit->name);
unit->name=s?strdup(s):NULL;
free(unit->typeName);
unit->typeName=s?strdup(s):NULL;
}
}
@@ -314,7 +314,7 @@ double AQHREACT_Unit_GetParamValueDouble(const AQHREACT_UNIT *unit, const char *
return AQHREACT_Param_GetDoubleValue(param);
}
else {
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not DOUBLE", (unit->name)?unit->name:"<unnamed>", paramName);
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not DOUBLE", (unit->typeName)?unit->typeName:"<unnamed>", paramName);
}
}
@@ -333,11 +333,11 @@ void AQHREACT_Unit_SetParamValueDouble(AQHREACT_UNIT *unit, const char *paramNam
AQHREACT_Param_SetDoubleValue(param, val);
}
else {
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not DOUBLE", (unit->name)?unit->name:"<unnamed>", paramName);
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not DOUBLE", (unit->typeName)?unit->typeName:"<unnamed>", paramName);
}
}
else {
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->name)?unit->name:"<unnamed>");
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->typeName)?unit->typeName:"<unnamed>");
}
}
@@ -353,11 +353,11 @@ const char *AQHREACT_Unit_GetParamValueString(const AQHREACT_UNIT *unit, const c
return AQHREACT_Param_GetStringValue(param);
}
else {
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not STRING", (unit->name)?unit->name:"<unnamed>", paramName);
DBG_INFO(NULL, "Datatype for param \"%s/%s\" is not STRING", (unit->typeName)?unit->typeName:"<unnamed>", paramName);
}
}
else {
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->name)?unit->name:"<unnamed>");
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->typeName)?unit->typeName:"<unnamed>");
}
return defVal;
@@ -379,7 +379,7 @@ void AQHREACT_Unit_SetParamValueString(AQHREACT_UNIT *unit, const char *paramNam
}
}
else {
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->name)?unit->name:"<unnamed>");
DBG_INFO(NULL, "Param \"%s\" not found in unit %s", paramName, (unit->typeName)?unit->typeName:"<unnamed>");
}
}
@@ -603,7 +603,7 @@ void AQHREACT_Unit_Dump(const AQHREACT_UNIT *unit, GWEN_BUFFER *buf, int indent)
if (indent)
GWEN_Buffer_FillWithBytes(buf, ' ', indent);
GWEN_Buffer_AppendArgs(buf, "type.......: %s\n", (unit->name)?(unit->name):"<empty>");
GWEN_Buffer_AppendArgs(buf, "type.......: %s\n", (unit->typeName)?(unit->typeName):"<empty>");
if (indent)
GWEN_Buffer_FillWithBytes(buf, ' ', indent);

View File

@@ -44,8 +44,8 @@ void AQHREACT_Unit_free(AQHREACT_UNIT *unit);
AQHOME_REACT *AQHREACT_Unit_GetAqHomeReact(const AQHREACT_UNIT *unit);
const char *AQHREACT_Unit_GetName(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_SetName(AQHREACT_UNIT *unit, const char *s);
const char *AQHREACT_Unit_GetTypeName(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_SetTypeName(AQHREACT_UNIT *unit, const char *s);
const char *AQHREACT_Unit_GetDescription(const AQHREACT_UNIT *unit);
void AQHREACT_Unit_SetDescription(AQHREACT_UNIT *unit, const char *s);

View File

@@ -18,7 +18,7 @@ struct AQHREACT_UNIT {
GWEN_LIST_ELEMENT(AQHREACT_UNIT)
AQHOME_REACT *aqHomeReact;
char *name;
char *typeName;
char *description;
char *id;

View File

@@ -47,7 +47,7 @@ AQHREACT_UNIT *AqHomeReact_UnitHighPass_new(AQHOME_REACT *aqh)
AQHREACT_PARAM *param;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "highpass");
AQHREACT_Unit_SetTypeName(unit, "highpass");
AQHREACT_Unit_SetDescription(unit, "Highpass filter for data");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);

View File

@@ -51,7 +51,7 @@ AQHREACT_UNIT *AqHomeReact_UnitOr_new(AQHOME_REACT *aqh)
AQHREACT_UNIT *unit;
unit=_unitLogical_new(aqh);
AQHREACT_Unit_SetName(unit, "or");
AQHREACT_Unit_SetTypeName(unit, "or");
AQHREACT_Unit_SetDescription(unit, "Logical OR inputs");
AQHREACT_Unit_SetProcessFn(unit, _cbProcessOr);
return unit;
@@ -64,7 +64,7 @@ AQHREACT_UNIT *AqHomeReact_UnitAnd_new(AQHOME_REACT *aqh)
AQHREACT_UNIT *unit;
unit=_unitLogical_new(aqh);
AQHREACT_Unit_SetName(unit, "and");
AQHREACT_Unit_SetTypeName(unit, "and");
AQHREACT_Unit_SetDescription(unit, "Logical AND inputs");
AQHREACT_Unit_SetProcessFn(unit, _cbProcessAnd);
return unit;
@@ -77,7 +77,7 @@ AQHREACT_UNIT *AqHomeReact_UnitXor_new(AQHOME_REACT *aqh)
AQHREACT_UNIT *unit;
unit=_unitLogical_new(aqh);
AQHREACT_Unit_SetName(unit, "xor");
AQHREACT_Unit_SetTypeName(unit, "xor");
AQHREACT_Unit_SetDescription(unit, "Logical XOR inputs");
AQHREACT_Unit_SetProcessFn(unit, _cbProcessXor);
return unit;
@@ -92,7 +92,7 @@ AQHREACT_UNIT *_unitLogical_new(AQHOME_REACT *aqh)
AQHREACT_PORT *port;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "or");
AQHREACT_Unit_SetTypeName(unit, "or");
AQHREACT_Unit_SetDescription(unit, "Logical OR inputs");
AQHREACT_Unit_SetNextInputPortId(unit, AQHOMEREACT_UNIT_LOGICAL_INSLOT_AUTOINPUT); /* for auto-gen multi-slots */

View File

@@ -47,7 +47,7 @@ AQHREACT_UNIT *AqHomeReact_UnitLowPass_new(AQHOME_REACT *aqh)
AQHREACT_PARAM *param;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "lowpass");
AQHREACT_Unit_SetTypeName(unit, "lowpass");
AQHREACT_Unit_SetDescription(unit, "Lowpass filter for data");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);

View File

@@ -186,7 +186,7 @@ AQHREACT_UNIT *AqHomeReact_UnitModule_fromXml(AQHOME_REACT *aqh, GWEN_XMLNODE *x
unit=AqHomeReact_UnitModule_new(aqh);
xunit=(AQHREACT_UNIT_MODULE*)GWEN_INHERIT_GETDATA(AQHREACT_UNIT, AQHREACT_UNIT_MODULE, unit);
AQHREACT_Unit_SetName(unit, GWEN_XMLNode_GetProperty(xmlNode, "type", NULL));
AQHREACT_Unit_SetTypeName(unit, GWEN_XMLNode_GetProperty(xmlNode, "type", NULL));
AQHREACT_Unit_SetId(unit, GWEN_XMLNode_GetProperty(xmlNode, "id", NULL));
_readProxyFromXml(xmlNode, xunit->paramProxyList, "paramdefs", "param", "name", "targetModule", "targetParam");
@@ -245,7 +245,7 @@ AQHREACT_PARAM *_cbGetParamByName(const AQHREACT_UNIT *unit, const char *paramNa
{
AQHREACT_UNIT_MODULE *xunit;
DBG_INFO(NULL, "Looking for param \"%s\" in proxy descr of module \"%s\"", paramName, AQHREACT_Unit_GetName(unit));
DBG_INFO(NULL, "Looking for param \"%s\" in proxy descr of module \"%s\"", paramName, AQHREACT_Unit_GetTypeName(unit));
xunit=(AQHREACT_UNIT_MODULE*)GWEN_INHERIT_GETDATA(AQHREACT_UNIT, AQHREACT_UNIT_MODULE, unit);
if (xunit) {
const MODULE_PROXY_DESCR *pd;
@@ -253,7 +253,7 @@ AQHREACT_PARAM *_cbGetParamByName(const AQHREACT_UNIT *unit, const char *paramNa
pd=ModuleProxyDescr_List_FindByName(xunit->paramProxyList, paramName);
if (pd) {
DBG_INFO(NULL, "Found proxydescr for param (-> %s:%s)",
(pd->targetObjectPtr)?AQHREACT_Unit_GetName(pd->targetObjectPtr):"<no unit>",
(pd->targetObjectPtr)?AQHREACT_Unit_GetTypeName(pd->targetObjectPtr):"<no unit>",
(pd->targetName)?(pd->targetName):"<no param>");
return AQHREACT_Unit_GetParamByName(pd->targetObjectPtr, pd->targetName);
}
@@ -433,7 +433,7 @@ int _finishParams(AQHREACT_UNIT *unit)
const char *unitName;
xunit=(AQHREACT_UNIT_MODULE*)GWEN_INHERIT_GETDATA(AQHREACT_UNIT, AQHREACT_UNIT_MODULE, unit);
unitName=AQHREACT_Unit_GetName(unit);
unitName=AQHREACT_Unit_GetTypeName(unit);
pd=ModuleProxyDescr_List_First(xunit->paramProxyList);
while(pd) {
AQHREACT_UNIT *subUnit;
@@ -561,7 +561,7 @@ int _readParamFromXml(AQHREACT_UNIT *unit, GWEN_XMLNODE *paramNode)
} /* if value */
}
else {
DBG_ERROR(NULL, "No param name \"%s\" in unit \"%s\"", paramName, AQHREACT_Unit_GetName(unit));
DBG_ERROR(NULL, "No param name \"%s\" in unit \"%s\"", paramName, AQHREACT_Unit_GetTypeName(unit));
return GWEN_ERROR_BAD_DATA;
}
}
@@ -616,7 +616,7 @@ int _readLinksFromXml(AQHOME_REACT *aqh, AQHREACT_UNIT *unit, GWEN_XMLNODE *xmlN
rv=_readLinkFromXml(aqh, unit, n);
if (rv<0) {
DBG_ERROR(NULL, "Error reading link in net \"%s\" (%d)", AQHREACT_Unit_GetName(unit), rv);
DBG_ERROR(NULL, "Error reading link in net \"%s\" (%d)", AQHREACT_Unit_GetTypeName(unit), rv);
return GWEN_ERROR_BAD_DATA;
}
n=GWEN_XMLNode_FindNextTag(n, "link", NULL, NULL);
@@ -644,7 +644,7 @@ int _readLinkFromXml(AQHOME_REACT *aqh, AQHREACT_UNIT *unit, GWEN_XMLNODE *linkN
receivingUnitName && *receivingUnitName && receivingPortName && *receivingPortName)) {
DBG_ERROR(NULL,
"Link in net \"%s\" needs properties sourceUnit, sourcePort, targetUnit and targetPort",
AQHREACT_Unit_GetName(unit));
AQHREACT_Unit_GetTypeName(unit));
return GWEN_ERROR_BAD_DATA;
}
@@ -689,7 +689,7 @@ int _linkFromThisModulesInput(AQHOME_REACT *aqh,
emittingPort=AQHREACT_Unit_GetInputPortByName(unit, emittingPortName); /* find in modules input port list! */
if (emittingPort==NULL) {
DBG_ERROR(NULL, "Target port \"%s\" not found for source unit \"%s\"", emittingPortName, AQHREACT_Unit_GetName(unit));
DBG_ERROR(NULL, "Target port \"%s\" not found for source unit \"%s\"", emittingPortName, AQHREACT_Unit_GetTypeName(unit));
return GWEN_ERROR_NOT_FOUND;
}

View File

@@ -43,7 +43,7 @@ AQHREACT_UNIT *AqHomeReact_UnitPassthrough_new(AQHOME_REACT *aqh)
AQHREACT_PORT *port;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "passthrough");
AQHREACT_Unit_SetTypeName(unit, "passthrough");
AQHREACT_Unit_SetDescription(unit, "Generic passthrough unit");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);

View File

@@ -73,7 +73,7 @@ AQHREACT_UNIT *AqHomeReact_UnitStabilize_new(AQHOME_REACT *aqh)
GWEN_NEW_OBJECT(AQHREACT_UNIT_STABILIZE, xunit);
GWEN_INHERIT_SETDATA(AQHREACT_UNIT, AQHREACT_UNIT_STABILIZE, unit, xunit, _freeData);
AQHREACT_Unit_SetName(unit, "stabilize");
AQHREACT_Unit_SetTypeName(unit, "stabilize");
AQHREACT_Unit_SetDescription(unit, "Stabilize signal changes (only propagate changes stable for some time)");
AQHREACT_Unit_SetProcessFn(unit, _cbProcessFn);

View File

@@ -22,7 +22,7 @@ AQHREACT_UNIT *AqHomeReact_UnitTimer_new(AQHOME_REACT *aqh)
AQHREACT_UNIT *unit;
unit=AqHomeReact_UnitPassthrough_new(aqh);
AQHREACT_Unit_SetName(unit, "timer");
AQHREACT_Unit_SetTypeName(unit, "timer");
AQHREACT_Unit_SetDescription(unit, "Periodically generate a timer signal");
return unit;

View File

@@ -48,7 +48,7 @@ AQHREACT_UNIT *AqHomeReact_UnitValueFilter_new(AQHOME_REACT *aqh)
AQHREACT_PARAM *param;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "valuefilter");
AQHREACT_Unit_SetTypeName(unit, "valuefilter");
AQHREACT_Unit_SetDescription(unit, "Filter values received from unit VarChanges by value path");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);

View File

@@ -54,7 +54,7 @@ AQHREACT_UNIT *AqHomeReact_UnitValueSet_new(AQHOME_REACT *aqh)
AQHREACT_PARAM *param;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "valueset");
AQHREACT_Unit_SetTypeName(unit, "valueset");
AQHREACT_Unit_SetDescription(unit, "Set value by value path");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);

View File

@@ -22,7 +22,7 @@ AQHREACT_UNIT *AqHomeReact_UnitVarChanges_new(AQHOME_REACT *aqh)
AQHREACT_UNIT *unit;
unit=AqHomeReact_UnitPassthrough_new(aqh);
AQHREACT_Unit_SetName(unit, "varchanges");
AQHREACT_Unit_SetTypeName(unit, "varchanges");
AQHREACT_Unit_SetDescription(unit, "Propagates changes of values on the data server");
return unit;

View File

@@ -48,7 +48,7 @@ AQHREACT_UNIT *AqHomeReact_UnitZeroPosNegString_new(AQHOME_REACT *aqh)
AQHREACT_PARAM *param;
unit=AQHREACT_Unit_new(aqh);
AQHREACT_Unit_SetName(unit, "zeroPosNegString");
AQHREACT_Unit_SetTypeName(unit, "zeroPosNegString");
AQHREACT_Unit_SetDescription(unit, "Translate double value into strings for zero, positive, negative values");
AQHREACT_Unit_SetInputDataFn(unit, _cbInputData);