packages/web/353/control_panel/ui_ajax.php

Go to the documentation of this file.
00001 <?php
00002 function getSweep() {
00003         echo "<div id='sweep_style'>";
00004                 echo "<a name='sweep' />";
00005                 echo "<h3>Your quick camera information</h3>";
00006                 echo "<ul>";
00007                         echo    "<li id='option'><a name='ip' href='#ip' class='option' onclick='print_ip()'>This camera's ip is: </a><img src='down.png' onclick='print_ip()' id='arrow' />";
00008                         echo    "<p id='ip_print'>" . $_SERVER['SERVER_ADDR'] . "</p></li>";
00009                         echo    "<li id='option'><a name='version' href='#version' class='option' onclick='print_soft()'>Camera's software version: </a><img src='down.png' onclick='print_soft()' id='arrow' />";
00010                         echo    "<p id='soft_print'>" . getSoftware() . "</p></li>";
00011                         echo    "<li id='option'><a name='ser' href='#ser' class='option' onload='print_gen()' onclick='print_gen()'>Your camera serial number is: </a><img src='down.png' onclick='print_gen()' id='arrow' />";
00012                         echo    "<p id='serial_print'>" . getSerial() . "</p></li>";
00013                         echo    "<li id='option'><a name='fpga' href='#fpga' class='option' onload='print_fpga()' onclick='print_fpga()'>FPGA info:</a><img src='down.png' onclick='print_fpga()' id='arrow' />";
00014                         echo    "<p id='fpga_print'>" . fpga() . "</p></li>";
00015                         echo    "<li id='option'><div name='proc' href='#proc' class='option' onload='print_proc()' >Print Processes</div>"; //make this dynamic again!!
00016                         echo    "<p id='proc_print'>" . ps() . "</p></li>";
00017                 echo "</ul>";
00018         echo "</div>";
00019 }
00020 
00021         
00022 function getSoftware() {
00023         return "<a href='/docs/" . exec('ls /usr/html/docs') . "'>" . exec('ls /usr/html/docs') . "</a> (get source)";
00024         //return $to_out;
00025         }
00026         
00027 function ps() {
00028         echo "<pre>";   
00029         exec('ps -w', $arr); 
00030         function low_daemon($v)
00031         {
00032          return (substr($v, -1) != ']');
00033         }
00034         $p = (array_filter($arr, "low_daemon"));
00035         print implode("<br />",$p);
00036         
00037         echo "</pre>";
00038 }
00039 
00040 function getSerial() {
00041   $s=exec("/bin/bootblocktool -x SERNO");
00042   return substr($s,0,2).":".substr($s,2,2).":".substr($s,4,2).":".substr($s,6,2).":".substr($s,8,2).":".substr($s,10,2);
00043   return header("Pragma: no-cache \n");
00044 }
00045 
00046 function fpga() {
00047         $arr = array();
00048         $s = exec("/bin/fpcf -r 13", $arr);
00049         return implode("<br />",$arr);
00050         return header("Pragma: no-cache \n");
00051 }
00052 
00053 function cat_interupts() {
00054         $arr = array();
00055         echo "<pre>";
00056         $s = exec("/bin/cat /proc/interrupts", $arr);
00057         echo implode("<br />",$arr);
00058         echo "</pre>";
00059 }
00060 
00061 function cat_sdram() {
00062         $arr = array();
00063         echo "<pre>";
00064         $s = exec("/bin/cat /var/log/fpga_sdram_phase", $arr);
00065         echo implode("<br />",$arr);
00066         echo "</pre>";
00067 }
00068 
00069 function ifconfig() {
00070         $arr = array();
00071         echo "<pre>";
00072         $s = exec("/sbin/ifconfig", $arr);
00073         echo implode("<br />",$arr);
00074         echo "</pre>";
00075 }
00076 
00077 function generate() {
00078         $arr = array();
00079         $generate =  
00080                 cat_interupts() . "<br />" .
00081                 cat_sdram() . "<br />" . 
00082                 ifconfig() . "<br />" .
00083                 fpga() . "<br />" . 
00084                 getSerial() . "<br />" . 
00085                 getSoftware() . "<br />" .
00086                 ps();
00087         return $generate;
00088         return header("Pragma: no-cache \n");
00089 }
00090 
00091 $q = $_GET['q'];
00092 if(!$q == null || !$q == ""){
00093 
00094                 switch ($q){
00095                         case "sweep":
00096                                 $out = getSweep();
00097                                 break;
00098                         case "serial":
00099                                 $out = getSerial();
00100                                 break;
00101                         case "ip":
00102                                 $out = $_SERVER['SERVER_ADDR'];
00103                                 break;
00104                         case "soft":
00105                                 $out = getSoftware();
00106                                 break;
00107                         case "proc":
00108                                 $out = ps();
00109                                 break;
00110                         case "fpga":
00111                                 $out = fpga();
00112                                 break;
00113                         case "int":
00114                                 $out = cat_interupts();
00115                                 break;
00116                         case "sdram":
00117                                 $out = cat_sdram();
00118                                 break;
00119                         case "ifconfig":
00120                                 $out = ifconfig();
00121                                 break;
00122                         case "generate":
00123                                 $out = generate();
00124                                 break;
00125         }
00126 }
00127                 //header("Content-Type: text/html");
00128                 //header("Content-Length: " . strlen($out) . "\n");
00129                 
00130 print $out;
00131 ?>

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