跳到主要内容

Method 方法

OPC UA Method 节点是服务端暴露的 RPC 接口. 通过 ua.call(...) 调用.

子页跳转
  • 调用方法的完整签名 / 内存所有权 / 找方法 NodeId 请参考 call.
  • 报警 Acknowledge 也通过 call 调用, 见 事件订阅.

一分钟示例

from darra_opcua import OpcUaVariant

outputs = ua.call(
object_node_id="ns=2;s=Calculator",
method_node_id="ns=2;s=Calculator.Add",
inputs=[OpcUaVariant().set_int32(3), OpcUaVariant().set_int32(4)])

for v in outputs:
with v:
print(f"sum = {v.as_int32}")

下一步