CopyRamToRomParamsRequest.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using PlcSiemens.Core.Extension;
  2. using PlcSiemens.O;
  3. using PlcSiemens.Protocol.Common;
  4. namespace PlcSiemens.Protocol.Control
  5. {
  6. public class CopyRamToRomParamsRequest
  7. {
  8. public byte Fun { get; set; } // pduControl 0x28
  9. public byte[] Uk7 { get; set; } // unknown 7
  10. public ushort Len1 { get; set; } // Length part 1 : 0x0002
  11. public ushort SFun { get; set; } // 'EP' 0x4550
  12. public byte Len2 { get; set; } // Length part 2 : 0x05
  13. public char[] Cmd { get; set; } // ascii '_MODU' 5
  14. public ushort PacketLength = 0x12;
  15. public void Build()
  16. {
  17. Fun = (byte)PduFuncType.PduControl;
  18. Uk7 = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFD };
  19. Len1 = 0x0002;
  20. SFun = 0x4550;
  21. Len2 = 0x05;
  22. Cmd = new[] { '_', 'M', 'O', 'D', 'U' };
  23. }
  24. public void GetByteBuffer(ByteBuffer buffer)
  25. {
  26. buffer.Push(Fun);
  27. buffer.Push(Uk7);
  28. buffer.Push(Len1);
  29. buffer.Push(SFun);
  30. buffer.Push(Len2);
  31. Cmd.ForEach(t => buffer.Push((byte)t));
  32. }
  33. }
  34. }