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

update

parent 82aaba97
......@@ -57,7 +57,6 @@ async def get_send_hash():
node_hierarchy["hash"] = hash(str(node_hierarchy))
json_hierarchy = json.dumps(node_hierarchy)
hierarchy=pickle.dumps(json_hierarchy)
print(json_hierarchy)
UDPClientSocket.sendto(hierarchy, serverAddressPort)
def send_hash():
......
......@@ -34,23 +34,30 @@ class MyHandler(SubHandler):
pass
async def get_nodes(client):
subnodes = None
root = client.get_root_node()
objects = await root.get_children()
for obj in objects:
nodes = await obj.get_children()
for node in nodes:
node_id = node.nodeid.Identifier
if (node_id == str('85/0:Simulation')):
subnodes = await node.get_children()
return subnodes
variables=[]
async def get_nodes(client,node_objects):
for sub_obj in node_objects:
if ("ns=3;" in str(sub_obj)):
node = client.get_node(sub_obj)
children_nodes = await node.get_children()
identifier = str(children_nodes[0].nodeid.Identifier) if children_nodes else ""
node_class = await sub_obj.read_node_class()
if (identifier not in str(sub_obj)):
await get_nodes(client, children_nodes)
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 with Client(url=ENDPOINT) as client:
# 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.
t1=threading.Thread(target=hash_sender.send_hash)
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