How to retrieve BuitInType from custom DataType

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
hartmut_irs
Jr. Member
Jr. Member
Posts: 4
Joined: 26 Oct 2018, 08:31

How to retrieve BuitInType from custom DataType

Post by hartmut_irs »

We are storing the BuiltInType internally for each node object, in order to use it in e.g. for read or write purposes.
Actually we are using a Siemens OPC which holds customized DataTypes.

Our approach to get the BuiltInType is working for DataTypes defined in the namespace of opcfoundation (BuiltInTypes), but not for the types defined in the Siemens-namespace.

For instance there is a DataType ("STRING", ns=3, Identifier=3014) derived from String (ns=0, Identifier=12).
What we want is to get the Supertype (BuiltInType "String", Identifier=12) but the method GetBuiltInType returns Null. Probably because it is a custom type.

Code: Select all

ReadValueIdCollection coNodes = new ReadValueIdCollection();
coNodes.Add(new ReadValueId() { NodeId = gNode.NodeId, AttributeId = Attributes.DataType });
coNodes.Add(new ReadValueId() { NodeId = gNode.NodeId, AttributeId = Attributes.ArrayDimensions });
List<DataValue> coResults = gSession.Read(coNodes, 0, TimestampsToReturn.Both, new RequestSettings() { OperationTimeout = 10000 });

if (StatusCode.IsGood(coResults[0].StatusCode))
{
    gNode.Type = TypeUtils.GetBuiltInType((NodeId)coResults[0].WrappedValue.Value);
    gNode.ArrayDimensions = coResults[1].WrappedValue.ToUInt32Array();
}
Is there a possibility to get the Supertype of this customized type?
The tool UaExpert shows for that Type as References a Supertype "String" exactly what we need.
Unfortunately I couldn't find any hint or code example concerning this issue.

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

Re: How to retrieve BuitInType from custom DataType

Post by Support Team »

Hello,

There is also an overload of GetBuiltInType using a ITypeTable as second argument. Please use this method for getting BuiltInType. You should use Session.Cache as typeTable.
Best regards
Unified Automation Support Team

melieager
Jr. Member
Jr. Member
Posts: 1
Joined: 24 Aug 2019, 08:13

Re: How to retrieve BuitInType from custom DataType

Post by melieager »

thanks
You need to retrieve some built in types that have all affection on it that was good. I have to prepare report on this so I hire top essay writer these all are fiction among other effects they all are professionals on it that was good to read over.

Post Reply