BxCmdState.py 724 B

12345678910111213141516171819202122232425262728
  1. from .BxCmd import baseBxCmd
  2. from .BxCmdCode import CMD_SYSTEM_STATE
  3. class CmdState(baseBxCmd):
  4. """系统状态命令"""
  5. def __init__(self):
  6. super().__init__(CMD_SYSTEM_STATE.group, CMD_SYSTEM_STATE.code)
  7. def Build(self):
  8. """构建命令数据"""
  9. result = bytearray()
  10. # 写入命令组
  11. result.append(self.Group())
  12. # 写入命令
  13. result.append(self.Cmd())
  14. # 写入响应标志
  15. result.append(self.ReqResp())
  16. # 写入保留字r0 r1
  17. result.append(0x00)
  18. result.append(0x00)
  19. return bytes(result)
  20. # 创建CmdState实例的函数
  21. def NewCmdState():
  22. """创建系统状态命令实例"""
  23. return CmdState()