|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
using DotNetty.Buffers;
|
|
|
|
|
using DotNetty.Codecs;
|
|
|
|
|
using DotNetty.Transport.Channels;
|
|
|
|
|
using HybirdFrameworkCore.Utils;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Service.Car.Common;
|
|
|
|
|
using Service.Car.Msg;
|
|
|
|
@ -8,14 +9,14 @@ using Service.Car.Msg;
|
|
|
|
|
namespace Service.Car.Codec;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Encoder : MessageToByteEncoder<BaseMsg>
|
|
|
|
|
{
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(Encoder));
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="context"></param>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
@ -25,6 +26,8 @@ public class Encoder : MessageToByteEncoder<BaseMsg>
|
|
|
|
|
byte[] bytes = obj.ToBytes();
|
|
|
|
|
List<byte> list = new List<byte>(bytes);
|
|
|
|
|
list.AddRange(CarConst.EndChar);
|
|
|
|
|
output.WriteBytes(list.ToArray());
|
|
|
|
|
byte[] result = list.ToArray();
|
|
|
|
|
Log.Info($"send {BitUtls.BytesToHexStr(result)}");
|
|
|
|
|
output.WriteBytes(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|