新增功能:
1 编写地震仪参数读取和设置功能;
This commit is contained in:
parent
29a4b89416
commit
f2ad8bcd46
Binary file not shown.
@ -6,6 +6,10 @@
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|f:\\code\\jseq\\20240301_jseq_upperpc\\jiangsuearthquake\\jiangsuearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\viewmodels\\mainviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\jiangsuearthquake\\views\\systemcontrolview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\views\\systemcontrolview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|f:\\code\\jseq\\20240301_jseq_upperpc\\jiangsuearthquake\\jiangsuearthquake\\models\\earthquakeparasetmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\models\\earthquakeparasetmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
@ -14,10 +18,6 @@
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|f:\\code\\jseq\\20240301_jseq_upperpc\\jiangsuearthquake\\jiangsuearthquake\\viewmodels\\boosterstationstatedataviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\viewmodels\\boosterstationstatedataviewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\jiangsuearthquake\\views\\systemcontrolview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\views\\systemcontrolview.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\jiangsuearthquake\\common\\tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{51CD2C1B-B7CD-4AC0-8087-846E14D316AD}|JiangsuEarthquake\\JiangsuEarthquake.csproj|solutionrelative:jiangsuearthquake\\common\\tools.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
@ -58,7 +58,7 @@
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 196,
|
||||
"SelectedChildIndex": 10,
|
||||
"SelectedChildIndex": 11,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
@ -73,22 +73,26 @@
|
||||
"WhenOpened": "2024-04-24T08:54:53.626Z",
|
||||
"IsPinned": true
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:128:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"DocumentIndex": 2,
|
||||
"Title": "EarthQuakeParaSetModel.cs",
|
||||
"DocumentMoniker": "F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\JiangsuEarthquake\\Models\\EarthQuakeParaSetModel.cs",
|
||||
"RelativeDocumentMoniker": "JiangsuEarthquake\\Models\\EarthQuakeParaSetModel.cs",
|
||||
"ToolTip": "F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\JiangsuEarthquake\\Models\\EarthQuakeParaSetModel.cs",
|
||||
"RelativeToolTip": "JiangsuEarthquake\\Models\\EarthQuakeParaSetModel.cs",
|
||||
"ViewState": "AQIAABwAAAAAAAAAAAAkwC8AAAAlAAAA",
|
||||
"ViewState": "AQIAAGsAAAAAAAAAAAAUwIMAAAAnAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-05-07T06:16:48.633Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"DocumentIndex": 3,
|
||||
"Title": "BoosterStationStateDataViewModel.cs",
|
||||
"DocumentMoniker": "F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\JiangsuEarthquake\\ViewModels\\BoosterStationStateDataViewModel.cs",
|
||||
"RelativeDocumentMoniker": "JiangsuEarthquake\\ViewModels\\BoosterStationStateDataViewModel.cs",
|
||||
@ -127,7 +131,7 @@
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 3,
|
||||
"DocumentIndex": 1,
|
||||
"Title": "SystemControlView.xaml",
|
||||
"DocumentMoniker": "F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\JiangsuEarthquake\\Views\\SystemControlView.xaml",
|
||||
"RelativeDocumentMoniker": "JiangsuEarthquake\\Views\\SystemControlView.xaml",
|
||||
@ -197,7 +201,7 @@
|
||||
"RelativeDocumentMoniker": "JiangsuEarthquake\\ViewModels\\MainViewModel.cs",
|
||||
"ToolTip": "F:\\Code\\JSEQ\\20240301_JSEQ_upperpc\\JiangsuEarthquake\\JiangsuEarthquake\\ViewModels\\MainViewModel.cs",
|
||||
"RelativeToolTip": "JiangsuEarthquake\\ViewModels\\MainViewModel.cs",
|
||||
"ViewState": "AQIAAAgIAAAAAAAAAIAwwBwIAAAAAAAA",
|
||||
"ViewState": "AQIAAIIIAAAAAAAAAAAqwI0IAAAVAAAA",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2024-03-12T06:03:03.53Z",
|
||||
"EditorCaption": ""
|
||||
|
||||
@ -1477,10 +1477,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!SeisZeroSetStartIsReceived)
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "请求数据发送成功,但未接收到数据!";
|
||||
OpenSetMsg = "请求凋零开启发送成功,但未接收到数据!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -1492,10 +1493,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!SeisZeroSetStopIsReceived)
|
||||
{
|
||||
CloseSetMsgVisibility = Visibility.Visible;
|
||||
CloseSetMsg = "请求数据发送成功,但未接收到数据!";
|
||||
CloseSetMsg = "请求调零停止发送成功,但未接收到数据!";
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -1507,10 +1509,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!SeisLevelSetStartIsReceived)
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "请求数据发送成功,但未接收到数据!";
|
||||
OpenSetMsg = "请求调平开始发送成功,但未接收到数据!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -1522,10 +1525,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!SeisLevelSetStopIsReceived)
|
||||
{
|
||||
CloseSetMsgVisibility = Visibility.Visible;
|
||||
CloseSetMsg = "请求数据发送成功,但未接收到数据!";
|
||||
CloseSetMsg = "请求调平停止发送成功,但未接收到数据!";
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -1668,6 +1672,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if(msg[1].Equals("True")) //打开
|
||||
{
|
||||
SeisZeroSetStartButtonIsEnabled = false;
|
||||
SeisZeroSetStopButtonIsEnabled = false;
|
||||
SeisZeroSetStartIsReceived = false;
|
||||
|
||||
sendDataSeis.Clear();
|
||||
@ -1696,6 +1701,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1712,6 +1718,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1731,6 +1738,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1738,6 +1746,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if(!msg[1].Equals("True")) //关闭
|
||||
{
|
||||
SeisZeroSetStopButtonIsEnabled = false;
|
||||
SeisZeroSetStartButtonIsEnabled = false;
|
||||
SeisZeroSetStopIsReceived = false;
|
||||
|
||||
sendDataSeis.Clear();
|
||||
@ -1766,6 +1775,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1782,6 +1792,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1801,6 +1812,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStopButtonIsEnabled = true;
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1808,6 +1820,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if(msg[1].Equals("True")) //开启
|
||||
{
|
||||
SeisLevelSetStartButtonIsEnabled = false;
|
||||
SeisLevelSetStopButtonIsEnabled = false;
|
||||
SeisLevelSetStartIsReceived = false;
|
||||
|
||||
sendDataSeis.Clear();
|
||||
@ -1836,6 +1849,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1852,6 +1866,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1871,6 +1886,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1878,6 +1894,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if(!msg[1].Equals("True")) //关闭
|
||||
{
|
||||
SeisLevelSetStopButtonIsEnabled = false;
|
||||
SeisLevelSetStartButtonIsEnabled = false;
|
||||
SeisLevelSetStopIsReceived = false;
|
||||
|
||||
sendDataSeis.Clear();
|
||||
@ -1906,6 +1923,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1922,6 +1940,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1941,6 +1960,7 @@ namespace JiangsuEarthquake.ViewModels
|
||||
timerCloseSetMsgHidden.Start();
|
||||
CloseSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisLevelSetStopButtonIsEnabled = true;
|
||||
SeisLevelSetStartButtonIsEnabled = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1965,10 +1985,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!EarthQuakeParaSetIsReceived)
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "请求数据发送成功,但未接收到数据!";
|
||||
SeisParaMsg = "参数设置发送成功,但未接收到数据!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -1980,10 +2001,11 @@ namespace JiangsuEarthquake.ViewModels
|
||||
if (!EarthQuakeParaReadIsReceived)
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "请求数据发送成功,但未接收到数据!";
|
||||
SeisParaMsg = "参数读取发送成功,但未接收到数据!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
}
|
||||
|
||||
// 停止定时器
|
||||
@ -2065,24 +2087,59 @@ namespace JiangsuEarthquake.ViewModels
|
||||
// break;
|
||||
case "EarthQuakeParaSetBtn":
|
||||
EarthQuakeParaSetBtnIsEnabled = false;
|
||||
EarthQuakeParaReadBtnIsEnabled = false;
|
||||
earthQuakeParaSetIsReceived = false;
|
||||
|
||||
byte[] sationNo = Tools.IntToBytes(int.Parse(msg[1])); //台号
|
||||
byte[] stationName = Encoding.UTF8.GetBytes(msg[2]); //台站名称
|
||||
stationName = Tools.PadArrayWithZeros(stationName, 36);
|
||||
stationName = Tools.PadArrayWithZeros(stationName, 32);
|
||||
byte[] stationShortName = Encoding.UTF8.GetBytes(msg[3]); //台站缩写
|
||||
stationShortName = Tools.PadArrayWithZeros(stationShortName, 8);
|
||||
byte[] earthQuakeCount = BitConverter.GetBytes(short.Parse(msg[4]));
|
||||
byte[] earthQuakeCount = BitConverter.GetBytes(short.Parse(msg[4])); //地震计总数
|
||||
earthQuakeCount = Tools.PadArrayWithZeros(earthQuakeCount, 2);
|
||||
byte[] channelsNo = BitConverter.GetBytes(short.Parse(msg[5])); //总通道数
|
||||
channelsNo = Tools.PadArrayWithZeros(channelsNo, 2);
|
||||
byte[] wd = Tools.IntToBytes(int.Parse(msg[6])); //纬度
|
||||
byte[] jd = Tools.IntToBytes(int.Parse(msg[7])); //经度
|
||||
byte[] gaoCheng = Tools.IntToBytes(int.Parse(msg[8])); //高程
|
||||
byte[] startTime = BitConverter.GetBytes(short.Parse(msg[9])); //起用日期
|
||||
startTime = Tools.PadArrayWithZeros(startTime, 32);
|
||||
byte[] stationid = BitConverter.GetBytes(short.Parse(msg[10])); //台网标志
|
||||
stationid = Tools.PadArrayWithZeros(stationid, 4);
|
||||
byte[] software_version = BitConverter.GetBytes(short.Parse(msg[11])); //软件版本
|
||||
software_version = Tools.PadArrayWithZeros(software_version, 32);
|
||||
|
||||
sendDataSeis.Clear();
|
||||
sendDataSeis.AddRange(new byte[] { 0xBF, 0x13, 0x97, 0x74 }); //SYNC
|
||||
sendDataSeis.AddRange(new byte[] { 0xA0, 0x00 }); //CMD
|
||||
sendDataSeis.AddRange(new byte[] { 0x00, 0x82 }); //LENGTH
|
||||
sendDataSeis.AddRange(sationNo);
|
||||
sendDataSeis.AddRange(stationName);
|
||||
sendDataSeis.AddRange(stationShortName);
|
||||
sendDataSeis.AddRange(earthQuakeCount);
|
||||
sendDataSeis.AddRange(channelsNo);
|
||||
sendDataSeis.AddRange(wd);
|
||||
sendDataSeis.AddRange(jd);
|
||||
sendDataSeis.AddRange(gaoCheng);
|
||||
sendDataSeis.AddRange(startTime);
|
||||
sendDataSeis.AddRange(stationid);
|
||||
sendDataSeis.AddRange(software_version);
|
||||
checkByte.Clear();
|
||||
checkByte.AddRange(new byte[] { 0xA0, 0x00 }); //CMD
|
||||
checkByte.AddRange(new byte[] { 0x00, 0x82 }); //LENGTH
|
||||
checkByte.AddRange(sationNo);
|
||||
checkByte.AddRange(stationName);
|
||||
checkByte.AddRange(stationShortName);
|
||||
checkByte.AddRange(earthQuakeCount);
|
||||
checkByte.AddRange(channelsNo);
|
||||
checkByte.AddRange(wd);
|
||||
checkByte.AddRange(jd);
|
||||
checkByte.AddRange(gaoCheng);
|
||||
checkByte.AddRange(startTime);
|
||||
checkByte.AddRange(stationid);
|
||||
checkByte.AddRange(software_version);
|
||||
checkCode = Tools.CRCCalc(checkByte.ToArray()); //CHK_SUM
|
||||
|
||||
sendDataSeis.AddRange(checkCode);
|
||||
|
||||
bool result = false;
|
||||
@ -2094,11 +2151,12 @@ namespace JiangsuEarthquake.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "通信未连接!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "通信未连接!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2110,34 +2168,105 @@ namespace JiangsuEarthquake.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "通信未连接!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "通信未连接!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "请求调零开启发送成功!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Green);
|
||||
timerSeisZeroSetStart.Start();
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "设置参数发送成功!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Green);
|
||||
timerEarthQuakeParaSet.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenSetMsgVisibility = Visibility.Visible;
|
||||
OpenSetMsg = "请求调零开启发送失败!";
|
||||
timerOpenSetMsgHidden.Start();
|
||||
OpenSetMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
SeisZeroSetStartButtonIsEnabled = true;
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "设置参数发送失败!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
}
|
||||
break;
|
||||
case "EarthQuakeParaReadBtn":
|
||||
EarthQuakeParaSetBtnIsEnabled = false;
|
||||
EarthQuakeParaReadBtnIsEnabled = false;
|
||||
earthQuakeParaReadIsReceived = false;
|
||||
|
||||
sendDataSeis.Clear();
|
||||
sendDataSeis.AddRange(new byte[] { 0xBF, 0x13, 0x97, 0x74 }); //SYNC
|
||||
sendDataSeis.AddRange(new byte[] { 0xB0, 0x00 }); //CMD
|
||||
sendDataSeis.AddRange(new byte[] { 0x00, 0x02 }); //LENGTH
|
||||
sendDataSeis.AddRange(new byte[] { 0x00, 0x00 }); //地震计号
|
||||
checkByte.Clear();
|
||||
checkByte.AddRange(new byte[] { 0xB0, 0x00 }); //CMD
|
||||
checkByte.AddRange(new byte[] { 0x00, 0x02 }); //LENGTH
|
||||
checkByte.AddRange(new byte[] { 0x00, 0x00 }); //地震计号
|
||||
checkCode = Tools.CRCCalc(checkByte.ToArray()); //CHK_SUM
|
||||
|
||||
sendDataSeis.AddRange(checkCode);
|
||||
|
||||
result = false;
|
||||
if (station_id == 1)
|
||||
{
|
||||
if (clientModelDZY1.IsConnected)
|
||||
{
|
||||
result = clientModelDZY1.SendMessage(sendDataSeis.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "通信未连接!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clientModelDZY2.IsConnected)
|
||||
{
|
||||
result = clientModelDZY2.SendMessage(sendDataSeis.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "通信未连接!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "设置参数发送成功!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Green);
|
||||
timerEarthQuakeParaSet.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
SeisParaMsgVisibility = Visibility.Visible;
|
||||
SeisParaMsg = "设置参数发送失败!";
|
||||
timerSeisParaMsgHidden.Start();
|
||||
SeisParaMsgForeground = new SolidColorBrush(Colors.Red);
|
||||
EarthQuakeParaSetBtnIsEnabled = true;
|
||||
EarthQuakeParaReadBtnIsEnabled = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user