Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
HEV - High Energy Ventilator
Commits
68758b12
Commit
68758b12
authored
4 years ago
by
Peter Švihra
Browse files
Options
Downloads
Patches
Plain Diff
fixes for alarm ack and removal
parent
25962b08
Branches
Branches containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
raspberry-dataserver/hevserver.py
+7
-5
7 additions, 5 deletions
raspberry-dataserver/hevserver.py
with
7 additions
and
5 deletions
raspberry-dataserver/hevserver.py
+
7
−
5
View file @
68758b12
...
...
@@ -13,7 +13,7 @@ import svpi
import
hevfromtxt
from
hevtestdata
import
HEVTestData
from
CommsLLI
import
CommsLLI
from
CommsCommon
import
PAYLOAD_TYPE
,
CMD_TYPE
,
CMD_GENERAL
,
CMD_SET_TIMEOUT
,
VENTILATION_MODE
,
ALARM_CODES
,
CMD_MAP
,
CommandFormat
,
AlarmFormat
from
CommsCommon
import
PAYLOAD_TYPE
,
CMD_TYPE
,
CMD_GENERAL
,
CMD_SET_TIMEOUT
,
VENTILATION_MODE
,
ALARM_TYPE
,
ALARM_CODES
,
CMD_MAP
,
CommandFormat
,
AlarmFormat
from
collections
import
deque
from
serial.tools
import
list_ports
from
typing
import
List
...
...
@@ -111,17 +111,19 @@ class HEVServer(object):
elif
reqtype
==
"
ALARM
"
:
# acknowledgement of alarm from gui
reqalarm_type
=
request
[
"
alarm_type
"
]
reqalarm_code
=
ALARM_CODES
[
request
[
"
alarm_code
"
]]
.
value
reqalarm_code
=
ALARM_CODES
[
request
[
"
alarm_code
"
]]
reqparam
=
request
[
"
param
"
]
if
request
[
"
param
"
]
is
not
None
else
0
alarm_to_ack
=
AlarmFormat
(
alarm_type
=
reqalarm_type
,
alarm_to_ack
=
AlarmFormat
(
alarm_type
=
ALARM_TYPE
[
reqalarm_type
]
,
alarm_code
=
reqalarm_code
,
param
=
reqparam
)
try
:
# delete alarm if it exists
with
self
.
_dblock
:
self
.
_alarms
.
remove
(
alarm_to_ack
)
for
alarm
in
self
.
_alarms
:
if
alarm
==
alarm_to_ack
:
print
(
alarm
,
alarm_to_ack
)
self
.
_alarms
.
remove
(
alarm
)
payload
=
{
"
type
"
:
"
ack
"
}
except
NameError
as
e
:
raise
HEVPacketError
(
f
"
Alarm could not be removed. May have been removed already.
{
e
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment