Fixed file structure update
This commit is contained in:
parent
61e3fda199
commit
a9fa7c5fad
|
@ -147,7 +147,7 @@
|
|||
|
||||
/* (4) If no action found -> abort */
|
||||
if( count($grantedFor) == 0 ){
|
||||
slog('user not granted to any action', 'mfrc522:loop');
|
||||
slog('user not granted to any action', 'rfid-read:loop');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@
|
|||
|
||||
/* (6) If no action cant be performed -> abort */
|
||||
if( is_null($toPerform) ){
|
||||
slog('global state allows no action to be performed', 'mfrc522:loop');
|
||||
slog('global state allows no action to be performed', 'rfid-read:loop');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@
|
|||
|
||||
/* (3) Manage error */
|
||||
if( $written === false )
|
||||
slog('cannot update STATE file', 'mfrc522:loop');
|
||||
slog('cannot update STATE file', 'rfid-read:loop');
|
||||
|
||||
|
||||
|
||||
|
@ -338,6 +338,7 @@
|
|||
|
||||
/* (2) Caches */
|
||||
global $actions;
|
||||
global $FEATURE;
|
||||
|
||||
/* (3) Get global state */
|
||||
$gstate = get_gstate();
|
||||
|
@ -354,7 +355,7 @@
|
|||
$start_ts = microtime(true);
|
||||
|
||||
/* (2) Read card */
|
||||
$code = syscall(SOURCE_DIR.'/lib/mfrc522/read');
|
||||
$code = syscall(SOURCE_DIR."/feature/$FEATURE/read");
|
||||
|
||||
/* (3) If no card read -> reset @last_user / @timeout + abort */
|
||||
if( $code === false ){
|
||||
|
@ -379,7 +380,7 @@
|
|||
/* (6) If code -> format it */
|
||||
$code = strtoupper($code);
|
||||
|
||||
slog("card '$code' read", 'mfrc522:read');
|
||||
slog("card '$code' read", 'rfid-read:read');
|
||||
|
||||
|
||||
|
||||
|
@ -392,7 +393,7 @@
|
|||
/* (2) If not found -> reset @last_user / @timeout + abort */
|
||||
if( is_null($user) ){
|
||||
|
||||
slog("Unknown user (not authenticated)", "mfrc522:loop");
|
||||
slog("Unknown user (not authenticated)", "rfid-read:loop");
|
||||
$last_user = null;
|
||||
$timeout = 0;
|
||||
return false;
|
||||
|
@ -424,14 +425,14 @@
|
|||
|
||||
// {2} If not updated -> error //
|
||||
if( !$updateds )
|
||||
slog("Cannot update chips to '{$gstate}'", 'mfrc522:loop');
|
||||
slog("Cannot update chips to '{$gstate}'", 'rfid-read:loop');
|
||||
// {3} If updated -> success //
|
||||
else
|
||||
slog("Chips updated to '{$gstate}'", 'mfrc522:loop');
|
||||
slog("Chips updated to '{$gstate}'", 'rfid-read:loop');
|
||||
|
||||
/* (3) If not performed -> log error */
|
||||
}else
|
||||
slog("Cannot perform action by '$code' at timeout $timeout", 'mfrc522:loop');
|
||||
slog("Cannot perform action by '$code' at timeout $timeout", 'rfid-read:loop');
|
||||
|
||||
/* (4) Store user for next loop */
|
||||
$last_user = $user['id'];
|
||||
|
@ -453,13 +454,13 @@
|
|||
|
||||
/* (2) Manage error */
|
||||
if( $exec != 0 ){
|
||||
slog('cannot set up the daemon', 'mfrc522:loop');
|
||||
slog('cannot set up the daemon', 'rfid-read:loop');
|
||||
echo $exec;
|
||||
die($exec);
|
||||
}
|
||||
|
||||
/* (3) Success message */
|
||||
slog('daemon started (loop)', 'mfrc522:loop');
|
||||
slog('daemon started (loop)', 'rfid-read:loop');
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import MFRC522
|
|||
|
||||
|
||||
# Create an object of the class MFRC522
|
||||
GPIO.setwarnings(False);
|
||||
MIFAREReader = MFRC522.MFRC522()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue