MCPcopy Create free account
hub / github.com/FreeOpcUa/python-opcua / call_method_full

Function call_method_full

opcua/common/methods.py:27–42  ·  view source on GitHub ↗

Call an OPC-UA method. methodid is browse name of child method or the nodeid of method as a NodeId object arguments are variants or python object convertible to variants. which may be of different types returns a CallMethodResult object with converted OutputArguments

(parent, methodid, *args)

Source from the content-addressed store, hash-verified

25
26
27def call_method_full(parent, methodid, *args):
28 """
29 Call an OPC-UA method. methodid is browse name of child method or the
30 nodeid of method as a NodeId object
31 arguments are variants or python object convertible to variants.
32 which may be of different types
33 returns a CallMethodResult object with converted OutputArguments
34 """
35 if isinstance(methodid, (str, ua.uatypes.QualifiedName)):
36 methodid = parent.get_child(methodid).nodeid
37 elif isinstance(methodid, node.Node):
38 methodid = methodid.nodeid
39
40 result = _call_method(parent.server, parent.nodeid, methodid, to_variant(*args))
41 result.OutputArguments = [var.Value for var in result.OutputArguments]
42 return result
43
44
45def _call_method(server, parentnodeid, methodid, arguments):

Callers 4

test_method_array2Method · 0.90
test_method_tupleMethod · 0.90
test_method_noneMethod · 0.90
call_methodFunction · 0.85

Calls 3

_call_methodFunction · 0.85
to_variantFunction · 0.85
get_childMethod · 0.80

Tested by 3

test_method_array2Method · 0.72
test_method_tupleMethod · 0.72
test_method_noneMethod · 0.72