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
137740f8
Commit
137740f8
authored
Jun 09, 2022
by
Alexander Schrode
Committed by
oroulet
Jun 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use BrowseResultMask
parent
4cde1daa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
asyncua/common/events.py
asyncua/common/events.py
+8
-5
asyncua/common/node.py
asyncua/common/node.py
+8
-6
No files found.
asyncua/common/events.py
View file @
137740f8
...
...
@@ -8,6 +8,9 @@ if TYPE_CHECKING:
from
asyncua.common.node
import
Node
_BROWSE_MASK
=
ua
.
BrowseResultMask
.
NodeClass
|
ua
.
BrowseResultMask
.
ReferenceTypeId
|
ua
.
BrowseResultMask
.
BrowseName
class
Event
:
"""
OPC UA Event object.
...
...
@@ -161,12 +164,12 @@ async def _select_clause_from_childs(child: "Node", refs: List[ua.ReferenceDescr
await
_append_new_attribute_to_select_clauses
(
select_clauses
,
already_selected
,
[
*
browse_path
]
+
[
ref
.
BrowseName
])
else
:
await
_append_new_attribute_to_select_clauses
(
select_clauses
,
already_selected
,
[
*
browse_path
]
+
[
ref
.
BrowseName
])
var
=
child
.
init_child_node
(
ref
.
NodeId
)
refs
=
await
var
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
)
var
=
child
.
new_node
(
child
.
server
,
ref
.
NodeId
)
refs
=
await
var
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
,
_BROWSE_MASK
)
await
_select_clause_from_childs
(
var
,
refs
,
select_clauses
,
already_selected
,
browse_path
+
[
ref
.
BrowseName
])
elif
ref
.
NodeClass
==
ua
.
NodeClass
.
Object
:
obj
=
child
.
init_child_node
(
ref
.
NodeId
)
refs
=
await
obj
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
)
obj
=
child
.
new_node
(
child
.
server
,
ref
.
NodeId
)
refs
=
await
obj
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
,
_BROWSE_MASK
)
await
_select_clause_from_childs
(
obj
,
refs
,
select_clauses
,
already_selected
,
browse_path
+
[
ref
.
BrowseName
])
...
...
@@ -174,7 +177,7 @@ async def select_clauses_from_evtype(evtypes: List["Node"]):
select_clauses
=
[]
already_selected
=
{}
for
evtype
in
evtypes
:
refs
=
await
select_event_attributes_from_type_node
(
evtype
,
lambda
n
:
n
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
))
refs
=
await
select_event_attributes_from_type_node
(
evtype
,
lambda
n
:
n
.
get_references
(
ua
.
ObjectIds
.
Aggregates
,
ua
.
BrowseDirection
.
Forward
,
ua
.
NodeClass
.
Object
|
ua
.
NodeClass
.
Variable
,
True
,
_BROWSE_MASK
))
if
refs
:
await
_select_clause_from_childs
(
evtype
,
refs
,
select_clauses
,
already_selected
,
[])
return
select_clauses
...
...
asyncua/common/node.py
View file @
137740f8
...
...
@@ -369,8 +369,8 @@ class Node:
"""
return
self
.
get_children
(
refs
=
ua
.
ObjectIds
.
HasComponent
,
nodeclassmask
=
ua
.
NodeClass
.
Method
)
async
def
get_children_descriptions
(
self
,
refs
=
ua
.
ObjectIds
.
HierarchicalReferences
,
nodeclassmask
=
ua
.
NodeClass
.
Unspecified
,
includesubtypes
=
True
):
return
await
self
.
get_references
(
refs
,
ua
.
BrowseDirection
.
Forward
,
nodeclassmask
,
includesubtypes
)
async
def
get_children_descriptions
(
self
,
refs
=
ua
.
ObjectIds
.
HierarchicalReferences
,
nodeclassmask
=
ua
.
NodeClass
.
Unspecified
,
includesubtypes
=
True
,
result_mask
=
ua
.
BrowseResultMask
.
All
):
return
await
self
.
get_references
(
refs
,
ua
.
BrowseDirection
.
Forward
,
nodeclassmask
,
includesubtypes
,
result_mask
)
def
get_encoding_refs
(
self
):
return
self
.
get_referenced_nodes
(
ua
.
ObjectIds
.
HasEncoding
,
ua
.
BrowseDirection
.
Forward
)
...
...
@@ -378,7 +378,7 @@ class Node:
def
get_description_refs
(
self
):
return
self
.
get_referenced_nodes
(
ua
.
ObjectIds
.
HasDescription
,
ua
.
BrowseDirection
.
Forward
)
async
def
get_references
(
self
,
refs
=
ua
.
ObjectIds
.
References
,
direction
=
ua
.
BrowseDirection
.
Both
,
nodeclassmask
=
ua
.
NodeClass
.
Unspecified
,
includesubtypes
=
True
):
async
def
get_references
(
self
,
refs
=
ua
.
ObjectIds
.
References
,
direction
=
ua
.
BrowseDirection
.
Both
,
nodeclassmask
=
ua
.
NodeClass
.
Unspecified
,
includesubtypes
=
True
,
result_mask
=
ua
.
BrowseResultMask
.
All
):
"""
returns references of the node based on specific filter defined with:
...
...
@@ -386,13 +386,14 @@ class Node:
direction = Browse direction for references
nodeclassmask = filter nodes based on specific class
includesubtypes = If true subtypes of the reference (ref) are also included
result_mask = define what results information are requested
"""
desc
=
ua
.
BrowseDescription
()
desc
.
BrowseDirection
=
direction
desc
.
ReferenceTypeId
=
_to_nodeid
(
refs
)
desc
.
IncludeSubtypes
=
includesubtypes
desc
.
NodeClassMask
=
nodeclassmask
desc
.
ResultMask
=
ua
.
BrowseResultMask
.
All
desc
.
ResultMask
=
result_mask
desc
.
NodeId
=
self
.
nodeid
params
=
ua
.
BrowseParameters
()
params
.
View
.
Timestamp
=
ua
.
get_win_epoch
()
...
...
@@ -726,8 +727,9 @@ class Node:
self
.
nodeid
=
self
.
basenodeid
self
.
basenodeid
=
None
def
init_child_node
(
self
,
nodeid
:
ua
.
NodeId
):
@
staticmethod
def
new_node
(
server
,
nodeid
:
ua
.
NodeId
):
"""
Helper function to init nodes with out importing Node
"""
return
Node
(
se
lf
.
se
rver
,
nodeid
)
return
Node
(
server
,
nodeid
)
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