CompressParamsRequest.cs 988 B

12345678910111213141516171819202122232425262728293031323334
  1. using PlcSiemens.Core.Extension;
  2. using PlcSiemens.O;
  3. using PlcSiemens.Protocol.Common;
  4. namespace PlcSiemens.Protocol.Control
  5. {
  6. public class CompressParamsRequest
  7. {
  8. public byte Fun; // pduControl 0x28
  9. public byte[] Uk7; // unknown 7
  10. public ushort Len1; // Length part 1 : 0x00
  11. public byte Len2; // Length part 2 : 0x05
  12. public char[] Cmd; // ascii '_GARB'
  13. public ushort PacketLength = 0x10;
  14. public void Build()
  15. {
  16. Fun = (byte)PduFuncType.PduControl;
  17. Uk7 = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD };
  18. Len1 = 0x0000;
  19. Len2 = 0x05;
  20. Cmd = new[] { '_', 'G', 'A', 'R', 'B' };
  21. }
  22. public void GetByteBuffer(ByteBuffer buffer)
  23. {
  24. buffer.Push(Fun);
  25. buffer.Push(Uk7);
  26. buffer.Push(Len1);
  27. buffer.Push(Len2);
  28. Cmd.ForEach(t => buffer.Push((byte)t));
  29. }
  30. }
  31. }