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();
}
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.