<?php
$a=$_GET["p"];

if ($a==0)
{
    echo "error";
    return;
}
set_time_limit(0);
ob_end_clean();//清空（擦除）缓冲区并关闭输出缓冲
ob_implicit_flush(1);//将打开或关闭绝对（隐式）刷送。绝对（隐式）刷送将导致在每次输出调用后有一次刷送操作，以便不再需要对 flush() 的显式调用
//echo  shell_exec("D:\\03MyGit\\linux\\movingliner\\cmake-build-debug-mingw\\movingliner.exe");
echo "application beging<br>";
//$cmd = 'ping 127.0.0.1';

system("sudo pkill ocean_optics_calibration_console");
system("sudo gpio write 1 1");
$cmd="";




if ($a==1)
{
    $cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs ocean_optics.lmp --cfon FSNsdfsd'.$a.'.data -p '.$a;
}
else
{
    $cmd = 'sudo /home/pi/bin/ocean_optics_calibration_console -t 30 -slfs 4000nit.dat --cfon FSNsdfsd'.$a.'.data -p '.$a;
}




while(@ ob_end_flush());

$proc = popen($cmd, 'r');


while(!feof($proc)){
    echo fread($proc, 4096);
    @ flush();
}
echo 'FINISH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!';
echo '<a href=/fileup/position.html>回到首页</a>';