Errata exists for this version of the document.
- A 128-bit signed integer.
<opc:OpaqueType Name="Int128" LengthInBits="128" ByteOrderSignificant="true">
<opc:Documentation>A 128-bit signed integer.</opc:Documentation>
</opc:OpaqueType>
- A 16-bit value divided into several fields.
<opc:StructuredType Name="Quality">
<opc:Documentation>An OPC COM-DA quality value.</opc:Documentation>
<opc:Field Name="LimitBits" TypeName="opc:Bit" Length="2" />
<opc:Field Name="QualityBits" TypeName="opc:Bit" Length="6"/>
<opc:Field Name="VendorBits" TypeName="opc:Byte" />
</opc:StructuredType>
When using bit fields, the least significant bits within a byte shall appear first.
- A structured type with optional fields.
<opc:StructuredType Name="DataValue">
<opc:Documentation>A value with an associated timestamp, and quality.</opc:Documentation>
<opc:Field Name="ValueSpecified" TypeName="Bit" />
<opc:Field Name="StatusCodeSpecified" TypeName="Bit" />
<opc:Field Name="TimestampSpecified" TypeName="Bit" />
<opc:Field Name="Reserved1" TypeName="Bit" Length="5" />
<opc:Field Name="Value" TypeName="Variant" SwitchField="ValueSpecified" />
<opc:Field Name="Quality" TypeName="Quality" SwitchField="StatusCodeSpecified" />
<opc:Field Name="Timestamp"
TypeName="opc:DateTime" SwitchField="SourceTimestampSpecified" />
</opc:StructuredType>
It is necessary to explicitly specify any padding bits required to ensure subsequent fields line up on byte boundaries.
- An array of integers.
<opc:StructuredType Name="IntegerArray">
<opc:Documentation>An array of integers prefixed by its length.</opc:Documentation>
<opc:Field Name="Size" TypeName="opc:Int32" />
<opc:Field Name="Array" TypeName="opc:Int32" LengthField="Size" />
</opc:StructuredType>
Nothing is encoded for the Array field if the Size field has a value ≤ 0.
- An array of integers with a terminator instead of a length prefix.
<opc:StructuredType Name="IntegerArray" DefaultByteOrder="LittleEndian">
<opc:Documentation>An array of integers terminated with a known value.</opc:Documentation>
<opc:Field Name="Value" TypeName="opc:Int16" Terminator="FF7F" />
</opc:StructuredType>
The terminator is 32,767 converted to hexadecimal with LittleEndian byte order.
- A simple union.
<opc:StructuredType Name="Variant">
<opc:Documentation>A union of several types.</opc:Documentation>
<opc:Field Name="ArrayLengthSpecified" TypeName="opc:Bit" Length="1"/>
<opc:Field Name="VariantType" TypeName="opc:Bit" Length="7" />
<opc:Field Name="ArrayLength" TypeName="opc:Int32"
SwitchField="ArrayLengthSpecified" />
<opc:Field Name="Int32" TypeName="opc:Int32" LengthField="ArrayLength"
SwitchField="VariantType" SwitchValue="1" />
<opc:Field Name="String" TypeName="opc:String" LengthField="ArrayLength"
SwitchField="VariantType" SwitchValue="2" />
<opc:Field Name="DateTime" TypeName="opc:DateTime" LengthField="ArrayLength"
SwitchField="VariantType" SwitchValue="3" />
</opc:StructuredType>
The ArrayLength field is optional. If it is not present in an encoded value, then the length of all fields with LengthField set to “ArrayLength” have a length of 1.
It is valid for the VariantType field to have a value that has no matching field defined. This simply means all optional fields are not present in the encoded value.
- An enumerated type.
<opc:EnumeratedType Name="TrafficLight" LengthInBits="32">
<opc:Documentation>The possible colours for a traffic signal.</opc:Documentation>
<opc:EnumeratedValue Name="Red" Value="4">
<opc:Documentation>Red says stop immediately.</opc:Documentation>
</opc:EnumeratedValue>
<opc:EnumeratedValue Name="Yellow" Value="3">
<opc:Documentation>Yellow says prepare to stop.</opc:Documentation>
</opc:EnumeratedValue>
<opc:EnumeratedValue Name="Green" Value="2">
<opc:Documentation>Green says you may proceed.</opc:Documentation>
</opc:EnumeratedValue>
</opc:EnumeratedType>
The documentation element is used to provide human readable description of the type and values.
- A nillable array.
<opc:StructuredTypen Name="NillableArray">
<opc:Documentation>An array where a length of -1 means null.</opc:Documentation>
<opc:Field Name="Length" TypeName="opc:Int32" />
<opc:Field
Name="Int32"
TypeName="opc:Int32"
LengthField="Length"
SwitchField="Length"
SwitchValue="0"
SwitchOperand="GreaterThanOrEqual" />
</opc:StructuredType>
If the length of the array is −1 then the array does not appear in the stream.