diff --git a/Correlator/Dialog/CheckResponseDialog.xaml b/Correlator/Dialog/CheckResponseDialog.xaml index 676a083..7c0dc75 100644 --- a/Correlator/Dialog/CheckResponseDialog.xaml +++ b/Correlator/Dialog/CheckResponseDialog.xaml @@ -38,20 +38,14 @@ Grid.Row="0" Margin="10" Orientation="Horizontal"> - @@ -61,16 +55,11 @@ - + diff --git a/Correlator/Dialog/CheckResponseDialog.xaml b/Correlator/Dialog/CheckResponseDialog.xaml index 676a083..7c0dc75 100644 --- a/Correlator/Dialog/CheckResponseDialog.xaml +++ b/Correlator/Dialog/CheckResponseDialog.xaml @@ -38,20 +38,14 @@ Grid.Row="0" Margin="10" Orientation="Horizontal"> - @@ -61,16 +55,11 @@ - + diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs index eb3d4f3..e7448d4 100644 --- a/Correlator/Util/CommandSender.cs +++ b/Correlator/Util/CommandSender.cs @@ -203,7 +203,7 @@ const string seq = "1"; var btSeq = byte.Parse(seq, NumberStyles.HexNumber); - byte[] oidTag = { 0x40, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00 }; + byte[] oidTag = { 0x40, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 }; byte[] timeTag = { diff --git a/Correlator/Dialog/CheckResponseDialog.xaml b/Correlator/Dialog/CheckResponseDialog.xaml index 676a083..7c0dc75 100644 --- a/Correlator/Dialog/CheckResponseDialog.xaml +++ b/Correlator/Dialog/CheckResponseDialog.xaml @@ -38,20 +38,14 @@ Grid.Row="0" Margin="10" Orientation="Horizontal"> - @@ -61,16 +55,11 @@ - + diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs index eb3d4f3..e7448d4 100644 --- a/Correlator/Util/CommandSender.cs +++ b/Correlator/Util/CommandSender.cs @@ -203,7 +203,7 @@ const string seq = "1"; var btSeq = byte.Parse(seq, NumberStyles.HexNumber); - byte[] oidTag = { 0x40, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00 }; + byte[] oidTag = { 0x40, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 }; byte[] timeTag = { diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index ddcab54..0e43937 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -91,7 +91,14 @@ } break; - case 1: + case 22543: + if (receiveData[0] == 0xA3 && receiveData[1] == 0x20) + { + //取出seq,确定收到的是第几包数据 + FlowStatus.SeqCaches.Add(receiveData[15]); + + HandleHydrophoneData(strDeviceId, tags); + } break; case 15024: //听音 @@ -243,7 +250,7 @@ } } - private static void HandleListenData(List tags) + private void HandleListenData(List tags) { //处理接到的噪声数据 var noiseTag = tags.GetUploadNoiseTag(); @@ -304,6 +311,15 @@ } /// + /// 水听器数据 + /// + /// + /// + private void HandleHydrophoneData(string devCode, List tags) + { + } + + /// /// 获取设备信号 /// /// diff --git a/Correlator/Dialog/CheckResponseDialog.xaml b/Correlator/Dialog/CheckResponseDialog.xaml index 676a083..7c0dc75 100644 --- a/Correlator/Dialog/CheckResponseDialog.xaml +++ b/Correlator/Dialog/CheckResponseDialog.xaml @@ -38,20 +38,14 @@ Grid.Row="0" Margin="10" Orientation="Horizontal"> - @@ -61,16 +55,11 @@ - + diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs index eb3d4f3..e7448d4 100644 --- a/Correlator/Util/CommandSender.cs +++ b/Correlator/Util/CommandSender.cs @@ -203,7 +203,7 @@ const string seq = "1"; var btSeq = byte.Parse(seq, NumberStyles.HexNumber); - byte[] oidTag = { 0x40, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00 }; + byte[] oidTag = { 0x40, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00 }; byte[] timeTag = { diff --git a/Correlator/Util/SerialPortManager.cs b/Correlator/Util/SerialPortManager.cs index ddcab54..0e43937 100644 --- a/Correlator/Util/SerialPortManager.cs +++ b/Correlator/Util/SerialPortManager.cs @@ -91,7 +91,14 @@ } break; - case 1: + case 22543: + if (receiveData[0] == 0xA3 && receiveData[1] == 0x20) + { + //取出seq,确定收到的是第几包数据 + FlowStatus.SeqCaches.Add(receiveData[15]); + + HandleHydrophoneData(strDeviceId, tags); + } break; case 15024: //听音 @@ -243,7 +250,7 @@ } } - private static void HandleListenData(List tags) + private void HandleListenData(List tags) { //处理接到的噪声数据 var noiseTag = tags.GetUploadNoiseTag(); @@ -304,6 +311,15 @@ } /// + /// 水听器数据 + /// + /// + /// + private void HandleHydrophoneData(string devCode, List tags) + { + } + + /// /// 获取设备信号 /// /// diff --git a/Correlator/ViewModel/HomePageProViewModel.cs b/Correlator/ViewModel/HomePageProViewModel.cs index cc14ec9..2e4adba 100644 --- a/Correlator/ViewModel/HomePageProViewModel.cs +++ b/Correlator/ViewModel/HomePageProViewModel.cs @@ -58,12 +58,6 @@ Interval = TimeSpan.FromSeconds(10) }; - //水听器下发指令Timer - private readonly DispatcherTimer _hydrophoneCommandTimer = new DispatcherTimer - { - Interval = TimeSpan.FromSeconds(10) - }; - private HomePageProWindow _homePageWindow; private string _locateDataDir; private int _locateTimes; @@ -499,11 +493,7 @@ Messenger.Default.Register(this, MessengerToken.HomePageDeviceData, it => { //开始计算停止收集指令 - if (FlowStatus.IsHydrophone) - { - _hydrophoneCommandTimer.Stop(); - } - else + if (!FlowStatus.IsHydrophone) { _accelerometerCommandTimer.Stop(); } @@ -565,7 +555,7 @@ //水听器 Messenger.Default.Register(this, MessengerToken.ShowCheckResponseDialog, - timeBytes => { new CheckResponseDialog(timeBytes) { Owner = _homePageWindow }.ShowDialog(); }); + timeBytes => { new CheckResponseDialog(timeBytes) { Owner = _homePageWindow }.Show(); }); } /// @@ -604,7 +594,7 @@ { _runningSeconds++; ElapseTime = _runningSeconds.ToString(); - if (_runningSeconds >= 90) + if (_runningSeconds >= 120) { _runningTimer.Stop(); MessageBox.Show("接收不到数据,请点击复位并重新开始采集数据", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Error); @@ -620,15 +610,6 @@ } }; - //水听器下发指令Timer - _hydrophoneCommandTimer.Tick += delegate - { - if (FlowStatus.CanCollectData) - { - CommandSender.SendHydrophoneWakeUpCmd(SerialPortManager.Get.Sp); - } - }; - //自动截屏Timer _snapShotTimer.Tick += delegate { @@ -786,7 +767,7 @@ //开始数据采集 if (FlowStatus.IsHydrophone) { - _hydrophoneCommandTimer.Start(); + CommandSender.SendHydrophoneWakeUpCmd(SerialPortManager.Get.Sp); } else { @@ -832,11 +813,7 @@ Messenger.Default.Send("", MessengerToken.ClearOscillogram); - if (FlowStatus.IsHydrophone) - { - _hydrophoneCommandTimer.Stop(); - } - else + if (!FlowStatus.IsHydrophone) { _accelerometerCommandTimer.Stop(); }