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
bfc80dff
Commit
bfc80dff
authored
Dec 22, 2022
by
Alexander Schrode
Committed by
oroulet
Dec 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle missing types
parent
4e2389e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
asyncua/common/ua_utils.py
asyncua/common/ua_utils.py
+9
-6
No files found.
asyncua/common/ua_utils.py
View file @
bfc80dff
...
...
@@ -231,17 +231,20 @@ async def data_type_to_variant_type(dtype_node):
data. This is not exactly straightforward...
"""
base
=
await
get_base_data_type
(
dtype_node
)
if
base
.
nodeid
.
Identifier
!=
29
:
return
ua
.
VariantType
(
base
.
nodeid
.
Identifier
)
# we have an enumeration, value is a Int32
return
ua
.
VariantType
.
Int32
if
base
.
nodeid
.
Identifier
==
29
:
# we have an enumeration, value is a Int32
return
ua
.
VariantType
.
Int32
elif
base
.
nodeid
.
Identifier
in
[
24
,
26
,
27
,
28
]:
# BaseDataType, Number, Integer, UInteger -> Variant
return
ua
.
VariantType
.
Variant
return
ua
.
VariantType
(
base
.
nodeid
.
Identifier
)
async
def
get_base_data_type
(
datatype
):
"""
Looks up the base datatype of the provided datatype Node
The base datatype is either:
A primitive type (ns=0, i<=21) or a complex one (ns=0 i>21 and i<
=
30) like Enum and Struct.
A primitive type (ns=0, i<=21) or a complex one (ns=0 i>21 and i<30) like Enum and Struct.
Args:
datatype: NodeId of a datype of a variable
...
...
@@ -250,7 +253,7 @@ async def get_base_data_type(datatype):
"""
base
=
datatype
while
base
:
if
base
.
nodeid
.
NamespaceIndex
==
0
and
isinstance
(
base
.
nodeid
.
Identifier
,
int
)
and
base
.
nodeid
.
Identifier
<
=
30
:
if
base
.
nodeid
.
NamespaceIndex
==
0
and
isinstance
(
base
.
nodeid
.
Identifier
,
int
)
and
base
.
nodeid
.
Identifier
<
30
:
return
base
base
=
await
get_node_supertype
(
base
)
raise
ua
.
UaError
(
f"Datatype must be a subtype of builtin types
{
str
(
datatype
)
}
"
)
...
...
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