Commit 4678d928 authored by Andrey Filippov's avatar Andrey Filippov

updated camera state

parent f00269cd
......@@ -74,6 +74,7 @@
define('DAEMON_CTRL', 'daemon');
define('DAEMON_CTRL_CMDS', 'cmd'); //comma-separated commands to be sent to the daemon
define('OUTPUT_LOG', 'output_log'); // redirect daemon output
define('CAMERA_STATE', '/var/state/camera');
// print_r($_GET); // magic
// exit(0); // magic
......@@ -267,7 +268,7 @@
exit(0); // no time to close log
} else if ($cmd == 'state'){
// TODO: read all subcameras
$state = file('/var/state/camera');
$state = file(CAMERA_STATE);
$xml = new SimpleXMLElement("<?xml version='1.0' standalone='yes'?><lwir16_state/>");
foreach ($state as $line){
$kv = explode('=',$line);
......@@ -1087,4 +1088,16 @@ EOT;
}
}
function isCameraBooted(){
return (getCameraState(CAMERA_STATE) == 'INITIALIZED');
}
function getCameraState($camera_state_file){
if (!file_exists($camera_state_file)){
return NULL;
}
$camera_state = parse_ini_file($camera_state_file);
return $camera_state['state'];
}
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment