I am doing an evaluation of the latest C++ SDK/UaModeler and I am running into the following issue:
I created a subclass from AnalogItemType called MyCoolTemperatureType and overridden the EngineeringUnits property. I entered the "degrees celcius" engineering unit as value of the overriden EngineeringUnits property.
The goal is to already provide the degrees C value in the Type so that it is pre-filled when instantiating a MyCoolTemperatureType variable.
However the codegen C++ template 1.7 does not seem to take the default value into account. The resulting code just enters an emtpy default value:
Code: Select all
...
UaVariant defaultValue;
...
// Mandatory variable EngineeringUnits
UaEUInformation valEngineeringUnits;
valEngineeringUnits.toVariant(defaultValue);
s_pEngineeringUnits = new OpcUa::PropertyType(UaNodeId(msgcatalogId_MyCoolTemperatureType_EngineeringUnits, nsTypeIdx), "EngineeringUnits", NodeManagerRoot::getTypeNamespace(), defaultValue, 1, pTypeNodeConfig);
s_pEngineeringUnits->setDataType(UaNodeId(OpcUaId_EUInformation));
s_pEngineeringUnits->setModellingRuleId(OpcUaId_ModellingRule_Mandatory);
s_pEngineeringUnits->setValueRank(-1);
addStatus = pTypeNodeConfig->addNodeAndReference(pVariableType, s_pEngineeringUnits, OpcUaId_HasProperty);
UA_ASSERT(addStatus.isGood());
Code: Select all
...
pEngineeringUnits->setDataTypeId(OpcUaId_EUInformation);
{
UaEUInformation valEngineeringUnits = UaEUInformation(
"http://www.opcfoundation.org/UA/units/un/cefact",
4408652,
UaLocalizedText("", "\302\260C"),
UaLocalizedText("", "degree Celsius"));
valEngineeringUnits.toVariant(defaultValue);
}
pEngineeringUnits->setValue(defaultValue);
...
Is there a explanation/workaround for this?
Best regards,
Maarten