OPC UA PubSub JSON mapping component

From OPC Labs Knowledge Base
Revision as of 13:09, 30 January 2020 by User (talk | contribs) (→‎OpcCmd tool)
Jump to navigation Jump to search

Introduction

(tbd!!!)

Installation

With some software (such as the OpcCmd and UADemoPublisher tools), this package comes preinstalled; you do not have to do any additional installation steps before you can start working with it. In other cases, such as if you are developing your own software, you need to make sure that the package is properly installed.

The package consists of one or more .NET assemblies. In runtime, the host software must be able to find and load these assemblies. This is usually assured by placing the assemblies of the package alongside the assemblies of your own project.

When developing a software in .NET (for .NET Framework, or targeting .NET Standard), you can add the available NuGet package (OpcLabs.UAPubSubJson) as a dependency to your project, and this in turn will include the necessary communication package's assemblies in the output of your project. When developing for .NET Framework, as an alternative, you can unpack all files of the ZIP package to some directory, and reference the assemblies (or just the main assembly) from your project. When developing for COM, you unpack all files of the ZIP package to the output directory of your project. In QuickOPC, links to the various ZIP packages are available from the Launcher ("Start menu") under Redistributables.

Configuration

The configuration of the OPC UA PubSub JSON mapping package consists of three parts that correspond to the three areas of functionality that the package provides:

Send message mapping
The full name of the corresponding configuration part type is OpcLabs.UAPubSubJson.JsonSendMessageMapping.
Receive message mapping
The full name of the corresponding configuration part type is OpcLabs.UAPubSubJson.JsonReceiveMessageMapping.
Envelope mapping
The full name of the corresponding configuration part type is OpcLabs.UAPubSubJson.JsonEnvelopeMapping.

In order to configure properties of the OPC UA PubSub JSON mapping package, you need to set one or more custom properties on a PubSub connection as follows:

  • Property namespace: http://opclabs.com/OpcUA/PubSub
  • Property name: Full name of the configuration part type (see above), followed by "." and the property name from the documentation below. For example, the PubSub connection custom property name for the MessageFormattingParameters.PrettificationLevel property of the send message mapping will be "OpcLabs.UAPubSubJson.JsonSendMessageMapping.MessageFormattingParameters.PrettificationLevel".
  • Property datatype: As given by the documentation below.
  • Property value: The desired value.

How this is done depends on the concrete software you are using.

EasyUASubscriber object

OpcCmd tool

In "uaSubscriber subscribeDataSet" or "uaSubscriber subscribeDataSetField" commands in the OpcCmd tool (Using OpcCmd Utility as OPC UA PubSub Subscriber), you set the custom property on a PubSub connection using the --ConnectionProperty (-cp) option. They key is in the form {url}name, where url is the property namespace, and name is the property name. The value is in the form [String]stringValue.

UADemoPublisher tool

Parameters

This chapter describes the configurable parameters of the package.

Send message mapping

The table below lists the available properties, their types, and descriptions.

Property Type Default Description
MessageFormattingParameters OpcLabs.UAPubSubJson.Sdk.PubSub.JsonMessageFormattingParameters
MessageFormattingParameters.IndentChars System.String " " (two spaces) The character string to use when indenting.
MessageFormattingParameters.PrettificationLevel OpcLabs.UAPubSubJson.Sdk.PubSub.JsonMessagePrettificationLevel JsonMessagePrettificationLevel.DataSetMessageData A value indicating how to prettify the output.

The JsonMessagePrettificationLevel enumeration is defined in the following table:

Name Value Description
None 0 The JSON message is not prettified.
NetworkMessage 1 The message is prettified to the network message level.
NetworkMessageData 2 The message is prettified to the network message data level.
DataSetMessage 3 The message is prettified to the dataset message level.
DataSetMessageData 4 The message is prettified to the dataset message data level.

Receive message mapping

The table below lists the available properties, their types, and descriptions.

Property Type Default Description
MessageParsingParameters OpcLabs.UAPubSubJson.Sdk.PubSub.JsonMessageParsingParameters
MessageParsingParameters.AutoRecognizeMessageFormat System.Boolean True Determines whether the message format will be automatically recognized when possible.
MessageParsingParameters.RecognizedNonReversibleBuiltInTypesMask System.Int32 NodeId, ExpandedNodeId, StatusCode,
QualifiedName, DataValue, DiagnosticInfo
The built-in types that be recognized when parsing the non-reversible JSON encoding.
MessageParsingParameters.RequireDataSetMetadata System.Boolean False Determines whether data set metadata will always be required for parsing.

Envelope mapping

There are no parameters that can be set for the envelope mapping.