-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.sh
executable file
·45 lines (38 loc) · 1.21 KB
/
auth.sh
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
40
41
42
43
44
45
#!/bin/bash
#########################
# Author: Trenton Foster
# Authentication driver
# Responsible for the complete process of authenticating a finger on the fingerprint scanner.
#########################
function open_mailbox(){
./upload_to_arduino.sh /home/pi/Documents/F2023Capstone/Build/open_servo/open_servo.ino.hex
echo "Mailbox unlocked for 30s"
sleep 35
echo "Mailbox locked"
}
#Upload RFID reading script to arduino
./upload_to_arduino.sh /home/pi/Documents/F2023Capstone/Build/RFID/RFID.ino.hex
# Start python module to read output from arduino
python3 auth.py
AUTH_EXIT_STATUS=$?
case $AUTH_EXIT_STATUS in
# If postman prensents RFID
"1")
# Upload script that opens mailbox
open_mailbox
;;
# If authentiacated RFID is presented
"2")
# Upload fingerprint reading script to arduino
./upload_to_arduino.sh /home/pi/Documents/F2023Capstone/Build/fingerprint/fingerprint.ino.hex
# Start python module to read output from arduino
python3 auth.py
AUTH_EXIT_STATUS=$?
;;
esac
# If a user is authenticated, open the mailbox
if [[ "$AUTH_EXIT_STATUS" == "0" ]]; then
open_mailbox
fi
# continuously run this script
./auth.sh