From 33a2901d7439f0b3afe6641c95b76a8c929aa690 Mon Sep 17 00:00:00 2001 From: Dai Mr <1822802785@qq.com> Date: Wed, 12 Mar 2025 13:39:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E5=87=86=E5=8D=8F=E8=AE=AE=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StandardProtocolPlugin.cs | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/JiShe.CollectBus.Protocol/StandardProtocolPlugin.cs b/src/JiShe.CollectBus.Protocol/StandardProtocolPlugin.cs index 8233b99..a6918fd 100644 --- a/src/JiShe.CollectBus.Protocol/StandardProtocolPlugin.cs +++ b/src/JiShe.CollectBus.Protocol/StandardProtocolPlugin.cs @@ -27,19 +27,28 @@ namespace JiShe.CollectBus.Protocol var aTuple = (Tuple)hexStringList.GetAnalyzeValue(CommandChunkEnum.A); var afn = (int)hexStringList.GetAnalyzeValue(CommandChunkEnum.AFN); var fn = (int)hexStringList.GetAnalyzeValue(CommandChunkEnum.FN); - if (afn == (int)AFN.请求实时数据) + switch ((AFN)afn) { - if (Enum.IsDefined(typeof(ATypeOfDataItems), fn)) //Enum.TryParse(afn.ToString(), out ATypeOfDataItems parseResult) - { - AnalyzeReadingDataAsync(messageReceived, sendAction); - } - } - else if(afn == (int)AFN.请求历史数据) - { - if (Enum.IsDefined(typeof(IIdataTypeItems), fn)) - { - AnalyzeReadingTdcDataAsync(messageReceived, sendAction); - } + case AFN.确认或否认: + AnalyzeAnswerDataAsync(messageReceived, sendAction); + break; + case AFN.设置参数: break; + case AFN.查询参数: break; + case AFN.请求实时数据: + if (Enum.IsDefined(typeof(ATypeOfDataItems), fn)) //Enum.TryParse(afn.ToString(), out ATypeOfDataItems parseResult) + { + AnalyzeReadingDataAsync(messageReceived, sendAction); + } + break; + case AFN.请求历史数据: + if (Enum.IsDefined(typeof(IIdataTypeItems), fn)) + { + AnalyzeReadingTdcDataAsync(messageReceived, sendAction); + } + break; + case AFN.数据转发: + AnalyzeTransparentForwardingAnswerAsync(messageReceived, sendAction); + break; } throw new NotImplementedException();