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
77f35359
Commit
77f35359
authored
4 years ago
by
Dónal Murray
Browse files
Options
Downloads
Patches
Plain Diff
Add updated hevserver readme and fix enumchecker regex
parent
4a97240d
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
raspberry-dataserver/README.md
+16
-7
16 additions, 7 deletions
raspberry-dataserver/README.md
utils/enumcheck.sh
+1
-1
1 addition, 1 deletion
utils/enumcheck.sh
with
17 additions
and
8 deletions
raspberry-dataserver/README.md
+
16
−
7
View file @
77f35359
...
...
@@ -126,14 +126,14 @@ where type can be either `"ack"` in response to a valid command or `"nack"` in r
## Example `hevclient.py` Usage
```
python
import
hevclient
# create instance of hevclient. Starts connection and polls in the background
# just import hevclient and do something like the following
hevclient
=
HEVClient
()
time
.
sleep
(
2
)
print
(
hevclient
.
send_cmd
(
"
GENERAL
"
,
"
START
"
))
# Play with sensor values and alarms
for
i
in
range
(
3
0
):
for
i
in
range
(
2
0
):
values
=
hevclient
.
get_values
()
# returns a dict or None
alarms
=
hevclient
.
get_alarms
()
# returns a list of alarms currently ongoing
if
values
is
None
:
...
...
@@ -143,16 +143,25 @@ for i in range(30):
print
(
f
"
Alarms:
{
alarms
}
"
)
time
.
sleep
(
1
)
# acknowledge the oldest alarm
try
:
hevclient
.
ack_alarm
(
alarms
[
0
])
# blindly assume we have one after 40s
except
:
logging
.
info
(
"
No alarms received
"
)
time
.
sleep
(
1
)
print
(
f
"
Alarms:
{
hevclient
.
get_alarms
()
}
"
)
# send commands:
print
(
hevclient
.
send_cmd
(
"
CMD_START
"
))
time
.
sleep
(
1
)
print
(
"
This one will fail since foo is not in the command_codes enum:
"
)
print
(
hevclient
.
send_cmd
(
"
foo
"
))
print
(
hevclient
.
send_cmd
(
"
general
"
,
"
foo
"
))
# print some more values
for
i
in
range
(
10
):
print
(
f
"
Alarms:
{
hevclient
.
get_alarms
()
}
"
)
print
(
f
"
Values:
{
json
.
dumps
(
hevclient
.
get_values
(),
indent
=
4
)
}
"
)
print
(
f
"
Alarms:
{
hevclient
.
get_alarms
()
}
"
)
time
.
sleep
(
1
)
print
(
hevclient
.
send_cmd
(
"
GENERAL
"
,
"
STOP
"
))
```
This diff is collapsed.
Click to expand it.
utils/enumcheck.sh
+
1
−
1
View file @
77f35359
...
...
@@ -2,7 +2,7 @@
set
-euo
pipefail
for
enum
in
CMD_TYPE CMD_GENERAL CMD_SET_TIMEOUT CMD_SET_MODE ALARM_TYPE ALARM_CODES
;
do
sed
-e
"/enum
$enum
/,/};/!d"
-e
'/};/d'
-e
's/,$//g'
-e
's/,\([[:blank:]]*\)\/\/\(.*\)/\1 #\2/g'
-e
's@//@#@g'
-e
"s/enum
\(
[
[:graph:]
]*
\)
.*{/class
\1
(Enum):/"
../arduino/hev_prototype_v1/src/common.h
;
sed
-e
"/enum
$enum
/,/};/!d"
-e
'/};/d'
-e
's/,$//g'
-e
's/,\([[:blank:]]*\)\/\/\(.*\)/\1 #\2/g'
-e
's@//@#@g'
-e
"s/enum
\(
[
a-zA-Z_
]*
\)
.*{/class
\1
(Enum):/"
../arduino/hev_prototype_v1/src/common.h
;
echo
;
done
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