/// <summary> /// 向客户端发送应答 /// </summary> /// <param name="context"></param> /// <param name="resp"></param> private void DoResponse(IChannelHandlerContext context, PlatformResp resp) { // 构建消息体属性对象 JT808MessageBodyAttr attr = new JT808MessageBodyAttr(); attr.EncryptionType = 0; byte[] body = resp.Encode(); attr.MsgBodyLength = body.Length; attr.IsSplit = false; JT808MessageHead head = new JT808MessageHead(); head.MessageId = resp.GetMessageId(); head.MessageSerial = GetFlowId(context.Channel); head.TerminalId = resp.TerminalId; head.MsgBodyAttr = attr; // 构建JT/T808协议消息对象 JT808Message message = new JT808Message(); message.MsgHeader = head; message.MsgBody = body; byte[] reply = message.Encode(); context.WriteAndFlushAsync(Unpooled.CopiedBuffer(reply)); //ResponseData response = new ResponseData(); //response.CmdID = message.MsgHeader.MessageId; //response.CmdSerialNo = message.MsgHeader.MessageSerial; //response.MsgBody = reply; //response.TerminalID = resp.TerminalId; //response.Time = response.GetTimeStamp(); //context.WriteAndFlushAsync(response); }
/// <summary> /// 向客户端发送应答 /// </summary> /// <param name="context"></param> /// <param name="resp"></param> private void DoResponse(IChannelHandlerContext context, PlatformResp resp) { //应答Byte[]构造暂时未完成 }