이 페이지에서

MethodNode QML Type

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

Import Statement: import QtOpcUa
Since: QtOpcUa 5.12
Inherits:

Node

Status: Deprecated since 6.9

이 유형은 QtOpcUa 6.9부터 더 이상 사용되지 않습니다. 새로운 코드에서는 이 유형을 사용하지 않는 것을 강력히 권장합니다.

속성

방법

상세 설명

이 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
}

또는 JavaScript를 통해

myNode.callMethod()

속성 문서

inputArguments : list<MethodArgument>

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

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

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

callMethod도 참조하십시오 .

objectNodeId : OpcUaNode

메서드가 호출되는 실제 노드를 지정합니다. 상대 노드 ID나 절대 노드 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])
}

callMethod 및 resultStatus도 참조하십시오 .

resultStatus : Status [read-only]

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

Status도 참조하십시오 .

type : QOpcUa::Types

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

MethodNode::callMethod도 참조하십시오 .

메서드 문서

void callMethod()

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

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