00001 <?php 00002 /*!*************************************************************************** 00003 *! FILE NAME : camogmstate.php 00004 *! DESCRIPTION: Just a sample program that interacts with camogm recorder 00005 *! Copyright (C) 2007 Elphel, Inc 00006 *! -----------------------------------------------------------------------------** 00007 *! 00008 *! This program is free software: you can redistribute it and/or modify 00009 *! it under the terms of the GNU General Public License as published by 00010 *! the Free Software Foundation, either version 3 of the License, or 00011 *! (at your option) any later version. 00012 *! 00013 *! This program is distributed in the hope that it will be useful, 00014 *! but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 *! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 *! GNU General Public License for more details. 00017 *! 00018 *! You should have received a copy of the GNU General Public License 00019 *! along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 *! -----------------------------------------------------------------------------** 00021 *! $Log: camogmstate.php,v $ 00022 *! Revision 1.2 2007/11/28 07:15:38 elphel 00023 *! added sending arbitrary commands to camogm 00024 *! 00025 *! Revision 1.1 2007/11/19 03:23:21 elphel 00026 *! 7.1.5.5 Added support for *.mov files in camogm. 00027 *! 00028 *! 00029 */ 00030 00033 $pipe="/var/state/camogm.state"; 00034 $cmd_pipe="/var/state/camogm_cmd"; 00035 $mode=0777; 00036 if(!file_exists($pipe)) { 00037 // create the pipe 00038 umask(0); 00039 posix_mkfifo($pipe,$mode); 00040 } else { 00042 } 00044 $fcmd=fopen($cmd_pipe,"w"); 00046 $cmd=$_GET['cmd']; 00047 if ($cmd) $cmd=urldecode($cmd).";"; 00049 fprintf($fcmd,$cmd."xstatus=%s\n",$pipe); 00050 fclose($fcmd); 00052 $status=file_get_contents($pipe); 00053 header("Content-Type: text/xml"); 00054 header("Content-Length: ".strlen($status)."\n"); 00055 header("Pragma: no-cache\n"); 00056 printf($status); 00057 ?>