From b374692c02d26d77f1837d49fc1bce0bc52bdf94 Mon Sep 17 00:00:00 2001
From: zenghongyao <873884283@qq.com>
Date: Sun, 27 Apr 2025 09:44:08 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8C=B9=E9=85=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AnalysisData/AFN_10H/AFN16_F1_Analysis.cs | 69 +++++++++++++++++++
.../AnalysisData/F10TranspondMatch.cs | 66 ++++++++++++++++++
2 files changed, 135 insertions(+)
create mode 100644 protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F1_Analysis.cs
create mode 100644 protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/F10TranspondMatch.cs
diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F1_Analysis.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F1_Analysis.cs
new file mode 100644
index 0000000..e352900
--- /dev/null
+++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/AFN_10H/AFN16_F1_Analysis.cs
@@ -0,0 +1,69 @@
+using GatherService.WattMeter.AnalysisData.AFN_10H;
+using JiShe.CollectBus.Common.Extensions;
+using JiShe.CollectBus.Protocol.Contracts.Protocol.Dto;
+using JiShe.CollectBus.Protocol.Dto;
+using JiShe.CollectBus.Protocol.Interfaces;
+using JiShe.CollectBus.Protocol3761;
+using Microsoft.Extensions.Logging;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using TouchSocket.Core;
+
+namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_10H
+{
+ ///
+ /// 5.16 数据转发(AFN=10H)
+ ///
+ public class AFN16_F1_Analysis : IAnalysisStrategy>
+ {
+ private readonly ILogger _logger;
+
+ public AFN16_F1_Analysis(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ public Task> ExecuteAsync(TB3761 input)
+ {
+ try
+ {
+ ArgumentNullException.ThrowIfNull(input);
+ ArgumentNullException.ThrowIfNull(input.UnitData.HexMessageList);
+ UnitDataAnalysis dto = new UnitDataAnalysis
+ {
+ Code = input.A.Code!,
+ AFN = input.AFN_FC.AFN,
+ Fn = input.DT.Fn,
+ Pn = input.DA.Pn,
+ Data = AnalysisDataUnit(input.UnitData.HexMessageList)
+ };
+ return Task.FromResult(dto);
+ }
+ catch (Exception ex)
+ {
+ _logger.LogError(ex, $"10_101解析失败:{input.A?.Code}-{input.DT?.Fn ?? 0}-{input?.BaseHexMessage?.HexMessageString},{ex.Message}");
+ return null;
+ }
+ }
+
+
+ private string AnalysisDataUnit(List hexMessageList)
+ {
+ // TODO: 待定,等确认如何匹配规则
+ string value = string.Join(" ", hexMessageList);
+ if (value.Contains(F10TranspondMatch.ReadNormal))
+ {
+ if (value.Contains(F10TranspondMatch.PowerHz))//电网频率
+ return "AFN16_F97_Analysis";
+ //else if (value.Contains(F10TranspondMatch.ReadData))//读取电表地址
+ // result = "AFN16_F105_Analysis";
+
+ }
+ return "";
+ }
+
+ }
+}
diff --git a/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/F10TranspondMatch.cs b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/F10TranspondMatch.cs
new file mode 100644
index 0000000..f7b1176
--- /dev/null
+++ b/protocols/JiShe.CollectBus.Protocol.T37612012/AnalysisData/F10TranspondMatch.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData
+{
+ public class F10TranspondMatch
+ {
+ ///
+ /// 188协议良禾水表透传解析
+ ///
+ public const string WaterLiangHe188 = "1F 90 00";
+ ///
+ /// 188协议良禾水表透传解析
+ ///
+ public const string WaterLiangHe188_1 = "90 1F 00";
+ ///
+ /// 电网频率
+ ///
+ public const string PowerHz = "35 33 B3 35";
+
+ ///
+ /// 读取数据
+ ///
+ public const string ReadData = "34 37 33 37";
+
+ ///
+ /// 跳合闸 正常应答帧
+ ///
+ public const string JumpClosingNormal = "68 9C";
+ ///
+ /// 跳合闸 异常应答帧
+ ///
+ public const string JumpClosingError = "68 DC";
+ ///
+ /// 写数据正常应答帧
+ ///
+ public const string WriteNormal = "68 94 00";
+ ///
+ /// 写数据异常应答帧
+ ///
+ public const string WriteError = "68 D4 01";
+
+ ///
+ /// 读数据异常应答帧
+ ///
+ public const string ReadError = "68 D1";
+
+ ///
+ /// 读数据正常应答帧
+ ///
+ public const string ReadNormal = "68 91";
+ ///
+ /// 捷先电动阀门(DN50)
+ ///
+ public const string CJT_188_2018 = "84 05 A0 17 00";
+
+ public const string DLT_645_1997 = "68 84 00";
+ ///
+ /// ES190_DC 4G水表
+ ///
+ public const string ES190_DC = "FF D5";
+ }
+}