first commnit

This commit is contained in:
2022-08-16 09:26:36 +08:00
commit 11d5fc83c2
941 changed files with 168924 additions and 0 deletions

98
html/config.html Normal file
View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="/css/config.css">
</head>
<body class="body" >
<div>
<h1 class="title1">Sif And Spectral</h1>
</div>
<div style="margin-left:auto;margin-right:auto;width:80%;" >
<table style="width: 100%">
<tr>
<td width="100px">程序运行状态</td>
<td width="50px" id="statid"></td>
<td ></td>
<td><input type="button" value="重启" onclick="rebootclicked()"></td>
</tr>
</table>
</div>
<form action="/php/config.php" method="POST" >
<div style="margin-left:auto;margin-right:auto;width:80%;" >
<div class="mainframe" >
<table class="linetb">
<tr>
<td><h2>控制设置</h2></td>
</tr>
</table>
<div align="center">
<table class="linetb" >
<tr style="width:80%">
<td style="width:33%">开始时间 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="time" id="BeginTime" name="BeginTime" class="TextInput"></td>
<td style="width:33%">时间间隔&nbsp; &nbsp;&nbsp;
<input type="number" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
<td style="width:33%">停止时间&nbsp;&nbsp;&nbsp;&nbsp;
<input type="time" id="EndTime" class="TextInput" name="EndTime"></td>
</tr>
</table>
</div>
<p></p>
<p></p>
<div>
<h2>描述信息</h2>
</div>
<div align="center">
<table style="width:100%">
<tr>
<td>设备序列号&nbsp;&nbsp;&nbsp; <input class="TextInput" id="Dev_SN" name="Dev_SN" value="1000000"></td>
<td>地点&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="TextInput" name="Location" id="Location"></td>
<td>北半球 <input type="checkbox" name="GPS_North" id="GPS_North"> </td>
</tr>
<tr>
<td>GPS经度 <input type="text" class="TextInput" name="GPS_Longtitude" id="GPS_Longtitude"></td>
<td>GPS经度 <input type="text" class="TextInput" name="GPS_Latitude" id="GPS_Latitude"> </td>
<td>GPS高程 <input type="text" class="TextInput" name="GPS_Atitude" id="GPS_Atitude"> </td>
</tr>
</table>
<p></p>
<table style="width:100%">
<tr>
<td>安装时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="date" name="InstallTime" id="InstallTime"></td>
<td>ISIF定标时间&nbsp;&nbsp;<input type="date" name="ISIFCalibrationTime" id="ISIFCalibrationTime"> </td>
<td>IS1定标时间 <input type="date" name="IS1CalibrationTime" id="IS1CalibrationTime"> </td>
</tr>
<tr>
<td>设备维护人员 <input type="text" class="TextInput" name="NameOfMaintenance" id="NameOfMaintenance"></td>
<td>维护人员电话 <input type="number" name="PhoneOfMaintenance" id="PhoneOfMaintenance" style="width: 100px" ></td>
</tr>
<tr>
<td>远程资源用户ID <input type="text" name="DownloadUserID" class="TextInput" id="DownloadUserID"></td>
<td>定标文件下载路径<input type="text" name="DownlaodAddress" id="DownlaodAddress"></td>
</tr>
</table>
</div>
<div id="devinfo">
</div>
<div>
<h2></h2>
<input type="submit" value="提交" >
</div>
</div>
</div>
</form>
<script type="text/javascript" src="/javascript/comment.js"></script>
<script type="text/javascript" src="/javascript/config.js"></script>
</body>
</html>

View File

@ -0,0 +1,59 @@
<?php
//var_dump($_GET);
$sensor=$_GET['sensor'];
$number=$_GET['positionnumber'];
$shuter=$_GET['shutterTime'];
set_time_limit(0);
ob_end_clean();//清空(擦除)缓冲区并关闭输出缓冲
ob_implicit_flush(1);//将打开或关闭绝对(隐式)刷送。绝对(隐式)刷送将导致在每次输出调用后有一次刷送操作,以便不再需要对 flush() 的显式调用
system("sudo gpio mode 1 out");
system("sudo gpio write 1 1");
system("sudo killall Mywathdog.sh");
system("sudo killall TowerOptoSifAndSpectral");
system("sudo pkill shutter_calibrate");
$cmd = 'sudo /home/pi/bin/shutter_calibrate '.$sensor." ".$number.' '.$shuter;
echo $cmd.'<br>';
while(@ ob_end_flush());
$proc = popen($cmd, 'r');
while(!feof($proc)){
echo fread($proc, 4096);
@ flush();
}
echo "<br>";
echo "finish";
echo '<a href=/config/position.html>回到首页</a>';
$file=fopen('/home/data/test.csv','r');
while ($data = fgetcsv($file)) { //每次读取CSV里面的一行内容
//print_r($data); //此为一个数组,要获得每一个数据,访问数组下标即可
$goods_list[] = $data;
}
//var_dump($goods_list[0]);
$hang=count($goods_list);
$x=$goods_list[0][2];
$y=$goods_list[0][1];;
for($i=1;$i<$hang;$i++)
{
$x=$x.','.$goods_list[$i][2];
$y=$y.','.$goods_list[$i][1];
}
echo '<div id="main" style="width: 600px;height:400px;"></div> ';
echo ' <script src="/config/js/echarts.js"></script>';
echo '<script>var xx=['.$x.']; var yy=['.$y.']; </script>';
echo '<script src="/config/js/printercaliresult.js"></script>';

95096
html/config/js/echarts.js Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
var chartDom = document.getElementById('main');
var myChart = echarts.init(chartDom);
// 指定图表的配置项和数据
var option = {
xAxis: {
type: 'category',
data: [1,2,3,4,5,6]
},
yAxis: {
type: 'value'
},
tooltip:{
trigger:'axis'
},
dataZoom:[{
type:"inside" //详细配置可见echarts官网
}],
series: [
{
name: 'DN',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
}
]
};
option.xAxis.data=xx;
option.series[0].data=yy;
option
myChart.setOption(option);

66
html/config/location.php Normal file
View File

@ -0,0 +1,66 @@
<?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");
//$cmd = 'ping 127.0.0.1';
//sy""
system("sudo killall Mywathdog.sh");
system("sudo killall TowerOptoSifAndSpectral");
system("sudo pkill movingliner");
Echo $a;
$cmd = 'sudo /home/pi/bin/movingliner '.$a;
while(@ ob_end_flush());
$proc = popen($cmd, 'r');
while(!feof($proc)){
echo fread($proc, 4096);
@ flush();
}
echo '<form action="/config/calibrate.php" method="get" target="_blank">';
echo '设备<input id="sensor" name="sensor" type="text" list="typelist" placeholder="请选择">
<datalist id="typelist">
  <option>IS1</option>
  <option>IS2</option>
  <option>ISIF</option>
  <option>OSIFAlpha</option>
<option>OSIFBeta</option>
</datalist>';
echo '尼特 <input type="number" name="nite" id="nite"/>';
echo '<input id="p" name="p" type="hidden" value="'.$a.'">';
echo '<input type="submit" value="定标">';
echo '</form>';
echo '<a href=/config/position.html>回到首页</a>';
/*
$i = 100;
while ($i<1000) {
++$i;
//部分浏览器需要内容达到一定长度了才输出
if ($i === 103) {
echo"<p>hello word".$i."</p>";;
} else {
echo"<p>hello word".$i."</p>";;
}
sleep(1);
}
*/

66
html/config/position.html Normal file
View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<a href="/config/location.php?p=1">位置1</a>
<a href="/config/location.php?p=2">位置2</a>
<a href="/config/location.php?p=3">位置3</a>
<a href="/config/location.php?p=4">位置4</a>
<a href="/config/location.php?p=5">位置5</a>
<a href="/config/location.php?p=12">位置try</a>
<form action="LocationCali.php" method="get">
<table>
<tr>
<td>
位置自动计算:
</td>
<td>
</td>
<td>设备<input id="sensor" name="sensor" type="text" list="typelist" placeholder="请选择">
<datalist id="typelist">
  <option>IS1</option>
  <option>IS2</option>
  <option>ISIF</option>
  <option>OSIFAlpha</option>
<option>OSIFBeta</option>
</datalist>
</td>
<td>
预估位置数量
<input id="positionnumber" name="positionnumber" type="number" list="positionnumbertypelist" placeholder="请选择">
<datalist id="positionnumbertypelist">
  <option>1</option>
  <option>2</option>
  <option>3</option>
  <option>4</option>
<option>5</option>
  <option>6</option>
  <option>7</option>
  <option>8</option>
  <option>9</option>
<option>10</option>
</datalist>
</td>
<td>
曝光事件
<input id="shutterTime" name="shutterTime" type="number" value="10">ms
</td>
<td>
<input type="submit" value="开始">
</td>
</tr>
</table>
</form>
</body>
</html>

32
html/css/config.css Normal file
View File

@ -0,0 +1,32 @@
.title1 {
align-content: center;
font-style: normal;
font-weight: 900;
}
h2 {
width: 100%;
border-bottom: 1px dashed rgba(0, 0, 0, 1.00);
}
.linetb {
width: 100%;
}
.TextInput{
width: 80px;
}
body{
text-align:center;
margin-left:auto;
margin-right:auto;
}
h2 {
text-align: left;
margin-left: 0px;
margin-top: 5px;
margin-right: 0px;
margin-bottom: 5px;
}
.mainframe {
border: 1px ridge rgba(0, 0, 0, 1.00);
}

100
html/index.html Normal file
View File

@ -0,0 +1,100 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="/css/config.css">
</head>
<body class="body" >
<div>
<h1 class="title1">Sif And Spectral</h1>
</div>
<div style="margin-left:auto;margin-right:auto;width:80%;" >
<table style="width: 100%">
<tr>
<td width="100px">程序运行状态</td>
<td width="50px" id="statid"></td>
<td ></td>
<td><input type="button" value="重启" onclick="rebootclicked()"></td>
</tr>
</table>
</div>
<form action="/php/config.php" method="POST" >
<div style="margin-left:auto;margin-right:auto;width:80%;" >
<div class="mainframe" >
<table class="linetb">
<tr>
<td><h2>控制设置</h2></td>
</tr>
</table>
<div align="center">
<table class="linetb" >
<tr style="width:80%">
<td style="width:33%">开始时间 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="time" id="BeginTime" name="BeginTime" class="TextInput"></td>
<td style="width:33%">时间间隔&nbsp; &nbsp;&nbsp;
<input type="number" id="IntervalTime" name="IntervalTime" class="TextInput"></td>
<td style="width:33%">停止时间&nbsp;&nbsp;&nbsp;&nbsp;
<input type="time" id="EndTime" class="TextInput" name="EndTime"></td>
</tr>
</table>
</div>
<p></p>
<p></p>
<div>
<h2>描述信息</h2>
</div>
<div align="center">
<table style="width:100%">
<tr>
<td>设备序列号&nbsp;&nbsp;&nbsp; <input class="TextInput" id="Dev_SN" name="Dev_SN" value="1000000"></td>
<td>地点&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input class="TextInput" name="Location" id="Location"></td>
<td>北半球 <input type="checkbox" name="GPS_North" id="GPS_North"> </td>
</tr>
<tr>
<td>GPS经度 <input type="text" class="TextInput" name="GPS_Longtitude" id="GPS_Longtitude"></td>
<td>GPS经度 <input type="text" class="TextInput" name="GPS_Latitude" id="GPS_Latitude"> </td>
<td>GPS高程 <input type="text" class="TextInput" name="GPS_Altitude" id="GPS_Altitude"> </td>
</tr>
</table>
<p></p>
<table style="width:100%">
<tr>
<td>安装时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="date" name="InstallationTime" id="InstallationTime"></td>
<td>ISIF定标时间&nbsp;&nbsp;<input type="date" name="ISIFCalibrationTime" id="ISIFCalibrationTime"> </td>
<td>IS1定标时间 <input type="date" name="IS1CalibrationTime" id="IS1CalibrationTime"> </td>
</tr>
<tr>
<td>设备维护人员 <input type="text" class="TextInput" name="NameOfMaintenanceStaff" id="NameOfMaintenanceStaff"></td>
<td>维护人员电话 <input type="number" name="PhoneNumberOfMaintenanceStaff" id="PhoneNumberOfMaintenanceStaff" style="width: 100px" ></td>
</tr>
<tr>
<td>远程资源用户ID <input type="text" name="DownloadUserID" class="TextInput" id="DownloadUserID"></td>
<td>定标文件下载路径<input type="url" name="DownlaodAddress" id="DownlaodAddress"></td>
<td>远程服务器<input type="url" name="HTTPServer" id="HTTPServer"></td>
</tr>
</table>
</div>
<div id="devinfo">
</div>
<div>
<h2></h2>
<input type="submit" value="提交" >
</div>
</div>
</div>
</form>
<script type="text/javascript" src="/javascript/comment.js"></script>
<script type="text/javascript" src="/javascript/config.js"></script>
</body>
</html>

View File

@ -0,0 +1,69 @@
function ajaxObject() {
var xmlHttp;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("您的浏览器不支持AJAX");
return false;
}
}
}
return xmlHttp;
}
function httppost ( url , data , fnSucceed ){// fnFail , fnLoading ) {
var ajax = ajaxObject();
ajax.open( "post" , url , true );
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
ajax.onreadystatechange = function () {
if( ajax.readyState == 4 ) {
if( ajax.status == 200 ) {
fnSucceed( ajax.response);
//ajax.response.size();
}
else {
// fnFail( "HTTP请求错误错误码"+ajax.status );
}
}
else {
//fnLoading();
}
}
// ajax.responseType="arraybuffer";
ajax.send( data );
}
function httpget ( url , data , fnSucceed ){// fnFail , fnLoading ) {
var ajax = ajaxObject();
ajax.open( "get" , url , true );
// ajax.setRequestHeader( "Content-Type" , "application/octet-binary" );
ajax.onreadystatechange = function () {
if( ajax.readyState == 4 ) {
if( ajax.status == 200 ) {
fnSucceed( ajax.response);
//ajax.response.size();
}
else {
// fnFail( "HTTP请求错误错误码"+ajax.status );
}
}
else {
//fnLoading();
}
}
// ajax.responseType="arraybuffer";
ajax.send( data );
}

61
html/javascript/config.js Normal file
View File

@ -0,0 +1,61 @@
function getConfigRentrun(reson)
{
var aa=JSON.parse(reson);
for (var obj in aa)
{
var temmp=document.getElementById(obj);
temmp.value=aa[obj];
if (obj=="GPS_North")
{
if (aa[obj]=="on")
{
temmp.checked=true;
}else {
temmp.checked=false;
}
}
}
}
function getDevinfoRetrun(retrun)
{
var div=document.getElementById('devinfo');
div.innerHTML=retrun;
init()
}
function getstataRetrun(retrun){
var div=document.getElementById('statid');
div.innerHTML=retrun;
}
var datad;
function init()
{
httpget("/php/GetConfig.php",datad,getConfigRentrun)
}
function getinit()
{
httpget("/php/GetIniFile.php",datad,getDevinfoRetrun)
httpget("/php/GetSata.php",datad,getstataRetrun)
}
function rebootclicked()
{
httpget("/php/reboot.php",datad,getrebootRentrun)
var div=document.getElementById('statid');
div.innerHTML="";
}
function getrebootRentrun(ret)
{
alert(ret)
setTimeout(() => {
location.reload()
}, 100);
}
window.onload=getinit;

4
html/php/GetConfig.php Normal file
View File

@ -0,0 +1,4 @@
<?php
header("Content-type:application/json");
$a=file_get_contents("/home/data/Setting/config.json");
echo $a;

17
html/php/GetIniFile.php Normal file
View File

@ -0,0 +1,17 @@
<?php
$a=parse_ini_file("/home/data/Setting/DeviceSettings.ini",true);
$numberofsensor=intval($a['DEVICE INFO']['TotalSpectrometer']);
$b=array_values($a);
echo '<h2>设备信息</h2>';
echo '设备数量 '.$numberofsensor.'';
echo '<table>';
for ($i=0;$i<$numberofsensor;$i++)
{
echo '<tr>';
echo '<td>'.$b[$i+1]['Model'].'_定标文件主名称'.'</td>';
echo '<td><input type="text" id="'.$b[$i+1]['Model'].'_CaliFileMainName'.'" name="'.$b[$i+1]['Model'].'_CaliFileMainName'.'"></td>';
echo '</tr>';
}
echo '</table>';

10
html/php/GetSata.php Normal file
View File

@ -0,0 +1,10 @@
<?php
exec("ps -ef | grep TowerOptoSifAndSpectral | grep -v grep",$output,$return);
//var_dump( $output);
if ( count($output)>0)
{
echo '<div style="width: 40px;height: 20px;background: green"></div>';
}else{
echo '<div style="width: 40px;height: 20px;background: red"></div>';
}

1
html/php/config.json Normal file
View File

@ -0,0 +1 @@
{"BeginTime":"","IntervalTime":"","EndTime":"","Dev_SN":"1000000","Location":"","GPS_Longtitude":"","GPS_Latitude":"","GPS_Atitude":"","InstallTime":"","ISIFCalibrationTime":"","IS1CalibrationTime":"","NameOfMaintenance":"","PhoneOfMaintenance":"","DownloadUserID":"","DownlaodAddress":""}

7
html/php/config.php Normal file
View File

@ -0,0 +1,7 @@
<?php
var_dump($_POST);
exec("sudo touch /home/data/Setting/config.json");
exec("sudo chmod 777 /home/data/Setting/config.json");
file_put_contents("/home/data/Setting/config.json",json_encode($_POST));
echo "提交成功";

8
html/php/reboot.php Normal file
View File

@ -0,0 +1,8 @@
<?php
ignore_user_abort(true);
set_time_limit(0);
echo system("sudo killall Mywathdog.sh");
echo system("sudo killall TowerOptoSifAndSpectral");
echo system("sudo ./reboot.sh &");
echo "系统已重启";
//var_dump($output);

3
html/php/reboot.sh Normal file
View File

@ -0,0 +1,3 @@
/root/Mywathdog.sh>>log.txt &