Blame view

src/device_controller/abstract_component/detector_sensor.py 2.52 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 *
1cf4a67f   Etienne Pallier   Affichage console...
25
from device_controller.abstract_component.device_controller import printd, DeviceController
12c6569f   Etienne Pallier   Ajout des nouvell...
26
27


12c6569f   Etienne Pallier   Ajout des nouvell...
28
29

#class SocketClientTelescopeAbstract(SocketClientAbstract):
e0853b2e   Etienne Pallier   Bugfixes assert t...
30
31
#class DeviceControllerFilterSelector(DeviceController):
class DC_DetectorSensor(DeviceController):
57621753   Etienne Pallier   NOUVELLE ARCHI un...
32

12c6569f   Etienne Pallier   Ajout des nouvell...
33
    _cmd_device_concrete = {}
57621753   Etienne Pallier   NOUVELLE ARCHI un...
34
    #_cmd_device_abstract = {
bcf29d0f   Etienne Pallier   update controller...
35
    GEN2NAT_CMDS = {
57621753   Etienne Pallier   NOUVELLE ARCHI un...
36
37
        # (test only) will raise a NotImplementedException
        'do_unimplemented': [],
15d4b08f   Etienne Pallier   Fin grosse refact...
38

57621753   Etienne Pallier   NOUVELLE ARCHI un...
39
40
41
42
43
44
45
46
        # Get current status
        'get_state': [],
        'do_init': [],
        'do_start_acq': [],
        'do_stop_acq': [],
        'do_abort': [],
        'do_shutdown': [],
    }
12c6569f   Etienne Pallier   Ajout des nouvell...
47
48
49


    #TODO: remplacer PROTOCOL par "SOCKET-TCP", "SOCKET-UDP", "SERIAL", ou "USB"
57621753   Etienne Pallier   NOUVELLE ARCHI un...
50
    #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...
51
52
    #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...
53
54
55
56
57
        '''
        :param device_host: server IP or hostname
        :param device_port: server port
        :param PROTOCOL: "UDP" or "TCP"
        '''
bcf29d0f   Etienne Pallier   update controller...
58
59
        #self._my_gen2nat_cmds = { **self.GEN2NAT_CMDS, **gen2nat_cmds }
        my_gen2nat_cmds = { **self.GEN2NAT_CMDS, **gen2nat_cmds }
57621753   Etienne Pallier   NOUVELLE ARCHI un...
60
        #super().__init__(device_host, device_port, PROTOCOL, buffer_size, DEBUG, device_sim)
ce74dbbb   Etienne Pallier   LOGGER unique : p...
61
62
        #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...
63
        self.printd("IN DeviceControllerFilterSelector")
57621753   Etienne Pallier   NOUVELLE ARCHI un...
64

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