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
00031
00032
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 ?>