From ba620f2a08ea6d032cf2ef8db43866da30d27e64 Mon Sep 17 00:00:00 2001 From: AlinMoldovean Date: Fri, 6 Dec 2019 10:24:32 +0200 Subject: [PATCH] Implement import of DataTypeDefinition attribute from NodeSet files. --- Stack/Opc.Ua.Core/Schema/UANodeSet.cs | 364 ++++++++++++++---- Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs | 307 ++++++++++----- .../Opc.Ua.Core/Stack/State/BaseTypeState.cs | 49 --- .../Opc.Ua.Core/Stack/State/DataTypeState.cs | 285 ++++++++++---- Stack/Opc.Ua.Core/Stack/State/NodeState.cs | 17 +- .../Stack/State/NodeStateCollection.cs | 2 +- 6 files changed, 729 insertions(+), 295 deletions(-) diff --git a/Stack/Opc.Ua.Core/Schema/UANodeSet.cs b/Stack/Opc.Ua.Core/Schema/UANodeSet.cs index 0eefb70c54..e69076eee7 100644 --- a/Stack/Opc.Ua.Core/Schema/UANodeSet.cs +++ b/Stack/Opc.Ua.Core/Schema/UANodeSet.cs @@ -13,15 +13,14 @@ // This source code was auto-generated by xsd, Version=4.6.1055.0. // namespace Opc.Ua.Export { - using System.Runtime.Serialization; using System.Xml.Serialization; - - + + /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd", IsNullable=false)] public partial class UANodeSet { @@ -140,12 +139,14 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class ModelTableEntry { + private RolePermission[] rolePermissionsField; + private ModelTableEntry[] requiredModelField; private string modelUriField; @@ -156,6 +157,23 @@ namespace Opc.Ua.Export { private bool publicationDateFieldSpecified; + private byte accessRestrictionsField; + + public ModelTableEntry() { + this.accessRestrictionsField = ((byte)(0)); + } + + /// + [System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)] + public RolePermission[] RolePermissions { + get { + return this.rolePermissionsField; + } + set { + this.rolePermissionsField = value; + } + } + /// [System.Xml.Serialization.XmlElementAttribute("RequiredModel")] public ModelTableEntry[] RequiredModel { @@ -210,13 +228,65 @@ namespace Opc.Ua.Export { this.publicationDateFieldSpecified = value; } } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(typeof(byte), "0")] + public byte AccessRestrictions { + get { + return this.accessRestrictionsField; + } + set { + this.accessRestrictionsField = value; + } + } } /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] + public partial class RolePermission { + + private uint permissionsField; + + private string valueField; + + public RolePermission() { + this.permissionsField = ((uint)(0)); + } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(typeof(uint), "0")] + public uint Permissions { + get { + return this.permissionsField; + } + set { + this.permissionsField = value; + } + } + + /// + [System.Xml.Serialization.XmlTextAttribute()] + public string Value { + get { + return this.valueField; + } + set { + this.valueField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] + [System.SerializableAttribute()] + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class NodeSetStatus { @@ -254,9 +324,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class NodeToDelete { @@ -294,9 +364,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class ReferenceChange { @@ -360,9 +430,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class DataTypeField { @@ -370,8 +440,6 @@ namespace Opc.Ua.Export { private LocalizedText[] descriptionField; - private DataTypeDefinition definitionField; - private string nameField; private string symbolicNameField; @@ -380,6 +448,10 @@ namespace Opc.Ua.Export { private int valueRankField; + private string arrayDimensionsField; + + private uint maxStringLengthField; + private int valueField; private bool isOptionalField; @@ -387,6 +459,8 @@ namespace Opc.Ua.Export { public DataTypeField() { this.dataTypeField = "i=24"; this.valueRankField = -1; + this.arrayDimensionsField = ""; + this.maxStringLengthField = ((uint)(0)); this.valueField = -1; this.isOptionalField = false; } @@ -413,16 +487,6 @@ namespace Opc.Ua.Export { } } - /// - public DataTypeDefinition Definition { - get { - return this.definitionField; - } - set { - this.definitionField = value; - } - } - /// [System.Xml.Serialization.XmlAttributeAttribute()] public string Name { @@ -469,6 +533,30 @@ namespace Opc.Ua.Export { } } + /// + [System.Xml.Serialization.XmlAttributeAttribute(DataType="token")] + [System.ComponentModel.DefaultValueAttribute("")] + public string ArrayDimensions { + get { + return this.arrayDimensionsField; + } + set { + this.arrayDimensionsField = value; + } + } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(typeof(uint), "0")] + public uint MaxStringLength { + get { + return this.maxStringLengthField; + } + set { + this.maxStringLengthField = value; + } + } + /// [System.Xml.Serialization.XmlAttributeAttribute()] [System.ComponentModel.DefaultValueAttribute(-1)] @@ -496,9 +584,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class LocalizedText { @@ -536,9 +624,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class DataTypeDefinition { @@ -546,16 +634,19 @@ namespace Opc.Ua.Export { private string nameField; - private string baseTypeField; - private string symbolicNameField; private bool isUnionField; + private bool isOptionSetField; + + private string baseTypeField; + public DataTypeDefinition() { - this.baseTypeField = ""; this.symbolicNameField = ""; this.isUnionField = false; + this.isOptionSetField = false; + this.baseTypeField = ""; } /// @@ -580,18 +671,6 @@ namespace Opc.Ua.Export { } } - /// - [System.Xml.Serialization.XmlAttributeAttribute()] - [System.ComponentModel.DefaultValueAttribute("")] - public string BaseType { - get { - return this.baseTypeField; - } - set { - this.baseTypeField = value; - } - } - /// [System.Xml.Serialization.XmlAttributeAttribute()] [System.ComponentModel.DefaultValueAttribute("")] @@ -615,13 +694,37 @@ namespace Opc.Ua.Export { this.isUnionField = value; } } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(false)] + public bool IsOptionSet { + get { + return this.isOptionSetField; + } + set { + this.isOptionSetField = value; + } + } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute("")] + public string BaseType { + get { + return this.baseTypeField; + } + set { + this.baseTypeField = value; + } + } } /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAMethodArgument { @@ -653,9 +756,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class StructureTranslationType { @@ -688,9 +791,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class TranslationType { @@ -711,9 +814,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class Reference { @@ -774,9 +877,9 @@ namespace Opc.Ua.Export { [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAVariable))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAObject))] [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UANode { @@ -790,6 +893,8 @@ namespace Opc.Ua.Export { private Reference[] referencesField; + private RolePermission[] rolePermissionsField; + private System.Xml.XmlElement[] extensionsField; private string nodeIdField; @@ -800,11 +905,17 @@ namespace Opc.Ua.Export { private uint userWriteMaskField; + private byte accessRestrictionsField; + private string symbolicNameField; + private ReleaseStatus releaseStatusField; + public UANode() { this.writeMaskField = ((uint)(0)); this.userWriteMaskField = ((uint)(0)); + this.accessRestrictionsField = ((byte)(0)); + this.releaseStatusField = ReleaseStatus.Released; } /// @@ -861,6 +972,17 @@ namespace Opc.Ua.Export { } } + /// + [System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)] + public RolePermission[] RolePermissions { + get { + return this.rolePermissionsField; + } + set { + this.rolePermissionsField = value; + } + } + /// [System.Xml.Serialization.XmlArrayItemAttribute("Extension", IsNullable=false)] public System.Xml.XmlElement[] Extensions { @@ -918,6 +1040,18 @@ namespace Opc.Ua.Export { } } + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(typeof(byte), "0")] + public byte AccessRestrictions { + get { + return this.accessRestrictionsField; + } + set { + this.accessRestrictionsField = value; + } + } + /// [System.Xml.Serialization.XmlAttributeAttribute()] public string SymbolicName { @@ -928,6 +1062,34 @@ namespace Opc.Ua.Export { this.symbolicNameField = value; } } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(ReleaseStatus.Released)] + public ReleaseStatus ReleaseStatus { + get { + return this.releaseStatusField; + } + set { + this.releaseStatusField = value; + } + } + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] + public enum ReleaseStatus { + + /// + Released, + + /// + Draft, + + /// + Deprecated, } /// @@ -936,9 +1098,9 @@ namespace Opc.Ua.Export { [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAVariableType))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAObjectType))] [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAType : UANode { @@ -963,9 +1125,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAReferenceType : UAType { @@ -1003,14 +1165,20 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UADataType : UAType { private DataTypeDefinition definitionField; + private DataTypePurpose purposeField; + + public UADataType() { + this.purposeField = DataTypePurpose.Normal; + } + /// public DataTypeDefinition Definition { get { @@ -1020,13 +1188,41 @@ namespace Opc.Ua.Export { this.definitionField = value; } } + + /// + [System.Xml.Serialization.XmlAttributeAttribute()] + [System.ComponentModel.DefaultValueAttribute(DataTypePurpose.Normal)] + public DataTypePurpose Purpose { + get { + return this.purposeField; + } + set { + this.purposeField = value; + } + } } /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] + [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] + public enum DataTypePurpose { + + /// + Normal, + + /// + ServicesOnly, + + /// + CodeGenerator, + } + + /// + [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAVariableType : UAType { @@ -1093,9 +1289,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAObjectType : UAType { } @@ -1106,9 +1302,9 @@ namespace Opc.Ua.Export { [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAVariable))] [System.Xml.Serialization.XmlIncludeAttribute(typeof(UAObject))] [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAInstance : UANode { @@ -1128,9 +1324,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAView : UAInstance { @@ -1170,9 +1366,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAMethod : UAInstance { @@ -1238,9 +1434,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAVariable : UAInstance { @@ -1266,8 +1462,8 @@ namespace Opc.Ua.Export { this.dataTypeField = "i=24"; this.valueRankField = -1; this.arrayDimensionsField = ""; - this.accessLevelField = ((byte)(1)); - this.userAccessLevelField = ((byte)(1)); + this.accessLevelField = ((uint)(1)); + this.userAccessLevelField = ((uint)(1)); this.minimumSamplingIntervalField = 0D; this.historizingField = false; } @@ -1380,9 +1576,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class UAObject : UAInstance { @@ -1407,9 +1603,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] public partial class NodeIdAlias { @@ -1442,9 +1638,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd", IsNullable=false)] public partial class UANodeSetChanges { @@ -1620,9 +1816,9 @@ namespace Opc.Ua.Export { /// [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.6.1055.0")] - [DataContractAttribute()] + [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] - + [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd")] [System.Xml.Serialization.XmlRootAttribute(Namespace="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd", IsNullable=false)] public partial class UANodeSetChangesStatus { diff --git a/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs b/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs index 086ded3cbd..f49a5882d9 100644 --- a/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs +++ b/Stack/Opc.Ua.Core/Schema/UANodeSetHelpers.cs @@ -19,7 +19,7 @@ using System.Xml.Serialization; namespace Opc.Ua.Export -{ +{ /// /// A set of nodes in an address space. /// @@ -32,7 +32,7 @@ namespace Opc.Ua.Export public UANodeSet() { } - + /// /// Loads a nodeset from a stream. /// @@ -41,7 +41,7 @@ namespace Opc.Ua.Export public static UANodeSet Read(Stream istrm) { StreamReader reader = new StreamReader(istrm); - + try { XmlSerializer serializer = new XmlSerializer(typeof(UANodeSet)); @@ -52,7 +52,7 @@ namespace Opc.Ua.Export reader.Dispose(); } } - + /// /// Write a nodeset to a stream. /// @@ -60,7 +60,7 @@ namespace Opc.Ua.Export public void Write(Stream istrm) { StreamWriter writer = new StreamWriter(istrm, Encoding.UTF8); - + try { XmlSerializer serializer = new XmlSerializer(typeof(UANodeSet)); @@ -123,7 +123,7 @@ namespace Opc.Ua.Export /// /// Adds a node to the set. /// - public void Export(ISystemContext context, NodeState node) + public void Export(ISystemContext context, NodeState node, bool outputRedundantNames =true) { if (node == null) throw new ArgumentNullException("node"); @@ -158,8 +158,7 @@ namespace Opc.Ua.Export value.DataType = ExportAlias(o.DataType, context.NamespaceUris); value.ValueRank = o.ValueRank; value.ArrayDimensions = Export(o.ArrayDimensions); - value.AccessLevel = o.AccessLevel < o.AccessLevelEx ? o.AccessLevelEx : o.AccessLevel; - value.UserAccessLevel = o.UserAccessLevel; + value.AccessLevel = o.AccessLevel; value.MinimumSamplingInterval = o.MinimumSamplingInterval; value.Historizing = o.Historizing; @@ -180,7 +179,7 @@ namespace Opc.Ua.Export value.Value = document.DocumentElement; } - exportedNode = value; + exportedNode = value; break; } @@ -189,7 +188,11 @@ namespace Opc.Ua.Export MethodState o = (MethodState)node; UAMethod value = new UAMethod(); value.Executable = o.Executable; - value.UserExecutable = o.UserExecutable; + + if (o.TypeDefinitionId != o.NodeId) + { + value.MethodDeclarationId = Export(o.TypeDefinitionId, context.NamespaceUris); + } if (o.Parent != null) { @@ -248,7 +251,8 @@ namespace Opc.Ua.Export DataTypeState o = (DataTypeState)node; UADataType value = new UADataType(); value.IsAbstract = o.IsAbstract; - value.Definition = Export(o.Definition, context.NamespaceUris); + value.Definition = Export(o, o.DataTypeDefinition, context.NamespaceUris, outputRedundantNames); + value.Purpose = o.Purpose; exportedNode = value; break; } @@ -258,7 +262,12 @@ namespace Opc.Ua.Export ReferenceTypeState o = (ReferenceTypeState)node; UAReferenceType value = new UAReferenceType(); value.IsAbstract = o.IsAbstract; - value.InverseName = Export(new Opc.Ua.LocalizedText[] { o.InverseName }); + + if (!Opc.Ua.LocalizedText.IsNullOrEmpty(o.InverseName)) + { + value.InverseName = Export(new Opc.Ua.LocalizedText[] { o.InverseName }); + } + value.Symmetric = o.Symmetric; exportedNode = value; break; @@ -267,11 +276,29 @@ namespace Opc.Ua.Export exportedNode.NodeId = Export(node.NodeId, context.NamespaceUris); exportedNode.BrowseName = Export(node.BrowseName, context.NamespaceUris); - exportedNode.DisplayName = Export(new Opc.Ua.LocalizedText[] { node.DisplayName }); - exportedNode.Description = Export(new Opc.Ua.LocalizedText[] { node.Description }); + + if (outputRedundantNames || node.DisplayName.Text != node.BrowseName.Name) + { + exportedNode.DisplayName = Export(new Opc.Ua.LocalizedText[] { node.DisplayName }); + } + else + { + exportedNode.DisplayName = null; + } + + if (node.Description != null && !String.IsNullOrEmpty(node.Description.Text)) + { + exportedNode.Description = Export(new Opc.Ua.LocalizedText[] { node.Description }); + } + else + { + exportedNode.Description = new LocalizedText[0]; + } + + exportedNode.Category = (node.Categories != null && node.Categories.Count > 0) ? new List(node.Categories).ToArray() : null; + exportedNode.ReleaseStatus = node.ReleaseStatus; exportedNode.WriteMask = (uint)node.WriteMask; exportedNode.UserWriteMask = (uint)node.UserWriteMask; - exportedNode.Extensions = node.Extensions; if (!String.IsNullOrEmpty(node.SymbolicName) && node.SymbolicName != node.BrowseName.Name) { @@ -280,11 +307,20 @@ namespace Opc.Ua.Export // export references. INodeBrowser browser = node.CreateBrowser(context, null, null, true, BrowseDirection.Both, null, null, true); - List exportedReferences = new List(); + List exportedReferences = new List(); IReference reference = browser.Next(); while (reference != null) { + if (node.NodeClass == NodeClass.Method) + { + if (!reference.IsInverse && reference.ReferenceTypeId == ReferenceTypeIds.HasTypeDefinition) + { + reference = browser.Next(); + continue; + } + } + Reference exportedReference = new Reference(); exportedReference.ReferenceType = ExportAlias(reference.ReferenceTypeId, context.NamespaceUris); @@ -323,7 +359,7 @@ namespace Opc.Ua.Export for (int ii = 0; ii < children.Count; ii++) { - Export(context, children[ii]); + Export(context, children[ii], outputRedundantNames); } } #endregion @@ -472,14 +508,8 @@ namespace Opc.Ua.Export value.DataType = ImportNodeId(o.DataType, context.NamespaceUris, true); value.ValueRank = o.ValueRank; value.ArrayDimensions = ImportArrayDimensions(o.ArrayDimensions); - value.AccessLevel = (byte)o.AccessLevel; value.AccessLevelEx = o.AccessLevel; - value.UserAccessLevel = (byte)o.UserAccessLevel; - //if UserAccessLevel is not specified but Access level is different from default use AccessLevel for UserAccessLevel - if (o.UserAccessLevel == AccessLevels.CurrentRead && o.AccessLevel > o.UserAccessLevel) - { - value.UserAccessLevel = (byte)o.AccessLevel; - } + value.UserAccessLevel = (byte)(o.AccessLevel & 0xFF); value.MinimumSamplingInterval = o.MinimumSamplingInterval; value.Historizing = o.Historizing; @@ -500,15 +530,8 @@ namespace Opc.Ua.Export UAMethod o = (UAMethod)node; MethodState value = new MethodState(null); value.Executable = o.Executable; - value.UserExecutable = o.UserExecutable; - if (o.MethodDeclarationId == null) - { - value.TypeDefinitionId = ImportNodeId(o.NodeId, context.NamespaceUris, false); - } - else - { - value.TypeDefinitionId = ImportNodeId(o.MethodDeclarationId, context.NamespaceUris, false); - } + value.UserExecutable = o.Executable; + value.TypeDefinitionId = ImportNodeId(o.MethodDeclarationId, context.NamespaceUris, true); importedNode = value; break; } @@ -557,7 +580,23 @@ namespace Opc.Ua.Export UADataType o = (UADataType)node; DataTypeState value = new DataTypeState(); value.IsAbstract = o.IsAbstract; - value.Definition = Import(o.Definition, context.NamespaceUris); + Opc.Ua.DataTypeDefinition dataTypeDefinition = Import(o, o.Definition, context.NamespaceUris); + value.DataTypeDefinition = new ExtensionObject(dataTypeDefinition); + value.Purpose = o.Purpose; + value.DataTypeModifier = DataTypeModifier.None; + + if (o.Definition != null) + { + if (o.Definition.IsOptionSet) + { + value.DataTypeModifier = DataTypeModifier.OptionSet; + } + else if (o.Definition.IsUnion) + { + value.DataTypeModifier = DataTypeModifier.Union; + } + } + importedNode = value; break; } @@ -577,14 +616,17 @@ namespace Opc.Ua.Export importedNode.NodeId = ImportNodeId(node.NodeId, context.NamespaceUris, false); importedNode.BrowseName = ImportQualifiedName(node.BrowseName, context.NamespaceUris); importedNode.DisplayName = Import(node.DisplayName); + + if (importedNode.DisplayName == null) + { + importedNode.DisplayName = new Ua.LocalizedText(importedNode.BrowseName.Name); + } + importedNode.Description = Import(node.Description); + importedNode.Categories = (node.Category != null && node.Category.Length > 0) ? node.Category : null; + importedNode.ReleaseStatus = node.ReleaseStatus; importedNode.WriteMask = (AttributeWriteMask)node.WriteMask; importedNode.UserWriteMask = (AttributeWriteMask)node.UserWriteMask; - if (importedNode.UserWriteMask == AttributeWriteMask.None) - { - importedNode.UserWriteMask = importedNode.WriteMask; - } - importedNode.Extensions = node.Extensions; if (!String.IsNullOrEmpty(node.SymbolicName)) { @@ -803,48 +845,96 @@ namespace Opc.Ua.Export /// /// Exports a DataTypeDefinition /// - private Opc.Ua.Export.DataTypeDefinition Export(Opc.Ua.UADataTypeDefinition source, NamespaceTable namespaceUris) + private Opc.Ua.Export.DataTypeDefinition Export( + DataTypeState dataType, + ExtensionObject source, + NamespaceTable namespaceUris, + bool outputRedundantNames) { - if (source == null) + if (source == null || source.Body == null) { return null; } DataTypeDefinition definition = new DataTypeDefinition(); - definition.Name = Export(source.Name, namespaceUris); - definition.SymbolicName = source.SymbolicName; - definition.BaseType = Export(source.BaseType, namespaceUris); - - if (source.Fields != null) + if (outputRedundantNames || dataType.BrowseName != null) { - List fields = new List(); + definition.Name = Export(dataType.BrowseName, namespaceUris); + } - foreach (DataTypeDefinitionField field in source.Fields) + if (dataType.BrowseName.Name != dataType.SymbolicName) + { + definition.SymbolicName = dataType.SymbolicName; + } + + switch (dataType.DataTypeModifier) + { + case DataTypeModifier.Union: { definition.IsUnion = true; break; } + case DataTypeModifier.OptionSet: { definition.IsOptionSet = true; break; } + } + + StructureDefinition structureDefinition = source.Body as StructureDefinition; + + if (structureDefinition != null) + { + if (structureDefinition.StructureType == StructureType.Union) { - Opc.Ua.Export.DataTypeField output = new Opc.Ua.Export.DataTypeField(); - - output.Name = field.Name; - output.SymbolicName = field.SymbolicName; - output.Description = Export(new Opc.Ua.LocalizedText[] { field.Description }); - - if (NodeId.IsNull(field.DataType)) - { - output.DataType = Export(DataTypeIds.BaseDataType, namespaceUris); - } - else - { - output.DataType = Export(field.DataType, namespaceUris); - } - - output.ValueRank = field.ValueRank; - output.Value = field.Value; - output.Definition = Export(field.Definition, namespaceUris); - - fields.Add(output); + definition.IsUnion = true; } - definition.Field = fields.ToArray(); + + if (structureDefinition.Fields != null) + { + List fields = new List(); + + foreach (StructureField field in structureDefinition.Fields) + { + Opc.Ua.Export.DataTypeField output = new Opc.Ua.Export.DataTypeField(); + + output.Name = field.Name; + output.Description = Export(new Opc.Ua.LocalizedText[] { field.Description }); + + if (NodeId.IsNull(field.DataType)) + { + output.DataType = Export(DataTypeIds.BaseDataType, namespaceUris); + } + else + { + output.DataType = Export(field.DataType, namespaceUris); + } + + output.ValueRank = field.ValueRank; + + fields.Add(output); + } + + definition.Field = fields.ToArray(); + } + } + + EnumDefinition enumDefinition = source.Body as EnumDefinition; + + if (enumDefinition != null) + { + if (enumDefinition.Fields != null) + { + List fields = new List(); + + foreach (EnumField field in enumDefinition.Fields) + { + Opc.Ua.Export.DataTypeField output = new Opc.Ua.Export.DataTypeField(); + + output.Name = field.Name; + output.Description = Export(new Opc.Ua.LocalizedText[] { field.Description }); + output.ValueRank = ValueRanks.Scalar; + output.Value = (int)field.Value; + + fields.Add(output); + } + + definition.Field = fields.ToArray(); + } } return definition; @@ -853,39 +943,76 @@ namespace Opc.Ua.Export /// /// Imports a DataTypeDefinition /// - private Opc.Ua.UADataTypeDefinition Import(Opc.Ua.Export.DataTypeDefinition source, NamespaceTable namespaceUris) + private Opc.Ua.DataTypeDefinition Import(UADataType dataType, Opc.Ua.Export.DataTypeDefinition source, NamespaceTable namespaceUris) { if (source == null) { return null; } - Opc.Ua.UADataTypeDefinition definition = new Opc.Ua.UADataTypeDefinition(); - - definition.Name = ImportQualifiedName(source.Name, namespaceUris); - definition.SymbolicName = source.SymbolicName; - definition.BaseType = ImportQualifiedName(source.BaseType, namespaceUris); + Opc.Ua.DataTypeDefinition definition = null; if (source.Field != null) { - List fields = new List(); - - foreach (DataTypeField field in source.Field) + // check if definition is for enumeration or structure. + bool isStructure = Array.Exists(source.Field, delegate (DataTypeField fieldLookup) { - Opc.Ua.DataTypeDefinitionField output = new Opc.Ua.DataTypeDefinitionField(); + return fieldLookup.Value == -1; + }); - output.Name = field.Name; - output.SymbolicName = field.SymbolicName; - output.Description = Import(field.Description); - output.DataType = ImportNodeId(field.DataType, namespaceUris, true); - output.ValueRank = field.ValueRank; - output.Value = field.Value; - output.Definition = Import(field.Definition, namespaceUris); + if (isStructure) + { + StructureDefinition structureDefinition = new StructureDefinition(); + structureDefinition.BaseDataType = ImportNodeId(source.BaseType, namespaceUris, true); - fields.Add(output); + if (source.IsUnion) + { + structureDefinition.StructureType = StructureType.Union; + } + + if (source.Field != null) + { + List fields = new List(); + + foreach (DataTypeField field in source.Field) + { + StructureField output = new StructureField(); + + output.Name = field.Name; + output.Description = Import(field.Description); + output.DataType = ImportNodeId(field.DataType, namespaceUris, true); + output.ValueRank = field.ValueRank; + + fields.Add(output); + } + + structureDefinition.Fields = fields.ToArray(); + } + definition = structureDefinition; } + else + { + EnumDefinition enumDefinition = new EnumDefinition(); + if (source.Field != null) + { + List fields = new List(); - definition.Fields = fields; + foreach (DataTypeField field in source.Field) + { + EnumField output = new EnumField(); + + output.Name = field.Name; + output.DisplayName = Import(field.DisplayName); + output.Description = Import(field.Description); + output.Value = field.Value; + + fields.Add(output); + } + + enumDefinition.Fields = fields.ToArray(); + } + definition = enumDefinition; + } } return definition; @@ -1213,12 +1340,12 @@ namespace Opc.Ua.Export { return UInt16.MaxValue; } - + // find or append uri. return serverUris.GetIndexOrAppend(this.ServerUris[serverIndex - 1]); } #endregion - + #region Private Fields #endregion } diff --git a/Stack/Opc.Ua.Core/Stack/State/BaseTypeState.cs b/Stack/Opc.Ua.Core/Stack/State/BaseTypeState.cs index d1c7091744..9df3c14ff1 100644 --- a/Stack/Opc.Ua.Core/Stack/State/BaseTypeState.cs +++ b/Stack/Opc.Ua.Core/Stack/State/BaseTypeState.cs @@ -123,27 +123,6 @@ namespace Opc.Ua m_isAbstract = value; } } - - /// - ///Provides the metadata and encoding information for custom DataTypes. - /// - public ExtensionObject DataTypeDefinition - { - get - { - return m_dataTypeDefinition; - } - - set - { - if (m_dataTypeDefinition != value) - { - ChangeMasks |= NodeStateChangeMasks.NonValue; - } - - m_dataTypeDefinition = value; - } - } #endregion #region Event Callbacks @@ -156,16 +135,6 @@ namespace Opc.Ua /// Raised when the IsAbstract attribute is written. /// public NodeAttributeEventHandler OnWriteIsAbstract; - - /// - /// Raised when the DataTypeDefinition attribute is read. - /// - public NodeAttributeEventHandler OnReadDataTypeDefinition; - - /// - /// Raised when the DataTypeDefinition attribute is written. - /// - public NodeAttributeEventHandler OnWriteDataTypeDefinition; #endregion #region Serialization Functions @@ -353,23 +322,6 @@ namespace Opc.Ua return result; } - - case Attributes.DataTypeDefinition: - { - ExtensionObject dataTypeDefinition = m_dataTypeDefinition; - - if (OnReadDataTypeDefinition != null) - { - result = OnReadDataTypeDefinition(context, this, ref dataTypeDefinition); - } - - if (ServiceResult.IsGood(result)) - { - value = dataTypeDefinition; - } - - return result; - } } return base.ReadNonValueAttribute(context, attributeId, ref value); @@ -460,7 +412,6 @@ namespace Opc.Ua #region Private Fields private NodeId m_superTypeId; private bool m_isAbstract; - private ExtensionObject m_dataTypeDefinition; #endregion } } diff --git a/Stack/Opc.Ua.Core/Stack/State/DataTypeState.cs b/Stack/Opc.Ua.Core/Stack/State/DataTypeState.cs index a7c3a72330..61b88133cb 100644 --- a/Stack/Opc.Ua.Core/Stack/State/DataTypeState.cs +++ b/Stack/Opc.Ua.Core/Stack/State/DataTypeState.cs @@ -15,7 +15,7 @@ using System.Collections.Generic; namespace Opc.Ua { - /// + /// /// The base class for all reference type nodes. /// public class DataTypeState : BaseTypeState @@ -42,78 +42,223 @@ namespace Opc.Ua /// /// The abstract definition of the data type. /// - public UADataTypeDefinition Definition { get; set; } + public ExtensionObject DataTypeDefinition + { + get + { + return m_dataTypeDefinition; + } + + set + { + if (m_dataTypeDefinition != value) + { + ChangeMasks |= NodeStateChangeMasks.NonValue; + } + + m_dataTypeDefinition = value; + } + } + + /// + /// A modifier applied to the datatype. + /// + public DataTypeModifier DataTypeModifier { get; set; } + + /// + /// The purpose of the data type. + /// + public Opc.Ua.Export.DataTypePurpose Purpose { get; set; } + #region Serialization Functions + /// + /// Saves the attributes from the stream. + /// + /// The context for the system being accessed. + /// The encoder wrapping the stream to write. + public override void Save(ISystemContext context, XmlEncoder encoder) + { + base.Save(context, encoder); + + encoder.PushNamespace(Namespaces.OpcUaXsd); + + if (m_dataTypeDefinition != null) + { + encoder.WriteExtensionObject("DataTypeDefinition", m_dataTypeDefinition); + } + + encoder.PopNamespace(); + } + + /// + /// Updates the attributes from the stream. + /// + /// The context for the system being accessed. + /// The decoder wrapping the stream to read. + public override void Update(ISystemContext context, XmlDecoder decoder) + { + base.Update(context, decoder); + + decoder.PushNamespace(Namespaces.OpcUaXsd); + + if (decoder.Peek("DataTypeDefinition")) + { + DataTypeDefinition = decoder.ReadExtensionObject("DataTypeDefinition"); + } + + decoder.PopNamespace(); + } + + /// + /// Returns a mask which indicates which attributes have non-default value. + /// + /// The context for the system being accessed. + /// A mask the specifies the available attributes. + public override AttributesToSave GetAttributesToSave(ISystemContext context) + { + AttributesToSave attributesToSave = base.GetAttributesToSave(context); + + if (m_dataTypeDefinition != null) + { + attributesToSave |= AttributesToSave.DataTypeDefinition; + } + + return attributesToSave; + } + + /// + /// Saves object in an binary stream. + /// + /// The context for the system being accessed. + /// The encoder to write to. + /// The masks indicating what attributes to write. + public override void Save(ISystemContext context, BinaryEncoder encoder, AttributesToSave attributesToSave) + { + base.Save(context, encoder, attributesToSave); + + if ((attributesToSave & AttributesToSave.DataTypeDefinition) != 0) + { + encoder.WriteExtensionObject(null, DataTypeDefinition); + } + } + + /// + /// Updates the specified context. + /// + /// The context. + /// The decoder. + /// The attributes to load. + public override void Update(ISystemContext context, BinaryDecoder decoder, AttributesToSave attributesToLoad) + { + base.Update(context, decoder, attributesToLoad); + + if ((attributesToLoad & AttributesToSave.DataTypeDefinition) != 0) + { + DataTypeDefinition = decoder.ReadExtensionObject(null); + } + } + #endregion + + #region Event Callbacks + /// + /// Raised when the DataTypeDefinition attribute is read. + /// + public NodeAttributeEventHandler OnReadDataTypeDefinition; + + /// + /// Raised when the DataTypeDefinition attribute is written. + /// + public NodeAttributeEventHandler OnWriteDataTypeDefinition; + #endregion + + #region Read Support Functions + /// + /// Reads the value for DataTypeDefinition attribute. + /// + protected override ServiceResult ReadNonValueAttribute( + ISystemContext context, + uint attributeId, + ref object value) + { + ServiceResult result = null; + + switch (attributeId) + { + case Attributes.DataTypeDefinition: + { + ExtensionObject dataTypeDefinition = m_dataTypeDefinition; + + if (OnReadDataTypeDefinition != null) + { + result = OnReadDataTypeDefinition(context, this, ref dataTypeDefinition); + } + + if (ServiceResult.IsGood(result)) + { + value = dataTypeDefinition; + } + + return result; + } + } + + return base.ReadNonValueAttribute(context, attributeId, ref value); + } + #endregion + + #region Write Support Functions + /// + /// Write the value for DataTypeDefinition attribute. + /// + protected override ServiceResult WriteNonValueAttribute( + ISystemContext context, + uint attributeId, + object value) + { + ServiceResult result = null; + + switch (attributeId) + { + case Attributes.DataTypeDefinition: + { + ExtensionObject dataTypeDefinition = value as ExtensionObject; + + if ((WriteMask & AttributeWriteMask.DataTypeDefinition) == 0) + { + return StatusCodes.BadNotWritable; + } + + if (OnWriteDataTypeDefinition != null) + { + result = OnWriteDataTypeDefinition(context, this, ref dataTypeDefinition); + } + + if (ServiceResult.IsGood(result)) + { + m_dataTypeDefinition = dataTypeDefinition; + } + + return result; + } + } + + return base.WriteNonValueAttribute(context, attributeId, value); + } + #endregion + #region Private Fields + private ExtensionObject m_dataTypeDefinition; + #endregion } - /// - /// Defines an abstract description of a type. - /// - public class UADataTypeDefinition + /// + public enum DataTypeModifier { - /// - /// The name of the type. - /// - public QualifiedName Name { get; set; } + /// + None = 0, - /// - /// The symbolic name (if the name can't be used as a program symbol). - /// - public string SymbolicName { get; set; } + /// + Union = 1, - /// - /// The qualified name of the base type. - /// - public QualifiedName BaseType { get; set; } - - /// - /// The description of the data type. - /// - public LocalizedText Description { get; set; } - - /// - /// The fields in structure. - /// - public List Fields { get; set; } + /// + OptionSet = 2 } - - /// - /// Defines a field within an abstract definition of a data type. - /// - public class DataTypeDefinitionField - { - /// - /// The name of the field. - /// - public string Name { get; set; } - - /// - /// The symbolic name (if the name can't be used as a program symbol). - /// - public string SymbolicName { get; set; } - - /// - /// The data type of the field. - /// - public NodeId DataType { get; set; } - - /// - /// The value rank for the field. - /// - public int ValueRank { get; set; } - - /// - /// The description of the field. - /// - public LocalizedText Description { get; set; } - - /// - /// A nested description of a structured field. - /// - public UADataTypeDefinition Definition { get; set; } - - /// - /// The value of an enumerated field. - /// - public int Value { get; set; } - } -} +} \ No newline at end of file diff --git a/Stack/Opc.Ua.Core/Stack/State/NodeState.cs b/Stack/Opc.Ua.Core/Stack/State/NodeState.cs index 2015b8b4b2..104f82834f 100644 --- a/Stack/Opc.Ua.Core/Stack/State/NodeState.cs +++ b/Stack/Opc.Ua.Core/Stack/State/NodeState.cs @@ -445,6 +445,16 @@ namespace Opc.Ua m_extensions = value; } } + + /// + /// The categories assigned to the node. + /// + public IList Categories { get; set; } + + /// + /// The release status for the node. + /// + public Opc.Ua.Export.ReleaseStatus ReleaseStatus { get; set; } #endregion #region Serialization Methods @@ -793,7 +803,12 @@ namespace Opc.Ua /// /// The StatusCode associated with the Value attribute. /// - StatusCode = 0x20000000 + StatusCode = 0x20000000, + + /// + /// The DataTypeDefinition attribute of a DataType Node. + /// + DataTypeDefinition = 0x40000000 } #endregion diff --git a/Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs b/Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs index 2056b6bc85..9f477bcc5d 100644 --- a/Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs +++ b/Stack/Opc.Ua.Core/Stack/State/NodeStateCollection.cs @@ -170,7 +170,7 @@ namespace Opc.Ua for (int ii = 0; ii < this.Count; ii++) { - nodeSet.Export(context, this[ii]); + nodeSet.Export(context, this[ii], true); } nodeSet.Write(ostrm);