RTCM发送中遇到端口被关闭的情况,自动再次打开,走虚拟基站经常有这种情况(30分钟被服务器断开一次)

This commit is contained in:
xu 2024-04-27 15:33:11 +08:00
parent 9bc7a66831
commit 77afef5ee1
3 changed files with 19 additions and 6 deletions

View File

@ -9,6 +9,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -406,6 +407,7 @@ namespace Plane.FormationCreator.Formation
bool Ensend = false; bool Ensend = false;
//新版本打包发送模式 //新版本打包发送模式
//await _commModuleManager.StartRtcmLoop(); //await _commModuleManager.StartRtcmLoop();
Plane.Windows.Messages.Message.Show("RTCM发送开始............");
while (Rtcmthreadrun) while (Rtcmthreadrun)
{ {
// Console.WriteLine(string.Format("{0:T} 1", DateTime.Now)); // Console.WriteLine(string.Format("{0:T} 1", DateTime.Now));
@ -424,6 +426,7 @@ namespace Plane.FormationCreator.Formation
{ {
comPort.Close(); comPort.Close();
comPort.Open(); comPort.Open();
Plane.Windows.Messages.Message.Show("RTCM数据超时或端口被关闭重新打开");
} }
// reset timer // reset timer
lastrecv = unow; lastrecv = unow;
@ -433,7 +436,9 @@ namespace Plane.FormationCreator.Formation
if (!comPort.IsOpen) if (!comPort.IsOpen)
{ {
return; comPort.Open();
Plane.Windows.Messages.Message.Show("RTCM端口已被关闭再次打开");
// return;
} }
/////////////////////////////////重写发送RTCM数据部分---23/10/18 by panxu /////////////////////////////////重写发送RTCM数据部分---23/10/18 by panxu
/// ///
@ -577,9 +582,16 @@ namespace Plane.FormationCreator.Formation
} }
catch (Exception ex) catch (Exception ex)
{ {
Plane.Windows.Messages.Message.Show(ex.Message); //Plane.Windows.Messages.Message.Show("RTCM异常:" + ex.Message);
/*
StackFrame sf = new System.Diagnostics.StackTrace(ex, true).GetFrame(0);
Plane.Windows.Messages.Message.Show("RTCM异常:"+ ex.Message+" 行:" +
sf.GetFileLineNumber() + " 文件:"+ sf.GetFileName());
*/
} }
} }
Plane.Windows.Messages.Message.Show("RTCM发送停止............");
Rtcmthreadrun = false;
} }

View File

@ -53,6 +53,7 @@
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\FGCS.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ApplicationIcon>gcs.ico</ApplicationIcon> <ApplicationIcon>gcs.ico</ApplicationIcon>

View File

@ -20,18 +20,18 @@
Margin="10" ItemsSource="{Binding serialPorts, Mode=OneWay}" Margin="10" ItemsSource="{Binding serialPorts, Mode=OneWay}"
SelectedValue="{Binding SerialPortsSelectdValue}" SelectedValue="{Binding SerialPortsSelectdValue}"
DropDownOpened="ComboBox_DropDownOpened"/> DropDownOpened="ComboBox_DropDownOpened"/>
<Button Margin="6" Width="80" Height="28" <Button Margin="6" Width="90" Height="28"
Content="{Binding RtcmManager.Rtcmthreadrun,Converter={StaticResource SendConverter}}" Content="{Binding RtcmManager.Rtcmthreadrun,Converter={StaticResource SendConverter}}"
Command="{Binding ConnectRtcmCommand}"/> Command="{Binding ConnectRtcmCommand}"/>
<Label Margin="6,6,0,6" Height="28" Content="卫星数:"/> <Label Margin="6,6,0,6" Height="28" Content="卫星数:"/>
<Label Margin="0,6,6,6" Height="28" Content="{Binding RtcmManager.rtcmInfoList.Count,UpdateSourceTrigger=PropertyChanged}"></Label> <Label Margin="0,6,6,6" Height="28" Content="{Binding RtcmManager.rtcmInfoList.Count,UpdateSourceTrigger=PropertyChanged}"></Label>
</StackPanel> </StackPanel>
<StackPanel Margin="6,0,0,6" Orientation="Horizontal"> <StackPanel Margin="6,0,0,6" Orientation="Horizontal">
<CheckBox x:Name="checkBox" Content="同时发送到:" <CheckBox x:Name="checkBox" Content="同时发送到(57600)"
Margin="4,5,5,0" Width="90" Margin="4,5,5,0" Width="130"
IsChecked="{Binding ResendToComMK}"/> IsChecked="{Binding ResendToComMK}"/>
<ComboBox Width="90" Height="25" Foreground="White" SelectedIndex="0" <ComboBox Width="90" Height="25" Foreground="White" SelectedIndex="0"
Margin="0,0,5,0" ItemsSource="{Binding serialRePorts, Mode=OneWay}" ItemsSource="{Binding serialRePorts, Mode=OneWay}"
SelectedValue="{Binding SerialPortResend}" SelectedValue="{Binding SerialPortResend}"
DropDownOpened="ComboBox_DropDownOpened"/> DropDownOpened="ComboBox_DropDownOpened"/>
<CheckBox x:Name="cBsmalldata" Content="减少广播数据" <CheckBox x:Name="cBsmalldata" Content="减少广播数据"