using DotNetty.Transport.Channels;
using log4net;
using Service.Charger.Client;
using Service.Charger.Handler;
namespace Service.Charger.Msg.Charger.OutCharger.Req;
///
/// 3.7.11 充电桩遥信数据上报
///
public class PileUploadRemoteSignalHandler: SimpleChannelInboundHandler, IBaseHandler
{
private static readonly ILog Log = LogManager.GetLogger(typeof(PileUploadRemoteSignalHandler));
protected override void ChannelRead0(IChannelHandlerContext ctx, PileUploadRemoteSignal msg)
{
if (ClientMgr.TryGetClient(ctx.Channel, out var sn, out var client))
{
//存储日志
Log.Info($"receive {msg} from {sn}");
client.Workstate = msg.WorkStatus;
client.IsCharged = msg.WorkStatus == 1 ? true : false;
client.TotalError = msg.TotalError;
client.TotalWarning = msg.TotalWarning;
}
}
}