NIRCamera.py 1.35 KB
from pyrosapp.models import *
from .Device import DeviceObj
from enum import Enum
import configparser

CONFIG_FILE = "../simulators/socket_config.ini"

class ReadmodeEnum(Enum):
    ramp = "Ramp"
    # TODO: définir les modes de lecture

class ShutterEnum(Enum):
    synchro = "Synchro"
    closed = "Closed"
    opened = "Opened"

class FilterEnum(Enum):
    t = "T"
    h = "H"
    # TODO: définir les noms des filtres

class NIRCameraObj(DeviceObj):

    def __init__(self):
        super().__init__()

        self.set_msgs = [
            ("WINDOW", [4, ], int),
            ("READMODE", [1, ], ReadmodeEnum),
            ("FILENAME", [1, ], str),
            ("HEADER", [1, ], dict),
            ("READOUT_FREQUENCY", [1, ], float),
            ("NB_IMAGES", [1, ], int),
            ("FILTER", [1, ], FilterEnum)
        ]

        self.get_msgs = [
            "STATUS",
            "SETUP",
            "TEMPERATURE",
            "TIMER",
        ]

        self.do_msgs = [
            ("COOLER", [2, ], float),
            ("SHUTTER", [1, ], ShutterEnum),
            ("START", [0, ]),
            ("ABORT", [0, ]),
            ("STOP", [0, ]),
        ]

        config = configparser.ConfigParser()
        config.read(CONFIG_FILE)

        self.ip = config.get("CameraNIR", "ip")
        self.port = int(config.get("CameraNIR", "port"))

        print(self.ip, self.port)