Commit 60f21340c98e799cf5a0475de84c674703360e0b
1 parent
cbed2644
Exists in
dev
diagramme général des classes assez complet (agent, device et channel)
Showing
3 changed files
with
25 additions
and
18 deletions
Show diff stats
src/core/pyros_django/majordome/doc/AgentMajordome_object_diag.pu
... | ... | @@ -77,11 +77,12 @@ AgentDeviceSBIG_CXZ347 --> DeviceControllerSBIG :use |
77 | 77 | |
78 | 78 | object DeviceSimulatorSBIG #lightblue |
79 | 79 | DeviceControllerSBIG o- DeviceSimulatorSBIG |
80 | +DeviceControllerSBIG --|> DeviceControllerAbstract | |
80 | 81 | DeviceControllerSBIG <---> sbig_device :> channel/socket |
81 | 82 | |
82 | -DeviceControllerSBIG --|> DeviceControllerDetectorSensor | |
83 | -DeviceControllerSBIG --|> DeviceControllerDetectorShutter | |
84 | -DeviceControllerSBIG --|> DeviceControllerFilterSelector | |
83 | +DeviceControllerSBIG o-down- DeviceControllerDetectorSensor | |
84 | +DeviceControllerSBIG o-down- DeviceControllerDetectorShutter | |
85 | +DeviceControllerSBIG o-down- DeviceControllerFilterSelector | |
85 | 86 | |
86 | 87 | DeviceControllerDetectorSensor --|> DeviceControllerAbstract |
87 | 88 | DeviceControllerDetectorShutter --|> DeviceControllerAbstract |
... | ... | @@ -92,9 +93,16 @@ class DeviceControllerTelescope #lightblue |
92 | 93 | object DeviceControllerTelescopeGemini <<Singleton>> #lightblue |
93 | 94 | AgentDeviceTelescopeGemini_A1CZ3 --> DeviceControllerTelescopeGemini :use |
94 | 95 | object DeviceSimulatorTelescopeGemini #lightblue |
95 | -DeviceControllerTelescopeGemini o-.left. DeviceSimulatorTelescopeGemini | |
96 | +DeviceControllerTelescopeGemini o-left- DeviceSimulatorTelescopeGemini | |
96 | 97 | DeviceControllerTelescopeGemini <---> gemini_device :> channel/socket |
97 | 98 | DeviceControllerTelescopeGemini --|> DeviceControllerTelescope |
98 | 99 | DeviceControllerTelescope --|> DeviceControllerAbstract |
99 | 100 | |
101 | + | |
102 | +/' Channels '/ | |
103 | +ClientChannel <|-- ClientSerial | |
104 | +ClientChannel <|-- ClientSocket | |
105 | +ClientChannel <|-- ClientUSB | |
106 | +DeviceControllerAbstract o-- ClientChannel | |
107 | + | |
100 | 108 | @enduml | ... | ... |
src/device_controller/abstract_component/base.py
... | ... | @@ -103,7 +103,8 @@ class DeviceCommand: |
103 | 103 | return cmd_name.startswith('do_') or cmd_name.startswith('get_') or cmd_name.startswith('set_') |
104 | 104 | |
105 | 105 | def is_generic(self): |
106 | - return DeviceCommand.is_generic_cmd_name(self.full_name) | |
106 | + return self.is_generic_cmd_name(self.full_name) | |
107 | + #return DeviceCommand.is_generic_cmd_name(self.full_name) | |
107 | 108 | #return self.name.startswith('do_') or self.name.startswith('get_') or self.name.startswith('set_') |
108 | 109 | |
109 | 110 | @property |
... | ... | @@ -181,8 +182,8 @@ class DeviceControllerAbstract(): |
181 | 182 | _device_host = "localhost" |
182 | 183 | _device_port = None |
183 | 184 | |
184 | - # List of device component types (by default, None) | |
185 | - _my_dc_component_types = [] | |
185 | + # List of device controller (dc) components (by default, None) | |
186 | + _my_dc_components = [] | |
186 | 187 | |
187 | 188 | # ClientChannel used by the device controller (to be set during __init__ via set_client_channel()) |
188 | 189 | my_channel = None |
... | ... | @@ -415,10 +416,10 @@ class DeviceControllerAbstract(): |
415 | 416 | # ex1: None |
416 | 417 | # ex2: "Telescope" (is in "AgentDeviceTelescopeGemini") |
417 | 418 | if dc_component_type is None or dc_component_type in self.__class__.__name__ : return self |
418 | - for dcct in self._my_dc_component_types: | |
419 | - #if dc_component_type in type(dcct): | |
419 | + for dcct in self._my_dc_components: | |
420 | 420 | print(dc_component_type, "in ?", dcct.__class__.__name__) |
421 | - if dc_component_type in dcct.__class__.__name__: | |
421 | + #if dc_component_type in dcct.__class__.__name__: | |
422 | + if dc_component_type in type(dcct).__name__: | |
422 | 423 | return dcct |
423 | 424 | raise Exception("NO DEVICE CONTROLLER COMPONENT FOUND FOR THIS TYPE: "+dc_component_type) |
424 | 425 | |
... | ... | @@ -543,10 +544,10 @@ class DeviceControllerAbstract(): |
543 | 544 | :param value: only for a "set_" cmd |
544 | 545 | ''' |
545 | 546 | |
546 | - # If generic_cmd is for a specific device component, pass it to this device component (instead of me) | |
547 | + # If generic_cmd is for a specific device component (dc), pass it to this dc (instead of me) | |
547 | 548 | print(dc_component_type, "is not in ???", None, self.__class__.__name__) |
548 | - if dc_component_type: | |
549 | 549 | ####if dc_component_type and dc_component_type not in self.__class__.__name__ : |
550 | + if dc_component_type: | |
550 | 551 | dc = self.get_dc_component_for_type(dc_component_type) |
551 | 552 | print("*** EXECUTÉ PAR COMPONENT", dc) |
552 | 553 | return dc.execute_generic_cmd(generic_cmd, values_to_set) |
... | ... | @@ -587,9 +588,9 @@ class DeviceControllerAbstract(): |
587 | 588 | native_res = self.execute_native_cmd(native_cmd) |
588 | 589 | ok = True if not awaited_res_if_ok else (native_res == awaited_res_if_ok) |
589 | 590 | return GenericResult(native_res, ok) |
590 | - | |
591 | 591 | |
592 | - | |
592 | + | |
593 | + | |
593 | 594 | ''' |
594 | 595 | **************************** |
595 | 596 | **************************** | ... | ... |
src/device_controller/concrete_component/sbig/sbig_controller.py
... | ... | @@ -107,12 +107,10 @@ class DeviceControllerSBIG(DeviceControllerAbstract): |
107 | 107 | myDC_detector_sensor = DeviceControllerDetectorSensor(device_host, device_port, "SOCKET-UDP", 1024, DEBUG) |
108 | 108 | myDC_detector_shutter = DeviceControllerDetectorShutter(device_host, device_port, "SOCKET-UDP", 1024, DEBUG) |
109 | 109 | myDC_filter_selector = DeviceControllerFilterSelector(device_host, device_port, "SOCKET-UDP", 1024, DEBUG) |
110 | - self._my_device_component_types.append(myDC_detector_sensor) | |
111 | - self._my_device_component_types.append(myDC_detector_shutter) | |
112 | - self._my_device_component_types.append(myDC_filter_selector) | |
110 | + # @override superclass empty list | |
111 | + self._my_dc_components = [myDC_detector_sensor, myDC_detector_shutter, myDC_filter_selector] | |
113 | 112 | |
114 | 113 | |
115 | - | |
116 | 114 | # @overwrite |
117 | 115 | def formated_cmd(self, cmd:str, values_to_set:str=None)->str: |
118 | 116 | if values_to_set != None: | ... | ... |