packages/web/353/php_top/camtools/camPipe.php

Go to the documentation of this file.
00001 <?php
00002         $oper=$_GET['oper'];
00003 
00004         switch($oper)
00005         {
00006                 case "setup":
00007                         //setupCamera();
00008                         break;
00009                 case "recorder":
00010                         //recorder();
00011                         break;
00012                 case "getImage":
00013                         getImage();
00014                         break;
00015                 case "pushSetting":
00016                         //pushSetting();
00017                         break;
00018         }
00019         
00020         function setupCamera()
00021         {
00022                 if(!file_exists("/var/tmp/z/"))
00023                 {               
00024                         //directly stolen from camera_demo.php
00025                         $init_pars=array(
00026                           "FLIP"=>3,  
00027                           "COLOR"=>1, 
00028                           "DCM_HOR"  => 1,  
00029                           "DCM_VERT" => 1,  
00030                           "BIN_HOR"  => 1,  
00031                           "BIN_VERT" => 1,  
00032                           "QUALITY"  => 90, 
00033                           "COLOR_SATURATION_BLUE" => 200 , 
00034                           "COLOR_SATURATION_RED" => 200 ,  
00035                           "BITS" => 8,                     
00036                           "GAMMA" => 57,                   
00037                           "PIXEL_LOW" => 10,               
00038                           "PIXEL_HIGH" => 254,             
00039                           "EXPOS" =>    100,               
00040                           "WOI_LEFT" =>  0,                 
00041                           "WOI_TOP" =>   0,                 
00042                           "WOI_WIDTH" =>  10000,            
00043                           "WOI_HEIGHT" => 10000,            
00044                           "RSCALE" =>       256,            
00045                           "BSCALE" =>       256,            
00046                           "GAINR" =>        512,            
00047                           "GAING" =>        512,            
00048                           "GAINB" =>        512,            
00049                           "GAINGB" =>       512,            
00050                           "BAYER" =>          4             
00051                           );
00052 
00053                         elphel_reset_sensor();
00054                         elphel_set_P_arr($init_pars);
00055                         elphel_program_sensor (0);
00056                         elphel_compressor_run();
00057                         sleep(1);
00058                         shell_exec('mkdir /var/tmp/z');
00059                         shell_exec('mount /dev/hda1 /var/tmp/z');
00060                         shell_exec('echo "prefix=/var/tmp/z/vid01_; exif=1; format=mov; status" > /var/state/camogm_cmd');
00061                 }
00062         }
00063         
00064         function recorder()
00065         {
00066                 $state=$_GET['state'];
00067                 if($state==0)
00068                 {
00069                         shell_exec('echo "stop ; status" > /var/state/camogm_cmd');
00070                         echo "All stop.";
00071                 }
00072                 if($state==1)
00073                 {                                
00074                         shell_exec('echo "start ; status" > /var/state/camogm_cmd');
00075                         echo "Recording!";
00076                 }
00077         }
00078         
00079         function getImage()
00080         {
00081                 echo "<img src=\"http://" . $_SERVER["SERVER_ADDR"] . ":8081/last/save/wait/img\" width=100%/>";
00082         }
00083         
00084         function pushSetting()
00085         {
00086                 $variable=$_GET['variable'];
00087                 $value=$_GET['value'];
00088                 
00089                 //stolen from camera_demo.php
00090                 
00091                 if (elphel_get_state()>7) 
00092                 {  
00093                         elphel_compressor_stop(); 
00094                         while (elphel_get_state()>7) ; 
00095                         elphel_compressor_reset(); 
00096                         elphel_compressor_reset(); 
00097                 }
00098                 elphel_set_P_value($variable+0,$value+0);
00099                 elphel_program_sensor (0);
00100                 elphel_compressor_run();
00101         }
00102         
00103 ?>

Generated on Thu Aug 7 16:19:00 2008 for elphel by  doxygen 1.5.1