diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Util/RuntimeCache.cs b/Correlator/Util/RuntimeCache.cs
new file mode 100644
index 0000000..e91619c
--- /dev/null
+++ b/Correlator/Util/RuntimeCache.cs
@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using Correlator.Model;
+using Correlator.SensorHubTag;
+
+namespace Correlator.Util
+{
+ ///
+ /// 业务流程个节点状态
+ ///
+ public class RuntimeCache
+ {
+ ///
+ /// 是否可以收集数据
+ ///
+ public static bool CanCollectData = false;
+
+ ///
+ /// 红色传感器是否正常
+ ///
+ public static bool RedSensorIsEnable = false;
+
+ ///
+ /// 蓝色传感器是否正常
+ ///
+ public static bool BlueSensorIsEnable = false;
+
+ ///
+ /// 采集到的数据
+ ///
+ public static CorrelatorDataModel CorrelatorData;
+
+ ///
+ /// 水听器模式
+ ///
+ public static bool IsHydrophone = false;
+
+ ///
+ /// 点名对话框是否已显示
+ ///
+ public static bool IsShowing = false;
+
+ ///
+ /// 数据包index
+ ///
+ public static readonly List SeqCaches = new List();
+
+ ///
+ /// 水听器下发唤醒指令时间戳
+ ///
+ public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器红色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器蓝色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
+
+ //听音数据
+ public static readonly List RedSoundCaches = new List();
+ public static readonly List BlueSoundCaches = new List();
+
+ ///
+ /// 正在听音的设备编号
+ ///
+ public static string CurrentListenSoundDevCode = DevCode.Dev1;
+
+ ///
+ /// 小于1K的音频文件全路径集合
+ ///
+ public static readonly List SmallAudioFiles = new List();
+
+ ///
+ /// 列表每页条目数
+ ///
+ public const int PerPageItemCount = 10;
+ }
+}
\ No newline at end of file
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Util/RuntimeCache.cs b/Correlator/Util/RuntimeCache.cs
new file mode 100644
index 0000000..e91619c
--- /dev/null
+++ b/Correlator/Util/RuntimeCache.cs
@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using Correlator.Model;
+using Correlator.SensorHubTag;
+
+namespace Correlator.Util
+{
+ ///
+ /// 业务流程个节点状态
+ ///
+ public class RuntimeCache
+ {
+ ///
+ /// 是否可以收集数据
+ ///
+ public static bool CanCollectData = false;
+
+ ///
+ /// 红色传感器是否正常
+ ///
+ public static bool RedSensorIsEnable = false;
+
+ ///
+ /// 蓝色传感器是否正常
+ ///
+ public static bool BlueSensorIsEnable = false;
+
+ ///
+ /// 采集到的数据
+ ///
+ public static CorrelatorDataModel CorrelatorData;
+
+ ///
+ /// 水听器模式
+ ///
+ public static bool IsHydrophone = false;
+
+ ///
+ /// 点名对话框是否已显示
+ ///
+ public static bool IsShowing = false;
+
+ ///
+ /// 数据包index
+ ///
+ public static readonly List SeqCaches = new List();
+
+ ///
+ /// 水听器下发唤醒指令时间戳
+ ///
+ public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器红色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器蓝色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
+
+ //听音数据
+ public static readonly List RedSoundCaches = new List();
+ public static readonly List BlueSoundCaches = new List();
+
+ ///
+ /// 正在听音的设备编号
+ ///
+ public static string CurrentListenSoundDevCode = DevCode.Dev1;
+
+ ///
+ /// 小于1K的音频文件全路径集合
+ ///
+ public static readonly List SmallAudioFiles = new List();
+
+ ///
+ /// 列表每页条目数
+ ///
+ public const int PerPageItemCount = 10;
+ }
+}
\ No newline at end of file
diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs
index f522a7a..1846bcc 100644
--- a/Correlator/ViewModels/AudioFileViewModel.cs
+++ b/Correlator/ViewModels/AudioFileViewModel.cs
@@ -142,7 +142,7 @@
//刷新数据
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
catch (IOException)
{
@@ -154,7 +154,10 @@
PageUpdatedCmd = new DelegateCommand>(args =>
{
- AudioFiles = _totalFiles.Skip((args.Info - 1) * 8).Take(8).ToList();
+ AudioFiles = _totalFiles
+ .Skip((args.Info - 1) * RuntimeCache.PerPageItemCount)
+ .Take(RuntimeCache.PerPageItemCount)
+ .ToList();
});
}
@@ -171,7 +174,7 @@
{
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
private static List GetTotalAudioFiles()
@@ -184,7 +187,7 @@
{
if (file.Length < 1024)
{
- FlowStatus.SmallAudioFiles.Add(file.FullName);
+ RuntimeCache.SmallAudioFiles.Add(file.FullName);
}
else
{
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Util/RuntimeCache.cs b/Correlator/Util/RuntimeCache.cs
new file mode 100644
index 0000000..e91619c
--- /dev/null
+++ b/Correlator/Util/RuntimeCache.cs
@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using Correlator.Model;
+using Correlator.SensorHubTag;
+
+namespace Correlator.Util
+{
+ ///
+ /// 业务流程个节点状态
+ ///
+ public class RuntimeCache
+ {
+ ///
+ /// 是否可以收集数据
+ ///
+ public static bool CanCollectData = false;
+
+ ///
+ /// 红色传感器是否正常
+ ///
+ public static bool RedSensorIsEnable = false;
+
+ ///
+ /// 蓝色传感器是否正常
+ ///
+ public static bool BlueSensorIsEnable = false;
+
+ ///
+ /// 采集到的数据
+ ///
+ public static CorrelatorDataModel CorrelatorData;
+
+ ///
+ /// 水听器模式
+ ///
+ public static bool IsHydrophone = false;
+
+ ///
+ /// 点名对话框是否已显示
+ ///
+ public static bool IsShowing = false;
+
+ ///
+ /// 数据包index
+ ///
+ public static readonly List SeqCaches = new List();
+
+ ///
+ /// 水听器下发唤醒指令时间戳
+ ///
+ public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器红色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器蓝色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
+
+ //听音数据
+ public static readonly List RedSoundCaches = new List();
+ public static readonly List BlueSoundCaches = new List();
+
+ ///
+ /// 正在听音的设备编号
+ ///
+ public static string CurrentListenSoundDevCode = DevCode.Dev1;
+
+ ///
+ /// 小于1K的音频文件全路径集合
+ ///
+ public static readonly List SmallAudioFiles = new List();
+
+ ///
+ /// 列表每页条目数
+ ///
+ public const int PerPageItemCount = 10;
+ }
+}
\ No newline at end of file
diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs
index f522a7a..1846bcc 100644
--- a/Correlator/ViewModels/AudioFileViewModel.cs
+++ b/Correlator/ViewModels/AudioFileViewModel.cs
@@ -142,7 +142,7 @@
//刷新数据
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
catch (IOException)
{
@@ -154,7 +154,10 @@
PageUpdatedCmd = new DelegateCommand>(args =>
{
- AudioFiles = _totalFiles.Skip((args.Info - 1) * 8).Take(8).ToList();
+ AudioFiles = _totalFiles
+ .Skip((args.Info - 1) * RuntimeCache.PerPageItemCount)
+ .Take(RuntimeCache.PerPageItemCount)
+ .ToList();
});
}
@@ -171,7 +174,7 @@
{
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
private static List GetTotalAudioFiles()
@@ -184,7 +187,7 @@
{
if (file.Length < 1024)
{
- FlowStatus.SmallAudioFiles.Add(file.FullName);
+ RuntimeCache.SmallAudioFiles.Add(file.FullName);
}
else
{
diff --git a/Correlator/ViewModels/AuditionViewModel.cs b/Correlator/ViewModels/AuditionViewModel.cs
index b334ec9..7945aa7 100644
--- a/Correlator/ViewModels/AuditionViewModel.cs
+++ b/Correlator/ViewModels/AuditionViewModel.cs
@@ -94,7 +94,7 @@
sts[outIndex++] = BitConverter.ToInt16(buffer, i) / 32768f;
}
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
eventAggregator.GetEvent().Publish(sts);
}
@@ -117,7 +117,7 @@
CommandSender.SendSoundStopCmd(_serialPortService.Sp, _isRedSensor ? DevCode.Dev1 : DevCode.Dev2);
_audioService.Stop();
_isStartRecording = false;
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
//TODO 保存原始PCM数据到文件
// using (var fs = new FileStream("C:\\Users\\Administrator\\Desktop\\input.pcm",
@@ -129,13 +129,13 @@
// }
// }
- FlowStatus.RedSoundCaches.SaveSoundData();
- FlowStatus.RedSoundCaches.Clear();
+ RuntimeCache.RedSoundCaches.SaveSoundData();
+ RuntimeCache.RedSoundCaches.Clear();
}
else
{
- FlowStatus.BlueSoundCaches.SaveSoundData();
- FlowStatus.BlueSoundCaches.Clear();
+ RuntimeCache.BlueSoundCaches.SaveSoundData();
+ RuntimeCache.BlueSoundCaches.Clear();
}
//波形图停止模拟
@@ -146,7 +146,7 @@
var devCode = _isRedSensor ? DevCode.Dev1 : DevCode.Dev2;
CommandSender.SendSoundCollectCmd(_serialPortService.Sp, devCode);
- FlowStatus.CurrentListenSoundDevCode = devCode;
+ RuntimeCache.CurrentListenSoundDevCode = devCode;
_audioService.Start(devCode);
_isStartRecording = true;
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Util/RuntimeCache.cs b/Correlator/Util/RuntimeCache.cs
new file mode 100644
index 0000000..e91619c
--- /dev/null
+++ b/Correlator/Util/RuntimeCache.cs
@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using Correlator.Model;
+using Correlator.SensorHubTag;
+
+namespace Correlator.Util
+{
+ ///
+ /// 业务流程个节点状态
+ ///
+ public class RuntimeCache
+ {
+ ///
+ /// 是否可以收集数据
+ ///
+ public static bool CanCollectData = false;
+
+ ///
+ /// 红色传感器是否正常
+ ///
+ public static bool RedSensorIsEnable = false;
+
+ ///
+ /// 蓝色传感器是否正常
+ ///
+ public static bool BlueSensorIsEnable = false;
+
+ ///
+ /// 采集到的数据
+ ///
+ public static CorrelatorDataModel CorrelatorData;
+
+ ///
+ /// 水听器模式
+ ///
+ public static bool IsHydrophone = false;
+
+ ///
+ /// 点名对话框是否已显示
+ ///
+ public static bool IsShowing = false;
+
+ ///
+ /// 数据包index
+ ///
+ public static readonly List SeqCaches = new List();
+
+ ///
+ /// 水听器下发唤醒指令时间戳
+ ///
+ public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器红色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器蓝色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
+
+ //听音数据
+ public static readonly List RedSoundCaches = new List();
+ public static readonly List BlueSoundCaches = new List();
+
+ ///
+ /// 正在听音的设备编号
+ ///
+ public static string CurrentListenSoundDevCode = DevCode.Dev1;
+
+ ///
+ /// 小于1K的音频文件全路径集合
+ ///
+ public static readonly List SmallAudioFiles = new List();
+
+ ///
+ /// 列表每页条目数
+ ///
+ public const int PerPageItemCount = 10;
+ }
+}
\ No newline at end of file
diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs
index f522a7a..1846bcc 100644
--- a/Correlator/ViewModels/AudioFileViewModel.cs
+++ b/Correlator/ViewModels/AudioFileViewModel.cs
@@ -142,7 +142,7 @@
//刷新数据
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
catch (IOException)
{
@@ -154,7 +154,10 @@
PageUpdatedCmd = new DelegateCommand>(args =>
{
- AudioFiles = _totalFiles.Skip((args.Info - 1) * 8).Take(8).ToList();
+ AudioFiles = _totalFiles
+ .Skip((args.Info - 1) * RuntimeCache.PerPageItemCount)
+ .Take(RuntimeCache.PerPageItemCount)
+ .ToList();
});
}
@@ -171,7 +174,7 @@
{
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
private static List GetTotalAudioFiles()
@@ -184,7 +187,7 @@
{
if (file.Length < 1024)
{
- FlowStatus.SmallAudioFiles.Add(file.FullName);
+ RuntimeCache.SmallAudioFiles.Add(file.FullName);
}
else
{
diff --git a/Correlator/ViewModels/AuditionViewModel.cs b/Correlator/ViewModels/AuditionViewModel.cs
index b334ec9..7945aa7 100644
--- a/Correlator/ViewModels/AuditionViewModel.cs
+++ b/Correlator/ViewModels/AuditionViewModel.cs
@@ -94,7 +94,7 @@
sts[outIndex++] = BitConverter.ToInt16(buffer, i) / 32768f;
}
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
eventAggregator.GetEvent().Publish(sts);
}
@@ -117,7 +117,7 @@
CommandSender.SendSoundStopCmd(_serialPortService.Sp, _isRedSensor ? DevCode.Dev1 : DevCode.Dev2);
_audioService.Stop();
_isStartRecording = false;
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
//TODO 保存原始PCM数据到文件
// using (var fs = new FileStream("C:\\Users\\Administrator\\Desktop\\input.pcm",
@@ -129,13 +129,13 @@
// }
// }
- FlowStatus.RedSoundCaches.SaveSoundData();
- FlowStatus.RedSoundCaches.Clear();
+ RuntimeCache.RedSoundCaches.SaveSoundData();
+ RuntimeCache.RedSoundCaches.Clear();
}
else
{
- FlowStatus.BlueSoundCaches.SaveSoundData();
- FlowStatus.BlueSoundCaches.Clear();
+ RuntimeCache.BlueSoundCaches.SaveSoundData();
+ RuntimeCache.BlueSoundCaches.Clear();
}
//波形图停止模拟
@@ -146,7 +146,7 @@
var devCode = _isRedSensor ? DevCode.Dev1 : DevCode.Dev2;
CommandSender.SendSoundCollectCmd(_serialPortService.Sp, devCode);
- FlowStatus.CurrentListenSoundDevCode = devCode;
+ RuntimeCache.CurrentListenSoundDevCode = devCode;
_audioService.Start(devCode);
_isStartRecording = true;
diff --git a/Correlator/ViewModels/CheckResponseDialogViewModel.cs b/Correlator/ViewModels/CheckResponseDialogViewModel.cs
index e3b140f..a6dd527 100644
--- a/Correlator/ViewModels/CheckResponseDialogViewModel.cs
+++ b/Correlator/ViewModels/CheckResponseDialogViewModel.cs
@@ -16,7 +16,7 @@
{
eventAggregator.GetEvent().Subscribe(delegate(IDialogResult result)
{
- FlowStatus.IsShowing = false;
+ RuntimeCache.IsShowing = false;
RequestClose?.Invoke(result);
});
}
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器蓝色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
-
- //听音数据
- public static readonly List RedSoundCaches = new List();
- public static readonly List BlueSoundCaches = new List();
-
- ///
- /// 正在听音的设备编号
- ///
- public static string CurrentListenSoundDevCode = DevCode.Dev1;
-
- ///
- /// 小于1K的音频文件全路径集合
- ///
- public static readonly List SmallAudioFiles = new List();
- }
-}
\ No newline at end of file
diff --git a/Correlator/Util/MethodExtensions.cs b/Correlator/Util/MethodExtensions.cs
index 7d742ce..a8b0136 100644
--- a/Correlator/Util/MethodExtensions.cs
+++ b/Correlator/Util/MethodExtensions.cs
@@ -741,7 +741,7 @@
///
public static int GetPageSize(this int count)
{
- return (count + 8 - 1) / 8;
+ return (count + RuntimeCache.PerPageItemCount - 1) / RuntimeCache.PerPageItemCount;
}
}
}
\ No newline at end of file
diff --git a/Correlator/Util/RuntimeCache.cs b/Correlator/Util/RuntimeCache.cs
new file mode 100644
index 0000000..e91619c
--- /dev/null
+++ b/Correlator/Util/RuntimeCache.cs
@@ -0,0 +1,91 @@
+using System.Collections.Generic;
+using Correlator.Model;
+using Correlator.SensorHubTag;
+
+namespace Correlator.Util
+{
+ ///
+ /// 业务流程个节点状态
+ ///
+ public class RuntimeCache
+ {
+ ///
+ /// 是否可以收集数据
+ ///
+ public static bool CanCollectData = false;
+
+ ///
+ /// 红色传感器是否正常
+ ///
+ public static bool RedSensorIsEnable = false;
+
+ ///
+ /// 蓝色传感器是否正常
+ ///
+ public static bool BlueSensorIsEnable = false;
+
+ ///
+ /// 采集到的数据
+ ///
+ public static CorrelatorDataModel CorrelatorData;
+
+ ///
+ /// 水听器模式
+ ///
+ public static bool IsHydrophone = false;
+
+ ///
+ /// 点名对话框是否已显示
+ ///
+ public static bool IsShowing = false;
+
+ ///
+ /// 数据包index
+ ///
+ public static readonly List SeqCaches = new List();
+
+ ///
+ /// 水听器下发唤醒指令时间戳
+ ///
+ public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器红色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
+
+ ///
+ /// 水听器红色信号接收器原始数据
+ ///
+ public static readonly Dictionary BlueSensorOriginalResp = new Dictionary();
+
+ ///
+ /// 水听器蓝色信号接收器解析之后的Tags
+ ///
+ public static readonly Dictionary> BlueSensorResponseTags = new Dictionary>();
+
+ //听音数据
+ public static readonly List RedSoundCaches = new List();
+ public static readonly List BlueSoundCaches = new List();
+
+ ///
+ /// 正在听音的设备编号
+ ///
+ public static string CurrentListenSoundDevCode = DevCode.Dev1;
+
+ ///
+ /// 小于1K的音频文件全路径集合
+ ///
+ public static readonly List SmallAudioFiles = new List();
+
+ ///
+ /// 列表每页条目数
+ ///
+ public const int PerPageItemCount = 10;
+ }
+}
\ No newline at end of file
diff --git a/Correlator/ViewModels/AudioFileViewModel.cs b/Correlator/ViewModels/AudioFileViewModel.cs
index f522a7a..1846bcc 100644
--- a/Correlator/ViewModels/AudioFileViewModel.cs
+++ b/Correlator/ViewModels/AudioFileViewModel.cs
@@ -142,7 +142,7 @@
//刷新数据
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
catch (IOException)
{
@@ -154,7 +154,10 @@
PageUpdatedCmd = new DelegateCommand>(args =>
{
- AudioFiles = _totalFiles.Skip((args.Info - 1) * 8).Take(8).ToList();
+ AudioFiles = _totalFiles
+ .Skip((args.Info - 1) * RuntimeCache.PerPageItemCount)
+ .Take(RuntimeCache.PerPageItemCount)
+ .ToList();
});
}
@@ -171,7 +174,7 @@
{
_totalFiles = GetTotalAudioFiles();
MaxPage = _totalFiles.Count.GetPageSize();
- AudioFiles = _totalFiles.Take(8).ToList();
+ AudioFiles = _totalFiles.Take(RuntimeCache.PerPageItemCount).ToList();
}
private static List GetTotalAudioFiles()
@@ -184,7 +187,7 @@
{
if (file.Length < 1024)
{
- FlowStatus.SmallAudioFiles.Add(file.FullName);
+ RuntimeCache.SmallAudioFiles.Add(file.FullName);
}
else
{
diff --git a/Correlator/ViewModels/AuditionViewModel.cs b/Correlator/ViewModels/AuditionViewModel.cs
index b334ec9..7945aa7 100644
--- a/Correlator/ViewModels/AuditionViewModel.cs
+++ b/Correlator/ViewModels/AuditionViewModel.cs
@@ -94,7 +94,7 @@
sts[outIndex++] = BitConverter.ToInt16(buffer, i) / 32768f;
}
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
eventAggregator.GetEvent().Publish(sts);
}
@@ -117,7 +117,7 @@
CommandSender.SendSoundStopCmd(_serialPortService.Sp, _isRedSensor ? DevCode.Dev1 : DevCode.Dev2);
_audioService.Stop();
_isStartRecording = false;
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
//TODO 保存原始PCM数据到文件
// using (var fs = new FileStream("C:\\Users\\Administrator\\Desktop\\input.pcm",
@@ -129,13 +129,13 @@
// }
// }
- FlowStatus.RedSoundCaches.SaveSoundData();
- FlowStatus.RedSoundCaches.Clear();
+ RuntimeCache.RedSoundCaches.SaveSoundData();
+ RuntimeCache.RedSoundCaches.Clear();
}
else
{
- FlowStatus.BlueSoundCaches.SaveSoundData();
- FlowStatus.BlueSoundCaches.Clear();
+ RuntimeCache.BlueSoundCaches.SaveSoundData();
+ RuntimeCache.BlueSoundCaches.Clear();
}
//波形图停止模拟
@@ -146,7 +146,7 @@
var devCode = _isRedSensor ? DevCode.Dev1 : DevCode.Dev2;
CommandSender.SendSoundCollectCmd(_serialPortService.Sp, devCode);
- FlowStatus.CurrentListenSoundDevCode = devCode;
+ RuntimeCache.CurrentListenSoundDevCode = devCode;
_audioService.Start(devCode);
_isStartRecording = true;
diff --git a/Correlator/ViewModels/CheckResponseDialogViewModel.cs b/Correlator/ViewModels/CheckResponseDialogViewModel.cs
index e3b140f..a6dd527 100644
--- a/Correlator/ViewModels/CheckResponseDialogViewModel.cs
+++ b/Correlator/ViewModels/CheckResponseDialogViewModel.cs
@@ -16,7 +16,7 @@
{
eventAggregator.GetEvent().Subscribe(delegate(IDialogResult result)
{
- FlowStatus.IsShowing = false;
+ RuntimeCache.IsShowing = false;
RequestClose?.Invoke(result);
});
}
diff --git a/Correlator/ViewModels/ImportResponseDialogViewModel.cs b/Correlator/ViewModels/ImportResponseDialogViewModel.cs
index a914f66..5b6c1f3 100644
--- a/Correlator/ViewModels/ImportResponseDialogViewModel.cs
+++ b/Correlator/ViewModels/ImportResponseDialogViewModel.cs
@@ -343,7 +343,7 @@
private void Worker_OnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
//赋值给缓存
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
}
///
diff --git a/Correlator/Correlator.csproj b/Correlator/Correlator.csproj
index cb3946e..5d33683 100644
--- a/Correlator/Correlator.csproj
+++ b/Correlator/Correlator.csproj
@@ -265,7 +265,7 @@
-
+
diff --git a/Correlator/DataService/SerialPortServiceImpl.cs b/Correlator/DataService/SerialPortServiceImpl.cs
index 4c897c0..51294cd 100644
--- a/Correlator/DataService/SerialPortServiceImpl.cs
+++ b/Correlator/DataService/SerialPortServiceImpl.cs
@@ -81,23 +81,23 @@
break;
case 11293: //数据采集
- if (!FlowStatus.IsHydrophone)
+ if (!RuntimeCache.IsHydrophone)
{
HandleCorrelatorData(deviceId, tags);
}
break;
case 30:
- if (FlowStatus.IsHydrophone && FlowStatus.CanCollectData)
+ if (RuntimeCache.IsHydrophone && RuntimeCache.CanCollectData)
{
Application.Current.Dispatcher.Invoke(delegate
{
//显示点名弹窗
- if (!FlowStatus.IsShowing)
+ if (!RuntimeCache.IsShowing)
{
//因为是广播发的数据,所以会收到两条回复,但是只需要显示一次对话框
_eventAggregator.GetEvent().Publish();
- FlowStatus.IsShowing = true;
+ RuntimeCache.IsShowing = true;
}
});
}
@@ -108,23 +108,23 @@
{
int index = receiveData[15];
//取出seq,确定收到的是第几包数据
- FlowStatus.SeqCaches.Add(index);
+ RuntimeCache.SeqCaches.Add(index);
var response = BitConverter.ToString(receiveData).Replace("-", "");
//收集数据
if (deviceId.Equals(DevCode.Dev1))
{
//原始数据
- FlowStatus.RedSensorOriginalResp.Add(index, response);
+ RuntimeCache.RedSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.RedSensorResponseTags.Add(index, tags);
+ RuntimeCache.RedSensorResponseTags.Add(index, tags);
}
else
{
//原始数据
- FlowStatus.BlueSensorOriginalResp.Add(index, response);
+ RuntimeCache.BlueSensorOriginalResp.Add(index, response);
//解析之后的数据
- FlowStatus.BlueSensorResponseTags.Add(index, tags);
+ RuntimeCache.BlueSensorResponseTags.Add(index, tags);
}
}
@@ -243,7 +243,7 @@
//左右两边接收到的数据时间差超过10s,认为不是同一次此指令返回的,舍弃
if (diffTime >= 10) return;
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
_eventAggregator.GetEvent().Publish();
}
else
@@ -273,13 +273,13 @@
}
//保存听音数据
- if (FlowStatus.CurrentListenSoundDevCode == DevCode.Dev1)
+ if (RuntimeCache.CurrentListenSoundDevCode == DevCode.Dev1)
{
- FlowStatus.RedSoundCaches.Add(pcm);
+ RuntimeCache.RedSoundCaches.Add(pcm);
}
else
{
- FlowStatus.BlueSoundCaches.Add(pcm);
+ RuntimeCache.BlueSoundCaches.Add(pcm);
}
//将pcm数据写入缓存
@@ -325,7 +325,7 @@
_dataModel.RightDeviceDataArray = doubleArrays.ToOneDimensionalArray();
}
- FlowStatus.CorrelatorData = _dataModel;
+ RuntimeCache.CorrelatorData = _dataModel;
"SerialPortServiceImpl".WriteLog(devCode + "数据处理完成");
}
diff --git a/Correlator/Dialog/CheckResponseDialog.xaml.cs b/Correlator/Dialog/CheckResponseDialog.xaml.cs
index 8def641..43f84fd 100644
--- a/Correlator/Dialog/CheckResponseDialog.xaml.cs
+++ b/Correlator/Dialog/CheckResponseDialog.xaml.cs
@@ -74,7 +74,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -88,7 +88,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -105,7 +105,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (RedResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -118,7 +118,7 @@
{
for (var i = 1; i <= 60; i++)
{
- if (FlowStatus.SeqCaches.Contains(i))
+ if (RuntimeCache.SeqCaches.Contains(i))
{
if (BlueResponsePanel.Children[i - 1] is Ellipse child)
{
@@ -230,7 +230,7 @@
{
if (RedSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev1);
_redResponseTimer.Start();
@@ -245,7 +245,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev1}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.RedSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.RedSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -257,7 +257,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.RedSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.RedSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
@@ -314,7 +314,7 @@
{
if (BlueSensorStepBar.StepIndex == 1)
{
- FlowStatus.SeqCaches.Clear();
+ RuntimeCache.SeqCaches.Clear();
CommandSender.StartCheckResponse(_serialPortService.Sp, DevCode.Dev2);
_blueResponseTimer.Start();
@@ -328,7 +328,7 @@
var fileName = $"{locateDataDir}\\原始数据.{DevCode.Dev2}.txt";
//将Dictionary按照index排序
- var sortResult = from pair in FlowStatus.BlueSensorOriginalResp orderby pair.Key select pair;
+ var sortResult = from pair in RuntimeCache.BlueSensorOriginalResp orderby pair.Key select pair;
//Dictionary排序结果转List
var result = sortResult.Select(valuePair => valuePair.Value).ToList();
@@ -340,7 +340,7 @@
#region 处理数据
//将Dictionary按照index排序
- var tagsSortResult = from pair in FlowStatus.BlueSensorResponseTags orderby pair.Key select pair;
+ var tagsSortResult = from pair in RuntimeCache.BlueSensorResponseTags orderby pair.Key select pair;
var tags = new List();
foreach (var valuePair in tagsSortResult)
{
diff --git a/Correlator/Util/CommandSender.cs b/Correlator/Util/CommandSender.cs
index afb3b85..5efc675 100644
--- a/Correlator/Util/CommandSender.cs
+++ b/Correlator/Util/CommandSender.cs
@@ -119,7 +119,7 @@
};
//获取时间(年-月-日-时-分-秒),年号-2000
- FlowStatus.HydrophoneWakeUpTimeBytes = new[]
+ RuntimeCache.HydrophoneWakeUpTimeBytes = new[]
{
CalendarHub.Year, CalendarHub.Mon, CalendarHub.Day, CalendarHub.Hor, CalendarHub.Min, CalendarHub.Sec
};
@@ -127,9 +127,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -226,9 +226,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
@@ -318,9 +318,9 @@
{
0x10, 0x00, 0x00, 0x51,
0x00, 0x06,
- FlowStatus.HydrophoneWakeUpTimeBytes[0], FlowStatus.HydrophoneWakeUpTimeBytes[1],
- FlowStatus.HydrophoneWakeUpTimeBytes[2], FlowStatus.HydrophoneWakeUpTimeBytes[3],
- FlowStatus.HydrophoneWakeUpTimeBytes[4], FlowStatus.HydrophoneWakeUpTimeBytes[5]
+ RuntimeCache.HydrophoneWakeUpTimeBytes[0], RuntimeCache.HydrophoneWakeUpTimeBytes[1],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[2], RuntimeCache.HydrophoneWakeUpTimeBytes[3],
+ RuntimeCache.HydrophoneWakeUpTimeBytes[4], RuntimeCache.HydrophoneWakeUpTimeBytes[5]
}; //时间oid
//wrap the whole data
diff --git a/Correlator/Util/FlowStatus.cs b/Correlator/Util/FlowStatus.cs
deleted file mode 100644
index 384caec..0000000
--- a/Correlator/Util/FlowStatus.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System.Collections.Generic;
-using Correlator.Model;
-using Correlator.SensorHubTag;
-
-namespace Correlator.Util
-{
- ///
- /// 业务流程个节点状态
- ///
- public class FlowStatus
- {
- ///
- /// 是否可以收集数据
- ///
- public static bool CanCollectData = false;
-
- ///
- /// 红色传感器是否正常
- ///
- public static bool RedSensorIsEnable = false;
-
- ///
- /// 蓝色传感器是否正常
- ///
- public static bool BlueSensorIsEnable = false;
-
- ///
- /// 采集到的数据
- ///
- public static CorrelatorDataModel CorrelatorData;
-
- ///
- /// 水听器模式
- ///
- public static bool IsHydrophone = false;
-
- ///
- /// 点名对话框是否已显示
- ///
- public static bool IsShowing = false;
-
- ///
- /// 数据包index
- ///
- public static readonly List SeqCaches = new List();
-
- ///
- /// 水听器下发唤醒指令时间戳
- ///
- public static byte[] HydrophoneWakeUpTimeBytes = new byte[6];
-
- ///
- /// 水听器红色信号接收器原始数据
- ///
- public static readonly Dictionary RedSensorOriginalResp = new Dictionary();
-
- ///
- /// 水听器红色信号接收器解析之后的Tags
- ///
- public static readonly Dictionary> RedSensorResponseTags = new Dictionary>();
-
- ///