public override void ChannelRead(IChannelHandlerContext context, object message)
 {
     if (message is Message msg)
     {
         // var json = JsonConvert.SerializeObject(msg,Formatting.None);
         GkParser.ParseCore(ref msg);
         Logger.Info($"收到设备消息, msg:{msg.Bodies[0].IdType.ToString()}");
         MsgBuilder.BuildResp(context, msg);
     }
 }
        public override void ChannelRead(IChannelHandlerContext context, object message)
        {
            var sender = ((UdpMessage)message).Sender;

            if (message is Message msg)
            {
                // var json = JsonConvert.SerializeObject(msg,Formatting.None);
                GkParser.ParseCore(ref msg);
                Logger.Info($"收到设备消息, msg:{msg.Bodies[0].IdType.ToString()}");
//                MsgBuilder.BuildResp(context, msg);
                var header = msg.Header;
                var body   = msg.Bodies[0];
                if (IdType.HeartBeat.Equals(body.IdType) && HeartBeatType.Online.Equals(body.HeartBeatInfo.HeartBeatType))
                {
                    //下发查询设备类型指令
                    var content = MsgBuilder.BuildContent(IdType.ReadDeviceInfo, MsgType.Configure, OpsType.ReadCommand,
                                                          0, 1, null);
                    var cmd    = MsgBuilder.BuildMessage(header.Src, header.Dst, header.Ver, false, 1, 0, content);
                    var buffer = Unpooled.WrappedBuffer(cmd);
                    var packet = new DatagramPacket(buffer, sender);
                    context.WriteAndFlushAsync(packet);
                }
            }
        }