p4a-demo/main.py
#!/usr/bin/env python3
import os,sys
from bottle import Bottle,route, run, template, static_file, request,redirect, response,get, post
from homepage import *
app=Bottle()
PORT=8080
@app.route('/html/<filename:path>')
def send_all(filename):
return static_file(filename, './html')
def setup_routing(app):
app.route('/', ['GET', 'POST'], home)
app.route('/quit', ['GET', 'POST'], quitApp)
app.route('/vibrate', ['GET', 'POST'], vibrate)
app.route('/notify', ['GET', 'POST'], notify)
app.route('/toast', ['GET', 'POST'], toast)
app.route('/flashon', ['GET', 'POST'], flashon)
app.route('/flashoff', ['GET', 'POST'], flashoff)
app.route('/position', ['GET', 'POST'], StartPosition)
app.route('/stopposition', ['GET', 'POST'], StopPosition)
app.route('/showpos', ['GET', 'POST'], showpos)
app.route('/selectfile', ['GET', 'POST'], selectfile)
app.route('/getfile', ['GET', 'POST'], getfile)
def start_server():
run(app , host='0.0.0.0', port=PORT, debug=True)
setup_routing(app)
start_server()