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
ab8950de
Commit
ab8950de
authored
Mar 15, 2023
by
yogesh.m
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9c79907c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
hash_sender.py
hash_sender.py
+0
-1
opcua-transmitter.py
opcua-transmitter.py
+16
-13
No files found.
hash_sender.py
View file @
ab8950de
...
@@ -38,7 +38,6 @@ async def create_node_hierarchy(client, node_objects):
...
@@ -38,7 +38,6 @@ async def create_node_hierarchy(client, node_objects):
async
def
get_send_hash
(
ENDPOINT
,
NAMESPACE
,
server_hash_udp_ip
,
server_hash_udp_port
):
async
def
get_send_hash
(
ENDPOINT
,
NAMESPACE
,
server_hash_udp_ip
,
server_hash_udp_port
):
global
nm_no
global
nm_no
serverAddressPort
=
(
server_hash_udp_ip
,
server_hash_udp_port
)
serverAddressPort
=
(
server_hash_udp_ip
,
server_hash_udp_port
)
bufferSize
=
1024
UDPClientSocket
=
socket
.
socket
(
family
=
socket
.
AF_INET
,
type
=
socket
.
SOCK_DGRAM
)
UDPClientSocket
=
socket
.
socket
(
family
=
socket
.
AF_INET
,
type
=
socket
.
SOCK_DGRAM
)
async
with
Client
(
url
=
ENDPOINT
)
as
client
:
async
with
Client
(
url
=
ENDPOINT
)
as
client
:
nm_no
=
await
client
.
get_namespace_index
(
NAMESPACE
)
nm_no
=
await
client
.
get_namespace_index
(
NAMESPACE
)
...
...
opcua-transmitter.py
View file @
ab8950de
...
@@ -60,19 +60,22 @@ async def get_nodes(client,node_objects):
...
@@ -60,19 +60,22 @@ async def get_nodes(client,node_objects):
async
def
main
()
->
None
:
async
def
main
()
->
None
:
global
nm_no
global
nm_no
async
with
Client
(
url
=
ENDPOINT
)
as
client
:
try
:
nm_no
=
str
(
await
client
.
get_namespace_index
(
NAMESPACE
))
async
with
Client
(
url
=
ENDPOINT
)
as
client
:
object_root_node
=
client
.
get_objects_node
()
nm_no
=
str
(
await
client
.
get_namespace_index
(
NAMESPACE
))
objects
=
await
object_root_node
.
get_children
()
object_root_node
=
client
.
get_objects_node
()
node
=
await
get_nodes
(
client
,
objects
)
objects
=
await
object_root_node
.
get_children
()
t1
=
threading
.
Thread
(
target
=
hash_sender
.
send_hash
,
args
=
(
ENDPOINT
,
NAMESPACE
,
server_hash_udp_ip
,
server_hash_udp_port
,))
node
=
await
get_nodes
(
client
,
objects
)
t1
.
start
()
t1
=
threading
.
Thread
(
target
=
hash_sender
.
send_hash
,
args
=
(
ENDPOINT
,
NAMESPACE
,
server_hash_udp_ip
,
server_hash_udp_port
,))
handler
=
MyHandler
()
t1
.
start
()
subscription
=
await
client
.
create_subscription
(
period
=
0
,
handler
=
handler
)
handler
=
MyHandler
()
await
subscription
.
subscribe_data_change
(
node
)
subscription
=
await
client
.
create_subscription
(
period
=
0
,
handler
=
handler
)
while
True
:
await
subscription
.
subscribe_data_change
(
node
)
await
handler
.
process
()
while
True
:
await
asyncio
.
sleep
(
0.01
)
await
handler
.
process
()
await
asyncio
.
sleep
(
0.01
)
except
:
print
(
"No connection found for opcua server, check if the server is active"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
asyncio
.
run
(
main
())
asyncio
.
run
(
main
())
...
...
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