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
3b30f433
Commit
3b30f433
authored
Mar 10, 2021
by
oroulet
Committed by
oroulet
Mar 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export xml in struct example (jsut for easier testing debug)
parent
ca0d9f2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
examples/server-data-type-definition.py
examples/server-data-type-definition.py
+6
-4
No files found.
examples/server-data-type-definition.py
View file @
3b30f433
...
@@ -18,16 +18,16 @@ async def main():
...
@@ -18,16 +18,16 @@ async def main():
uri
=
'http://examples.freeopcua.github.io'
uri
=
'http://examples.freeopcua.github.io'
idx
=
await
server
.
register_namespace
(
uri
)
idx
=
await
server
.
register_namespace
(
uri
)
await
new_struct
(
server
,
idx
,
"MyStruct"
,
[
snode1
,
_
=
await
new_struct
(
server
,
idx
,
"MyStruct"
,
[
new_struct_field
(
"MyBool"
,
ua
.
VariantType
.
Boolean
),
new_struct_field
(
"MyBool"
,
ua
.
VariantType
.
Boolean
),
new_struct_field
(
"MyUInt32List"
,
ua
.
VariantType
.
UInt32
,
array
=
True
),
new_struct_field
(
"MyUInt32List"
,
ua
.
VariantType
.
UInt32
,
array
=
True
),
])
])
await
new_struct
(
server
,
idx
,
"MyOptionalStruct"
,
[
snode2
,
_
=
await
new_struct
(
server
,
idx
,
"MyOptionalStruct"
,
[
new_struct_field
(
"MyBool"
,
ua
.
VariantType
.
Boolean
),
new_struct_field
(
"MyBool"
,
ua
.
VariantType
.
Boolean
),
new_struct_field
(
"MyUInt32List"
,
ua
.
VariantType
.
UInt32
,
array
=
True
),
new_struct_field
(
"MyUInt32List"
,
ua
.
VariantType
.
UInt32
,
array
=
True
),
new_struct_field
(
"MyInt64"
,
ua
.
VariantType
.
Int64
,
optional
=
True
),
new_struct_field
(
"MyInt64"
,
ua
.
VariantType
.
Int64
,
optional
=
True
),
])
])
await
new_enum
(
server
,
idx
,
"MyEnum"
,
[
enode
=
await
new_enum
(
server
,
idx
,
"MyEnum"
,
[
"titi"
,
"titi"
,
"toto"
,
"toto"
,
"tutu"
,
"tutu"
,
...
@@ -35,13 +35,15 @@ async def main():
...
@@ -35,13 +35,15 @@ async def main():
await
server
.
load_data_type_definitions
()
await
server
.
load_data_type_definitions
()
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_enum"
,
ua
.
MyEnum
.
toto
)
valnode
=
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_enum"
,
ua
.
MyEnum
.
toto
)
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_struct"
,
ua
.
Variant
(
ua
.
MyStruct
(),
ua
.
VariantType
.
ExtensionObject
))
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_struct"
,
ua
.
Variant
(
ua
.
MyStruct
(),
ua
.
VariantType
.
ExtensionObject
))
my_struct_optional
=
ua
.
MyOptionalStruct
()
my_struct_optional
=
ua
.
MyOptionalStruct
()
my_struct_optional
.
MyUInt32List
=
[
45
,
67
]
my_struct_optional
.
MyUInt32List
=
[
45
,
67
]
my_struct_optional
.
MyInt64
=
-
67
my_struct_optional
.
MyInt64
=
-
67
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_struct_optional"
,
ua
.
Variant
(
my_struct_optional
,
ua
.
VariantType
.
ExtensionObject
))
await
server
.
nodes
.
objects
.
add_variable
(
idx
,
"my_struct_optional"
,
ua
.
Variant
(
my_struct_optional
,
ua
.
VariantType
.
ExtensionObject
))
await
server
.
export_xml
([
server
.
nodes
.
objects
,
server
.
nodes
.
root
,
snode1
,
snode2
,
enode
,
valnode
],
"structs_and_enum.xml"
)
async
with
server
:
async
with
server
:
while
True
:
while
True
:
await
asyncio
.
sleep
(
1
)
await
asyncio
.
sleep
(
1
)
...
...
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