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
17393c6d
Commit
17393c6d
authored
Sep 12, 2016
by
olivier R-D
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only check left byte to know if status code is good
parent
09861d1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
6 deletions
+15
-6
opcua/ua/status_codes.py
opcua/ua/status_codes.py
+5
-1
opcua/ua/uatypes.py
opcua/ua/uatypes.py
+4
-3
schemas/generate_statuscode.py
schemas/generate_statuscode.py
+6
-2
No files found.
opcua/ua/status_codes.py
View file @
17393c6d
#AUTOGENERATED!!!
from
opcua.common.uaerrors
import
UaStatusCodeError
from
opcua.ua
import
ua_binary
as
uabin
class
StatusCodes
(
object
):
Good
=
0
...
...
@@ -473,4 +474,7 @@ def get_name_and_doc(val):
if
val
in
code_to_name_doc
:
return
code_to_name_doc
[
val
]
else
:
return
'UnknownUaError'
,
'Unknown StatusCode value: {}'
.
format
(
val
)
if
uabin
.
test_bit
(
val
,
31
):
return
'Bad'
,
'Unknown StatusCode value: {}'
.
format
(
val
)
else
:
return
'Good'
,
'Unknown StatusCode value: {}'
.
format
(
val
)
opcua/ua/uatypes.py
View file @
17393c6d
...
...
@@ -222,16 +222,17 @@ class StatusCode(FrozenClass):
Use the is_good() method if you do not want an exception.
"""
if
self
.
value
!=
0
:
if
not
self
.
is_good
()
:
raise
UaStatusCodeError
(
self
.
value
)
def
is_good
(
self
):
"""
return True if status is Good.
"""
if
self
.
value
==
0
:
if
uabin
.
test_bit
(
self
.
value
,
31
):
return
False
else
:
return
True
return
False
def
__str__
(
self
):
return
'StatusCode({})'
.
format
(
self
.
name
)
...
...
schemas/generate_statuscode.py
View file @
17393c6d
...
...
@@ -22,7 +22,8 @@ if __name__ == "__main__":
outputfile
=
open
(
"../opcua/ua/status_codes.py"
,
"w"
)
outputfile
.
write
(
"#AUTOGENERATED!!!
\
n
"
)
outputfile
.
write
(
"
\
n
"
)
outputfile
.
write
(
"from opcua.common.uaerrors import UAStatusCodeError
\
n
"
)
outputfile
.
write
(
"from opcua.common.uaerrors import UaStatusCodeError
\
n
"
)
outputfile
.
write
(
"from opcua.ua import ua_binary as uabin
\
n
"
)
#outputfile.write("from enum import Enum\n")
outputfile
.
write
(
"
\
n
"
)
...
...
@@ -46,7 +47,10 @@ if __name__ == "__main__":
if val in code_to_name_doc:
return code_to_name_doc[val]
else:
return 'UnknownUaError', 'Unknown StatusCode value: {}'.format(val)
if uabin.test_bit(val, 31):
return 'Bad', 'Unknown StatusCode value: {}'.format(val)
else:
return 'Good', 'Unknown StatusCode value: {}'.format(val)
"""
)
...
...
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