Blame view

src/device_controller/abstract_component/detector_shutter.py 2.16 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 *
d843e334   Etienne Pallier   renommé base.py e...
25
from device_controller.abstract_component.device_controller import DeviceControllerAbstract
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):
57621753   Etienne Pallier   NOUVELLE ARCHI un...
29
30
31
#class DeviceControllerFilterSelector(DeviceControllerAbstract):
class DC_DetectorShutter(DeviceControllerAbstract):

12c6569f   Etienne Pallier   Ajout des nouvell...
32
    _cmd_device_concrete = {}
57621753   Etienne Pallier   NOUVELLE ARCHI un...
33
34
35
36
37
38
39
40
41
    #_cmd_device_abstract = {
    MY_GEN2NAT_CMDS = {
        # (test only) will raise a NotImplementedException
        'do_unimplemented': [],
        'get_state': [],
        'do_open': [],
        'do_close': [],
        'do_sync': [],
    }
12c6569f   Etienne Pallier   Ajout des nouvell...
42
43
44


    #TODO: remplacer PROTOCOL par "SOCKET-TCP", "SOCKET-UDP", "SERIAL", ou "USB"
57621753   Etienne Pallier   NOUVELLE ARCHI un...
45
46
    #def __init__(self, device_host:str="localhost", device_port:int=11110, PROTOCOL:str="TCP", buffer_size=1024, DEBUG=False, device_sim=None):
    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):
12c6569f   Etienne Pallier   Ajout des nouvell...
47
48
49
50
51
        '''
        :param device_host: server IP or hostname
        :param device_port: server port
        :param PROTOCOL: "UDP" or "TCP"
        '''
57621753   Etienne Pallier   NOUVELLE ARCHI un...
52
53
54
55
56
57
        print("IN DeviceControllerFilterSelector")
        #self._my_gen2nat_cmds = { **self.MY_GEN2NAT_CMDS, **gen2nat_cmds }
        my_gen2nat_cmds = { **self.MY_GEN2NAT_CMDS, **gen2nat_cmds }
        #super().__init__(device_host, device_port, PROTOCOL, buffer_size, DEBUG, device_sim)
        super().__init__(device_host, device_port, channel, buffer_size, protoc=protoc, gen2nat_cmds=my_gen2nat_cmds, device_sim=device_sim, DEBUG=DEBUG)

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