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
3882b138
Commit
3882b138
authored
Aug 10, 2020
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inheritd fields from parent for substructure in loads_data_type_definition
parent
eb54353c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
asyncua/common/structures104.py
asyncua/common/structures104.py
+7
-2
tests/test_unit.py
tests/test_unit.py
+0
-2
No files found.
asyncua/common/structures104.py
View file @
3882b138
...
...
@@ -68,6 +68,8 @@ class {name}:
"""
counter = 0
# FIXME: with subscturutre weprobably need to add all fields from parents
# this requires network call etc...
if sdef.StructureType == ua.StructureType.StructureWithOptionalFields:
code += '
ua_switches
=
{
\
n
'
for field in sdef.Fields:
...
...
@@ -170,14 +172,17 @@ class DataTypeSorter:
__repr__ = __str__
async def _recursive_parse(server, base_node, dtypes):
async def _recursive_parse(server, base_node, dtypes
, parent_sdef=None
):
for desc in await base_node.get_children_descriptions(refs=ua.ObjectIds.HasSubtype):
sdef = await _read_data_type_definition(server, desc)
if not sdef:
continue
name = clean_name(desc.BrowseName.Name)
if parent_sdef:
for field in reversed(parent_sdef.Fields):
sdef.Fields.insert(0, field)
dtypes.append(DataTypeSorter(desc.NodeId, name, desc, sdef))
await _recursive_parse(server, server.get_node(desc.NodeId), dtypes)
await _recursive_parse(server, server.get_node(desc.NodeId), dtypes
, parent_sdef=sdef
)
async def load_data_type_definitions(server, base_node=None):
...
...
tests/test_unit.py
View file @
3882b138
...
...
@@ -714,6 +714,4 @@ def test_bin_data_type_def():
data
=
struct_to_binary
(
ad
)
ad2
=
struct_from_binary
(
ua
.
AddNodesItem
,
ua
.
utils
.
Buffer
(
data
))
assert
ad
.
ParentNodeId
==
ad2
.
ParentNodeId
from
IPython
import
embed
#embed()
assert
ad
.
NodeAttributes
.
DisplayName
==
ad2
.
NodeAttributes
.
DisplayName
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