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

updated camera state

parent f00269cd
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
define('DAEMON_CTRL', 'daemon'); define('DAEMON_CTRL', 'daemon');
define('DAEMON_CTRL_CMDS', 'cmd'); //comma-separated commands to be sent to the daemon define('DAEMON_CTRL_CMDS', 'cmd'); //comma-separated commands to be sent to the daemon
define('OUTPUT_LOG', 'output_log'); // redirect daemon output define('OUTPUT_LOG', 'output_log'); // redirect daemon output
define('CAMERA_STATE', '/var/state/camera');
// print_r($_GET); // magic // print_r($_GET); // magic
// exit(0); // magic // exit(0); // magic
...@@ -267,7 +268,7 @@ ...@@ -267,7 +268,7 @@
exit(0); // no time to close log exit(0); // no time to close log
} else if ($cmd == 'state'){ } else if ($cmd == 'state'){
// TODO: read all subcameras // TODO: read all subcameras
$state = file('/var/state/camera'); $state = file(CAMERA_STATE);
$xml = new SimpleXMLElement("<?xml version='1.0' standalone='yes'?><lwir16_state/>"); $xml = new SimpleXMLElement("<?xml version='1.0' standalone='yes'?><lwir16_state/>");
foreach ($state as $line){ foreach ($state as $line){
$kv = explode('=',$line); $kv = explode('=',$line);
...@@ -1086,5 +1087,17 @@ EOT; ...@@ -1086,5 +1087,17 @@ EOT;
exit(0); exit(0);
} }
} }
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'];
}
?> ?>
\ No newline at end of file
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