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)'
|
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.cursor.execute(statement)
|
||||||
self.db.commit()
|
self.db.commit()
|
||||||
def log_access_student(self, parent: Parent):
|
# 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)'
|
# 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.cursor.execute(statement)
|
||||||
self.db.commit()
|
# self.db.commit()
|
||||||
|
|
||||||
|
|
||||||
def fetch_log() -> list:
|
def fetch_log() -> list:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import paho.mqtt.client as pahomqtt
|
import paho.mqtt.client as pahomqtt
|
||||||
BROKER = "192.168.0.26"
|
BROKER = "192.168.0.239"
|
||||||
BASE_TOPIC = "/facescan"
|
BASE_TOPIC = "/facescan"
|
||||||
class ESPMegaMQTT:
|
class ESPMegaMQTT:
|
||||||
input_buffer = [0]*16
|
input_buffer = [0]*16
|
||||||
|
|
|
@ -52,19 +52,26 @@ while True:
|
||||||
parent_face = fp.identify_face(img, target_condidence=0.6)
|
parent_face = fp.identify_face(img, target_condidence=0.6)
|
||||||
parent_info = db.get_parent_info(parent_face)
|
parent_info = db.get_parent_info(parent_face)
|
||||||
#TODO Fill in student info
|
#TODO Fill in student info
|
||||||
db.log_access_parent(parent_info) # Log student data
|
|
||||||
if(parent_info != None): # Identified parent
|
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.
|
if(db.check_relationship(student_info,parent_info)): # Check if the detected parent is right for the detected student.
|
||||||
#TODO Log Access
|
#TODO Log Access STDw/P
|
||||||
display.set_page("Parent")
|
#TODO write parrent info to display
|
||||||
access_control.unlock_door() # Door open
|
access_control.unlock_door() # Door open
|
||||||
|
display.set_string("msg.txt","Get your kid")
|
||||||
|
#TODO Send timer to display
|
||||||
time.sleep(10)
|
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:
|
else:
|
||||||
access_control.lock_door() # Lock Door
|
|
||||||
display.set_page("Scan")
|
display.set_page("scan")
|
||||||
display.set_string("msg.txt","Wrong student. \t Try Again")
|
display.set_string("msg.txt","Wrong parent. \t Try Again")
|
||||||
|
#TODO Try again does not try again
|
||||||
else:
|
else:
|
||||||
display.set_page("student")
|
display.set_page("student")
|
||||||
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
display.set_string("msg.txt","Cannot find parent data. \t Try Again")
|
||||||
|
@ -76,15 +83,8 @@ while True:
|
||||||
elif (len(faces)>1):
|
elif (len(faces)>1):
|
||||||
#More than one people, error.
|
#More than one people, error.
|
||||||
print("more than one people. \t try again")
|
print("more than one people. \t try again")
|
||||||
display.set_page("Scan")
|
|
||||||
display.set_string("msg.txt","More than one people. \t try again")
|
display.set_string("msg.txt","More than one people. \t try again")
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
display.set_page("Scan")
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
#No one detected
|
|
||||||
print("No one detected \t try again")\
|
|
||||||
display.set_page("Scan")
|
|
||||||
pass
|
pass
|
||||||
print("DONE")
|
print("DONE")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue