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