MethodNode QML Type
Calls a method on the server. More...
Import Statement: | import QtOpcUa |
Since: | QtOpcUa 5.12 |
Inherits: |
Properties
- inputArguments : list<MethodArgument>
- objectNodeId : OpcUaNode
- outputArguments : list<var>
- resultStatus : Status
- type : QOpcUa::Types
Methods
Detailed Description
This QML element supports calling method nodes on a server. The target object node ID has to be specified by the objectNodeId property.
import QtOpcUa as QtOpcUa QtOpcUa.MethodNode { nodeId : QtOpcUa.NodeId { identifier: "s=Example.Method" ns: "Example Namespace" } objectNodeId : QtOpcUa.NodeId { identifier: "s=Example.Object" ns: "Example Namespace" } connection: myConnection }
The actual function call can be triggered by a signal.
Button { text: "Start" onClicked: myNode.callMethod }
or by JavaScript
myNode.callMethod()
Property Documentation
inputArguments : list<MethodArgument> |
Arguments to be used when calling the method on the server.
This example shows how to call a method with two double arguments.
QtOpcUa.MethodNode { ... inputArguments: [ QtOpcUa.MethodArgument { value: 3 type: QtOpcUa.Constants.Double }, QtOpcUa.MethodArgument { value: 4 type: QtOpcUa.Constants.Double } ] }
See also callMethod.
objectNodeId : OpcUaNode |
Determines the actual node on which the method is called. It can be a relative or absolute node Id.
Returns values from the method call. Depending on the output arguments, this list may contain zero or more values. The resultStatus has to be checked separately. In case the method call failed, the list will be empty.
if (node.status.isGood) { // print two arguments console.log("Number of return values:", node.outputArguments.length) console.log("Return value #1:", node.outputArguments[0]) console.log("Return value #2:", node.outputArguments[1]) }
See also callMethod and resultStatus.
[read-only] resultStatus : Status |
Status of the last method call. This property has to be checked to determine if the method call was successful.
See also Status.
type : QOpcUa::Types |
Sets the type of the argument that is expected by the server. The value variant is converted to that type when calling the method. The type has to match the method on the server exactly, otherwise the method call will fail.
See also MethodNode::callMethod.
Method Documentation
callMethod() |
Calls the method on the connected server.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.