Example #1
0
class App:
    def __init__(self):
        self.db = DataBase(data_base='cache.db')
        self.camera, self.communication = self.read_config()
        self.timer_process = TimerProcess()

        self.r = Recognition(config=self.camera, db=self.db)
        self.c = Communication(config=self.communication,
                               code_recognition=self.r,
                               timer_process=self.timer_process,
                               db=self.db)

        self.station = self.camera.station_id
        self.carts = mp.Array('i', self.r.create_list(12))

        self.connection = self.c.data_call()

        self.QRBE1 = self.c.create_digit('QRBE1,{}'.format(self.station))

    @staticmethod
    def read_config():
        db = DataBase(
            data_base='/home/madruga/developer/projects/config/config.db')

        camera = controller.consult_camera(db)

        communication = controller.consult_communication(db)

        return camera, communication

    def check_database(self):
        db = os.path.exists('./cache.db')

        if not db:
            self.db.create_data_base()
            self.db.create_table()