self.q_lock = threading.Lock() # lock for q sync self.db_conn = db # connection to database self.is_armed = False # is system armed? self.was_alert = False # comes lukes code on run everything return self.is_active_incident = False # is there an active alert self.is_max_alert = False # is it already escalated / high alert self.is_panic = False # was this a panic button alert self.record_incident = False # should i record incident? self.response_received = False self.sound_pid = -1 if __name__ == '__main__': # global shared resources message_q = deque() db_connection = DbConn(Constant.host, Constant.uname, Constant.password, Constant.db_name) shared_resources = Driver(message_q, db_connection) pi_client = Client(Constant.host_ip, Constant.port, shared_resources) pi_system_thread = ClientThread(pi_client, shared_resources) pi_system_thread.start() message_handler_thread = MessageHandlerThread(shared_resources) logic_handler_thread = LogicHandlerThread(shared_resources) print("threads created in Driver") message_handler_thread.start() print("started message handler thread") # comment out if you do not have sensors logic_handler_thread.start() print("started logic handler thread")
from flask import Flask, render_template from DbConn import DbConn app = Flask(__name__) dbConn = DbConn() @app.route('/') def index(): # dbConn.generate_all_hotels_for_prices() return render_template('index.html') @app.route('/get_all_hotels_prices/', methods=['GET', 'POST']) def get_all_hotels_prices(): return dbConn.get_all_hotels_prices() @app.route('/get_all_hotels/', methods=['GET', 'POST']) def get_all_hotels(): return dbConn.get_all_hotels() @app.route('/get_near_bus/<lat>/<lon>/', methods=['GET', 'POST']) def get_near_bus(lat, lon): return dbConn.get_near_bus(lat, lon) @app.route('/get_near_bus2/<lat>/<lon>/', methods=['GET', 'POST']) def get_near_bus2(lat, lon): return dbConn.get_near_bus2(lat, lon) @app.route('/get_near_road/<lat>/<lon>/', methods=['GET', 'POST']) def get_near_road(lat, lon):