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
ba17d430
Commit
ba17d430
authored
Jun 10, 2021
by
oroulet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not accept overwritting a node attribute with Null unless Null is the specified type
parent
447ed44f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
8 deletions
+6
-8
asyncua/server/address_space.py
asyncua/server/address_space.py
+0
-3
examples/server-example.py
examples/server-example.py
+2
-1
tests/test_common.py
tests/test_common.py
+1
-1
tests/test_custom_structures.py
tests/test_custom_structures.py
+2
-2
tests/test_xml.py
tests/test_xml.py
+1
-1
No files found.
asyncua/server/address_space.py
View file @
ba17d430
...
...
@@ -725,9 +725,6 @@ 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
...
...
examples/server-example.py
View file @
ba17d430
...
...
@@ -94,7 +94,8 @@ async def main():
mydtvar
=
await
myobj
.
add_variable
(
idx
,
"MyDateTimeVar"
,
datetime
.
utcnow
())
await
mydtvar
.
set_writable
()
# Set MyVariable to be writable by clients
myarrayvar
=
await
myobj
.
add_variable
(
idx
,
"myarrayvar"
,
[
6.7
,
7.9
])
myarrayvar
=
await
myobj
.
add_variable
(
idx
,
"myStronglytTypedVariable"
,
ua
.
Variant
([],
ua
.
VariantType
.
UInt32
))
await
myobj
.
add_variable
(
idx
,
"myStronglytTypedVariable"
,
ua
.
Variant
([],
ua
.
VariantType
.
UInt32
))
await
myarrayvar
.
set_writable
(
True
)
myprop
=
await
myobj
.
add_property
(
idx
,
"myproperty"
,
"I am a property"
)
mymethod
=
await
myobj
.
add_method
(
idx
,
"mymethod"
,
func
,
[
ua
.
VariantType
.
Int64
],
[
ua
.
VariantType
.
Boolean
])
multiply_node
=
await
myobj
.
add_method
(
idx
,
"multiply"
,
multiply
,
[
ua
.
VariantType
.
Int64
,
ua
.
VariantType
.
Int64
],
[
ua
.
VariantType
.
Int64
])
...
...
tests/test_common.py
View file @
ba17d430
...
...
@@ -439,7 +439,7 @@ async def test_utf8(opc):
async
def
test_null_variable
(
opc
):
objects
=
opc
.
opc
.
nodes
.
objects
var
=
await
objects
.
add_variable
(
3
,
'nullstring'
,
"a string"
)
await
var
.
write_value
(
None
)
await
var
.
write_value
(
ua
.
Variant
(
None
,
ua
.
VariantType
.
String
)
)
val
=
await
var
.
read_value
()
assert
val
is
None
await
var
.
write_value
(
""
)
...
...
tests/test_custom_structures.py
View file @
ba17d430
...
...
@@ -365,7 +365,7 @@ async def test_functional_advance(srv):
await
srv
.
srv
.
load_type_definitions
()
basic_var
=
await
srv
.
srv
.
nodes
.
objects
.
add_variable
(
ua
.
NodeId
(
NamespaceIndex
=
srv
.
idx
),
'BasicStruct'
,
ua
.
Variant
(
None
,
ua
.
VariantType
.
Null
),
ua
.
Variant
(
None
,
ua
.
VariantType
.
ExtensionObject
),
datatype
=
basic_struct
.
data_type
)
basic_msg
=
get_ua_class
(
basic_struct_name
)()
...
...
@@ -375,7 +375,7 @@ async def test_functional_advance(srv):
await
basic_var
.
write_value
(
basic_msg
)
nested_var
=
await
srv
.
srv
.
nodes
.
objects
.
add_variable
(
ua
.
NodeId
(
NamespaceIndex
=
srv
.
idx
),
'NestedStruct'
,
ua
.
Variant
(
None
,
ua
.
VariantType
.
Null
),
ua
.
Variant
(
None
,
ua
.
VariantType
.
ExtensionObject
),
datatype
=
nested_struct
.
data_type
)
nested_msg
=
get_ua_class
(
nested_struct_name
)()
...
...
tests/test_xml.py
View file @
ba17d430
...
...
@@ -228,7 +228,7 @@ async def test_xml_string(opc, tmpdir):
async
def
test_xml_string_with_null_description
(
opc
,
tmpdir
):
o
=
await
opc
.
opc
.
nodes
.
objects
.
add_variable
(
2
,
"xmlstring"
,
"mystring"
)
await
o
.
write_attribute
(
ua
.
AttributeIds
.
Description
,
ua
.
DataValue
(
None
))
await
o
.
write_attribute
(
ua
.
AttributeIds
.
Description
,
ua
.
DataValue
(
ua
.
Variant
(
ua
.
LocalizedText
())
))
o2
=
await
_test_xml_var_type
(
opc
,
tmpdir
,
o
,
"string"
)
assert
await
o
.
read_description
()
==
await
o2
.
read_description
()
await
opc
.
opc
.
delete_nodes
([
o
,
o2
])
...
...
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