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
25fdae58
Commit
25fdae58
authored
Jun 25, 2015
by
Olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add timestamp for datavalues in server. since it is not default anymore
parent
0268d918
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
opcua/address_space.py
opcua/address_space.py
+10
-1
opcua/uatypes.py
opcua/uatypes.py
+5
-5
No files found.
opcua/address_space.py
View file @
25fdae58
from
threading
import
RLock
import
logging
import
pickle
from
datetime
import
datetime
from
opcua
import
ua
...
...
@@ -243,6 +244,8 @@ class NodeManagementService(object):
def
_add_node_attr
(
self
,
item
,
nodedata
,
name
,
vtype
=
None
):
if
item
.
SpecifiedAttributes
&
getattr
(
ua
.
NodeAttributesMask
,
name
):
dv
=
ua
.
DataValue
(
ua
.
Variant
(
getattr
(
item
,
name
),
vtype
))
dv
.
ServerTimestamp
=
datetime
.
now
()
dv
.
SourceTimestamp
=
datetime
.
now
()
nodedata
.
attributes
[
getattr
(
ua
.
AttributeIds
,
name
)]
=
AttributeValue
(
dv
)
def
_add_nodeattributes
(
self
,
item
,
nodedata
):
...
...
@@ -347,12 +350,13 @@ class AddressSpace(object):
def
get_attribute_value
(
self
,
nodeid
,
attr
):
with
self
.
_lock
:
#self.logger.debug("get attr val: %s %s", nodeid, attr)
dv
=
ua
.
DataValue
()
if
not
nodeid
in
self
.
_nodes
:
dv
=
ua
.
DataValue
()
dv
.
StatusCode
=
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadNodeIdUnknown
)
return
dv
node
=
self
.
_nodes
[
nodeid
]
if
attr
not
in
node
.
attributes
:
dv
=
ua
.
DataValue
()
dv
.
StatusCode
=
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadAttributeIdInvalid
)
return
dv
attval
=
node
.
attributes
[
attr
]
...
...
@@ -368,6 +372,11 @@ class AddressSpace(object):
node
=
self
.
_nodes
[
nodeid
]
if
not
attr
in
node
.
attributes
:
return
ua
.
StatusCode
(
ua
.
StatusCodes
.
BadAttributeIdInvalid
)
if
not
value
.
SourceTimestamp
:
value
.
SourceTimestamp
=
datetime
.
now
()
if
not
value
.
ServerTimestamp
:
value
.
ServerTimestamp
=
datetime
.
now
()
attval
=
node
.
attributes
[
attr
]
attval
.
value
=
value
if
attval
.
value_callback
:
...
...
opcua/uatypes.py
View file @
25fdae58
...
...
@@ -220,7 +220,7 @@ class Guid(object):
return
isinstance
(
other
,
Guid
)
and
self
.
uuid
==
other
.
uuid
class
StatusCode
(
object
):
class
StatusCode
(
FrozenClass
):
"""
:ivar value:
...
...
@@ -262,7 +262,7 @@ class NodeIdType(object):
ByteString
=
5
class
NodeId
(
object
):
class
NodeId
(
FrozenClass
):
"""
NodeId Object
...
...
@@ -470,7 +470,7 @@ class StringNodeId(NodeId):
ExpandedNodeId
=
NodeId
class
QualifiedName
(
object
):
class
QualifiedName
(
FrozenClass
):
'''
A string qualified with a namespace index.
...
...
@@ -683,7 +683,7 @@ class VariantType(Enum):
DiagnosticInfo
=
25
class
Variant
(
object
):
class
Variant
(
FrozenClass
):
"""
Create an OPC-UA Variant object.
...
...
@@ -770,7 +770,7 @@ class Variant(object):
return
obj
class
DataValue
(
object
):
class
DataValue
(
FrozenClass
):
'''
A value with an associated timestamp, and quality.
...
...
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