Command Details: Method_Call
Category
Extended
Details
Command Code: | 10h |
Valid for: | Object |
Description
This command is used to forward the Call service of the OPC UA Method service set to the host application. This command is only relevant if an application defined information model is used.
An OPC UA Method performs an operation defined by the application designer when being called. To provide input to the operation and to return a result of the operation a method can define input and output arguments in property nodes.
The input and output arguments of a method call are lists of Variants (union of all OPC UA built in types), see the OPC UA Specification for more information. All OPC UA data types are derived from an OPC UA built in type. It is therefore possible to always trace the built in type of an OPC UA type. The arguments will be translated to Anybus types using the translation table of OPC UA built in types specified in Translation of Data Types.
Request format
The Method_Call request provides the NodeId of the method being called, the NodeId of the object the method is being called on, and a list of input arguments.
Parameter | Data type | Description |
---|---|---|
CmdExt[0] | UINT8 | Reserved, ignore |
CmdExt[1] | UINT8 | Reserved, ignore |
Data[0-X] | Anybus NodeId | NodeId of the Method being called For more information, see Anybus NodeId type. |
Anybus NodeId | NodeId of the Object the Method is being called on For more information, see Anybus NodeId type. | |
UINT32 | Number of input arguments | |
UINT32 | Number of output arguments | |
Array of Anybus Argument | Input arguments For more information, see Anybus Argument type. |
Response format
If the operation performed by the method was successful the response holds a list of output arguments to be returned. If the operation was non-successful the response will contain either an Anybus error code or an object specific code. The Anybus error code is translated to an OPC UA Status Code according to the table below. If Anybus error code is set to 0xFF (Object specific error code) the host application sends the OPC UA status code transparent through the Object specific error code parameter.
Parameter | Data type | Description |
---|---|---|
CmdExt[0] | UINT8 | Reserved, set to zero |
CmdExt[1] | UINT8 | Reserved, set to zero |
Data[0-X] | Array of Anybus Argument | Output arguments An Array of structures describing output arguments. |
Parameter | Data type | Description |
---|---|---|
CmdExt[0] | UINT8 | Reserved, set to zero |
CmdExt[1] | UINT8 | Reserved, set to zero |
Data[0] | UINT8 | Anybus error code |
Data[1-4] | UINT32 | Object specific error code: OPC UA status code NoteThis parameter should only be present if Anybus error code = 0xFF. |
Anybus Argument type
Element | Data type | Description |
---|---|---|
Argument type | ENUM | 0: Scalar 1: Array 2: Struct (for future use) |
Number of elements | UINT8 | Argument type = Scalar: Always 1 Argument type = Array: Defines number of values Argument type = Struct: Defines number of the elements in the struct |
Data types | Array of UINT8 | Argument type = Scalar and Array: One single UINT8 Argument type = Struct: Number of data types defined by "Number of elements" Defines the data type of the value. BitFieldMaskDataType is not supported. For translation of data types between Anybus and OPC UA, see Translation of Data Types. |
Sub elements | Array of UINT16 | Argument type = Scalar and Array: One single UINT16 Argument type = Struct: Number of sub elements defined by "Number of elements" Defines Number of subelements in a string if data type is OCTET or CHAR. For other data types, always 1. |
Value | Any |
Anybus NodeId type
This is an Anybus representation of the OPC UA NodeId type. For more information, see the OPC UA Specification from the OPC Foundation.
Element | Data type | Description |
---|---|---|
Namespace index | UINT16 | Namespace index of the NodeId |
Identifier type | UINT16 | NodeId type of Method NodeId 0 = Numeric 3 = String 4 = GUID 5 = Bytestring |
Identifier | Union of: | Determined by Identifier type element |
UINT32 | Numeric identifier | |
Struct of: UINT32 CHAR[] | String identifier String length in bytes specified in the first element. Padded with one byte if length is odd. | |
Struct of: UINT32 UINT16 UINT16 OCTET[8] | GUID identifier | |
Struct of: UINT32 OCTET[] | ByteString identifier ByteString length in bytes specified in the first element. Padded with one byte if length is odd. |
Anybus error code to OPC UA status code translation
See Translation of Data Types for common translation of Anybus error codes. In the table below follows the error codes which depends on function specific translation.
Anybus error code | OPC UA Status code |
---|---|
Unsupported object | Bad_InternalError |
Unsupported instance | Bad_InternalError |
Unsupported command | Bad_InternalError |
Invalid Cmd Ext 0 | Bad_InternalError |
Invalid Cmd Ext 1 | Bad_InternalError |
Object specific error | Transparent OPC UA status code specified in Table 5: “Error response”. |
In case the output arguments in the response does not have the right format according to the information model Bad_InternalError will be returned and the error counter Discarded Responses in the Anybus object will be increased.