-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrance.py
39 lines (28 loc) · 1.21 KB
/
entrance.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from cardScanner import CardScanner
from faceDetection import FaceRecognition
from model import *
import time
class Entrance:
def __init__(self,id,scanner_port,cam_port):
self.id = id
self.cardScanner = CardScanner(scanner_port)
self.camScanner = FaceRecognition(camera_port)
def generalMode(self):
while True:
## card scanner
self.cardScanner.readCard()
result = 'waiting'
while (result == 'denied' or result == 'waiting'):
result = self.cardScanner.readCard().__next__()
card_encodes = result
print(f"card encodes confirmed for: {card_encodes}")
## camera face recognition
if True: #self.camScanner.recognize_face(card_encodes):
users = session.query(Users).filter(Users.card_encodes == card_encodes)
for user in users:
userName = user.name
print('\n****************************************\n')
print(f"\nAcesss granted\nWelcome {userName}\n")
print('\n****************************************\n')
else:
print("Access denied")