PropertyType with DataType=String as a Children of the Server Object causes an error in the code.

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
ChSch
Hero Member
Hero Member
Posts: 21
Joined: 07 Oct 2012, 11:18

PropertyType with DataType=String as a Children of the Server Object causes an error in the code.

Post by ChSch »

I added the PropertyType "StringProperty" as a children of the Server Object. The generated code can't compile because there is an error in the create-instances part for the PropertyType in the nodemanager.cpp file.

I think the last two parameters in the "addNodeAndReference" method are wrong.
If I correct them like this, I can compile but the DataType is still wrong.

addNodeAndReference(UaNodeId(OpcUaId_Server, NodeManagerRoot::getTypeNamespace()), pVariableType, referenceTypeId);

I hope you have a hint what I can do.

This is the wrong part in the nodemanager.cpp file.

------------------------------------------------------------
// Create instances
// ------------------------------------------------------------
UaVariant defaultValue;
defaultValue.setInt32(0);
UaNodeId parentNodeId;
UaNodeId referenceTypeId;

OpcUa::BaseObjectType* pObjectType;
OpcUa::BaseVariableType* pVariableType;
UaNode* pParent;


//StringProperty
pVariableType = new OpcUa::PropertyType(UaNodeId(6002, getTypeNamespace()), "StringProperty",getTypeNamespace(), defaultValue, 3, this);
referenceTypeId = UaNodeId(46, NodeManagerRoot::getTypeNamespace());
addNodeAndReference(UaNodeId(OpcUaId_Server, NodeManagerRoot::getTypeNamespace()), pStringProperty, );

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re:PropertyType with DataType=String as a Children of the Server Object causes an error in the code.

Post by Support Team »

Hi,

Thank you reporting this bug.
To set the DataType correctly you have to set the default value like this:

Code: Select all

defaultValue.setString("");
Best Regards,
Unified Automation Support Team
Best regards
Unified Automation Support Team

ChSch
Hero Member
Hero Member
Posts: 21
Joined: 07 Oct 2012, 11:18

Re:PropertyType with DataType=String as a Children of the Server Object causes an error in the code.

Post by ChSch »

Thanks for that hint. It works for me.
But there is no way to fix this during the modelling process in the uaModeler?

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re:PropertyType with DataType=String as a Children of the Server Object causes an error in the code.

Post by Support Team »

UaModeler 1.2 will fix this. There is no way to fix this during the modelling process in the UaModeler 1.1.
Best regards
Unified Automation Support Team

Post Reply