Blame view

src/common/NIRCamera.py 1.35 KB
ec372f36   haribo   Date: 28/06/2016
1
2
3
from pyrosapp.models import *
from .Device import DeviceObj
from enum import Enum
00fa2456   haribo   Debug adaption code
4
5
6
import configparser

CONFIG_FILE = "../simulators/socket_config.ini"
ec372f36   haribo   Date: 28/06/2016
7
8
9
10
11
12
13
14
15
16

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

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

00fa2456   haribo   Debug adaption code
17
18
19
20
class FilterEnum(Enum):
    t = "T"
    h = "H"
    # TODO: définir les noms des filtres
ec372f36   haribo   Date: 28/06/2016
21

00fa2456   haribo   Debug adaption code
22
class NIRCameraObj(DeviceObj):
ad85da7c   haribo   Date: 28/06/2016
23

ec372f36   haribo   Date: 28/06/2016
24
25
26
27
28
29
30
31
32
33
    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),
00fa2456   haribo   Debug adaption code
34
            ("FILTER", [1, ], FilterEnum)
ec372f36   haribo   Date: 28/06/2016
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
        ]

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

        self.do_msgs = [
            ("COOLER", [2, ], float),
            ("SHUTTER", [1, ], ShutterEnum),
            ("START", [0, ]),
            ("ABORT", [0, ]),
            ("STOP", [0, ]),
        ]
00fa2456   haribo   Debug adaption code
51
52
53
54
55
56
57
58

        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)