Skip to content
Snippets Groups Projects
Commit 8ddf8e2f authored by adam-abed-abud's avatar adam-abed-abud
Browse files

Adding commands interface

parent 248758d0
Branches
No related merge requests found
...@@ -20,9 +20,9 @@ WEBAPP = Flask(__name__) ...@@ -20,9 +20,9 @@ WEBAPP = Flask(__name__)
hevclient = HEVClient() hevclient = HEVClient()
@WEBAPP.route('/') @WEBAPP.route('/', methods=['GET', 'POST'])
def hello_world(): def hello_world():
return render_template('index.html', result=live_data()) return render_template('index.html', result=live_data())
@WEBAPP.route('/new') @WEBAPP.route('/new')
def hello_worlds(): def hello_worlds():
...@@ -44,16 +44,21 @@ def fan(): ...@@ -44,16 +44,21 @@ def fan():
def multiple_appends(listname, *element): def multiple_appends(listname, *element):
listname.extend(element) listname.extend(element)
@WEBAPP.route('/') @WEBAPP.route('/send_cmd', methods=['POST'])
def send_cmd(): def send_cmd():
""" """
Send command to the data server Send command to the data server
""" """
if form.validate_on_submit(): web_form = request.form
if 'download' in request.form: if web_form.get('start') == "START":
print("benzina") # do something print("-----------------------------")
elif 'watch' in request.form: elif web_form.get('stop') == "STOP":
pass # do something else print("==============================")
elif web_form.get('reset') == "RESET":
print("******************************")
return render_template('index.html', result=live_data())
@WEBAPP.route('/data_handler', methods=['POST']) @WEBAPP.route('/data_handler', methods=['POST'])
def data_handler(): def data_handler():
......
...@@ -51,11 +51,13 @@ ...@@ -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> <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></a>
</div> </div>
<form action="{{ url_for('send_cmd') }}" method="post">
<div class = "controls py-1 ml-auto mr-auto"> <div class = "controls py-1 ml-auto mr-auto">
<a> <button class="sb-nav-button py-3 mb-1">STOP</button></a> <input type="submit" name="start" value="START" class="sb-nav-button py-1 mb-1"></input>
<a> <input type="submit" name="download" value="START" class="sb-nav-button py-1 mb-1"></input></a> <input type="submit" name="stop" value="STOP" class="sb-nav-button py-1 mb-1"></input>
<a> <button class="sb-nav-button py-1 mb-1">RESET</button></a> <input type="submit" name="reset" value="RESET" class="sb-nav-button py-1 mb-1"></input>
</div> </div>
</form>
</div> </div>
</nav> </nav>
</div> </div>
......
raspberry-backend/templates/settings.png

52.3 KiB

0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment