Files
Marc Schier 5795e50b58 Source-generated, NativeAOT-clean fluent server API with event-source publish (#3765)
* Add async read/write hooks to BaseVariableState and AsyncCustomNodeManager

Introduces an end-to-end async path for variable Value-attribute reads
and writes that does not require holding lock(this) while the user
callback executes:

* New AttributeReadResult, AttributeSimpleReadResult and AttributeWriteResult
  readonly record structs in NodeState carry the typed result of an async
  Value-attribute hook (no ref/out params across await).
* Four new async delegates (NodeValueEventHandlerAsync,
  NodeValueSimpleEventHandlerAsync, NodeValueWriteEventHandlerAsync,
  NodeValueSimpleWriteEventHandlerAsync) sit alongside the existing sync
  hooks.
* NodeState gains virtual ReadAttributeAsync / WriteAttributeAsync methods.
  The default implementation wraps the synchronous call in lock(this) so
  callers that have not opted into async hooks see bit-identical behaviour.
* BaseVariableState exposes OnReadValueAsync, OnSimpleReadValueAsync,
  OnWriteValueAsync and OnSimpleWriteValueAsync slots and overrides the new
  virtuals to dispatch to them WITHOUT holding the lock during the await.
  On simple-read the framework still applies index range, data encoding and
  copy policy; on simple-write the cached value/status/timestamp are
  updated under lock after the hook completes.
* AsyncCustomNodeManager.ReadAsync and WriteAsync now await the new
  ReadAttributeAsync / WriteAttributeAsync entry points instead of taking
  lock(source) around the synchronous call. Existing per-source locking
  semantics are preserved by the default async wrappers.
* The fluent INodeBuilder surface gains four new async OnRead/OnWrite
  overloads that wire to the new BaseVariableState slots, with the same
  ThrowIfSlotOccupied + null-check pattern as the sync overloads.

* Add typed IVariableBuilder<T> fluent surface

Adds typed sub-interfaces and impls so the existing fluent surface

can expose simple Func<T> / Action<T> / Func<CancellationToken,

ValueTask<T>> overloads for variables — without losing the lower-level

Variant-based overloads on INodeBuilder.

* IVariableBuilder<TValue> + VariableBuilder<TValue> derive from

  INodeBuilder<BaseVariableState> / NodeBuilder<BaseVariableState>

  (NodeBuilder<TState> unsealed).

* Marshalling uses Variant.AsBoxedObject(BoxingBehavior.Legacy) for

  reads and Variant(object) for writes; the AOT-unsafe write path is

  scoped-suppressed with a TODO pointing at the planned per-type

  generated walker.

* INodeManagerBuilder gains Variable<T>(string),

  Variable<T>(NodeId), VariableFromTypeId<T>(NodeId),

  VariableFromTypeId<T>(NodeId, QualifiedName).

Server library builds clean across all 6 TFMs.

* Add relative-child traversal API on INodeBuilder

Adds INodeBuilder.Child(QualifiedName), Child<TState>(QualifiedName)

and Variable<TValue>(QualifiedName) so source-generated typed

wrappers can walk one segment at a time without re-resolving from

the manager root. Resolution uses NodeState.FindChild and reuses

NodeManagerBuilder.ToVariableBuilder to keep the typed-variable

marshalling story consistent.

Adds 7 NUnit cases (Fluent category) covering the happy path,

type-mismatch, null/missing browse-name, and non-variable

rejection. All 66 fluent tests pass.

* Mix old + new fluent APIs in MinimalBoilerServer demo

BoilerNodeManager.Configure now exercises five wiring styles:

  (1) browse-path with the legacy ref-Variant callback

  (2) absolute NodeId with the legacy ref-Variant callback

  (3) typed Variable<double>(NodeId) + simple Func<double> sync getter

  (4) typed Variable<double>(NodeId) + Func<CancellationToken, ValueTask<double>>

      async getter — exercises the BaseVariableState.OnReadValueAsync

      slot end-to-end through AsyncCustomNodeManager.ReadAsync

  (5) NodeFromTypeId with OnNodeAdded lifecycle hook

All five styles compose against the same INodeManagerBuilder, with

the typed and async callbacks pulling in the new IVariableBuilder<T>

surface (committed at e557ecdd9) and the BaseVariableState async

path (committed at 2e2efb4ad).

* Add async-hook tests for BaseVariableState

15 NUnit cases covering the new On{Read,Write}ValueAsync and On
Simple{Read,Write}ValueAsync slots plus the
ReadAttributeAsync/WriteAttributeAsync overrides on
BaseVariableState:

* full async slot routes Value reads/writes
* lock(this) is released around the awaited handler
* simple async slot reapplies cached StatusCode and respects index
  ranges (BadIndexRangeInvalid for non-null ranges)
* exceptions and OperationCanceledException from the hook are
  caught and surfaced as BadUnexpectedError, mirroring the sync flow
* CancellationToken propagates to the hook
* cache (m_value, m_statusCode, m_timestamp) is updated on success
  and skipped on Bad return
* fallback to base sync ReadAttribute/WriteAttribute when no async
  slot is set (preserves today's lock(this) semantics)
* non-Value attributes never invoke the async hook
* CurrentRead/CurrentWrite access checks short-circuit before the
  hook runs

All 596 State tests pass on net10.0.

* Add round-trip tests for typed IVariableBuilder<T>

Covers the typed Func<T>/Action<T>/Func<...,ValueTask<T>> overloads
on IVariableBuilder<TValue>: each registers the appropriate hook
slot on the underlying BaseDataVariableState, and driving the
variable through ReadAttribute/WriteAttribute (sync) and
ReadAttributeAsync/WriteAttributeAsync (async) reproduces the
typed values the user supplied.

* Add typed model-traversal source generator

Adds FluentBuilderGenerator that walks the design's predefined-instance tree and emits a typed sibling for every NodeManagerBuilder. Each generated wrapper exposes IntelliSense-friendly accessors for child instances, variables (IVariableBuilder<T>) and methods (sync/async OnCall) so wiring sites become builder.Boilers.Boiler__1.LCX001.Measurement.OnRead(...) instead of a stringly typed browse path. The NodeManager template now also emits a Configure(I{Manager}NodeManagerBuilder) partial alongside the existing Configure(INodeManagerBuilder); both partials run, both are optional, and the typed surface is fully AOT-safe (no dynamic, no MakeGenericType, no reflection).

* Add tests for the typed model-traversal source generator

Adds 9 snapshot tests in Tests/Opc.Ua.SourceGeneration.Core.Tests covering the FluentBuilderGenerator's opt-in flag, typed-manager-interface and proxy emission, internal-sealed visibility, lazy child resolution via Context.NamespaceUris.GetIndexOrAppend, IVariableBuilder<TValue> accessors, sync+async OnCall overloads on method wrappers, and the dual Configure(INodeManagerBuilder)/Configure(I{Manager}NodeManagerBuilder) partial wiring in the NodeManager template. Adds 2 end-to-end AOT tests in Tests/Opc.Ua.Aot.Tests that exercise typed-traversal sync read on LCX001/Measurement and typed-traversal async OnCall on Simulation/Halt through the AOT-compiled MinimalBoilerServer fixture.

* Document the typed model-traversal Configure(I{Manager}NodeManagerBuilder) partial
2026-05-15 07:52:49 +02:00

498 lines
21 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<opc:ModelDesign
xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ua="http://opcfoundation.org/UA/"
xmlns:opc="http://opcfoundation.org/UA/ModelDesign.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="urn:opcfoundation.org:2024-01:TestModel"
TargetNamespace="urn:opcfoundation.org:2024-01:TestModel"
TargetXmlNamespace="urn:opc-foundation.org:2024-01:TestModel"
TargetVersion="1.05.07"
TargetPublicationDate="2025-12-25T00:00:00Z">
<opc:Namespaces>
<opc:Namespace Name="TestModel" Prefix="TestModel" XmlNamespace="urn:opcfoundation.org:2024-01:TestModelTypes.xsd" XmlPrefix="Model">urn:opcfoundation.org:2024-01:TestModel</opc:Namespace>
<opc:Namespace Name="OpcUa" Prefix="Opc.Ua" Version="1.05.07" PublicationDate="2025-12-25T00:00:00Z" InternalPrefix="Opc.Ua.Server" XmlNamespace="http://opcfoundation.org/UA/2008/02/Types.xsd" XmlPrefix="OpcUa">http://opcfoundation.org/UA/</opc:Namespace>
</opc:Namespaces>
<opc:PermissionSets>
<opc:PermissionSet Name="AuthenticatedUserOnly" >
<opc:RolePermission Role="ua:WellKnownRole_AuthenticatedUser">
<opc:Permission>Browse</opc:Permission>
<opc:Permission>Read</opc:Permission>
<opc:Permission>Write</opc:Permission>
<opc:Permission>Call</opc:Permission>
</opc:RolePermission>
</opc:PermissionSet>
<opc:PermissionSet Name="SecurityAdminOnly" >
<opc:RolePermission Role="ua:WellKnownRole_SecurityAdmin">
<opc:Permission>Browse</opc:Permission>
<opc:Permission>Read</opc:Permission>
<opc:Permission>Write</opc:Permission>
<opc:Permission>Call</opc:Permission>
</opc:RolePermission>
</opc:PermissionSet>
<opc:PermissionSet Name="SeekerOnly" >
<opc:RolePermission Role="Seeker">
<opc:Permission>Browse</opc:Permission>
<opc:Permission>Read</opc:Permission>
</opc:RolePermission>
</opc:PermissionSet>
</opc:PermissionSets>
<opc:DataType SymbolicName="TestAbstractStructure" BaseType="ua:Structure" IsAbstract="true">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestAbstractStructure</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="ua:Int16" />
<opc:Field Name="B" DataType="ua:Double" />
<opc:Field Name="C" DataType="ua:String" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestConcreteStructure" BaseType="TestAbstractStructure">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestConcreteStructure</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="D" DataType="ua:Int16" />
<opc:Field Name="E" DataType="ua:Double" />
<opc:Field Name="F" DataType="ua:String" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestUnion" BaseType="ua:Union" IsUnion="true">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestUnion</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="ua:Int16" />
<opc:Field Name="B" DataType="ua:Double" />
<opc:Field Name="C" DataType="ua:String" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestOptionalFields" BaseType="ua:Structure">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestOptionalFields</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="ua:Int16" IsOptional="true" />
<opc:Field Name="B" DataType="ua:Double" IsOptional="true" />
<opc:Field Name="C" DataType="ua:String" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestEnumeration" BaseType="ua:Enumeration">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestEnumeration</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="Invalid" Identifier="0" />
<opc:Field Name="Red" Identifier="2" />
<opc:Field Name="Green" Identifier="4" />
<opc:Field Name="Blue" Identifier="6" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestOptionSet" IsOptionSet="true" BaseType="ua:UInt64">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestOptionSet</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" BitMask="0001" />
<opc:Field Name="B" BitMask="0002" />
<opc:Field Name="C" BitMask="0004" />
<opc:Field Name="D" BitMask="0008" />
<opc:Field Name="E" BitMask="0010" />
<opc:Field Name="F" BitMask="0020" />
<opc:Field Name="G" BitMask="0040" />
<opc:Field Name="H" BitMask="0080" />
<opc:Field Name="I" BitMask="0100" />
<opc:Field Name="J" BitMask="0200" />
<opc:Field Name="K" BitMask="0400" />
<opc:Field Name="L" BitMask="0800" />
<opc:Field Name="M" BitMask="1000" />
<opc:Field Name="N" BitMask="2000" />
<opc:Field Name="O" BitMask="4000" />
<opc:Field Name="P" BitMask="8000" />
<opc:Field Name="Q" BitMask="00010000" />
<opc:Field Name="R" BitMask="00020000" />
<opc:Field Name="S" BitMask="00040000" />
<opc:Field Name="T" BitMask="00080000" />
<opc:Field Name="U" BitMask="00100000" />
<opc:Field Name="V" BitMask="00200000" />
<opc:Field Name="W" BitMask="00400000" />
<opc:Field Name="X" BitMask="00800000" />
<opc:Field Name="Z" BitMask="01000000" />
<opc:Field Name="A1" BitMask="02000000" />
<opc:Field Name="B1" BitMask="04000000" />
<opc:Field Name="C1" BitMask="08000000" />
<opc:Field Name="D1" BitMask="10000000" />
<opc:Field Name="E1" BitMask="20000000" />
<opc:Field Name="F1" BitMask="40000000" />
<opc:Field Name="G1" BitMask="0080000000" />
<opc:Field Name="H1" BitMask="0100000000" />
<opc:Field Name="I1" BitMask="0200000000" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestScalarStructure" BaseType="ua:Structure">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestScalarStructure</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="ua:Boolean" />
<opc:Field Name="B" DataType="ua:SByte" />
<opc:Field Name="C" DataType="ua:Byte" />
<opc:Field Name="D" DataType="ua:Int16" />
<opc:Field Name="E" DataType="ua:UInt16" />
<opc:Field Name="F" DataType="ua:Int32" />
<opc:Field Name="G" DataType="ua:UInt32" />
<opc:Field Name="H" DataType="ua:Int64" />
<opc:Field Name="I" DataType="ua:UInt64" />
<opc:Field Name="J" DataType="ua:Float" />
<opc:Field Name="K" DataType="ua:Double" />
<opc:Field Name="L" DataType="ua:Guid" />
<opc:Field Name="M" DataType="ua:DateTime" />
<opc:Field Name="N" DataType="ua:String" />
<opc:Field Name="O" DataType="ua:ByteString" />
<opc:Field Name="P" DataType="ua:NodeId" />
<opc:Field Name="Q" DataType="ua:ExpandedNodeId" />
<opc:Field Name="R" DataType="ua:QualifiedName" />
<opc:Field Name="S" DataType="ua:LocalizedText" />
<opc:Field Name="T" DataType="ua:StatusCode" />
<opc:Field Name="U" DataType="ua:XmlElement" />
<opc:Field Name="V" DataType="ua:BaseDataType" />
<opc:Field Name="W" DataType="TestAbstractStructure" AllowSubTypes="true" />
<opc:Field Name="X" DataType="TestConcreteStructure" />
<opc:Field Name="Y" DataType="TestEnumeration" />
<opc:Field Name="Z" DataType="TestOptionSet" />
<opc:Field Name="A1" DataType="TestUnion" />
<opc:Field Name="B1" DataType="TestOptionalFields" />
<opc:Field Name="C1" DataType="ua:DataValue" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestArrayStructure" BaseType="ua:Structure">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestArrayStructure</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="ua:Boolean" ValueRank="Array" />
<opc:Field Name="B" DataType="ua:SByte" ValueRank="Array" />
<opc:Field Name="C" DataType="ua:Byte" ValueRank="Array" />
<opc:Field Name="D" DataType="ua:Int16" ValueRank="Array" />
<opc:Field Name="E" DataType="ua:UInt16" ValueRank="Array" />
<opc:Field Name="F" DataType="ua:Int32" ValueRank="Array" />
<opc:Field Name="G" DataType="ua:UInt32" ValueRank="Array" />
<opc:Field Name="H" DataType="ua:Int64" ValueRank="Array" />
<opc:Field Name="I" DataType="ua:UInt64" ValueRank="Array" />
<opc:Field Name="J" DataType="ua:Float" ValueRank="Array" />
<opc:Field Name="K" DataType="ua:Double" ValueRank="Array" />
<opc:Field Name="L" DataType="ua:Guid" ValueRank="Array" />
<opc:Field Name="M" DataType="ua:DateTime" ValueRank="Array" />
<opc:Field Name="N" DataType="ua:String" ValueRank="Array" />
<opc:Field Name="O" DataType="ua:ByteString" ValueRank="Array" />
<opc:Field Name="P" DataType="ua:NodeId" ValueRank="Array" />
<opc:Field Name="Q" DataType="ua:ExpandedNodeId" ValueRank="Array" />
<opc:Field Name="R" DataType="ua:QualifiedName" ValueRank="Array" />
<opc:Field Name="S" DataType="ua:LocalizedText" ValueRank="Array" />
<opc:Field Name="T" DataType="ua:StatusCode" ValueRank="Array" />
<opc:Field Name="U" DataType="ua:XmlElement" ValueRank="Array" />
<opc:Field Name="V" DataType="ua:BaseDataType" ValueRank="Array" />
<opc:Field Name="W" DataType="TestAbstractStructure" ValueRank="Array" AllowSubTypes="true" />
<opc:Field Name="X" DataType="TestConcreteStructure" ValueRank="Array" />
<opc:Field Name="Y" DataType="TestEnumeration" ValueRank="Array" />
<opc:Field Name="Z" DataType="TestOptionSet" ValueRank="Array" />
<opc:Field Name="A1" DataType="TestUnion" ValueRank="Array" />
<opc:Field Name="B1" DataType="TestOptionalFields" ValueRank="Array" />
<opc:Field Name="C1" DataType="ua:DataValue" ValueRank="Array" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="TestStructure" BaseType="ua:Structure">
<opc:Extensions>
<opc:Extension>
<tag:Something xmlns:tag="http://tagsrus.net/schemas">TestStructure</tag:Something>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="A" DataType="TestScalarStructure" />
<opc:Field Name="B" DataType="TestArrayStructure" />
<opc:Field Name="C" DataType="TestScalarStructure" ValueRank="Array" />
<opc:Field Name="D" DataType="TestArrayStructure" ValueRank="Array" />
</opc:Fields>
</opc:DataType>
<opc:Object SymbolicName="Seeker" TypeDefinition="ua:RoleType">
<opc:BrowseName>Seeker</opc:BrowseName>
<opc:DisplayName>Seeker</opc:DisplayName>
<opc:Description>The Role is a test role.</opc:Description>
<opc:References>
<opc:Reference IsInverse="true">
<opc:ReferenceType>ua:HasComponent</opc:ReferenceType>
<opc:TargetId>ua:Server_ServerCapabilities_RoleSet</opc:TargetId>
</opc:Reference>
</opc:References>
<opc:Extensions>
<opc:Extension>
<some:Thing xmlns:some="http://tempuri.com/something">Wicked</some:Thing>
</opc:Extension>
</opc:Extensions>
</opc:Object>
<opc:DataType SymbolicName="EnumUnderscoreTest" BaseType="ua:Enumeration" ForceEnumValues="true">
<opc:Fields>
<opc:Field Name="x_x" Identifier="1"/>
<opc:Field Name="_x" Identifier="2"/>
<opc:Field Name="x_" Identifier="3"/>
<opc:Field Name="_" Identifier="4"/>
<opc:Field Name="Test5" Identifier="-1">
<opc:DisplayName>Test_5</opc:DisplayName>
</opc:Field>
</opc:Fields>
</opc:DataType>
<opc:VariableType SymbolicName="RestrictedVariableType" BaseType="ua:BaseDataVariableType" DataType="ua:String" >
<opc:Children>
<opc:Variable SymbolicName="Yellow" TypeDefinition="ua:PropertyType" DataType="ua:Int32">
<opc:DefaultRolePermissions Name="SeekerOnly" />
<opc:DefaultAccessRestrictions>SessionWithSigningRequired</opc:DefaultAccessRestrictions>
</opc:Variable>
<opc:Variable SymbolicName="X" TypeDefinition="ua:PropertyType" DataType="ua:Int32" />
<opc:Variable SymbolicName="Y" TypeDefinition="ua:PropertyType" DataType="ua:Int32" />
<opc:Variable SymbolicName="Z" TypeDefinition="ua:PropertyType" DataType="ua:Int32" />
</opc:Children>
<opc:DefaultRolePermissions Name="SecurityAdminOnly" />
<opc:DefaultAccessRestrictions>EncryptionRequired</opc:DefaultAccessRestrictions>
</opc:VariableType>
<opc:Method SymbolicName="RestrictedMethodType">
<opc:InputArguments>
<opc:Argument Name="In1" DataType="ua:Int32" />
</opc:InputArguments>
<opc:OutputArguments>
<opc:Argument Name="Out1" DataType="ua:Int32" />
</opc:OutputArguments>
<opc:DefaultRolePermissions Name="SecurityAdminOnly" />
<opc:DefaultAccessRestrictions>SigningRequired</opc:DefaultAccessRestrictions>
</opc:Method>
<opc:ObjectType SymbolicName="RestrictedObjectType" BaseType="ua:BaseObjectType">
<opc:Children>
<opc:Variable SymbolicName="Red" TypeDefinition="RestrictedVariableType" ModellingRule="Mandatory"/>
<opc:Variable SymbolicName="Pink_Placeholder" TypeDefinition="RestrictedVariableType" ModellingRule="OptionalPlaceholder">
<opc:BrowseName>&lt;Pink&gt;</opc:BrowseName>
</opc:Variable>
<opc:Method SymbolicName="Blue" ModellingRule="Mandatory">
<opc:DefaultRolePermissions Name="SecurityAdminOnly" />
<opc:DefaultAccessRestrictions>SessionWithSigningAndApplyToBrowseRequired</opc:DefaultAccessRestrictions>
</opc:Method>
</opc:Children>
<opc:Extensions>
<opc:Extension>
<some:Thing xmlns:some="http://tempuri.com/something">This way</some:Thing>
</opc:Extension>
<opc:Extension>
<some:World xmlns:some="http://tempuri.com/something">comes</some:World>
</opc:Extension>
</opc:Extensions>
<opc:DefaultRolePermissions Name="SecurityAdminOnly" />
<opc:DefaultAccessRestrictions>EncryptionRequired</opc:DefaultAccessRestrictions>
</opc:ObjectType>
<opc:Object SymbolicName="TestObject" TypeDefinition="RestrictedObjectType">
<opc:DefaultRolePermissions Name="AuthenticatedUserOnly" />
</opc:Object>
<opc:Object SymbolicName="MathInstance" TypeDefinition="ua:BaseObjectType">
<opc:Children>
<opc:Method SymbolicName="Compute" ModellingRule="Mandatory">
<opc:InputArguments>
<opc:Argument Name="x" DataType="ua:Int32" />
</opc:InputArguments>
<opc:OutputArguments>
<opc:Argument Name="result" DataType="ua:Int32" />
</opc:OutputArguments>
</opc:Method>
<opc:Method SymbolicName="Add" ModellingRule="Mandatory">
<opc:InputArguments>
<opc:Argument Name="a" DataType="ua:Int32" />
<opc:Argument Name="b" DataType="ua:Int32" />
</opc:InputArguments>
<opc:OutputArguments>
<opc:Argument Name="sum" DataType="ua:Int32" />
</opc:OutputArguments>
</opc:Method>
</opc:Children>
</opc:Object>
<opc:Object SymbolicName="Test_Error" TypeDefinition="ua:BaseObjectType" />
<opc:Object SymbolicName="Test_ErrorComponent" TypeDefinition="ua:BaseObjectType">
<opc:References>
<opc:Reference IsInverse="true">
<opc:ReferenceType>ua:HasComponent</opc:ReferenceType>
<opc:TargetId>Test_Error</opc:TargetId>
</opc:Reference>
</opc:References>
</opc:Object>
<opc:DataType SymbolicName="HeaterStatus" BaseType="ua:Enumeration">
<opc:Fields>
<opc:Field Name="Off" Identifier="0">
<opc:DisplayName>It is really off!</opc:DisplayName>
</opc:Field>
<opc:Field Name="Heating" Identifier="1">
<opc:DisplayName>暖房</opc:DisplayName>
</opc:Field>
<opc:Field Name="Cooling" Identifier="2">
<opc:DisplayName>200_冷房</opc:DisplayName>
</opc:Field>
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="Vector" BaseType="ua:Structure">
<opc:Extensions>
<opc:Extension>
<some:Thing xmlns:some="http://tempuri.com/something">This way</some:Thing>
</opc:Extension>
</opc:Extensions>
<opc:Fields>
<opc:Field Name="X" DataType="ua:Double" />
<opc:Field Name="Y" DataType="ua:Double" />
<opc:Field Name="Z" DataType="ua:Double" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="WorkOrderStatusType" BaseType="ua:Structure">
<opc:Fields>
<opc:Field Name="Actor" DataType="ua:String" />
<opc:Field Name="Timestamp" DataType="ua:DateTime" />
<opc:Field Name="Comment" DataType="ua:LocalizedText" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="WorkOrderType" BaseType="ua:Structure">
<opc:Fields>
<opc:Field Name="ID" DataType="ua:Guid" />
<opc:Field Name="AssetID" DataType="ua:String" />
<opc:Field Name="StartTime" DataType="ua:DateTime" />
<opc:Field Name="StatusComments" DataType="WorkOrderStatusType" ValueRank="Array" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="ExtendedWorkOrderType" BaseType="WorkOrderType">
<opc:Fields>
<opc:Field Name="ContactX" DataType="ua:UInt32" />
<opc:Field Name="ContactY" DataType="ua:String" ValueRank="Array" IsOptional="true" />
<opc:Field Name="ContactZ" DataType="ua:ByteString" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="FinalWorkOrderType" BaseType="ExtendedWorkOrderType">
<opc:Fields>
<opc:Field Name="Address" DataType="ua:String" />
<opc:Field Name="Phone" DataType="ua:String" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="SampleUnion" BaseType="ua:Union" IsUnion="true">
<opc:Fields>
<opc:Field Name="FieldX" DataType="ua:UInt32" />
<opc:Field Name="FieldY" DataType="ua:String" ValueRank="Array" />
<opc:Field Name="FieldZ" DataType="ua:ByteString" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="SampleStructureWithOptionalFields" BaseType="ua:Structure">
<opc:Fields>
<opc:Field Name="FieldX" DataType="ua:UInt32" />
<opc:Field Name="FieldY" DataType="ua:String" ValueRank="Array" IsOptional="true" />
<opc:Field Name="FieldZ" DataType="ua:ByteString" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="SampleUnionAllowSubtypes" BaseType="ua:Union" IsUnion="true">
<opc:Fields>
<opc:Field Name="FieldX" DataType="WorkOrderType" AllowSubTypes="true" />
<opc:Field Name="FieldY" DataType="WorkOrderStatusType" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="SampleStructureAllowSubtypes" BaseType="ua:Structure">
<opc:Fields>
<opc:Field Name="FieldX" DataType="Vector" AllowSubTypes="true" />
<opc:Field Name="FieldY" DataType="Vector" ValueRank="Array" AllowSubTypes="true" />
<opc:Field Name="FieldZ" DataType="Vector" ValueRank="ScalarOrArray" AllowSubTypes="true" />
<opc:Field Name="FieldW" DataType="WorkOrderStatusType" />
</opc:Fields>
</opc:DataType>
<opc:ObjectType SymbolicName="WithTwoDimensionalVariableType" BaseType="ua:BaseObjectType">
<opc:Children>
<opc:Variable SymbolicName="X" DataType="ua:Int32" ValueRank="OneOrMoreDimensions" ArrayDimensions="0,0" ModellingRule="Optional"/>
</opc:Children>
</opc:ObjectType>
<opc:DataType SymbolicName="Person" BaseType="ua:Structure">
<opc:Fields>
<opc:Field Name="LastName" DataType="ua:String" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<opc:DataType SymbolicName="Student" BaseType="Person">
<opc:Fields>
<opc:Field Name="FirstName" DataType="ua:String" IsOptional="true" />
<opc:Field Name="University" DataType="ua:String" IsOptional="true" />
</opc:Fields>
</opc:DataType>
<!-- Notifier object: SupportsEvents=true is the design-XML form of
EventNotifier=SubscribeToEvents. Wrappers for this node must
expose typed Publish<TEvent> overloads. -->
<opc:Object SymbolicName="NotifierObject" TypeDefinition="ua:BaseObjectType" SupportsEvents="true" />
<!-- Event-emitting object: declares an outgoing GeneratesEvent
reference. Wrappers must expose typed Publish<TEvent> even though
SupportsEvents is not set explicitly (the model says this object
can fire BaseEventType events). -->
<opc:Object SymbolicName="EventEmittingObject" TypeDefinition="ua:BaseObjectType">
<opc:References>
<opc:Reference>
<opc:ReferenceType>ua:GeneratesEvent</opc:ReferenceType>
<opc:TargetId>ua:BaseEventType</opc:TargetId>
</opc:Reference>
</opc:References>
</opc:Object>
<opc:Extensions>
<opc:Extension>
<blue:Something xmlns:blue="http://something.net/schemas">
<blue:Begin color="Red">Hello</blue:Begin>
<blue:End brightness="Dim">World</blue:End>
</blue:Something>
</opc:Extension>
</opc:Extensions>
</opc:ModelDesign>