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)
| 25 | |
| 26 | |
| 27 | def 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 | |
| 45 | def _call_method(server, parentnodeid, methodid, arguments): |