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
3f3ed7fb
Commit
3f3ed7fb
authored
Nov 18, 2022
by
martigr
Committed by
oroulet
Nov 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add write method to UaFile
parent
fb3ff711
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
asyncua/client/ua_file.py
asyncua/client/ua_file.py
+9
-0
No files found.
asyncua/client/ua_file.py
View file @
3f3ed7fb
...
...
@@ -8,6 +8,8 @@ class UaFile:
self
.
_handle
=
None
if
open_mode
==
'r'
:
self
.
_init_open
=
ua
.
OpenFileMode
.
Read
.
value
elif
open_mode
==
'w'
:
self
.
_init_open
=
ua
.
OpenFileMode
.
Write
.
value
else
:
raise
ValueError
(
"file mode is not supported"
)
...
...
@@ -38,6 +40,13 @@ class UaFile:
arg2
=
ua
.
Variant
(
size
,
ua
.
VariantType
.
Int32
)
return
await
self
.
_file_node
.
call_method
(
read_node
,
arg1
,
arg2
)
async
def
write
(
self
,
data
:
bytes
):
""" writes file contents """
read_node
=
await
self
.
_file_node
.
get_child
(
"Write"
)
arg1
=
ua
.
Variant
(
self
.
_handle
,
ua
.
VariantType
.
UInt32
)
arg2
=
ua
.
Variant
(
data
,
ua
.
VariantType
.
ByteString
)
return
await
self
.
_file_node
.
call_method
(
read_node
,
arg1
,
arg2
)
async
def
get_size
(
self
):
""" gets size of file """
size_node
=
await
self
.
_file_node
.
get_child
(
"Size"
)
...
...
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