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
8ddf8e2f
Commit
8ddf8e2f
authored
4 years ago
by
adam-abed-abud
Browse files
Options
Downloads
Patches
Plain Diff
Adding commands interface
parent
248758d0
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
raspberry-backend/app.py
+13
-8
13 additions, 8 deletions
raspberry-backend/app.py
raspberry-backend/templates/base.html
+5
-3
5 additions, 3 deletions
raspberry-backend/templates/base.html
raspberry-backend/templates/settings.png
+0
-0
0 additions, 0 deletions
raspberry-backend/templates/settings.png
with
18 additions
and
11 deletions
raspberry-backend/app.py
+
13
−
8
View file @
8ddf8e2f
...
...
@@ -20,9 +20,9 @@ WEBAPP = Flask(__name__)
hevclient
=
HEVClient
()
@WEBAPP.route
(
'
/
'
)
@WEBAPP.route
(
'
/
'
,
methods
=
[
'
GET
'
,
'
POST
'
]
)
def
hello_world
():
return
render_template
(
'
index.html
'
,
result
=
live_data
())
return
render_template
(
'
index.html
'
,
result
=
live_data
())
@WEBAPP.route
(
'
/new
'
)
def
hello_worlds
():
...
...
@@ -44,16 +44,21 @@ def fan():
def
multiple_appends
(
listname
,
*
element
):
listname
.
extend
(
element
)
@WEBAPP.route
(
'
/
'
)
@WEBAPP.route
(
'
/
send_cmd
'
,
methods
=
[
'
POST
'
]
)
def
send_cmd
():
"""
Send command to the data server
"""
if
form
.
validate_on_submit
():
if
'
download
'
in
request
.
form
:
print
(
"
benzina
"
)
# do something
elif
'
watch
'
in
request
.
form
:
pass
# do something else
web_form
=
request
.
form
if
web_form
.
get
(
'
start
'
)
==
"
START
"
:
print
(
"
-----------------------------
"
)
elif
web_form
.
get
(
'
stop
'
)
==
"
STOP
"
:
print
(
"
==============================
"
)
elif
web_form
.
get
(
'
reset
'
)
==
"
RESET
"
:
print
(
"
******************************
"
)
return
render_template
(
'
index.html
'
,
result
=
live_data
())
@WEBAPP.route
(
'
/data_handler
'
,
methods
=
[
'
POST
'
])
def
data_handler
():
...
...
This diff is collapsed.
Click to expand it.
raspberry-backend/templates/base.html
+
5
−
3
View file @
8ddf8e2f
...
...
@@ -51,11 +51,13 @@
<svg
aria-hidden=
"true"
focusable=
"false"
data-prefix=
"fas"
data-icon=
"sliders-h"
class=
"fa-sliders-h fa-w-16"
role=
"img"
xmlns=
"http://www.w3.org/2000/svg"
viewBox=
"0 0 512 512"
><path
class=
"path-icon"
d=
"M496 384H160v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h80v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h336c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160h-80v-16c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h336v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h80c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16zm0-160H288V48c0-8.8-7.2-16-16-16h-32c-8.8 0-16 7.2-16 16v16H16C7.2 64 0 71.2 0 80v32c0 8.8 7.2 16 16 16h208v16c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-16h208c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16z"
></path></svg>
</div></a>
</div>
<form
action=
"{{ url_for('send_cmd') }}"
method=
"post"
>
<div
class =
"controls py-1 ml-auto mr-auto"
>
<
a>
<button
class=
"sb-nav-button py-
3
mb-1"
>
STOP
</button></a
>
<a>
<input
type=
"submit"
name=
"
download
"
value=
"ST
ART
"
class=
"sb-nav-button py-1 mb-1"
></input>
</a>
<
a>
<button
class=
"sb-nav-button py-1 mb-1"
>
RESET
</button></a
>
<
input
type=
"submit"
name=
"start"
value=
"START"
class=
"sb-nav-button py-
1
mb-1"
>
</input
>
<input
type=
"submit"
name=
"
stop
"
value=
"ST
OP
"
class=
"sb-nav-button py-1 mb-1"
></input>
<
input
type=
"submit"
name=
"reset"
value=
"RESET"
class=
"sb-nav-button py-1 mb-1"
>
</input
>
</div>
</form>
</div>
</nav>
</div>
...
...
This diff is collapsed.
Click to expand it.
raspberry-backend/templates/settings.png
deleted
100644 → 0
+
0
−
0
View file @
248758d0
52.3 KiB
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