packages/web/353/php_top/camvars.php

Go to the documentation of this file.
00001 <?php
00002 /*!*******************************************************************************
00003 *! FILE NAME  : camvars.php
00004 *! DESCRIPTION: read/write camera internal variables by name
00005 *! Copyright (C) 2008 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: camvars.php,v $
00022 *!  Revision 1.1.1.1  2008/11/27 20:04:03  elphel
00023 *!
00024 *!
00025 *!  Revision 1.2  2008/11/22 05:58:24  elphel
00026 *!  modifying to match elphel_set_P_value()
00027 *!
00028 *!  Revision 1.2  2008/04/17 22:37:57  elphel
00029 *!  bug fix
00030 *!
00031 *!  Revision 1.1  2008/03/22 04:41:07  elphel
00032 *!  Script to set/get camera parameters with HTTP GET (result as XML)
00033 *!
00034 *!
00035 */
00036    if (count($_GET)==0) {
00037       echo <<<USAGE
00038    <p>This script returns camera variables as XML file, it also allows you to set those variables. Usually those changes will not take effect immediately - please use ccam.php that both changes variables and programs the camera to use them.</p>
00039    <p>The variable names to be read are specified without values (like camvar.php?WOI_WIDTH&WOI_HEIGHT ), the ones to be written - with the values (camvar.php?QUALITY=75). It is also possible to mix both types in the same request.</p>
00040 USAGE;
00041       exit (0);
00042     }
00043     $toRead=array();
00044     $toWrite=array();
00045     foreach($_GET as $key=>$value) {
00046       if ($value==="") $toRead[$key]=$value;
00047       else $toWrite[$key]=(integer) $value;
00048     }
00049     $npars=(count($toWrite)>0)?elphel_set_P_arr($toWrite):0;
00050     if (count($toRead)>0) $toRead=elphel_get_P_arr($toRead);
00051     if ($_GET["STATE"]!==NULL) $toRead["STATE"]=elphel_get_state();
00052     $xml = new SimpleXMLElement("<?xml version='1.0'  standalone='yes'?><camvars/>");
00053     foreach ($toRead as $key=>$value) {
00054        $xml->addChild ($key,$value);
00055     }
00056     if (count($toWrite)>0) {
00057        $xml->addChild ('frame',$npars);
00058     }
00059     $rslt=$xml->asXML();
00060     header("Content-Type: text/xml");
00061     header("Content-Length: ".strlen($rslt)."\n");
00062     header("Pragma: no-cache\n");
00063     printf($rslt);
00064 ?>

Generated on Fri Nov 28 00:06:24 2008 for elphel by  doxygen 1.5.1