Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-cloning
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yogesh.m
opcua-cloning
Commits
a0094c4e
Commit
a0094c4e
authored
Mar 10, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
82aaba97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
hash_sender.py
hash_sender.py
+0
-1
opcua-transmitter.py
opcua-transmitter.py
+19
-12
No files found.
hash_sender.py
View file @
a0094c4e
...
...
@@ -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
():
...
...
opcua-transmitter.py
View file @
a0094c4e
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment