Command1071.cs 976 B

12345678910111213141516171819202122232425262728293031323334
  1. using ProjectManagementSystem.Device.Core;
  2. using ProjectManagementSystem.Device.Extenions;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ProjectManagementSystem.Device.Command
  9. {
  10. public class Command1071 : IDeviceCommand
  11. {
  12. private byte[] buffer = new byte[10] { 0x10, 0x71, 0, 0, 0, 0, 0, 0, 0, 0x03 };
  13. public byte AgvId { get; set; }
  14. public byte Function { get; set; }
  15. public byte Operation { get; set; }
  16. public byte Speed { get; set; }
  17. public virtual byte[] Serialization()
  18. {
  19. buffer[1] = Function;
  20. buffer[2] = AgvId;
  21. if (Operation >= 0 && Operation < 8)
  22. {
  23. buffer[3] = Convert.ToByte((1 << Operation) | 0x00);
  24. }
  25. buffer[4] = Convert.ToByte(Speed);
  26. buffer[8] = buffer.XOR_Check(8);
  27. return buffer;
  28. }
  29. }
  30. }