6 from IPython
import embed
11 opcua.SubscriptionHandler.__init__(self, *args)
12 self.
val = MessageSecurityMode::
None 15 print(
"Python: New data change event", handle, node, val, attr)
19 print(
"Python: New event", handle, event)
23 if __name__ ==
"__main__":
24 client = opcua.Client(
False)
25 client.connect(
"opc.tcp://localhost:53530/OPCUA/SimulationServer/")
27 root = client.get_root_node()
28 print(
"I got root: ", root)
29 print(
"Childs are: ", root.get_children())
30 print(
"Objects is: ", client.get_objects_node())
31 o = client.get_objects_node()
32 print(
"Children of objects are: ", o.get_children())
34 myvar = root.get_child([
"0:Objects",
"5:Simulation",
"5:Random1"])
35 print(
"yvar is: ", myvar)
36 myfloat = client.get_node(
"ns=4;s=Float")
37 mydouble = client.get_node(
"ns=4;s=Double")
38 myint64 = client.get_node(
"ns=4;s=Int64")
39 myuint64 = client.get_node(
"ns=4;s=UInt64")
40 myint32 = client.get_node(
"ns=4;s=Int32")
41 myuint32 = client.get_node(
"ns=4;s=UInt32")
44 sub = client.create_subscription(100, sclt)
45 handle = sub.subscribe_data_change(myvar)
46 print(
"Subscribe handle is: ", handle)
FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args)
def event(self, handle, event)
def data_change(self, handle, node, val, attr)