mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-24 11:01:55 +08:00
Implement import of DataTypeDefinition attribute from NodeSet files.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)]
|
||||
public RolePermission[] RolePermissions {
|
||||
get {
|
||||
return this.rolePermissionsField;
|
||||
}
|
||||
set {
|
||||
this.rolePermissionsField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlElementAttribute("RequiredModel")]
|
||||
public ModelTableEntry[] RequiredModel {
|
||||
@@ -210,13 +228,65 @@ namespace Opc.Ua.Export {
|
||||
this.publicationDateFieldSpecified = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(typeof(byte), "0")]
|
||||
public byte AccessRestrictions {
|
||||
get {
|
||||
return this.accessRestrictionsField;
|
||||
}
|
||||
set {
|
||||
this.accessRestrictionsField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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));
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(typeof(uint), "0")]
|
||||
public uint Permissions {
|
||||
get {
|
||||
return this.permissionsField;
|
||||
}
|
||||
set {
|
||||
this.permissionsField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlTextAttribute()]
|
||||
public string Value {
|
||||
get {
|
||||
return this.valueField;
|
||||
}
|
||||
set {
|
||||
this.valueField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public DataTypeDefinition Definition {
|
||||
get {
|
||||
return this.definitionField;
|
||||
}
|
||||
set {
|
||||
this.definitionField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
public string Name {
|
||||
@@ -469,6 +533,30 @@ namespace Opc.Ua.Export {
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute(DataType="token")]
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
public string ArrayDimensions {
|
||||
get {
|
||||
return this.arrayDimensionsField;
|
||||
}
|
||||
set {
|
||||
this.arrayDimensionsField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(typeof(uint), "0")]
|
||||
public uint MaxStringLength {
|
||||
get {
|
||||
return this.maxStringLengthField;
|
||||
}
|
||||
set {
|
||||
this.maxStringLengthField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(-1)]
|
||||
@@ -496,9 +584,9 @@ namespace Opc.Ua.Export {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 = "";
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
@@ -580,18 +671,6 @@ namespace Opc.Ua.Export {
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
public string BaseType {
|
||||
get {
|
||||
return this.baseTypeField;
|
||||
}
|
||||
set {
|
||||
this.baseTypeField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
@@ -615,13 +694,37 @@ namespace Opc.Ua.Export {
|
||||
this.isUnionField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(false)]
|
||||
public bool IsOptionSet {
|
||||
get {
|
||||
return this.isOptionSetField;
|
||||
}
|
||||
set {
|
||||
this.isOptionSetField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute("")]
|
||||
public string BaseType {
|
||||
get {
|
||||
return this.baseTypeField;
|
||||
}
|
||||
set {
|
||||
this.baseTypeField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
@@ -861,6 +972,17 @@ namespace Opc.Ua.Export {
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlArrayItemAttribute(IsNullable=false)]
|
||||
public RolePermission[] RolePermissions {
|
||||
get {
|
||||
return this.rolePermissionsField;
|
||||
}
|
||||
set {
|
||||
this.rolePermissionsField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlArrayItemAttribute("Extension", IsNullable=false)]
|
||||
public System.Xml.XmlElement[] Extensions {
|
||||
@@ -918,6 +1040,18 @@ namespace Opc.Ua.Export {
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(typeof(byte), "0")]
|
||||
public byte AccessRestrictions {
|
||||
get {
|
||||
return this.accessRestrictionsField;
|
||||
}
|
||||
set {
|
||||
this.accessRestrictionsField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
public string SymbolicName {
|
||||
@@ -928,6 +1062,34 @@ namespace Opc.Ua.Export {
|
||||
this.symbolicNameField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(ReleaseStatus.Released)]
|
||||
public ReleaseStatus ReleaseStatus {
|
||||
get {
|
||||
return this.releaseStatusField;
|
||||
}
|
||||
set {
|
||||
this.releaseStatusField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
Released,
|
||||
|
||||
/// <remarks/>
|
||||
Draft,
|
||||
|
||||
/// <remarks/>
|
||||
Deprecated,
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
@@ -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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public DataTypeDefinition Definition {
|
||||
get {
|
||||
@@ -1020,13 +1188,41 @@ namespace Opc.Ua.Export {
|
||||
this.definitionField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[System.Xml.Serialization.XmlAttributeAttribute()]
|
||||
[System.ComponentModel.DefaultValueAttribute(DataTypePurpose.Normal)]
|
||||
public DataTypePurpose Purpose {
|
||||
get {
|
||||
return this.purposeField;
|
||||
}
|
||||
set {
|
||||
this.purposeField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
Normal,
|
||||
|
||||
/// <remarks/>
|
||||
ServicesOnly,
|
||||
|
||||
/// <remarks/>
|
||||
CodeGenerator,
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
/// <remarks/>
|
||||
[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 {
|
||||
|
||||
@@ -19,7 +19,7 @@ using System.Xml.Serialization;
|
||||
|
||||
|
||||
namespace Opc.Ua.Export
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// A set of nodes in an address space.
|
||||
/// </summary>
|
||||
@@ -32,7 +32,7 @@ namespace Opc.Ua.Export
|
||||
public UANodeSet()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Loads a nodeset from a stream.
|
||||
/// </summary>
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Write a nodeset to a stream.
|
||||
/// </summary>
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// Adds a node to the set.
|
||||
/// </summary>
|
||||
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<string>(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<Reference> exportedReferences = new List<Reference>();
|
||||
List<Reference> exportedReferences = new List<Reference>();
|
||||
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
|
||||
/// <summary>
|
||||
/// Exports a DataTypeDefinition
|
||||
/// </summary>
|
||||
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<Opc.Ua.Export.DataTypeField> fields = new List<DataTypeField>();
|
||||
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<Opc.Ua.Export.DataTypeField> fields = new List<DataTypeField>();
|
||||
|
||||
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<Opc.Ua.Export.DataTypeField> fields = new List<DataTypeField>();
|
||||
|
||||
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
|
||||
/// <summary>
|
||||
/// Imports a DataTypeDefinition
|
||||
/// </summary>
|
||||
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<Opc.Ua.DataTypeDefinitionField> fields = new List<Opc.Ua.DataTypeDefinitionField>();
|
||||
|
||||
foreach (DataTypeField field in source.Field)
|
||||
// check if definition is for enumeration or structure.
|
||||
bool isStructure = Array.Exists<DataTypeField>(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<StructureField> fields = new List<StructureField>();
|
||||
|
||||
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<EnumField> fields = new List<EnumField>();
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@@ -123,27 +123,6 @@ namespace Opc.Ua
|
||||
m_isAbstract = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///Provides the metadata and encoding information for custom DataTypes.
|
||||
/// </summary>
|
||||
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.
|
||||
/// </summary>
|
||||
public NodeAttributeEventHandler<bool> OnWriteIsAbstract;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the DataTypeDefinition attribute is read.
|
||||
/// </summary>
|
||||
public NodeAttributeEventHandler<ExtensionObject> OnReadDataTypeDefinition;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the DataTypeDefinition attribute is written.
|
||||
/// </summary>
|
||||
public NodeAttributeEventHandler<ExtensionObject> 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Opc.Ua
|
||||
{
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// The base class for all reference type nodes.
|
||||
/// </summary>
|
||||
public class DataTypeState : BaseTypeState
|
||||
@@ -42,78 +42,223 @@ namespace Opc.Ua
|
||||
/// <summary>
|
||||
/// The abstract definition of the data type.
|
||||
/// </summary>
|
||||
public UADataTypeDefinition Definition { get; set; }
|
||||
public ExtensionObject DataTypeDefinition
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_dataTypeDefinition;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (m_dataTypeDefinition != value)
|
||||
{
|
||||
ChangeMasks |= NodeStateChangeMasks.NonValue;
|
||||
}
|
||||
|
||||
m_dataTypeDefinition = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A modifier applied to the datatype.
|
||||
/// </summary>
|
||||
public DataTypeModifier DataTypeModifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The purpose of the data type.
|
||||
/// </summary>
|
||||
public Opc.Ua.Export.DataTypePurpose Purpose { get; set; }
|
||||
#region Serialization Functions
|
||||
/// <summary>
|
||||
/// Saves the attributes from the stream.
|
||||
/// </summary>
|
||||
/// <param name="context">The context for the system being accessed.</param>
|
||||
/// <param name="encoder">The encoder wrapping the stream to write.</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the attributes from the stream.
|
||||
/// </summary>
|
||||
/// <param name="context">The context for the system being accessed.</param>
|
||||
/// <param name="decoder">The decoder wrapping the stream to read.</param>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a mask which indicates which attributes have non-default value.
|
||||
/// </summary>
|
||||
/// <param name="context">The context for the system being accessed.</param>
|
||||
/// <returns>A mask the specifies the available attributes.</returns>
|
||||
public override AttributesToSave GetAttributesToSave(ISystemContext context)
|
||||
{
|
||||
AttributesToSave attributesToSave = base.GetAttributesToSave(context);
|
||||
|
||||
if (m_dataTypeDefinition != null)
|
||||
{
|
||||
attributesToSave |= AttributesToSave.DataTypeDefinition;
|
||||
}
|
||||
|
||||
return attributesToSave;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves object in an binary stream.
|
||||
/// </summary>
|
||||
/// <param name="context">The context for the system being accessed.</param>
|
||||
/// <param name="encoder">The encoder to write to.</param>
|
||||
/// <param name="attributesToSave">The masks indicating what attributes to write.</param>
|
||||
public override void Save(ISystemContext context, BinaryEncoder encoder, AttributesToSave attributesToSave)
|
||||
{
|
||||
base.Save(context, encoder, attributesToSave);
|
||||
|
||||
if ((attributesToSave & AttributesToSave.DataTypeDefinition) != 0)
|
||||
{
|
||||
encoder.WriteExtensionObject(null, DataTypeDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the specified context.
|
||||
/// </summary>
|
||||
/// <param name="context">The context.</param>
|
||||
/// <param name="decoder">The decoder.</param>
|
||||
/// <param name="attibutesToLoad">The attributes to load.</param>
|
||||
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
|
||||
/// <summary>
|
||||
/// Raised when the DataTypeDefinition attribute is read.
|
||||
/// </summary>
|
||||
public NodeAttributeEventHandler<ExtensionObject> OnReadDataTypeDefinition;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the DataTypeDefinition attribute is written.
|
||||
/// </summary>
|
||||
public NodeAttributeEventHandler<ExtensionObject> OnWriteDataTypeDefinition;
|
||||
#endregion
|
||||
|
||||
#region Read Support Functions
|
||||
/// <summary>
|
||||
/// Reads the value for DataTypeDefinition attribute.
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
/// Write the value for DataTypeDefinition attribute.
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines an abstract description of a type.
|
||||
/// </summary>
|
||||
public class UADataTypeDefinition
|
||||
/// <remarks />
|
||||
public enum DataTypeModifier
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the type.
|
||||
/// </summary>
|
||||
public QualifiedName Name { get; set; }
|
||||
/// <remarks />
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The symbolic name (if the name can't be used as a program symbol).
|
||||
/// </summary>
|
||||
public string SymbolicName { get; set; }
|
||||
/// <remarks />
|
||||
Union = 1,
|
||||
|
||||
/// <summary>
|
||||
/// The qualified name of the base type.
|
||||
/// </summary>
|
||||
public QualifiedName BaseType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The description of the data type.
|
||||
/// </summary>
|
||||
public LocalizedText Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The fields in structure.
|
||||
/// </summary>
|
||||
public List<DataTypeDefinitionField> Fields { get; set; }
|
||||
/// <remarks />
|
||||
OptionSet = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a field within an abstract definition of a data type.
|
||||
/// </summary>
|
||||
public class DataTypeDefinitionField
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the field.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The symbolic name (if the name can't be used as a program symbol).
|
||||
/// </summary>
|
||||
public string SymbolicName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The data type of the field.
|
||||
/// </summary>
|
||||
public NodeId DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value rank for the field.
|
||||
/// </summary>
|
||||
public int ValueRank { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The description of the field.
|
||||
/// </summary>
|
||||
public LocalizedText Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A nested description of a structured field.
|
||||
/// </summary>
|
||||
public UADataTypeDefinition Definition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The value of an enumerated field.
|
||||
/// </summary>
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -445,6 +445,16 @@ namespace Opc.Ua
|
||||
m_extensions = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The categories assigned to the node.
|
||||
/// </summary>
|
||||
public IList<string> Categories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The release status for the node.
|
||||
/// </summary>
|
||||
public Opc.Ua.Export.ReleaseStatus ReleaseStatus { get; set; }
|
||||
#endregion
|
||||
|
||||
#region Serialization Methods
|
||||
@@ -793,7 +803,12 @@ namespace Opc.Ua
|
||||
/// <summary>
|
||||
/// The StatusCode associated with the Value attribute.
|
||||
/// </summary>
|
||||
StatusCode = 0x20000000
|
||||
StatusCode = 0x20000000,
|
||||
|
||||
/// <summary>
|
||||
/// The DataTypeDefinition attribute of a DataType Node.
|
||||
/// </summary>
|
||||
DataTypeDefinition = 0x40000000
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user