2025-04-30 17:25:35 +08:00

58 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using JiShe.CollectBus.Common.Enums;
using JiShe.CollectBus.Protocol.Dto;
using JiShe.CollectBus.Protocol.Interfaces;
using JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_00H;
using JiShe.CollectBus.Protocol3761;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JiShe.CollectBus.Protocol.T37612012.AnalysisData.AFN_02H
{
/// <summary>
/// 5.3.3.1 F1登录
/// </summary>
public class AFN2_F1_Analysis : IAnalysisStrategy<TB3761>
{
private readonly ILogger<AFN2_F1_Analysis> _logger;
public AFN2_F1_Analysis(ILogger<AFN2_F1_Analysis> logger)
{
_logger = logger;
}
public Task<bool> ExecuteAsync(TB3761 input, Action<dynamic>? result = null)
{
try
{
ArgumentNullException.ThrowIfNull(input);
ArgumentNullException.ThrowIfNull(input.A.Code);
UnitDataAnalysis<string> dto = new UnitDataAnalysis<string>
{
Code = input.A.Code,
AFN = input.AFN_FC.AFN,
Fn = input.DT.Fn,
Pn = input.DA.Pn,
Data = $"登录帧",
HexMessage = input.BaseHexMessage.HexMessageString,
MessageId = input.MessageId,
ReceivedTime = input.ReceivedTime,
DensityUnit = DensityUnit.None,
TimeDensity = -1
};
result?.Invoke(dto);
return Task.FromResult(true);
}
catch (Exception ex)
{
_logger.LogError(ex, $"02_1解析失败:{input.A.Code}-{input.DT.Fn}-{input.BaseHexMessage.HexMessageString},{ex.Message}");
}
return Task.FromResult(false);
}
}
}