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(
True)
26 client.connect(
"opc.tcp://utgaard:12685/ctt-server")
30 root = client.get_root_node()
31 print(
"I got root: ", root)
32 print(
"Childs are: ", root.get_children())
33 print(
"Objects is: ", client.get_objects_node())
34 o = client.get_objects_node()
35 print(
"Children of objects are: ", o.get_children())
36 myvar = root.get_child([
"0:Objects",
"2:NewObject",
"2:MyVariable"])
37 print(
"yvar is: ", myvar)
40 sub = client.create_subscription(100, sclt)
41 handle = sub.subscribe_data_change(myvar)
42 print(
"Subscribe handle is: ", handle)
43 evhandle = sub.subscribe_events()
44 print(
"Subscribe handle is: ", evhandle)
FMT_API void print(std::FILE *f, CStringRef format_str, ArgList args)
def data_change(self, handle, node, val, attr)
def event(self, handle, event)