
'Declaration
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection)> <ComVisibleAttribute(True)> <GuidAttribute("56F0D16D-8B4F-433B-95D4-BAF9D8CFD30B")> <TypeConverterAttribute(OpcLabs.EasyOpc.UA.PubSub.Configuration.UAFieldMetaDataCollection/ThisTypeConverter)> <DefaultMemberAttribute("Item")> <DebuggerTypeProxyAttribute(System.Collections.Generic.Mscorlib_CollectionDebugView`1)> <DebuggerDisplayAttribute("Count = {Count}")> <SerializableAttribute()> Public NotInheritable Class UAFieldMetaDataCollection Inherits System.Collections.ObjectModel.Collection(Of UAFieldMetaData) Implements OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection, System.Collections.Generic.ICollection(Of UAFieldMetaData), System.Collections.Generic.IEnumerable(Of UAFieldMetaData), System.Collections.Generic.IList(Of UAFieldMetaData), System.Collections.Generic.IReadOnlyCollection(Of UAFieldMetaData), System.Collections.Generic.IReadOnlyList(Of UAFieldMetaData), System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable
'Usage
Dim instance As UAFieldMetaDataCollection
[ComDefaultInterface(OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection)] [ComVisible(true)] [Guid("56F0D16D-8B4F-433B-95D4-BAF9D8CFD30B")] [TypeConverter(OpcLabs.EasyOpc.UA.PubSub.Configuration.UAFieldMetaDataCollection/ThisTypeConverter)] [DefaultMember("Item")] [DebuggerTypeProxy(System.Collections.Generic.Mscorlib_CollectionDebugView`1)] [DebuggerDisplay("Count = {Count}")] [Serializable()] public sealed class UAFieldMetaDataCollection : System.Collections.ObjectModel.Collection<UAFieldMetaData>, OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection, System.Collections.Generic.ICollection<UAFieldMetaData>, System.Collections.Generic.IEnumerable<UAFieldMetaData>, System.Collections.Generic.IList<UAFieldMetaData>, System.Collections.Generic.IReadOnlyCollection<UAFieldMetaData>, System.Collections.Generic.IReadOnlyList<UAFieldMetaData>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable
[ComDefaultInterface(OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection)] [ComVisible(true)] [Guid("56F0D16D-8B4F-433B-95D4-BAF9D8CFD30B")] [TypeConverter(OpcLabs.EasyOpc.UA.PubSub.Configuration.UAFieldMetaDataCollection/ThisTypeConverter)] [DefaultMember("Item")] [DebuggerTypeProxy(System.Collections.Generic.Mscorlib_CollectionDebugView`1)] [DebuggerDisplay("Count = {Count}")] [Serializable()] public ref class UAFieldMetaDataCollection sealed : public System.Collections.ObjectModel.Collection<UAFieldMetaData>, OpcLabs.EasyOpc.UA.PubSub.Configuration.ComTypes._UAFieldMetaDataCollection, System.Collections.Generic.ICollection<UAFieldMetaData>, System.Collections.Generic.IEnumerable<UAFieldMetaData>, System.Collections.Generic.IList<UAFieldMetaData>, System.Collections.Generic.IReadOnlyCollection<UAFieldMetaData>, System.Collections.Generic.IReadOnlyList<UAFieldMetaData>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.ICloneable, System.Xml.Serialization.IXmlSerializable
The order of fields is relevant in some message encodings. For this reason, UAFieldMetaDataCollection cannot be a KeyedCollection.
The dataset metadata describes the content and semantics of a dataset in OPC UA PubSub. In QuickOPC, it is represented by an instance of the UADataSetMetaData Class. When you are subscribing to a dataset, metadata is an optional part of the dataset subscription descriptor (UADataSetSubscriptionDescriptor Class), in its DataSetMetaData Property.
The main part of the dataset metadata are field definitions - a metadata for each of the fields contained in the dataset. This is a collection of UAFieldMetaData Class instances, contained in the collection stored in the Fields Property. Each field metadata contains following data members:
Most of the data members have reasonable defaults, and some are not necessary at all times. The Description Property, the DataSetFieldId Property and the DataSetFieldFlags Property are optional. In the most typical case of scalar fields of built-in types, you can leave the DataTypeId Property, the MaximumStringLength Property and the ValueRank Property at their defaults.
Besides the field metadata, the dataset metadata contains some data members that apply to the dataset as a whole. They are:
The answer is: It depends. Some message mappings (such as JSON) as largely self-descriptive, meaning that even without the metadata, it is possible to decode the dataset messages and event obtain metadata-like information, such as field names, from the dataset message itself. Other message mappings (such as UADP) are more compact, and not fully (or not at all) self-descriptive. The UADP message mapping does not transfer field names in the messages. Consequently, without metadata, QuickOPC will deliver to you the datasets with field indexes (such as "#0", "#1", ...) instead of field names - but in general, things will work. If you use the UADP message mapping and the dataset is encoded with the RawData encoding (check with the publisher), you must have metadata in order to be able to decode the dataset messages.
There are several (or rather, many) ways of obtaining the metadata, and applying them. Below are some of them.
In order to define the metadata in your code, create an instance of the UADataSetMetaData Class, and fill in its properties and the Fields collection as necessary. Then, assign this dataset metadata instance to the DataSetMetaData Property of the UADataSetSubscriptionDescriptor Class instance that you will use to make your dataset subscription. There are also some extension method overloads of the SubscribeDataSet Method that take the dataset metadata directly as one of their arguments.
In languages like C# or VB.NET, you can take advantage of the fact that the UADataSetMetaData Class support collection initializer syntax for its field, making the code even shorter. This approach is also shown in the example below.
In some cases, partial metadata is sufficient to achieve the purpose. For example, your intent might be to identify dataset fields by their names, but the communication uses UADP mapping, which does not transfer the field names in the messages, and therefore some metadata is required for that. The full metadata, which includes types information for individual fields, is however only needed if RawData encoding is used. If the encoding is Variant or DataValue, type information is not strictly necessary, because dataset data can be decoded based simply on the contents of the dataset message.
You can simplify your code by only specifying field names in the metadata in such cases. This is illustrated in the example below.
System.Object
System.Collections.ObjectModel.Collection<T>
OpcLabs.EasyOpc.UA.PubSub.Configuration.UAFieldMetaDataCollection