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
7e0e28a5
Commit
7e0e28a5
authored
Dec 01, 2022
by
Christoph Ziebuhr
Committed by
oroulet
Dec 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically set ServerTimestamp on Value attributes
parent
e680d7ee
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
2 deletions
+14
-2
asyncua/server/address_space.py
asyncua/server/address_space.py
+7
-1
asyncua/server/internal_server.py
asyncua/server/internal_server.py
+1
-1
asyncua/server/server.py
asyncua/server/server.py
+6
-0
No files found.
asyncua/server/address_space.py
View file @
7e0e28a5
...
...
@@ -100,8 +100,12 @@ class AttributeService:
):
res
.
append
(
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadUserAccessDenied
))
continue
if
writevalue
.
AttributeId
==
ua
.
AttributeIds
.
Value
and
self
.
_aspace
.
force_server_timestamp
:
dv
=
dataclasses
.
replace
(
writevalue
.
Value
,
ServerTimestamp
=
datetime
.
utcnow
(),
ServerPicoseconds
=
None
)
else
:
dv
=
writevalue
.
Value
res
.
append
(
await
self
.
_aspace
.
write_attribute_value
(
writevalue
.
NodeId
,
writevalue
.
AttributeId
,
writevalue
.
Value
)
await
self
.
_aspace
.
write_attribute_value
(
writevalue
.
NodeId
,
writevalue
.
AttributeId
,
dv
)
)
return
res
...
...
@@ -506,6 +510,7 @@ class NodeManagementService:
dv
=
ua
.
DataValue
(
ua
.
Variant
(
getattr
(
attributes
,
name
),
vtype
,
is_array
=
is_array
),
SourceTimestamp
=
datetime
.
utcnow
()
if
add_timestamps
else
None
,
ServerTimestamp
=
datetime
.
utcnow
()
if
add_timestamps
and
self
.
_aspace
.
force_server_timestamp
else
None
,
)
nodedata
.
attributes
[
getattr
(
ua
.
AttributeIds
,
name
)]
=
AttributeValue
(
dv
)
...
...
@@ -605,6 +610,7 @@ class AddressSpace:
def
__init__
(
self
):
self
.
logger
=
logging
.
getLogger
(
__name__
)
self
.
force_server_timestamp
:
bool
=
True
self
.
_nodes
:
Dict
[
ua
.
NodeId
,
NodeData
]
=
{}
self
.
_datachange_callback_counter
=
200
self
.
_handle_to_attribute_map
:
Dict
[
int
,
Tuple
[
ua
.
NodeId
,
ua
.
AttributeIds
]]
=
{}
...
...
asyncua/server/internal_server.py
View file @
7e0e28a5
...
...
@@ -110,7 +110,7 @@ class InternalServer:
attr
.
Value
=
ua
.
DataValue
(
ua
.
Variant
(
10000
,
ua
.
VariantType
.
UInt32
),
StatusCode_
=
ua
.
StatusCode
(
ua
.
StatusCodes
.
Good
),
S
erver
Timestamp
=
datetime
.
utcnow
(),
S
ource
Timestamp
=
datetime
.
utcnow
(),
)
params
.
NodesToWrite
.
append
(
attr
)
result
=
await
self
.
isession
.
write
(
params
)
...
...
asyncua/server/server.py
View file @
7e0e28a5
...
...
@@ -139,6 +139,12 @@ class Server:
"""
self
.
iserver
.
match_discovery_source_ip
=
match_discovery_client_ip
def
set_force_server_timestamp
(
self
,
force_server_timestamp
:
bool
):
"""
Enables or disables automatically setting ServerTimestamp on Value attributes
"""
self
.
iserver
.
aspace
.
force_server_timestamp
=
force_server_timestamp
async
def
set_build_info
(
self
,
product_uri
,
manufacturer_name
,
product_name
,
software_version
,
build_number
,
build_date
):
...
...
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