MethodNode QML Type

서버에서 메서드를 호출합니다. 더 보기...

Import Statement: import QtOpcUa
Since: QtOpcUa 5.12
Inherits:

Node

속성

방법

상세 설명

이 QML 요소는 서버에서 메서드 노드 호출을 지원합니다. 대상 객체 노드 ID는 objectNodeId 프로퍼티로 지정해야 합니다.

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
 }

실제 함수 호출은 신호에 의해 트리거될 수 있습니다.

Button {
      text: "Start"
      onClicked: myNode.callMethod
}

또는 자바스크립트에 의해

myNode.callMethod()

속성 문서

inputArguments : list<MethodArgument>

서버에서 메서드를 호출할 때 사용할 인수입니다.

이 예는 두 개의 이중 인수를 사용하여 메서드를 호출하는 방법을 보여줍니다.

QtOpcUa.MethodNode {
    ...
    inputArguments: [
        QtOpcUa.MethodArgument {
            value: 3
            type: QtOpcUa.Constants.Double
        },
        QtOpcUa.MethodArgument {
            value: 4
            type: QtOpcUa.Constants.Double
        }
    ]
}

callMethod참조하세요 .


objectNodeId : OpcUaNode

메서드가 호출되는 실제 노드를 결정합니다. 상대 또는 절대 노드 Id일 수 있습니다.


outputArguments : list<var> [read-only]

메서드 호출의 값을 반환합니다. 출력 인자에 따라 이 목록에는 0개 이상의 값이 포함될 수 있습니다. resultStatus 은 별도로 확인해야 합니다. 메서드 호출에 실패하면 목록이 비어 있습니다.

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])
}

callMethodresultStatus참조하세요 .


resultStatus : Status [read-only]

마지막 메서드 호출의 상태. 메서드 호출이 성공했는지 확인하려면 이 속성을 확인해야 합니다.

Status도 참조 하세요.


type : QOpcUa::Types

서버에서 예상되는 인수의 유형을 설정합니다. 메서드를 호출할 때 값 변형이 해당 유형으로 변환됩니다. 유형은 서버의 메서드와 정확히 일치해야 하며, 그렇지 않으면 메서드 호출이 실패합니다.

MethodNode::callMethod참조하세요 .


메서드 문서

callMethod()

연결된 서버의 메서드를 호출합니다.


© 2025 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.