Commit a0094c4e authored by yogesh.m's avatar yogesh.m

update

parent 82aaba97
...@@ -57,7 +57,6 @@ async def get_send_hash(): ...@@ -57,7 +57,6 @@ async def get_send_hash():
node_hierarchy["hash"] = hash(str(node_hierarchy)) node_hierarchy["hash"] = hash(str(node_hierarchy))
json_hierarchy = json.dumps(node_hierarchy) json_hierarchy = json.dumps(node_hierarchy)
hierarchy=pickle.dumps(json_hierarchy) hierarchy=pickle.dumps(json_hierarchy)
print(json_hierarchy)
UDPClientSocket.sendto(hierarchy, serverAddressPort) UDPClientSocket.sendto(hierarchy, serverAddressPort)
def send_hash(): def send_hash():
......
...@@ -34,23 +34,30 @@ class MyHandler(SubHandler): ...@@ -34,23 +34,30 @@ class MyHandler(SubHandler):
pass pass
async def get_nodes(client): variables=[]
subnodes = None async def get_nodes(client,node_objects):
root = client.get_root_node() for sub_obj in node_objects:
objects = await root.get_children() if ("ns=3;" in str(sub_obj)):
for obj in objects: node = client.get_node(sub_obj)
nodes = await obj.get_children() children_nodes = await node.get_children()
for node in nodes: identifier = str(children_nodes[0].nodeid.Identifier) if children_nodes else ""
node_id = node.nodeid.Identifier node_class = await sub_obj.read_node_class()
if (node_id == str('85/0:Simulation')): if (identifier not in str(sub_obj)):
subnodes = await node.get_children() await get_nodes(client, children_nodes)
return subnodes if (node_class._name_ == "Variable"):
variables.append(sub_obj)
else:
if (node_class._name_ == "Variable"):
variables.append(sub_obj)
return variables
async def main() -> None: async def main() -> None:
async with Client(url=ENDPOINT) as client: async with Client(url=ENDPOINT) as client:
# Get a variable node. # Get a variable node.
node = await get_nodes(client) object_root_node = client.get_objects_node()
objects = await object_root_node.get_children()
node = await get_nodes(client,objects)
# Subscribe data change. # Subscribe data change.
t1=threading.Thread(target=hash_sender.send_hash) t1=threading.Thread(target=hash_sender.send_hash)
t1.start() t1.start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment