1.修改使用单频RTK的函数,
2.加入可保存飞行日志到临时本地,下次登录再提交
This commit is contained in:
parent
3d2a3b10fb
commit
911024c0ad
@ -16,6 +16,7 @@ using Plane.Util;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Plane.Windows.Messages;
|
using Plane.Windows.Messages;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace Plane.FormationCreator.Formation
|
namespace Plane.FormationCreator.Formation
|
||||||
{
|
{
|
||||||
@ -28,6 +29,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
public int EnVCopterNumber = 0;
|
public int EnVCopterNumber = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 实现排序插入
|
/// 实现排序插入
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -133,6 +135,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
const string LoginPage = "checkforapp.php";
|
const string LoginPage = "checkforapp.php";
|
||||||
const string supername = "admin";
|
const string supername = "admin";
|
||||||
const string superpass = "fxmf0622";
|
const string superpass = "fxmf0622";
|
||||||
|
const string TEMP_MISSIONFILE = @".\gcs.dat";
|
||||||
//用户级别
|
//用户级别
|
||||||
const int LEVEL_NORMAL = 1;
|
const int LEVEL_NORMAL = 1;
|
||||||
const int LEVEL_ADMIN = 0;
|
const int LEVEL_ADMIN = 0;
|
||||||
@ -306,6 +309,62 @@ namespace Plane.FormationCreator.Formation
|
|||||||
Loginstate = "未登录";
|
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_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)
|
public void Net_PostStartMission(DateTime MissionTime, double OriginLng, double OriginLat)
|
||||||
@ -328,7 +387,21 @@ namespace Plane.FormationCreator.Formation
|
|||||||
new AsynDataUtils().AsynGetData(strUrl, null, out errorstr);
|
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]);
|
int userlevel = int.Parse(arr[4]);
|
||||||
NetLogined(tempuser, UserDisplayName, vEnCopterNumber, vEnVCopterNumber, userlevel);
|
NetLogined(tempuser, UserDisplayName, vEnCopterNumber, vEnVCopterNumber, userlevel);
|
||||||
VersionControl.SaveLogininfoToIni(tempuser, tempPassword, tempSavePassword);
|
VersionControl.SaveLogininfoToIni(tempuser, tempPassword, tempSavePassword);
|
||||||
|
Net_PostTempMission();
|
||||||
//MessageBox.Show(UserDisplayName + " 登录成功!", "登录提示");
|
//MessageBox.Show(UserDisplayName + " 登录成功!", "登录提示");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -290,8 +290,10 @@ namespace Plane.FormationCreator.Formation
|
|||||||
if ((seenmsg = rtcm.Read(buffer[a])) > 0)
|
if ((seenmsg = rtcm.Read(buffer[a])) > 0)
|
||||||
{
|
{
|
||||||
bpsusefull += rtcm.length;
|
bpsusefull += rtcm.length;
|
||||||
|
//用于双频RTK发送
|
||||||
await _commModuleManager.InjectGpsRTCMDataAsync(rtcm.packet, rtcm.length);
|
// await _commModuleManager.InjectGpsRTCMDataAsync(rtcm.packet, rtcm.length);
|
||||||
|
//用于单频rtk发送
|
||||||
|
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length);
|
||||||
|
|
||||||
string msgname = "Rtcm" + seenmsg;
|
string msgname = "Rtcm" + seenmsg;
|
||||||
|
|
||||||
|
@ -878,6 +878,8 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
if (packet != null && packet.Length > 0)
|
if (packet != null && packet.Length > 0)
|
||||||
{
|
{
|
||||||
//Message.Show($"{DateTime.Now.ToString("HH:mm:ss fff")}---packet.length = {packet.Length}");
|
//Message.Show($"{DateTime.Now.ToString("HH:mm:ss fff")}---packet.length = {packet.Length}");
|
||||||
|
//新方案的RTK发送,用于双频
|
||||||
|
/*
|
||||||
int read = packet.Length;
|
int read = packet.Length;
|
||||||
if (read > 0)
|
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);
|
await Task.Delay(10).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -1177,7 +1182,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
await Task.Delay(10).ConfigureAwait(false);
|
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);
|
Alert.Show("所有飞机开始执行航点任务。请勿多次开始任务!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user