Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
09eb9dc7
Commit
09eb9dc7
authored
May 18, 2023
by
Pete Bachant
Committed by
oroulet
May 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'depth' parameter to read_values
parent
4c6cc262
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
asyncua/client/client.py
asyncua/client/client.py
+13
-2
asyncua/sync.py
asyncua/sync.py
+3
-3
No files found.
asyncua/client/client.py
View file @
09eb9dc7
...
...
@@ -865,13 +865,24 @@ class Client:
node
.
nodeid
=
node
.
basenodeid
node
.
basenodeid
=
None
async
def
read_values
(
self
,
nodes
):
async
def
read_values
(
self
,
nodes
,
depth
=
2
):
"""
Read the value of multiple nodes in one ua call.
The 'depth' parameter defines how deep in the 'Value' attributes we
should extract
"""
if
0
>
depth
>
2
:
raise
ValueError
(
"'depth' must be between 0 and 2"
)
nodeids
=
[
node
.
nodeid
for
node
in
nodes
]
results
=
await
self
.
uaclient
.
read_attributes
(
nodeids
,
ua
.
AttributeIds
.
Value
)
return
[
result
.
Value
.
Value
for
result
in
results
]
vals
=
[]
for
r
in
results
:
v
=
r
for
_
in
range
(
depth
):
v
=
v
.
Value
vals
.
append
(
v
)
return
vals
async
def
write_values
(
self
,
nodes
,
values
):
"""
...
...
asyncua/sync.py
View file @
09eb9dc7
...
...
@@ -152,7 +152,7 @@ class _SubHandler:
def
event_notification
(
self
,
event
):
self
.
sync_handler
.
event_notification
(
event
)
def
status_change_notification
(
self
,
status
:
ua
.
StatusChangeNotification
):
self
.
sync_handler
.
status_change_notification
(
status
)
...
...
@@ -253,7 +253,7 @@ class Client:
pass
@
syncmethod
def
read_values
(
self
,
nodes
):
def
read_values
(
self
,
nodes
,
depth
=
2
):
pass
@
syncmethod
...
...
@@ -704,7 +704,7 @@ def new_enum( # type: ignore[empty-body]
name
:
Union
[
int
,
ua
.
QualifiedName
],
values
:
List
[
str
],
optional
:
bool
=
False
)
->
SyncNode
:
)
->
SyncNode
:
pass
...
...
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