def unregisterEvent(self, event): super().unregisterEvent(event) reply = self.execCommand(Command.disspont) if reply.error: raise CommandError(reply.value) reply = self.execCommand(Command.enspont, flags=self._events) if reply.error: raise CommandError(reply.value)
def setRate(self, newrate): brate = str(newrate).encode('ASCII') fields = [brate, b'ml/h'] reply = self.execCommand(Command.rate, fields) if reply.error: raise CommandError(reply.value) return reply.value
def securitycode(self): if self.__seccode is None: reply = self.execCommand(Command.getserialno) if reply.error: raise CommandError(reply.value) self.__seccode = genCheckSum(reply.value) return self.__seccode
def listModules(self): reply = self.execCommand(Command.readvar, flags=[VarId.modules]) if reply.error: raise CommandError(reply.value) results = parseVars(reply.value) binmods = int(results[VarId.modules], 16) return [i + 1 for i in range(5) if (1 << i) & binmods]
def readVolume(self): reply = self.execCommand(Command.queryvolume) if reply.error: raise CommandError(reply.value) return reply.value
def readRate(self): reply = self.execCommand(Command.rate) if reply.error: raise CommandError(reply.value) return reply.value
def stopInfusion(self): reply = self.execCommand(Command.setpause) if reply.error: raise CommandError(reply.value)
def remoteControl(self, doctrl): #1 : manual, 2 : PC control newmode = b'2' if doctrl else b'1' reply = self.execCommand(Command.mode, args=[newmode]) if reply.error: raise CommandError(reply.value)
def resetVolume(self): reply = self.execCommand(Command.resetvolume) if reply.error: raise CommandError(reply.value)
def readDrug(self): reply = self.execCommand(Command.readdrug) if reply.error: raise CommandError(reply.value) return reply.value
def readVolume(self): reply = self.execCommand(Command.readvar, flags=[VarId.volume]) if reply.error: raise CommandError(reply.value) return extractVolume(reply.value)
def clearEvents(self): super().clearEvents() reply = self.execCommand(Command.disspont) if reply.error: raise CommandError(reply.value)
def readDeviceType(self): reply = self.execCommand(Command.readfixed, flags=[FixedVarId.devicetype]) if reply.error: raise CommandError(reply.value) return reply.value
def connect(self): reply = self.execCommand(Command.connect) if reply.error: raise CommandError(reply.value) return reply.value