00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 if (count($_GET)==0) {
00031 echo <<<USAGE
00032 <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>
00033 <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>
00034 USAGE;
00035 exit (0);
00036 }
00037 $toRead=array();
00038 $toWrite=array();
00039 foreach($_GET as $key=>$value) {
00040 if ($value==="") $toRead[$key]=$value;
00041 else $toWrite[$key]=(integer) $value;
00042 }
00043 $npars=(count($toWrite)>0)?elphel_set_P_arr($toWrite):0;
00044 if (count($toRead)>0) $toRead=elphel_get_P_arr($toRead);
00045 if ($_GET["STATE"]!==NULL) $toRead["STATE"]=elphel_get_state();
00046 $xml = new SimpleXMLElement("<?xml version='1.0' standalone='yes'?><camvars/>");
00047 foreach ($toRead as $key=>$value) {
00048 $xml->addChild ($key,$value);
00049 }
00050 if (count($toWrite)>0) {
00051 $xml->addChild ('written',$npars);
00052 }
00053 $rslt=$xml->asXML();
00054 header("Content-Type: text/xml");
00055 header("Content-Length: ".strlen($rslt)."\n");
00056 header("Pragma: no-cache\n");
00057 printf($rslt);
00058 ?>