diff --git a/Common/lib/HybirdFrameworkCore.dll b/Common/lib/HybirdFrameworkCore.dll index 36f9605..0f30488 100644 Binary files a/Common/lib/HybirdFrameworkCore.dll and b/Common/lib/HybirdFrameworkCore.dll differ diff --git a/Common/lib/HybirdFrameworkDriver.dll b/Common/lib/HybirdFrameworkDriver.dll index eb4ed1b..2d7f1ab 100644 Binary files a/Common/lib/HybirdFrameworkDriver.dll and b/Common/lib/HybirdFrameworkDriver.dll differ diff --git a/Service/Charger/Codec/Decoder.cs b/Service/Charger/Codec/Decoder.cs index fe0a2f3..99ff833 100644 --- a/Service/Charger/Codec/Decoder.cs +++ b/Service/Charger/Codec/Decoder.cs @@ -68,7 +68,7 @@ public class Decoder : ByteToMessageDecoder byte[]? data = null; try { - ASDU asdu = Parse(buffer, totalFrameLength, out data); + ASDU asdu = Parse(buffer, totalFrameLength, delimiter, out data); Log(chargerSn).Info($"receive {BitUtls.BytesToHexStr(data)}:{JsonConvert.SerializeObject(asdu)} from {chargerSn}"); output.Add(asdu); buffer.Clear(); @@ -118,18 +118,12 @@ public class Decoder : ByteToMessageDecoder return -1; } - public ASDU Parse(IByteBuffer byteBuffer, int totalFrameLength, out byte[] data) + public ASDU Parse(IByteBuffer byteBuffer, int totalFrameLength, IByteBuffer delimiter, out byte[] data) { data = new byte[totalFrameLength]; byteBuffer.ReadBytes(data); - string ou = string.Empty; - for (int i = 0; i < data.Length; i++) - { - ou += data[i].ToString("X2") + " "; - } - //TODO bug length取值不对,上述测试使用 - int removeIndex = _delimiters.Length; + int removeIndex = delimiter.Capacity; ushort cmd = byteBuffer.GetByte(14 + removeIndex); ushort recordType = byteBuffer.GetByte(23 + removeIndex); diff --git a/Service/Charger/Handler/AuxiliaryPowerResHandler.cs b/Service/Charger/Handler/AuxiliaryPowerResHandler.cs index 3d07fe1..5511329 100644 --- a/Service/Charger/Handler/AuxiliaryPowerResHandler.cs +++ b/Service/Charger/Handler/AuxiliaryPowerResHandler.cs @@ -3,11 +3,6 @@ using HybirdFrameworkCore.Autofac.Attribute; using log4net; using Service.Charger.Client; using Service.Charger.Msg.Charger.Resp; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Service.Charger.Handler {