Blame view

src/device_controller/abstract_component/detector_shutter.py 2.57 KB
12c6569f   Etienne Pallier   Ajout des nouvell...
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env python3

"""
Filter selector (abstract) implementation

To be used as a base class (interface) for any concrete Filter selector class
"""


import sys

# from sockets_tele/
57621753   Etienne Pallier   NOUVELLE ARCHI un...
13
#sys.path.append("..")
12c6569f   Etienne Pallier   Ajout des nouvell...
14
15
16
# from src_socket/client/
#import src.core.pyros_django.utils.celme as celme

57621753   Etienne Pallier   NOUVELLE ARCHI un...
17
18
#sys.path.append("../../..")
#import src.core.celme as celme
12c6569f   Etienne Pallier   Ajout des nouvell...
19
20
21


# Local application imports
4783e5b5   Etienne Pallier   GROS RENOMMAGE de...
22
#from device_controller.abstract_component.base import *
57621753   Etienne Pallier   NOUVELLE ARCHI un...
23
#sys.path.append("../..")
d5281371   Etienne Pallier   un début de solut...
24
#from device_controller.abstract_component.base import *
e3278284   Etienne Pallier   Nouveau format co...
25
from device_controller.abstract_component.device_controller import printd, DeviceController, Cmd, Gen2NatCmds
d5281371   Etienne Pallier   un début de solut...
26

12c6569f   Etienne Pallier   Ajout des nouvell...
27

12c6569f   Etienne Pallier   Ajout des nouvell...
28
#class SocketClientTelescopeAbstract(SocketClientAbstract):
e0853b2e   Etienne Pallier   Bugfixes assert t...
29
30
#class DeviceControllerFilterSelector(DeviceController):
class DC_DetectorShutter(DeviceController):
57621753   Etienne Pallier   NOUVELLE ARCHI un...
31

12c6569f   Etienne Pallier   Ajout des nouvell...
32
    _cmd_device_concrete = {}
57621753   Etienne Pallier   NOUVELLE ARCHI un...
33
    #_cmd_device_abstract = {
e3278284   Etienne Pallier   Nouveau format co...
34
    GEN2NAT_CMDS_dict = {
57621753   Etienne Pallier   NOUVELLE ARCHI un...
35
36
        # (test only) will raise a NotImplementedException
        'do_unimplemented': [],
15d4b08f   Etienne Pallier   Fin grosse refact...
37

57621753   Etienne Pallier   NOUVELLE ARCHI un...
38
39
40
41
42
        'get_state': [],
        'do_open': [],
        'do_close': [],
        'do_sync': [],
    }
e3278284   Etienne Pallier   Nouveau format co...
43
44
45
46
47
48
49
50
51
52
53
    GEN2NAT_CMDS_obj = Gen2NatCmds([
        # (test only) will raise a NotImplementedException
        Cmd('do_unimplemented'),

        Cmd('get_state'),
        Cmd('do_open'),
        Cmd('do_close'),
        Cmd('do_sync'),
    ])
    GEN2NAT_CMDS = GEN2NAT_CMDS_dict
    GEN2NAT_CMDS = GEN2NAT_CMDS_obj
12c6569f   Etienne Pallier   Ajout des nouvell...
54
55
56


    #TODO: remplacer PROTOCOL par "SOCKET-TCP", "SOCKET-UDP", "SERIAL", ou "USB"
57621753   Etienne Pallier   NOUVELLE ARCHI un...
57
    #def __init__(self, device_host:str="localhost", device_port:int=11110, PROTOCOL:str="TCP", buffer_size=1024, DEBUG=False, device_sim=None):
ce74dbbb   Etienne Pallier   LOGGER unique : p...
58
    def __init__(self, device_host:str="localhost", device_port:int=11110, channel:str=None, buffer_size=None, protoc=None, gen2nat_cmds={}, device_sim=None):
12c6569f   Etienne Pallier   Ajout des nouvell...
59
60
61
62
63
        '''
        :param device_host: server IP or hostname
        :param device_port: server port
        :param PROTOCOL: "UDP" or "TCP"
        '''
bcf29d0f   Etienne Pallier   update controller...
64
        #self._my_gen2nat_cmds = { **self.GEN2NAT_CMDS, **gen2nat_cmds }
e3278284   Etienne Pallier   Nouveau format co...
65
66
67
68
        #my_gen2nat_cmds = { **self.GEN2NAT_CMDS, **gen2nat_cmds }
        #v4
        my_gen2nat_cmds = Gen2NatCmds({ **(self.GEN2NAT_CMDS.get_as_dict()), **(gen2nat_cmds.get_as_dict()) })
        
57621753   Etienne Pallier   NOUVELLE ARCHI un...
69
        #super().__init__(device_host, device_port, PROTOCOL, buffer_size, DEBUG, device_sim)
ce74dbbb   Etienne Pallier   LOGGER unique : p...
70
        super().__init__(device_host, device_port, channel, buffer_size, protoc=protoc, gen2nat_cmds=my_gen2nat_cmds, device_sim=device_sim)
d20a7876   Etienne Pallier   Nouveau format de...
71
        self.printd("IN DeviceControllerFilterSelector")
57621753   Etienne Pallier   NOUVELLE ARCHI un...
72

12c6569f   Etienne Pallier   Ajout des nouvell...
73
74
        # overwrite abstract _cmd dictionary with subclass native _cmd_native dictionary:
        #self._cmd = {**self._cmd, **self._cmd_native}