[feat] 调整双通道发送框架和界面
为了广播通道能服务于所有广播命令,调整广播发送框架, 将通道选择从rtk发送界面移到设置界面 右下角加入广播通道是否打开的提示 RTK发送状态的提示从按钮旁边移动到主界面状态栏,并加入更多信息 调整连接状态图标 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
12262ff53d
commit
32110aab07
@ -13,11 +13,11 @@
|
|||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<materialDesign:PackIcon x:Key="CheckIcon"
|
<materialDesign:PackIcon x:Key="CheckIcon"
|
||||||
x:Shared="False"
|
x:Shared="False"
|
||||||
Kind="Check"
|
Kind="LanConnect"
|
||||||
Foreground="#2196F3" />
|
Foreground="#2196F3" />
|
||||||
<materialDesign:PackIcon x:Key="CloseIcon"
|
<materialDesign:PackIcon x:Key="CloseIcon"
|
||||||
x:Shared="False"
|
x:Shared="False"
|
||||||
Kind="Close"
|
Kind="LanDisconnect"
|
||||||
Foreground="White" />
|
Foreground="White" />
|
||||||
<cnv:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
<cnv:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||||
<cnv:BooleanToVisibilityConverter x:Key="InversiveBooleanToVisibilityConverter"
|
<cnv:BooleanToVisibilityConverter x:Key="InversiveBooleanToVisibilityConverter"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using GalaSoft.MvvmLight;
|
using GalaSoft.MvvmLight;
|
||||||
using Microsoft.Practices.ServiceLocation;
|
using Microsoft.Practices.ServiceLocation;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using Plane.CommunicationManagement;
|
using Plane.CommunicationManagement;
|
||||||
using Plane.FormationCreator.ViewModels;
|
using Plane.FormationCreator.ViewModels;
|
||||||
using Plane.Util;
|
using Plane.Util;
|
||||||
@ -37,7 +38,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
private CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
|
private CopterManager _copterManager = ServiceLocator.Current.GetInstance<CopterManager>();
|
||||||
private bool _rtcmthreadrun = false;
|
private bool _rtcmthreadrun = false;
|
||||||
private bool _smallrtcmdata = false; //减少传输数据--用于带宽不够的通讯模块-对数传广播无效
|
private bool _smallrtcmdata = false; //减少传输数据--用于带宽不够的通讯模块-对数传广播无效
|
||||||
private bool _enrecom = false;//是否转发到另外串口
|
|
||||||
|
|
||||||
// rtcm发送类型0:直接发送,
|
// rtcm发送类型0:直接发送,
|
||||||
// 1:1秒只发一种卫星,1秒发GPS,第2秒发北斗,第3秒发格洛纳斯,其他数据随来随发
|
// 1:1秒只发一种卫星,1秒发GPS,第2秒发北斗,第3秒发格洛纳斯,其他数据随来随发
|
||||||
@ -100,19 +101,33 @@ namespace Plane.FormationCreator.Formation
|
|||||||
return typename;
|
return typename;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private void SetRTKStatestr()
|
||||||
|
{
|
||||||
|
string rtksstr= "";
|
||||||
|
// ResendToCom
|
||||||
|
if (Rtcmthreadrun)
|
||||||
|
{
|
||||||
|
rtksstr = "RTK发送中 ";
|
||||||
|
|
||||||
|
if (SmallRtcmData)
|
||||||
|
rtksstr += ",低带宽模式 ";
|
||||||
|
if (ResendToCom)
|
||||||
|
rtksstr += ",双通道发送 ";
|
||||||
|
rtksstr += "...";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
rtksstr = "RTK未发送";
|
||||||
|
|
||||||
|
ControlPanelVM.RTKState = rtksstr;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public bool Rtcmthreadrun
|
public bool Rtcmthreadrun
|
||||||
{
|
{
|
||||||
get { return _rtcmthreadrun; }
|
get { return _rtcmthreadrun; }
|
||||||
set {
|
set {
|
||||||
Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value);
|
Set(nameof(Rtcmthreadrun), ref _rtcmthreadrun, value);
|
||||||
|
SetRTKStatestr();
|
||||||
if (value)
|
|
||||||
ControlPanelVM.RTKState = "RTK发送中...";
|
|
||||||
else
|
|
||||||
ControlPanelVM.RTKState = "RTK未发送";
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,6 +137,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
Set(nameof(SmallRtcmData), ref _smallrtcmdata, value);
|
Set(nameof(SmallRtcmData), ref _smallrtcmdata, value);
|
||||||
|
SetRTKStatestr();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,6 +228,17 @@ namespace Plane.FormationCreator.Formation
|
|||||||
get { return _stationTime; }
|
get { return _stationTime; }
|
||||||
set { Set(nameof(StationTime), ref _stationTime, value); }
|
set { Set(nameof(StationTime), ref _stationTime, value); }
|
||||||
}
|
}
|
||||||
|
private bool _sesendtocom;
|
||||||
|
public bool ResendToCom
|
||||||
|
{
|
||||||
|
get { return _sesendtocom; }
|
||||||
|
set {
|
||||||
|
Set(nameof(ResendToCom), ref _sesendtocom, value);
|
||||||
|
SetRTKStatestr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private DispatcherTimer dispatcherTimer = null;
|
private DispatcherTimer dispatcherTimer = null;
|
||||||
public RtcmManager()
|
public RtcmManager()
|
||||||
@ -291,7 +318,8 @@ namespace Plane.FormationCreator.Formation
|
|||||||
return SerialPort.GetPortNames();
|
return SerialPort.GetPortNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Open(string CMB_serialport, string reserialport="")
|
|
||||||
|
public async Task Open(string CMB_serialport)
|
||||||
{
|
{
|
||||||
if (CMB_serialport == "") return;
|
if (CMB_serialport == "") return;
|
||||||
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
FlightTaskManager _flightTaskManager = ServiceLocator.Current.GetInstance<FlightTaskManager>();
|
||||||
@ -373,12 +401,6 @@ namespace Plane.FormationCreator.Formation
|
|||||||
if (comPort.IsOpen)
|
if (comPort.IsOpen)
|
||||||
{
|
{
|
||||||
Rtcmthreadrun = true;
|
Rtcmthreadrun = true;
|
||||||
_enrecom = false;
|
|
||||||
if (reserialport != "")
|
|
||||||
{
|
|
||||||
_enrecom=_commModuleManager.OpenResendRtcmserial(reserialport);
|
|
||||||
|
|
||||||
}
|
|
||||||
await RtcmLoop();
|
await RtcmLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,19 +509,12 @@ namespace Plane.FormationCreator.Formation
|
|||||||
nmea.resetParser();
|
nmea.resetParser();
|
||||||
string msgshowname = rtcm_typename(seenmsg);
|
string msgshowname = rtcm_typename(seenmsg);
|
||||||
//Plane.Windows.Messages.Message.Show("--收到[" + seenmsg + "]:"+ msgshowname+" ,长度:"+ rtcm.length);
|
//Plane.Windows.Messages.Message.Show("--收到[" + seenmsg + "]:"+ msgshowname+" ,长度:"+ rtcm.length);
|
||||||
//广播数据直接发送不受小带宽数据选项影响
|
|
||||||
if (_enrecom)
|
|
||||||
{
|
|
||||||
// Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss") + "--广播Rtcm长度: " + (ushort)rtcm.length + " 类型: " + msgshowname + " (" + seenmsg + ")");
|
|
||||||
_commModuleManager.BroadcastGpsDataAsync(rtcm.packet, (ushort)rtcm.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
//直接发送
|
//直接发送
|
||||||
if (!SmallRtcmData)
|
if (!SmallRtcmData)
|
||||||
{
|
{
|
||||||
//发送到飞机
|
//发送到飞机
|
||||||
// Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss") + "--通讯模块发送Rtcm长度: " + (ushort)rtcm.length + " 类型: " + msgshowname + " (" + seenmsg + ")");
|
// Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss") + "--通讯模块发送Rtcm长度: " + (ushort)rtcm.length + " 类型: " + msgshowname + " (" + seenmsg + ")");
|
||||||
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length);
|
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length, ResendToCom);
|
||||||
//累加消息数量,用于界面显示
|
//累加消息数量,用于界面显示
|
||||||
bpsusefull += rtcm.length;
|
bpsusefull += rtcm.length;
|
||||||
}
|
}
|
||||||
@ -615,7 +630,7 @@ namespace Plane.FormationCreator.Formation
|
|||||||
if (Ensend)
|
if (Ensend)
|
||||||
{
|
{
|
||||||
//Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss") + "--通讯模块发送Rtcm长度: " + (ushort)rtcm.length + " 类型: " + msgshowname + " (" + seenmsg + ")");
|
//Console.WriteLine(DateTime.UtcNow.ToString("HH:mm:ss") + "--通讯模块发送Rtcm长度: " + (ushort)rtcm.length + " 类型: " + msgshowname + " (" + seenmsg + ")");
|
||||||
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length);
|
await _commModuleManager.InjectGpsDataAsync(rtcm.packet, (ushort)rtcm.length, ResendToCom);
|
||||||
//累加消息数量,用于界面显示
|
//累加消息数量,用于界面显示
|
||||||
bpsusefull += rtcm.length;
|
bpsusefull += rtcm.length;
|
||||||
}
|
}
|
||||||
|
@ -267,20 +267,18 @@
|
|||||||
<TextBlock Margin="10,4"
|
<TextBlock Margin="10,4"
|
||||||
Text="{Binding Message}" Width="480" MouseUp="LogShowHide"/>
|
Text="{Binding Message}" Width="480" MouseUp="LogShowHide"/>
|
||||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
||||||
<TextBlock Margin="10,4"
|
<TextBlock Margin="10,4" Width="300" Text="{Binding SysStatusText}" />
|
||||||
Width="300" Text="{Binding SysStatusText}" />
|
|
||||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
||||||
<TextBlock Margin="10,4" Width="400"
|
<TextBlock Margin="10,4" Width="210"
|
||||||
Text="{Binding CopterListViewModel.SelectedCopter.StatusText}" />
|
Text="{Binding ControlPanelViewModelData.RTKState}" />
|
||||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
|
||||||
<TextBlock Margin="10,4" Width="200"
|
|
||||||
Text="{Binding ControlPanelViewModel.RTKState}" />
|
|
||||||
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
<Separator Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" Margin="0,8" BorderBrush="LightGray" BorderThickness="1"/>
|
||||||
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<TextBlock Text="{Binding Loginstate}" Margin="0,4,14,0"/>
|
<TextBlock Text="{Binding Loginstate}" Margin="0,4,14,0"/>
|
||||||
|
<TextBlock Text="广播端口:" Margin="4"/>
|
||||||
|
<ContentPresenter Margin="0,4,4,0" Content="{Binding BoardcastPortOpened, Converter={StaticResource CheckSignConverter}, Mode=OneWay}" />
|
||||||
<TextBlock Text="通信连接:" Margin="4"/>
|
<TextBlock Text="通信连接:" Margin="4"/>
|
||||||
<ContentPresenter Margin="0,4,14,0" Content="{Binding CommunicationModuleConnected, Converter={StaticResource CheckSignConverter}, Mode=OneWay}" />
|
<ContentPresenter Margin="0,4,14,0" Content="{Binding CommunicationModuleConnected, Converter={StaticResource CheckSignConverter}, Mode=OneWay}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
@ -25,16 +25,31 @@ using Plane.Protocols;
|
|||||||
using Microsoft.Practices.ServiceLocation;
|
using Microsoft.Practices.ServiceLocation;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using Plane.FormationCreator.Views;
|
using Plane.FormationCreator.Views;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using Plane.Util;
|
||||||
|
using System.IO.Ports;
|
||||||
|
using SerialPort = Plane.Util.SerialPort;
|
||||||
|
|
||||||
namespace Plane.FormationCreator.ViewModels
|
namespace Plane.FormationCreator.ViewModels
|
||||||
{
|
{
|
||||||
public class ConnectViewModel : ViewModelBase
|
public class ConnectViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
|
||||||
public ConnectViewModel(CopterManager copterManager)
|
public ConnectViewModel(CopterManager copterManager)
|
||||||
{
|
{
|
||||||
_copterManager = copterManager;
|
_copterManager = copterManager;
|
||||||
|
RefreshPorts();
|
||||||
}
|
}
|
||||||
|
public void RefreshPorts()
|
||||||
|
{
|
||||||
|
serialRePorts.Clear();
|
||||||
|
string[] commports = SerialPort.GetPortNames();
|
||||||
|
foreach (var item in commports)
|
||||||
|
{
|
||||||
|
serialRePorts.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private CommModuleManager _commModuleManager = CommModuleManager.Instance;
|
||||||
private CopterManager _copterManager;
|
private CopterManager _copterManager;
|
||||||
|
|
||||||
private const int PORT = 5250;
|
private const int PORT = 5250;
|
||||||
@ -67,6 +82,16 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
set { Set(nameof(IsProcessing), ref _IsProcessing, value); }
|
set { Set(nameof(IsProcessing), ref _IsProcessing, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ObservableCollection<string> serialRePorts { get; } = new ObservableCollection<string>();
|
||||||
|
private string _serialPortResend;
|
||||||
|
public string SerialPortResend
|
||||||
|
{
|
||||||
|
|
||||||
|
get { return _serialPortResend; }
|
||||||
|
set { Set(nameof(SerialPortResend), ref _serialPortResend, value); }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private ICommand _ConnectCommand;
|
private ICommand _ConnectCommand;
|
||||||
public ICommand ConnectCommand
|
public ICommand ConnectCommand
|
||||||
{
|
{
|
||||||
@ -79,6 +104,63 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RtcmInfoViewModel _rtcmInfoViewModel = ServiceLocator.Current.GetInstance<RtcmInfoViewModel>();
|
||||||
|
private ICommand _Openboardport;
|
||||||
|
public ICommand Openboardport
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _Openboardport ?? (_Openboardport = new RelayCommand<string>(async connectionType =>
|
||||||
|
{
|
||||||
|
if (_commModuleManager.Recomisopen)
|
||||||
|
{
|
||||||
|
//当前是否使用了广播端口
|
||||||
|
if (_rtcmInfoViewModel.ResendToComMK)
|
||||||
|
{
|
||||||
|
if (Alert.Show("将同时关闭双通道发送RTK数据,继续吗?", "警告", MessageBoxButton.OKCancel, MessageBoxImage.Warning)
|
||||||
|
== MessageBoxResult.OK)
|
||||||
|
{
|
||||||
|
_rtcmInfoViewModel.ResendToComMK = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_commModuleManager.CloseResendRtcmserial();
|
||||||
|
btnBoardPortStr = "打开广播端口";
|
||||||
|
BoardPortStatusStr = _commModuleManager.BoardPortStatusStr;
|
||||||
|
Message.BoardOpen(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((SerialPortResend != null))
|
||||||
|
{
|
||||||
|
if (!_commModuleManager.OpenResendRtcmserial(SerialPortResend))
|
||||||
|
{
|
||||||
|
Alert.Show($"打开串口失败", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
btnBoardPortStr = "关闭广播端口";
|
||||||
|
Message.BoardOpen(true);
|
||||||
|
}
|
||||||
|
BoardPortStatusStr = _commModuleManager.BoardPortStatusStr;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alert.Show($"请选择需要广播的端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private ICommand _SendCommand;
|
private ICommand _SendCommand;
|
||||||
public ICommand SendCommand
|
public ICommand SendCommand
|
||||||
@ -149,6 +231,20 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
set { Set(nameof(CopterColor), ref _CopterColor, value); }
|
set { Set(nameof(CopterColor), ref _CopterColor, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string _BoardPortStatusStr = "端口未打开";
|
||||||
|
public string BoardPortStatusStr
|
||||||
|
{
|
||||||
|
get { return _BoardPortStatusStr; }
|
||||||
|
set { Set(nameof(BoardPortStatusStr), ref _BoardPortStatusStr, value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _btnBoardPortStr = "打开广播端口";
|
||||||
|
public string btnBoardPortStr
|
||||||
|
{
|
||||||
|
get { return _btnBoardPortStr; }
|
||||||
|
set { Set(nameof(btnBoardPortStr), ref _btnBoardPortStr, value); }
|
||||||
|
}
|
||||||
|
|
||||||
private ICommand _WriteIdCommand;
|
private ICommand _WriteIdCommand;
|
||||||
public ICommand WriteIdCommand
|
public ICommand WriteIdCommand
|
||||||
{
|
{
|
||||||
|
@ -35,10 +35,15 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
//连接信息
|
//连接信息
|
||||||
Plane.Windows.Messages.Message.Configure(connectAction: connected => this.CommunicationModuleConnected = connected);
|
Plane.Windows.Messages.Message.Configure(connectAction: connected => this.CommunicationModuleConnected = connected);
|
||||||
|
|
||||||
|
//广播是否打开
|
||||||
|
Plane.Windows.Messages.Message.Configureboard(boardportAction: opened => this.BoardcastPortOpened = opened);
|
||||||
|
|
||||||
|
|
||||||
this.SwitchVelocityModeButtonContent = GetSwitchVelocityModeButtonContent();
|
this.SwitchVelocityModeButtonContent = GetSwitchVelocityModeButtonContent();
|
||||||
|
|
||||||
AppEx.Current.PropertyChanged += AppEx_PropertyChanged;
|
AppEx.Current.PropertyChanged += AppEx_PropertyChanged;
|
||||||
_copterManager.netStatusChanged += CopterManagernetStatusChanged;
|
_copterManager.netStatusChanged += CopterManagernetStatusChanged;
|
||||||
|
ControlPanelViewModelData = ServiceLocator.Current.GetInstance<ControlPanelViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CopterListViewModel _copterListViewModel;
|
private CopterListViewModel _copterListViewModel;
|
||||||
@ -88,10 +93,18 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
Logs += (Environment.NewLine + value);
|
Logs += (Environment.NewLine + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private ControlPanelViewModel _controlPanelViewModelData;
|
||||||
|
|
||||||
|
public ControlPanelViewModel ControlPanelViewModelData
|
||||||
|
{
|
||||||
|
get { return _controlPanelViewModelData; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Set(nameof(ControlPanelViewModelData), ref _controlPanelViewModelData, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// public ControlPanelViewModel ControlPanelViewModelData = ServiceLocator.Current.GetInstance<ControlPanelViewModel>();
|
||||||
|
|
||||||
|
|
||||||
private bool _CommunicationModuleConnected;
|
private bool _CommunicationModuleConnected;
|
||||||
public bool CommunicationModuleConnected
|
public bool CommunicationModuleConnected
|
||||||
@ -103,6 +116,18 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool _BoardcastPortOpened=false;
|
||||||
|
public bool BoardcastPortOpened
|
||||||
|
{
|
||||||
|
get { return _BoardcastPortOpened; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Set(nameof(BoardcastPortOpened), ref _BoardcastPortOpened, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private string _SysStatusText="系统信息";
|
private string _SysStatusText="系统信息";
|
||||||
public string SysStatusText
|
public string SysStatusText
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using GalaSoft.MvvmLight;
|
using GalaSoft.MvvmLight;
|
||||||
using GalaSoft.MvvmLight.Command;
|
using GalaSoft.MvvmLight.Command;
|
||||||
|
using Plane.CommunicationManagement;
|
||||||
using Plane.FormationCreator.Formation;
|
using Plane.FormationCreator.Formation;
|
||||||
using Plane.Windows.Messages;
|
using Plane.Windows.Messages;
|
||||||
using System;
|
using System;
|
||||||
@ -18,9 +19,19 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
private RtcmManager _rtcmManager;
|
private RtcmManager _rtcmManager;
|
||||||
|
|
||||||
public RtcmManager RtcmManager { get { return _rtcmManager; } }
|
public RtcmManager RtcmManager { get { return _rtcmManager; } }
|
||||||
|
//方式
|
||||||
public ObservableCollection<string> serialPorts { get; } = new ObservableCollection<string>();
|
public ObservableCollection<string> serialPorts { get; } = new ObservableCollection<string>();
|
||||||
public ObservableCollection<string> serialRePorts { get; } = new ObservableCollection<string>();
|
|
||||||
|
private CommModuleManager _commModuleManager = CommModuleManager.Instance;
|
||||||
|
|
||||||
|
public string BoardPortsStatus
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _commModuleManager.BoardPortStatusStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private string _serialPortsSelectdValue;
|
private string _serialPortsSelectdValue;
|
||||||
@ -32,14 +43,7 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string _serialPortResend;
|
|
||||||
public string SerialPortResend
|
|
||||||
{
|
|
||||||
|
|
||||||
get { return _serialPortResend; }
|
|
||||||
set { Set(nameof(SerialPortResend), ref _serialPortResend, value); }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool _smalldatamk;
|
private bool _smalldatamk;
|
||||||
public bool SmalldataMK
|
public bool SmalldataMK
|
||||||
@ -61,14 +65,15 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{ //发送
|
{ //发送
|
||||||
if (_rtcmManager.Rtcmthreadrun)
|
if (!_commModuleManager.Recomisopen)
|
||||||
{
|
{
|
||||||
Alert.Show($"请先关闭RTK", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
Alert.Show($"请在设置里面打开广播端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Set(nameof(ResendToComMK), ref _resendtocommk, value);
|
Set(nameof(ResendToComMK), ref _resendtocommk, value);
|
||||||
|
_rtcmManager.ResendToCom = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +89,6 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
foreach (var item in commports)
|
foreach (var item in commports)
|
||||||
{
|
{
|
||||||
serialPorts.Add(item);
|
serialPorts.Add(item);
|
||||||
serialRePorts.Add(item);
|
|
||||||
}
|
}
|
||||||
SerialPortsSelectdValue = serialPorts[0];
|
SerialPortsSelectdValue = serialPorts[0];
|
||||||
}
|
}
|
||||||
@ -94,7 +98,6 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
public void RefreshPorts()
|
public void RefreshPorts()
|
||||||
{
|
{
|
||||||
string lastSelectValue = SerialPortsSelectdValue;
|
string lastSelectValue = SerialPortsSelectdValue;
|
||||||
string lastSelectValue_re = SerialPortResend;
|
|
||||||
serialPorts.Clear();
|
serialPorts.Clear();
|
||||||
serialPorts.Add("魔方基站");
|
serialPorts.Add("魔方基站");
|
||||||
serialPorts.Add("千寻");
|
serialPorts.Add("千寻");
|
||||||
@ -105,17 +108,6 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
}
|
}
|
||||||
if (serialPorts.Contains(lastSelectValue))
|
if (serialPorts.Contains(lastSelectValue))
|
||||||
SerialPortsSelectdValue = lastSelectValue;
|
SerialPortsSelectdValue = lastSelectValue;
|
||||||
|
|
||||||
serialRePorts.Clear();
|
|
||||||
|
|
||||||
foreach (var item in commports)
|
|
||||||
{
|
|
||||||
serialRePorts.Add(item);
|
|
||||||
}
|
|
||||||
if (serialRePorts.Contains(lastSelectValue_re))
|
|
||||||
SerialPortResend = lastSelectValue_re;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ICommand _ConnectRtcmCommand;
|
private ICommand _ConnectRtcmCommand;
|
||||||
@ -127,18 +119,9 @@ namespace Plane.FormationCreator.ViewModels
|
|||||||
{
|
{
|
||||||
//是否转发到特定端口
|
//是否转发到特定端口
|
||||||
string resendserial = "";
|
string resendserial = "";
|
||||||
if (ResendToComMK)
|
_rtcmManager.ResendToCom = ResendToComMK;
|
||||||
{
|
|
||||||
if ((SerialPortResend!=null)&&(SerialPortResend != ""))
|
|
||||||
resendserial = SerialPortResend;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Alert.Show($"请选择需要转发的端口", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!_rtcmManager.Rtcmthreadrun)
|
if (!_rtcmManager.Rtcmthreadrun)
|
||||||
await _rtcmManager.Open(SerialPortsSelectdValue,resendserial);
|
await _rtcmManager.Open(SerialPortsSelectdValue);
|
||||||
else
|
else
|
||||||
await _rtcmManager.Close(SerialPortsSelectdValue);
|
await _rtcmManager.Close(SerialPortsSelectdValue);
|
||||||
}));
|
}));
|
||||||
|
@ -24,9 +24,8 @@
|
|||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
<RowDefinition Height="40" />
|
<RowDefinition Height="40" />
|
||||||
|
<RowDefinition Height="40" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
<RowDefinition Height="50" />
|
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
<RowDefinition Height="30"/>
|
<RowDefinition Height="30"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
@ -64,9 +63,20 @@
|
|||||||
|
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.Row="2" Name="panel7" >
|
||||||
|
|
||||||
|
<Button Content="{Binding btnBoardPortStr}" Width="115" Margin="5,5,5,5" Command="{Binding Openboardport}"/>
|
||||||
|
<ComboBox Width="90" Height="25" Foreground="White" SelectedIndex="0"
|
||||||
|
ItemsSource="{Binding serialRePorts, Mode=OneWay}"
|
||||||
|
SelectedValue="{Binding SerialPortResend}"
|
||||||
|
DropDownOpened="ComboBox_DropDownOpened"/>
|
||||||
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="{Binding BoardPortStatusStr}" />
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Grid.Row="2"
|
Grid.Row="3"
|
||||||
Name="panel2" >
|
Name="panel2" >
|
||||||
<TextBlock Margin="5" VerticalAlignment="Center" Text="总数:" />
|
<TextBlock Margin="5" VerticalAlignment="Center" Text="总数:" />
|
||||||
<TextBox Width="45" VerticalContentAlignment="Center" Text="{Binding CopterSum}" Margin="5,5,5,5" />
|
<TextBox Width="45" VerticalContentAlignment="Center" Text="{Binding CopterSum}" Margin="5,5,5,5" />
|
||||||
@ -77,7 +87,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal"
|
<StackPanel Orientation="Horizontal"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
Name="panel3" >
|
Name="panel3" >
|
||||||
<Button Content="空中升级" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
|
<Button Content="空中升级" Width="90" Margin="5,5,5,5" Command="{Binding UpdateAllCopterCommand}"></Button>
|
||||||
<Button Content="搜索飞机" Width="90" Margin="5,5,5,5" Command="{Binding QueryAllCopterCommand}"/>
|
<Button Content="搜索飞机" Width="90" Margin="5,5,5,5" Command="{Binding QueryAllCopterCommand}"/>
|
||||||
@ -87,9 +97,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Image Margin="0,0,0,0" x:Name="image1" Grid.RowSpan="2" Grid.Row="4" Source="/Resources/Logo_small.png" HorizontalAlignment="Left" />
|
<Image Margin="0,0,0,0" x:Name="image1" Grid.RowSpan="2" Grid.Row="5" Source="/Resources/Logo_small.png" HorizontalAlignment="Left" />
|
||||||
<TextBlock Margin="5" Grid.Row="5" x:Name="about_ver" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="版本:V2.0.1213" />
|
<TextBlock Margin="5" Grid.Row="6" x:Name="about_ver" HorizontalAlignment="Right" VerticalAlignment="Bottom" Text="版本:V2.0.1213" />
|
||||||
<TextBlock Margin="5" Grid.Row="6" HorizontalAlignment="Right" x:Name="about_buildtm" VerticalAlignment="Bottom" Text="编译日期:2020.12.12" />
|
<TextBlock Margin="5" Grid.Row="7" HorizontalAlignment="Right" x:Name="about_buildtm" VerticalAlignment="Bottom" Text="编译日期:2020.12.12" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,5 +55,11 @@ namespace Plane.FormationCreator.Views
|
|||||||
|
|
||||||
//txtIPs.Focus();
|
//txtIPs.Focus();
|
||||||
}
|
}
|
||||||
|
ConnectViewModel _ConnectViewModel = ServiceLocator.Current.GetInstance<ConnectViewModel>();
|
||||||
|
private void ComboBox_DropDownOpened(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_ConnectViewModel.RefreshPorts();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,6 @@
|
|||||||
<Button Content="通讯统计"
|
<Button Content="通讯统计"
|
||||||
Command="{Binding GetCommsumCommand}" />
|
Command="{Binding GetCommsumCommand}" />
|
||||||
|
|
||||||
<TextBlock
|
|
||||||
Margin="5,5,5,5" Foreground ="Red" VerticalAlignment="Center"
|
|
||||||
Text="{Binding RTKState}"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<WrapPanel>
|
<WrapPanel>
|
||||||
<Button Content="参数设置"
|
<Button Content="参数设置"
|
||||||
|
@ -27,14 +27,11 @@
|
|||||||
<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="同时发送到(57600):"
|
<CheckBox x:Name="checkBox" Content="双通道发送"
|
||||||
Margin="4,5,5,0" Width="130"
|
Margin="4,5,5,0" Width="130"
|
||||||
IsChecked="{Binding ResendToComMK}"/>
|
IsChecked="{Binding ResendToComMK}"/>
|
||||||
<ComboBox Width="90" Height="25" Foreground="White" SelectedIndex="0"
|
<TextBlock Margin="0,4,0,0" Text="{Binding BoardPortsStatus}"/>
|
||||||
ItemsSource="{Binding serialRePorts, Mode=OneWay}"
|
<CheckBox x:Name="cBsmalldata" Content="低带宽模式"
|
||||||
SelectedValue="{Binding SerialPortResend}"
|
|
||||||
DropDownOpened="ComboBox_DropDownOpened"/>
|
|
||||||
<CheckBox x:Name="cBsmalldata" Content="减少广播数据"
|
|
||||||
Margin="20,5,5,0" Width="95"
|
Margin="20,5,5,0" Width="95"
|
||||||
IsChecked="{Binding SmalldataMK}"/>
|
IsChecked="{Binding SmalldataMK}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
Loading…
Reference in New Issue
Block a user