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
191d7435
Commit
191d7435
authored
Jun 03, 2021
by
oroulet
Committed by
oroulet
Jun 12, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt to assess type of nodes having a Null value deep in address space
parent
93eebe36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
asyncua/server/address_space.py
asyncua/server/address_space.py
+23
-6
No files found.
asyncua/server/address_space.py
View file @
191d7435
...
...
@@ -706,12 +706,8 @@ class AddressSpace:
if
attval
is
None
:
return
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadAttributeIdInvalid
)
if
value
.
Value
.
VariantType
!=
attval
.
value
.
Value
.
VariantType
:
if
value
.
Value
.
VariantType
==
ua
.
VariantType
.
Null
or
attval
.
value
.
Value
.
VariantType
==
ua
.
VariantType
.
Null
:
pass
else
:
_logger
.
critical
(
"Write refused: Variant: %s with type %s does not have expected type: %s"
,
value
.
Value
,
value
.
Value
.
VariantType
,
attval
.
value
.
Value
.
VariantType
)
return
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadTypeMismatch
)
if
not
self
.
_is_expected_variant_type
(
value
,
attval
,
node
):
return
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadTypeMismatch
)
old
=
attval
.
value
attval
.
value
=
value
...
...
@@ -728,6 +724,27 @@ class AddressSpace:
return
ua
.
StatusCode
()
def
_is_expected_variant_type
(
self
,
value
,
attval
,
node
):
if
value
.
Value
.
VariantType
==
ua
.
VariantType
.
Null
:
# we accept overwrite with Null, not sure if this is OK in spec...
return
True
vtype
=
attval
.
value
.
Value
.
VariantType
if
vtype
==
ua
.
VariantType
.
Null
:
# Node had a null value, many nodes are initialized with that value
# we should check what the real type is
dtype
=
node
.
attributes
[
ua
.
AttributeIds
.
DataType
].
value
.
Value
.
Value
if
dtype
.
NamespaceIndex
==
0
and
dtype
.
Identifier
<=
25
:
vtype
=
ua
.
VariantType
(
dtype
.
Identifier
)
else
:
# FIXME: should find the correct variant type given data type but
# this is a bit complicaed so trusting the first write
return
True
if
value
.
Value
.
VariantType
==
vtype
:
return
True
_logger
.
critical
(
"Write refused: Variant: %s with type %s does not have expected type: %s"
,
value
.
Value
,
value
.
Value
.
VariantType
,
attval
.
value
.
Value
.
VariantType
)
return
False
def
add_datachange_callback
(
self
,
nodeid
,
attr
,
callback
):
self
.
logger
.
debug
(
"set attr callback: %s %s %s"
,
nodeid
,
attr
,
callback
)
if
nodeid
not
in
self
.
_nodes
:
...
...
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