add c
This commit is contained in:
parent
8082c08244
commit
dc3d283d5d
|
@ -67,10 +67,10 @@ class Database:
|
|||
statement = f'INSERT INTO face_detect.`access-log` (id, student_id, parent_id, `timestamp`) VALUES(NULL, NULL, {parent.id}, NULL)'
|
||||
self.cursor.execute(statement)
|
||||
self.db.commit()
|
||||
def log_access_student(self, parent: Parent):
|
||||
statement = f'INSERT INTO face_detect.`access-log` (id, student_id, parent_id, `timestamp`) VALUES(NULL, {student.id}, NULL, NULL)'
|
||||
self.cursor.execute(statement)
|
||||
self.db.commit()
|
||||
# def log_access_student(self, parent: Parent):
|
||||
# statement = f'INSERT INTO face_detect.`access-log` (id, student_id, parent_id, `timestamp`) VALUES(NULL, {student.id}, NULL, NULL)'
|
||||
# self.cursor.execute(statement)
|
||||
# self.db.commit()
|
||||
|
||||
|
||||
def fetch_log() -> list:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import paho.mqtt.client as pahomqtt
|
||||
BROKER = "192.168.0.26"
|
||||
BROKER = "192.168.0.239"
|
||||
BASE_TOPIC = "/facescan"
|
||||
class ESPMegaMQTT:
|
||||
input_buffer = [0]*16
|
||||
|
|
|
@ -52,19 +52,26 @@ while True:
|
|||
parent_face = fp.identify_face(img, target_condidence=0.6)
|
||||
parent_info = db.get_parent_info(parent_face)
|
||||
#TODO Fill in student info
|
||||
db.log_access_parent(parent_info) # Log student data
|
||||
|
||||
if(parent_info != None): # Identified parent
|
||||
print(parent_info)
|
||||
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
||||
#TODO Log Access
|
||||
display.set_page("Parent")
|
||||
#TODO Log Access STDw/P
|
||||
#TODO write parrent info to display
|
||||
access_control.unlock_door() # Door open
|
||||
display.set_string("msg.txt","Get your kid")
|
||||
#TODO Send timer to display
|
||||
time.sleep(10)
|
||||
#display.set_string("msg.txt","Get your kid")
|
||||
|
||||
#TODO Check if door can be locked
|
||||
# if can lock, lock
|
||||
#TODO If can't lock, say left open
|
||||
#Countdown
|
||||
# Activate Alarm
|
||||
else:
|
||||
access_control.lock_door() # Lock Door
|
||||
display.set_page("Scan")
|
||||
display.set_string("msg.txt","Wrong student. \t Try Again")
|
||||
|
||||
display.set_page("scan")
|
||||
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
||||
#TODO Try again does not try again
|
||||
else:
|
||||
display.set_page("student")
|
||||
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
||||
|
@ -76,15 +83,8 @@ while True:
|
|||
elif (len(faces)>1):
|
||||
#More than one people, error.
|
||||
print("more than one people. \t try again")
|
||||
display.set_page("Scan")
|
||||
display.set_string("msg.txt","More than one people. \t try again")
|
||||
time.sleep(2)
|
||||
display.set_page("Scan")
|
||||
pass
|
||||
else:
|
||||
#No one detected
|
||||
print("No one detected \t try again")\
|
||||
display.set_page("Scan")
|
||||
pass
|
||||
print("DONE")
|
||||
|
||||
|
|
Loading…
Reference in New Issue