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: camogmstate2.php,v $ 00022 *! Revision 1.1.1.1 2008/11/27 20:04:01 elphel 00023 *! 00024 *! 00025 *! Revision 1.1 2008/05/02 12:45:58 spectr_rain 00026 *! initial revision with the sound support 00027 *! 00028 *! Revision 1.2 2007/11/28 07:15:38 elphel 00029 *! added sending arbitrary commands to camogm 00030 *! 00031 *! Revision 1.1 2007/11/19 03:23:21 elphel 00032 *! 7.1.5.5 Added support for *.mov files in camogm. 00033 *! 00034 *! 00035 */ 00036 00039 $pipe="/var/state/camogm.state"; 00040 $cmd_pipe="/var/state/camogm_cmd"; 00041 $mode=0777; 00042 if(!file_exists($pipe)) { 00043 // create the pipe 00044 umask(0); 00045 posix_mkfifo($pipe,$mode); 00046 } else { 00048 } 00050 $fcmd=fopen($cmd_pipe,"w"); 00052 $cmd=$_GET['cmd']; 00053 if ($cmd) $cmd=urldecode($cmd).";"; 00055 fprintf($fcmd,$cmd."xstatus=%s\n",$pipe); 00056 fclose($fcmd); 00058 $status=file_get_contents($pipe); 00059 header("Content-Type: text/xml"); 00060 header("Content-Length: ".strlen($status)."\n"); 00061 header("Pragma: no-cache\n"); 00062 printf($status); 00063 ?>