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
b978ea6c
Commit
b978ea6c
authored
4 years ago
by
Dónal Murray
Browse files
Options
Downloads
Patches
Plain Diff
Change cmd json packet
parent
1ed59782
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
raspberry-dataserver/hevclient.py
+3
-3
3 additions, 3 deletions
raspberry-dataserver/hevclient.py
raspberry-dataserver/hevserver.py
+1
-1
1 addition, 1 deletion
raspberry-dataserver/hevserver.py
with
4 additions
and
4 deletions
raspberry-dataserver/hevclient.py
+
3
−
3
View file @
b978ea6c
...
...
@@ -92,9 +92,9 @@ class HEVClient(object):
async
def
send_request
(
self
,
reqtype
,
cmdtype
:
str
=
None
,
cmd
:
str
=
None
,
param
:
str
=
None
,
alarm
:
str
=
None
)
->
bool
:
# open connection and send packet
reader
,
writer
=
await
asyncio
.
open_connection
(
"
127.0.0.1
"
,
54321
)
if
reqtype
==
"
cmd
"
:
if
reqtype
==
"
CMD
"
:
payload
=
{
"
type
"
:
"
cmd
"
,
"
type
"
:
"
CMD
"
,
"
cmdtype
"
:
cmdtype
,
"
cmd
"
:
cmd
,
"
param
"
:
param
...
...
@@ -135,7 +135,7 @@ class HEVClient(object):
def
send_cmd
(
self
,
cmdtype
:
str
,
cmd
:
str
,
param
:
Union
[
float
,
int
]
=
None
)
->
bool
:
# send a cmd and wait to see if it's valid
return
asyncio
.
run
(
self
.
send_request
(
"
cmd
"
,
cmdtype
=
cmdtype
,
cmd
=
cmd
,
param
=
param
))
return
asyncio
.
run
(
self
.
send_request
(
"
CMD
"
,
cmdtype
=
cmdtype
,
cmd
=
cmd
,
param
=
param
))
def
ack_alarm
(
self
,
alarm
:
str
)
->
bool
:
# acknowledge alarm to remove it from the hevserver list
...
...
This diff is collapsed.
Click to expand it.
raspberry-dataserver/hevserver.py
+
1
−
1
View file @
b978ea6c
...
...
@@ -79,7 +79,7 @@ class HEVServer(object):
try
:
reqtype
=
request
[
"
type
"
]
if
reqtype
==
"
cmd
"
:
if
reqtype
==
"
CMD
"
:
reqcmd
=
request
[
"
cmd
"
]
reqcmdtype
=
request
[
"
cmdtype
"
]
reqparam
=
request
[
"
param
"
]
if
request
[
"
param
"
]
is
not
None
else
0
...
...
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