51 lines
1.6 KiB
C#
Raw Normal View History

2025-04-22 16:48:53 +08:00
using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Protocol.Contracts.Interfaces;
using JiShe.CollectBus.Protocol.Contracts.Models;
using JiShe.CollectBus.Protocol.Dto;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2025-04-24 00:34:00 +08:00
using Volo.Abp.DependencyInjection;
2025-04-22 16:48:53 +08:00
namespace JiShe.CollectBus.Protocol.AnalysisData.AFN_00H
{
/// <summary>
2025-04-24 19:31:28 +08:00
/// 5.1.3.1 F1全部确认对收到报文中的全部数据单元标识进行确认
/// </summary>
2025-04-24 19:31:28 +08:00
public class AFN0_F1_Analysis: IAnalysisStrategy<TB3761, UnitDataAnalysis<bool>>
2025-04-22 16:48:53 +08:00
{
private readonly ILogger<AFN0_F1_Analysis> _logger;
public AFN0_F1_Analysis(ILogger<AFN0_F1_Analysis> logger)
{
_logger = logger;
}
2025-04-24 19:40:51 +08:00
public Task<UnitDataAnalysis<bool>> ExecuteAsync(TB3761 tB3761)
2025-04-22 16:48:53 +08:00
{
try
{
ArgumentNullException.ThrowIfNull(nameof(tB3761));
2025-04-24 19:40:51 +08:00
UnitDataAnalysis<bool> dto = new UnitDataAnalysis<bool>
2025-04-22 16:48:53 +08:00
{
Code = tB3761.A?.Code,
AFN = tB3761.AFN_FC?.AFN ?? 0,
Fn = tB3761.DT?.Fn ?? 0,
Pn = tB3761.DA?.Pn ?? 0
};
return Task.FromResult(dto);
}
catch (Exception ex)
{
_logger.LogError(ex, $"00_1解析失败:{tB3761.A?.Code}-{tB3761.DT?.Fn ?? 0}-{tB3761?.BaseHexMessage?.HexMessageString},{ex.Message}");
return null;
}
}
}
2025-04-24 00:34:00 +08:00
2025-04-22 16:48:53 +08:00
}