Blame view

src/device_controller/abstract_component/detector_sensor.py 3.08 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
26
27
28
from device_controller.abstract_component.device_controller import (
    printd, DeviceController,
    Cmd, Gen2NatCmds
)
12c6569f   Etienne Pallier   Ajout des nouvell...
29
30


12c6569f   Etienne Pallier   Ajout des nouvell...
31
32

#class SocketClientTelescopeAbstract(SocketClientAbstract):
e0853b2e   Etienne Pallier   Bugfixes assert t...
33
34
#class DeviceControllerFilterSelector(DeviceController):
class DC_DetectorSensor(DeviceController):
57621753   Etienne Pallier   NOUVELLE ARCHI un...
35

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

57621753   Etienne Pallier   NOUVELLE ARCHI un...
42
43
44
45
46
47
48
49
        # Get current status
        'get_state': [],
        'do_init': [],
        'do_start_acq': [],
        'do_stop_acq': [],
        'do_abort': [],
        'do_shutdown': [],
    }
e3278284   Etienne Pallier   Nouveau format co...
50
51
52
53
54
55
56
57
58
59
60
61
62
    GEN2NAT_CMDS_obj = Gen2NatCmds([
        # (test only) will raise a NotImplementedException
        Cmd('do_unimplemented'),
        # Get current status
        Cmd('get_state'),
        Cmd('do_init'),
        Cmd('do_start_acq'),
        Cmd('do_stop_acq'),
        Cmd('do_abort'),
        Cmd('do_shutdown'),
    ])
    GEN2NAT_CMDS = GEN2NAT_CMDS_dict
    GEN2NAT_CMDS = GEN2NAT_CMDS_obj
12c6569f   Etienne Pallier   Ajout des nouvell...
63
64
65


    #TODO: remplacer PROTOCOL par "SOCKET-TCP", "SOCKET-UDP", "SERIAL", ou "USB"
57621753   Etienne Pallier   NOUVELLE ARCHI un...
66
    #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...
67
68
    #def __init__(self, device_host:str="localhost", device_port:int=11110, channel:str=None, buffer_size=None, protoc=None, gen2nat_cmds={}, device_sim=None, DEBUG=False):
    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...
69
70
71
72
73
        '''
        :param device_host: server IP or hostname
        :param device_port: server port
        :param PROTOCOL: "UDP" or "TCP"
        '''
bcf29d0f   Etienne Pallier   update controller...
74
        #self._my_gen2nat_cmds = { **self.GEN2NAT_CMDS, **gen2nat_cmds }
e3278284   Etienne Pallier   Nouveau format co...
75
76
77
78
        #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...
79
        #super().__init__(device_host, device_port, PROTOCOL, buffer_size, DEBUG, device_sim)
ce74dbbb   Etienne Pallier   LOGGER unique : p...
80
81
        #super().__init__(device_host, device_port, channel, buffer_size, protoc=protoc, gen2nat_cmds=my_gen2nat_cmds, device_sim=device_sim, DEBUG=DEBUG)
        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...
82
        self.printd("IN DeviceControllerFilterSelector")
57621753   Etienne Pallier   NOUVELLE ARCHI un...
83

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