def queueDevCmd(self, devCmdStr, userCmd): """Add a device command to the device command queue @param[in] devCmdStr: a command string to send to the device. @param[in] userCmd: a UserCmd associated with this device (probably but not necessarily linked. Used here for writeToUsers reference. """ log.info("%s.queueDevCmd(devCmdStr=%r, cmdQueue: %r"%(self, devCmdStr, self.devCmdQueue)) # append a cmdVerb for the command queue (otherwise all get the same cmdVerb and cancel eachother) # could change the default behavior in CommandQueue? cmdVerb = devCmdStr.split()[0] assert cmdVerb in self.validCmdVerbs devCmd = DevCmd(cmdStr=devCmdStr) devCmd.cmdVerb = cmdVerb devCmd.userCmd = userCmd def queueFunc(devCmd): # when the command is ready run this # everything besides a move should return quickly devCmd.setTimeLimit(SEC_TIMEOUT) devCmd.setState(devCmd.Running) if cmdVerb == "status": # wipe status, to ensure we've # gotten a full status when done. self.status.flushStatus() self.startDevCmd(devCmd.cmdStr) self.devCmdQueue.addCmd(devCmd, queueFunc) return devCmd
def queueDevCmd(self, devCmdStr, userCmd): """Add a device command to the device command queue @param[in] devCmdStr: a command string to send to the device. @param[in] userCmd: a UserCmd associated with this device (probably but not necessarily linked. Used here for writeToUsers reference. """ log.info("%s.queueDevCmd(devCmdStr=%r, cmdQueue: %r"%(self, devCmdStr, self.devCmdQueue)) #print("%s.queueDevCmd(devCmdStr=%r, cmdQueue: %r"%(self, devCmdStr, self.devCmdQueue)) # append a cmdVerb for the command queue (otherwise all get the same cmdVerb and cancel eachother) # could change the default behavior in CommandQueue? devCmd = DevCmd(cmdStr=devCmdStr) devCmd.userCmd = userCmd devCmd.cmdVerb = devCmdStr self.devCmdQueue.addCmd(devCmd, self.startDevCmd) return devCmd
def queueDevCmd(self, cmdStr, userCmd=None): """Add a device command to the device command queue @param[in] cmdStr, string to send to the device. """ log.info("%s.queueDevCmd(cmdStr=%r, cmdQueue: %r"%(self, cmdStr, self.devCmdQueue)) # print("%s.queueDevCmd(devCmd=%r, devCmdStr=%r, cmdQueue: %r"%(self, devCmd, devCmd.cmdStr, self.devCmdQueue)) # append a cmdVerb for the command queue (other wise all get the same cmdVerb and cancel eachother) # could change the default behavior in CommandQueue? userCmd = expandUserCmd(userCmd) devCmd = DevCmd(cmdStr) devCmd.cmdVerb = cmdStr.split()[0] devCmd.userCmd = userCmd def queueFunc(devCmd): self.startDevCmd(devCmd) self.devCmdQueue.addCmd(devCmd, queueFunc) return devCmd