from common.models import * import abc from .Device import DeviceController ''' Device controller for NIRCamera. This class must implement set, get and do functions (DeviceController is an abstract) ''' #TODO: refactoriser cette classe, la seule méthode utilisée est sendMessage, les autres sont obsolètes class NIRCameraController(DeviceController): def __init__(self): super().__init__("CameraNIR") def get(self, command: str, *args): message = "GET " + command + " " + " ".join([str(arg) for arg in args]) self.sendMessage(message) return (self.blockAndReadMessage()) def set(self, command: str, *args): message = "SET " + command + " " + " ".join([str(arg) for arg in args]) return (self.sendMessage(message)) def do(self, command: str, *args): message = "DO " + command + " " + " ".join([str(arg) for arg in args]) return (self.sendMessage(message)) def getStatus(self): self.get("STATUS") return "OK" def park(self): return 0 def open_shutter(self): self.do("OPEN SHUTTER") return 0 def send_command(self, command): self.sendMessage(command) return self.blockAndReadMessage()