1.修改使用单频RTK的函数,
2.加入可保存飞行日志到临时本地,下次登录再提交
This commit is contained in:
parent
3d2a3b10fb
commit
911024c0ad
@ -16,6 +16,7 @@ using Plane.Util;
|
||||
using System.Windows;
|
||||
using Plane.Windows.Messages;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
|
||||
namespace Plane.FormationCreator.Formation
|
||||
{
|
||||
@ -28,6 +29,7 @@ namespace Plane.FormationCreator.Formation
|
||||
public int EnVCopterNumber = 0;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 实现排序插入
|
||||
/// </summary>
|
||||
@ -133,6 +135,7 @@ namespace Plane.FormationCreator.Formation
|
||||
const string LoginPage = "checkforapp.php";
|
||||
const string supername = "admin";
|
||||
const string superpass = "fxmf0622";
|
||||
const string TEMP_MISSIONFILE = @".\gcs.dat";
|
||||
//用户级别
|
||||
const int LEVEL_NORMAL = 1;
|
||||
const int LEVEL_ADMIN = 0;
|
||||
@ -306,9 +309,65 @@ namespace Plane.FormationCreator.Formation
|
||||
Loginstate = "未登录";
|
||||
}
|
||||
|
||||
//本地飞行任务日志 提交到服务器
|
||||
public void Net_PostTempMission()
|
||||
{
|
||||
string filePath = TEMP_MISSIONFILE;
|
||||
string[] Missionstrs = { };
|
||||
try
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
Missionstrs = File.ReadAllLines(filePath);
|
||||
List<String> Mlist = new List<string>(Missionstrs);
|
||||
string upstr = "";
|
||||
foreach (var mstr in Mlist)
|
||||
upstr = upstr + mstr + "|";
|
||||
Net_PostTempMission(upstr);
|
||||
Mlist.Clear();
|
||||
File.WriteAllLines(TEMP_MISSIONFILE, Mlist);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//保存飞行任务日志临时到本地
|
||||
public void Net_WriteTempMission(DateTime MissionTime, double OriginLng, double OriginLat)
|
||||
{
|
||||
string filePath = TEMP_MISSIONFILE;
|
||||
string[] Missionstrs = { };
|
||||
try
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
Missionstrs = File.ReadAllLines(filePath);
|
||||
List<String> Mlist = new List<string>(Missionstrs);
|
||||
Mlist.Add(MissionTime.ToString() + ";" + OriginLng.ToString() + ";" + OriginLat.ToString() + ";" + Copters.Count().ToString()
|
||||
+ ";" + Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
|
||||
File.WriteAllLines(TEMP_MISSIONFILE, Mlist);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//提交飞行记录
|
||||
public void Net_PostStartMission(DateTime MissionTime,double OriginLng, double OriginLat)
|
||||
public void Net_LogStartMission(DateTime MissionTime,double OriginLng, double OriginLat)
|
||||
{
|
||||
Net_WriteTempMission(MissionTime, OriginLng, OriginLat);
|
||||
Net_PostStartMission(MissionTime, OriginLng, OriginLat);
|
||||
}
|
||||
|
||||
|
||||
//提交飞行记录
|
||||
public void Net_PostStartMission(DateTime MissionTime, double OriginLng, double OriginLat)
|
||||
{
|
||||
|
||||
// 发送请求
|
||||
@ -318,9 +377,9 @@ namespace Plane.FormationCreator.Formation
|
||||
sbUrl.Append("username=" + _UserName);
|
||||
sbUrl.Append("&" + "clientname=" + System.Net.Dns.GetHostName());
|
||||
sbUrl.Append("&type=StartMission");
|
||||
sbUrl.Append("&mtime="+ MissionTime.ToString());
|
||||
sbUrl.Append("&orgLng="+ OriginLng.ToString());
|
||||
sbUrl.Append("&orgLat="+ OriginLat.ToString());
|
||||
sbUrl.Append("&mtime=" + MissionTime.ToString());
|
||||
sbUrl.Append("&orgLng=" + OriginLng.ToString());
|
||||
sbUrl.Append("&orgLat=" + OriginLat.ToString());
|
||||
sbUrl.Append("&coptercount=" + Copters.Count().ToString());
|
||||
sbUrl.Append("&ver=" + Assembly.GetExecutingAssembly().GetName().Version.ToString());
|
||||
String strUrl = sbUrl.ToString();
|
||||
@ -328,7 +387,21 @@ namespace Plane.FormationCreator.Formation
|
||||
new AsynDataUtils().AsynGetData(strUrl, null, out errorstr);
|
||||
}
|
||||
|
||||
|
||||
//提交本地飞行记录
|
||||
public void Net_PostTempMission(string missstr)
|
||||
{
|
||||
// 发送请求
|
||||
StringBuilder sbUrl = new StringBuilder(); // 请求URL内容
|
||||
sbUrl.Append(VersionControl.ServerURL + LoginPage);
|
||||
sbUrl.Append("?");
|
||||
sbUrl.Append("username=" + _UserName);
|
||||
sbUrl.Append("&" + "clientname=" + System.Net.Dns.GetHostName());
|
||||
sbUrl.Append("&type=TempMission");
|
||||
sbUrl.Append("&Mission=" + missstr);
|
||||
String strUrl = sbUrl.ToString();
|
||||
string errorstr;
|
||||
new AsynDataUtils().AsynGetData(strUrl, null, out errorstr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -374,6 +447,7 @@ namespace Plane.FormationCreator.Formation
|
||||
int userlevel = int.Parse(arr[4]);
|
||||
NetLogined(tempuser, UserDisplayName, vEnCopterNumber, vEnVCopterNumber, userlevel);
|
||||
VersionControl.SaveLogininfoToIni(tempuser, tempPassword, tempSavePassword);
|
||||
Net_PostTempMission();
|
||||
//MessageBox.Show(UserDisplayName + " 登录成功!", "登录提示");
|
||||
}
|
||||
else
|
||||
|
@ -290,8 +290,10 @@ namespace Plane.FormationCreator.Formation
|
||||
if ((seenmsg = rtcm.Read(buffer[a])) > 0)
|
||||
{
|
||||
bpsusefull += rtcm.length;
|
||||
|
||||
await _commModuleManager.InjectGpsRTCMDataAsync(rtcm.packet, rtcm.length);
|
||||
//用于双频RTK发送
|
||||
// await _commModuleManager.InjectGpsRTCMDataAsync(rtcm.packet, rtcm.length);
|
||||
//用于单频rtk发送
|
||||
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length);
|
||||
|
||||
string msgname = "Rtcm" + seenmsg;
|
||||
|
||||
|
@ -878,6 +878,8 @@ namespace Plane.FormationCreator.ViewModels
|
||||
if (packet != null && packet.Length > 0)
|
||||
{
|
||||
//Message.Show($"{DateTime.Now.ToString("HH:mm:ss fff")}---packet.length = {packet.Length}");
|
||||
//新方案的RTK发送,用于双频
|
||||
/*
|
||||
int read = packet.Length;
|
||||
if (read > 0)
|
||||
{
|
||||
@ -892,6 +894,9 @@ namespace Plane.FormationCreator.ViewModels
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//稳定方案的rtk发送,用于单频
|
||||
await _commModuleManager.InjectGpsDataAsync(packet, (ushort)packet.Length);
|
||||
}
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
|
||||
@ -1177,7 +1182,7 @@ namespace Plane.FormationCreator.ViewModels
|
||||
await Task.Delay(10).ConfigureAwait(false);
|
||||
|
||||
}
|
||||
_copterManager.Net_PostStartMission(MissionTime, _flightTaskManager.OriginLng, _flightTaskManager.OriginLat);
|
||||
_copterManager.Net_LogStartMission(MissionTime, _flightTaskManager.OriginLng, _flightTaskManager.OriginLat);
|
||||
Alert.Show("所有飞机开始执行航点任务。请勿多次开始任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user