解码报错记录日志

master
rszn 6 months ago
parent 265f4ea3bc
commit 7da39b7de7

@ -58,11 +58,19 @@ public class Decoder : ByteToMessageDecoder
return; return;
} }
ASDU asdu = Parse(buffer, totalFrameLength, out var data); byte[]? data = null;
try
{
ASDU asdu = Parse(buffer, totalFrameLength, out data);
Log.Info($"receive {JsonConvert.SerializeObject(asdu)}:{data} from {ChannelUtils.GetAttr(context.Channel, ChargerConst.ChargerSn)}"); Log.Info($"receive {JsonConvert.SerializeObject(asdu)}:{data} from {ChannelUtils.GetAttr(context.Channel, ChargerConst.ChargerSn)}");
output.Add(asdu); output.Add(asdu);
buffer.Clear(); buffer.Clear();
} }
catch (Exception e)
{
Log.Error($"decode fail msg={BitUtls.BytesToHexStr(data)}");
}
}
} }
private IByteBuffer? FindDelimiter(IByteBuffer buffer) private IByteBuffer? FindDelimiter(IByteBuffer buffer)

Loading…
Cancel
Save