Example #1
0
    def __init__(self):
        print('Loading the ForkPi database...')
        self.db = ForkpiDB()

        print('Loading options...')
        attempt_limit = self.load_option('attempt_limit')
        lockout_time = self.load_option('lockout_time_minutes')
        self.lockout_table = LockoutTable(attempt_limit, lockout_time)
        self.keypad_timeout = self.load_option('keypad_timeout_seconds')
        self.max_transaction_time = self.load_option(
            'max_transaction_time_seconds')
        self.lock_release_time = self.load_option('lock_release_time_seconds')

        print('Loading (F)ingerprint Scanner...')
        self.fingerprint_thread = FingerprintThread(lambda: ForkpiDB())
        print('Loading (O)LED...')
        self.led = OLED()
        print('Loading (R)FID Reader...')
        self.rfid_thread = RfidThread()
        print('Loading (K)eypad...')
        self.keypad_thread = KeypadThread()

        print('Connecting to (dummy) door lock...')
        self.door_lock = DoorLock()

        # maps RFID UIDs to incorrect streak and remaining lockout time
        self.transaction_timer = self.new_timer()

        # start polling for cards and fingers
        self.rfid_thread.start()
        self.fingerprint_thread.start()
        self.keypad_thread.start()