AgvChangeRunStatusCmdMd.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace DWZB_Agv_Agreement.Agv_Agreement
  7. {
  8. /// <summary>
  9. /// 运行状态更改指令实体类
  10. /// </summary>
  11. public class AgvChangeRunStatusCmdMd : DataHeadMd
  12. {
  13. private const int btyArrLen = 11;
  14. /// <summary>
  15. /// 指令编号
  16. /// </summary>
  17. public int CmdNo { get; set; }
  18. /// <summary>
  19. /// 指令代码
  20. /// </summary>
  21. public byte CmdCode { get; set; }
  22. /// <summary>
  23. /// 状态代码
  24. /// </summary>
  25. public byte StatusCode { get; set; }
  26. /// <summary>
  27. /// 序列化为byte数组。
  28. /// </summary>
  29. public byte[] SerializeBytArr()
  30. {
  31. List<byte> retBtArr = new(btyArrLen);
  32. retBtArr.Add(FunctionCode);
  33. retBtArr.AddRange(DataHandleHelper.ReverseBtyArr(BitConverter.GetBytes(AgvNo)));
  34. retBtArr.AddRange(DataHandleHelper.ReverseBtyArr(BitConverter.GetBytes(CmdNo)));
  35. retBtArr.Add(CmdCode);
  36. retBtArr.Add(StatusCode);
  37. return retBtArr.ToArray();
  38. }
  39. }
  40. }