Using OpcCmd Utility for Static OPC UA Operations

From OPC Labs Knowledge Base
Jump to navigation Jump to search

Command, Arguments and Options

Command: ua nodeId

Example: Figure out standard name of a node ID in namespace 0 (reserved by OPC Foundation):

ua nodeId i=2253

Output:

Standard name: Server
Expanded text: nsu=http://opcfoundation.org/UA/ ;i=2253

Example: Find out a full node ID from its standard name (for nodes defined by OPC Foundation):

ua ni -sn=Server_NamespaceArray

Output:

Standard name: Server_NamespaceArray
Expanded text: nsu=http://opcfoundation.org/UA/ ;i=2255

Example: Display a table of all node IDs defined by OPC Foundation, sorted by their identifier.

ua nodeId listNames?

Output:

Result (sequence):
╒═══════════════════════════════════════╤══════════════════════════════════════════╕
│[]                                     │Value                                     │
╞═══════════════════════════════════════╪══════════════════════════════════════════╡
│nsu=http://opcfoundation.org/UA/ ;i=1  │Boolean                                   │
│nsu=http://opcfoundation.org/UA/ ;i=2  │SByte                                     │
│nsu=http://opcfoundation.org/UA/ ;i=3  │Byte                                      │
│nsu=http://opcfoundation.org/UA/ ;i=4  │Int16                                     │
│nsu=http://opcfoundation.org/UA/ ;i=5  │UInt16                                    │
...

The output sequence is truncated by default; in order to obtain the full table, use:

ua nodeId listNames? -!vs=:N99999

Example: Display a table of all node IDs defined by OPC Foundation, sorted by their class and standard name (alphabetically):

ua nodeId listValues?

Output:

Result (sequence):
╒══════════════════════════════════════════════╤═════════════════════════════════════════╕
│[]                                            │Value                                    │
╞══════════════════════════════════════════════╪═════════════════════════════════════════╡
│DataTypes.AccessLevelExType                   │nsu=http://opcfoundation.org/UA/ ;i=15406│
│DataTypes.AccessLevelType                     │nsu=http://opcfoundation.org/UA/ ;i=15031│
│DataTypes.AccessRestrictionType               │nsu=http://opcfoundation.org/UA/ ;i=95   │
│DataTypes.ActivateSessionRequest              │nsu=http://opcfoundation.org/UA/ ;i=465  │
│DataTypes.ActivateSessionResponse             │nsu=http://opcfoundation.org/UA/ ;i=468  │
...

The output sequence is truncated by default; in order to obtain the full table, use:

ua nodeId listValues? -!vs=:N99999

Command: ua qualifiedName

Similarly to the nodeId command, you can use this command e.g. to obtain tables of qualified names defined by the OPC Foundation.

Example:

ua qn ln?

which is an abbreviated form of:

ua qualifiedName listNames?

Command: ua statusCode

The statusCode command decodes and encodes OPC UA status codes.

Example (using hexadecimal value):

ua statusCode 0x80010000

or (using decimal value)

ua statusCode 2147549184

Output:

Status code: BadUnexpectedError
Internal value: 2147549184 (0x80010000)

Example: Encode the status code, given its code bits symbolically:

ua statusCode -cbs BadNodeIdUnknown

Output:

Status code: BadNodeIdUnknown
Internal value: 2150891520 (0x80340000)