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
6c33879b
Commit
6c33879b
authored
Apr 28, 2016
by
Denis Štogl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add types correctly and start implementation for adding reference GeneratesEvent
parent
751d0512
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
opcua/common/event.py
opcua/common/event.py
+9
-0
opcua/common/manage_nodes.py
opcua/common/manage_nodes.py
+9
-4
No files found.
opcua/common/event.py
View file @
6c33879b
...
...
@@ -59,6 +59,15 @@ class EventGenerator(object):
self
.
event
.
SourceName
=
source
.
get_display_name
().
Text
source
.
set_attribute
(
ua
.
AttributeIds
.
EventNotifier
,
ua
.
DataValue
(
ua
.
Variant
(
1
,
ua
.
VariantType
.
Byte
)))
refs
=
[]
ref
=
ua
.
AddReferencesItem
()
ref
.
IsForward
=
True
ref
.
ReferenceTypeId
=
ua
.
ObjectIds
.
GeneratesEvent
ref
.
SourceNodeId
=
source
ref
.
TargetNodeClass
=
ua
.
NodeClass
.
ObjectType
ref
.
TargetNodeId
=
self
.
event
.
EventType
refs
.
append
(
ref
)
self
.
isession
.
add_references
(
refs
)
def
__str__
(
self
):
return
"EventGenerator(Type:{}, Source:{}, Time:{}, Message: {})"
.
format
(
self
.
EventType
,
self
.
SourceNode
,
self
.
Time
,
self
.
Message
)
...
...
opcua/common/manage_nodes.py
View file @
6c33879b
...
...
@@ -108,21 +108,26 @@ def _create_object(server, parentnodeid, nodeid, qname, objecttype):
addnode
=
ua
.
AddNodesItem
()
addnode
.
RequestedNewNodeId
=
nodeid
addnode
.
BrowseName
=
qname
addnode
.
NodeClass
=
ua
.
NodeClass
.
Object
addnode
.
ParentNodeId
=
parentnodeid
#TODO: maybe move to address_space.py and implement for all node types?
if
not
objecttype
:
addnode
.
ReferenceTypeId
=
ua
.
NodeId
(
ua
.
ObjectIds
.
HasSubtype
)
addnode
.
NodeClass
=
ua
.
NodeClass
.
ObjectType
attrs
=
ua
.
ObjectTypeAttributes
()
attrs
.
IsAbstract
=
True
else
:
addnode
.
TypeDefinition
=
ua
.
NodeId
(
objecttype
)
if
node
.
Node
(
server
,
parentnodeid
).
get_type_definition
()
==
ua
.
ObjectIds
.
FolderType
:
addnode
.
ReferenceTypeId
=
ua
.
NodeId
(
ua
.
ObjectIds
.
Organizes
)
else
:
addnode
.
ReferenceTypeId
=
ua
.
NodeId
(
ua
.
ObjectIds
.
HasComponent
)
attrs
=
ua
.
ObjectAttributes
()
addnode
.
NodeClass
=
ua
.
NodeClass
.
Object
addnode
.
TypeDefinition
=
ua
.
NodeId
(
objecttype
)
attrs
=
ua
.
ObjectAttributes
()
attrs
.
EventNotifier
=
0
attrs
.
Description
=
ua
.
LocalizedText
(
qname
.
Name
)
attrs
.
DisplayName
=
ua
.
LocalizedText
(
qname
.
Name
)
attrs
.
EventNotifier
=
0
attrs
.
WriteMask
=
0
attrs
.
UserWriteMask
=
0
addnode
.
NodeAttributes
=
attrs
...
...
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