You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

21 lines
601 B

  1. using DotNetty.Buffers;
  2. using DotNetty.Codecs;
  3. using System.Collections.Generic;
  4. using DotNetty.Transport.Channels;
  5. using JT1078.Protocol;
  6. using System;
  7. namespace JT1078.Gateway.Codecs
  8. {
  9. public class JT1078TcpDecoder : ByteToMessageDecoder
  10. {
  11. protected override void Decode(IChannelHandlerContext context, IByteBuffer input, List<object> output)
  12. {
  13. byte[] buffer = new byte[input.Capacity+4];
  14. input.ReadBytes(buffer, 4, input.Capacity);
  15. Array.Copy(JT1078Package.FH_Bytes, 0,buffer, 0, 4);
  16. output.Add(buffer);
  17. }
  18. }
  19. }