Commit 8e15e89371420cf8b0e530192a3a8e29e450bc0f

Authored by Etienne Pallier
1 parent 1957c45d
Exists in dev

Renommé classes Command => AgentCmd et DeviceCommand => DeviceCmd

Et introduction de la nouvelle classe Cmd pour définir une nouvelle
commande
src/core/pyros_django/agent/Agent.py
... ... @@ -115,7 +115,7 @@ import config
115 115 #from config import PYROS_ENV, ROOT_DIR, DOC_DIR
116 116 #from config import *
117 117  
118   -from common.models import AgentSurvey, Command, AgentLogs
  118 +from common.models import AgentSurvey, AgentCmd, AgentLogs
119 119 from config.configpyros import ConfigPyros
120 120 #from dashboard.views import get_sunelev
121 121 #from devices.TelescopeRemoteControlDefault import TelescopeRemoteControlDefault
... ... @@ -389,7 +389,7 @@ class Agent:
389 389 _computer_description = ''
390 390  
391 391 # Current and next command to send
392   - _cmdts:Command = None
  392 + _cmdts:AgentCmd = None
393 393 _next_cmdts = None
394 394  
395 395 _agent_survey = None
... ... @@ -606,7 +606,7 @@ class Agent:
606 606  
607 607 # Avoid blocking on false "running" commands
608 608 # (old commands that stayed with "running" status when agent was killed)
609   - Command.delete_commands_with_running_status_for_agent(self.name)
  609 + AgentCmd.delete_commands_with_running_status_for_agent(self.name)
610 610  
611 611 self._iter_num = 1
612 612 self._DO_MAIN_LOOP = True
... ... @@ -715,7 +715,7 @@ class Agent:
715 715 N=5
716 716 if ((self._iter_num-1) % N) == 0:
717 717 self.print("Purging old commands if exists")
718   - #Command.purge_old_commands_for_agent(self.name)
  718 + #AgentCmd.purge_old_commands_for_agent(self.name)
719 719 self._purge_old_commands_sent_to_me()
720 720  
721 721 # Get next command and process it (if exists)
... ... @@ -778,14 +778,14 @@ class Agent:
778 778 if self.TEST_MODE:
779 779 self.printd("[IN TEST MODE]")
780 780 self.print("Flush previous commands to be sure to start in clean state")
781   - Command.delete_pending_commands_for_agent(self.name)
  781 + AgentCmd.delete_pending_commands_for_agent(self.name)
782 782 else:
783 783 self.printd("[IN NORMAL MODE]")
784 784 self.TEST_MAX_DURATION_SEC=None
785 785  
786 786  
787 787 def _purge_old_commands_sent_to_me(self):
788   - Command.purge_old_commands_sent_to_agent(self.name)
  788 + AgentCmd.purge_old_commands_sent_to_agent(self.name)
789 789  
790 790  
791 791 def _routine_process(self):
... ... @@ -822,14 +822,14 @@ class Agent:
822 822 ###
823 823 COMMAND_PEREMPTION_DATE_FROM_NOW = datetime.utcnow() - timedelta(hours = self.COMMANDS_PEREMPTION_HOURS)
824 824 #self.printd("peremption date", COMMAND_PEREMPTION_DATE_FROM_NOW)
825   - old_commands = Command.objects.filter(
  825 + old_commands = AgentCmd.objects.filter(
826 826 # only commands for me
827 827 recipient = self.name,
828 828 # only pending commands
829 829 sender_deposit_time__lt = COMMAND_PEREMPTION_DATE_FROM_NOW,
830 830 )
831 831 ###
832   - old_commands = Command.get_old_commands_for_agent(self.name)
  832 + old_commands = AgentCmd.get_old_commands_for_agent(self.name)
833 833 if old_commands.exists():
834 834 self.printd("Found old commands to delete:")
835 835 for cmd in old_commands: self.printd(cmd)
... ... @@ -1037,7 +1037,7 @@ class Agent:
1037 1037 """
1038 1038 def send_command(self, cmd_name):
1039 1039 recipient_agent = self.name if self.TEST_COMMANDS_DEST=="myself" else self.TEST_COMMANDS_DEST
1040   - Command.objects.create(sender=self.name, recipient=recipient_agent, name=cmd_name)
  1040 + AgentCmd.objects.create(sender=self.name, recipient=recipient_agent, name=cmd_name)
1041 1041 """
1042 1042 #def send_command(self, to_agent, cmd_type, cmd_name, cmd_args=None):
1043 1043 def send_cmd_to(self, to_agent, cmd_name, cmd_args=None):
... ... @@ -1045,19 +1045,19 @@ class Agent:
1045 1045 #ex: send_command(“AgentX”,”GENERIC”,”EVAL”,“3+4”)
1046 1046 ex: send_command(“AgentX”,"EVAL”,“3+4”)
1047 1047 """
1048   - #return Command.send_cmd(self.name, self._get_real_agent_name_for_alias(to_agent), cmd_name, cmd_args)
  1048 + #return AgentCmd.send_cmd(self.name, self._get_real_agent_name_for_alias(to_agent), cmd_name, cmd_args)
1049 1049 cmd = self.create_cmd_for(to_agent, cmd_name, cmd_args)
1050 1050 cmd.send()
1051 1051 return cmd
1052 1052  
1053   - def create_cmd_for(self, to_agent, cmd_name, cmd_args=None)->Command:
  1053 + def create_cmd_for(self, to_agent, cmd_name, cmd_args=None)->AgentCmd:
1054 1054 '''
1055 1055 real_agent_name = self._get_real_agent_name(to_agent)
1056 1056 real_cmd_name = cmd_name
1057 1057 if '.' in real_agent_name:
1058 1058 real_agent_name, component_name = real_agent_name.split('.')
1059 1059 real_cmd_name = component_name+'.'+cmd_name
1060   - return Command.create(self.name, real_agent_name, real_cmd_name, cmd_args)
  1060 + return AgentCmd.create(self.name, real_agent_name, real_cmd_name, cmd_args)
1061 1061 try:
1062 1062 real_agent_name = self._get_real_agent_name(to_agent)
1063 1063 except KeyError as e:
... ... @@ -1068,16 +1068,16 @@ class Agent:
1068 1068 #self.log_e("Exception raised", e)
1069 1069 self.log_e(f"=> Thus, I do not send this command '{cmd_name}'")
1070 1070 return None
1071   - return Command.create(self.name, real_agent_name, cmd_name, cmd_args)
  1071 + return AgentCmd.create(self.name, real_agent_name, cmd_name, cmd_args)
1072 1072 '''
1073   - return Command(
  1073 + return AgentCmd(
1074 1074 sender=self.name,
1075 1075 recipient=self._get_real_agent_name_for_alias(recipient_agent_alias_name),
1076 1076 name=cmd_name
1077 1077 )
1078 1078 '''
1079 1079  
1080   - def _get_next_valid_and_not_running_command(self)->Command:
  1080 + def _get_next_valid_and_not_running_command(self)->AgentCmd:
1081 1081 """
1082 1082 Return next VALID (not expired) command (read from the DB command table)
1083 1083 which is relevant to this agent.
... ... @@ -1091,13 +1091,13 @@ class Agent:
1091 1091 # but there might be a risk
1092 1092 # that a command status is modified while we are reading...
1093 1093 with transaction.atomic():
1094   - self._pending_commands = Command.get_pending_and_running_commands_for_agent(self.name)
  1094 + self._pending_commands = AgentCmd.get_pending_and_running_commands_for_agent(self.name)
1095 1095 commands = self._pending_commands
1096 1096 if not commands.exists():
1097 1097 self.print("<None>")
1098 1098 return None
1099 1099 self.printd("Current pending (or running) commands are (time ordered):")
1100   - Command.show_commands(commands)
  1100 + AgentCmd.show_commands(commands)
1101 1101  
1102 1102 # 2) If there is a "do_exit" or "do_abort" command pending (even at the end of the list),
1103 1103 # which is VALID (not expired),
... ... @@ -1165,7 +1165,7 @@ class Agent:
1165 1165  
1166 1166  
1167 1167 #def _exec_agent_general_cmd(self, cmd:Command):
1168   - def _exec_agent_cmd(self, cmd:Command):
  1168 + def _exec_agent_cmd(self, cmd:AgentCmd):
1169 1169  
1170 1170 #self.print(f"Starting execution of an AGENT LEVEL cmd {cmd}...")
1171 1171 self.print(f"Starting execution of an AGENT LEVEL cmd...")
... ... @@ -1210,7 +1210,7 @@ class Agent:
1210 1210 time.sleep(1)
1211 1211 elif cmd_name in ("do_flush_commands"):
1212 1212 self.printd("flush_commands received: Delete all pending commands")
1213   - Command.delete_pending_commands_for_agent(self.name)
  1213 + AgentCmd.delete_pending_commands_for_agent(self.name)
1214 1214 cmd.set_result('DONE')
1215 1215 elif cmd_name in ("do_abort", "do_exit", "do_restart_init"):
1216 1216 #self.printd("Current pending commands are:")
... ... @@ -1243,8 +1243,8 @@ class Agent:
1243 1243 # This "do_exit" should normally kill any current thread (to be checked...)
1244 1244 if cmd.name == "do_exit":
1245 1245 self.print("Before exiting, Here are (if exists) the current (still) pending commands (time ordered) :")
1246   - commands = Command.get_pending_and_running_commands_for_agent(self.name)
1247   - Command.show_commands(commands, True)
  1246 + commands = AgentCmd.get_pending_and_running_commands_for_agent(self.name)
  1247 + AgentCmd.show_commands(commands, True)
1248 1248 #if self.TEST_MODE and self.TEST_WITH_FINAL_TEST and self.TEST_COMMANDS_DEST == "myself": self.simulator_test_results()
1249 1249 if self.TEST_MODE and self.TEST_WITH_FINAL_TEST:
1250 1250 self._TEST_test_results()
... ... @@ -1264,14 +1264,14 @@ class Agent:
1264 1264 self.printd("Logging data...")
1265 1265 '''
1266 1266  
1267   - def exec_cmd_from_its_name(self, cmd:Command):
  1267 + def exec_cmd_from_its_name(self, cmd:AgentCmd):
1268 1268 func = cmd.name
1269 1269 if cmd.args:
1270 1270 return getattr(self, func)(*cmd.args)
1271 1271 else:
1272 1272 return getattr(self, func)()
1273 1273  
1274   - def is_agent_level_cmd(self, cmd:Command):
  1274 + def is_agent_level_cmd(self, cmd:AgentCmd):
1275 1275 return cmd.is_agent_general_cmd() or self._is_agent_specific_cmd(cmd)
1276 1276  
1277 1277 '''
... ... @@ -1292,7 +1292,7 @@ class Agent:
1292 1292 self._exec_agent_specific_cmd(cmd)
1293 1293 '''
1294 1294  
1295   - def _is_agent_specific_cmd(self, cmd:Command):
  1295 + def _is_agent_specific_cmd(self, cmd:AgentCmd):
1296 1296 return cmd.name in self.AGENT_SPECIFIC_COMMANDS
1297 1297  
1298 1298 '''
... ... @@ -1318,12 +1318,12 @@ class Agent:
1318 1318  
1319 1319 # to be overriden by subclass (AgentDevice)
1320 1320 # @abstract
1321   - def exec_device_cmd_if_possible(self, cmd:Command):
  1321 + def exec_device_cmd_if_possible(self, cmd:AgentCmd):
1322 1322 pass
1323 1323  
1324 1324 # TO BE OVERRIDEN by subclass (AgentDevice)
1325 1325 # @abstract
1326   - def exec_device_cmd(self, cmd:Command):
  1326 + def exec_device_cmd(self, cmd:AgentCmd):
1327 1327 #self.exec_cmd_from_its_name(cmd)
1328 1328 pass
1329 1329  
... ... @@ -1344,7 +1344,7 @@ class Agent:
1344 1344 def _set_test_mode(self, mode:bool):
1345 1345 self.TEST_MODE=mode
1346 1346  
1347   - def _TEST_get_next_command_to_send(self)->Command:
  1347 + def _TEST_get_next_command_to_send(self)->AgentCmd:
1348 1348 cmd_full_name = next(self.TEST_COMMANDS, None)
1349 1349 #return cmd_name
1350 1350 if cmd_full_name is None: return None
... ... @@ -1519,8 +1519,8 @@ class Agent:
1519 1519 #commands = Command.get_last_N_commands_sent_to_agent(self.name, 16)
1520 1520 nb_commands = len(self.TEST_COMMANDS_LIST)
1521 1521 if "ad_unknown get_dec" in self.TEST_COMMANDS_LIST: nb_commands -= 1
1522   - commands = Command.get_last_N_commands_sent_by_agent(self.name, nb_commands)
1523   - Command.show_commands(commands)
  1522 + commands = AgentCmd.get_last_N_commands_sent_by_agent(self.name, nb_commands)
  1523 + AgentCmd.show_commands(commands)
1524 1524 return nb_commands, commands
1525 1525 """ OLD SCENARIO
1526 1526 nb_asserted = 0
... ...
src/core/pyros_django/agent/AgentDevice.py
... ... @@ -10,13 +10,13 @@ import time
10 10 ##from .Agent import Agent
11 11 sys.path.append("..")
12 12 from agent.Agent import Agent, build_agent, StoppableThreadEvenWhenSleeping
13   -from common.models import AgentDeviceStatus, Command, get_or_create_unique_row_from_model
  13 +from common.models import AgentDeviceStatus, AgentCmd, get_or_create_unique_row_from_model
14 14  
15 15  
16 16 sys.path.append("../../..")
17 17 from device_controller.abstract_component.device_controller import (
18 18 DeviceController,
19   - DeviceCommand,
  19 + DeviceCmd,
20 20 DeviceTimeoutException,
21 21 UnknownGenericCmdException, UnimplementedGenericCmdException, DCCNotFoundException, UnknownNativeCmdException
22 22 )
... ... @@ -217,11 +217,11 @@ class AgentDevice(Agent):
217 217 """
218 218  
219 219 # @override superclass (Agent) method
220   - def is_device_level_cmd(self, cmd:Command):
221   - return self._device_ctrl.is_valid_cmd(DeviceCommand(cmd.full_name))
  220 + def is_device_level_cmd(self, cmd:AgentCmd):
  221 + return self._device_ctrl.is_valid_cmd(DeviceCmd(cmd.full_name))
222 222  
223   - def is_device_generic_but_UNIMPLEMENTED_cmd(self, cmd:Command):
224   - return self._device_ctrl.is_generic_but_UNIMPLEMENTED_cmd(DeviceCommand(cmd.full_name))
  223 + def is_device_generic_but_UNIMPLEMENTED_cmd(self, cmd:AgentCmd):
  224 + return self._device_ctrl.is_generic_but_UNIMPLEMENTED_cmd(DeviceCmd(cmd.full_name))
225 225  
226 226 def _is_running_device_cmd(self):
227 227 #return (self._current_device_cmd_thread is not None) or self._current_device_cmd_thread.is_alive()
... ... @@ -229,7 +229,7 @@ class AgentDevice(Agent):
229 229 return self._current_device_cmd_thread and self._current_device_cmd_thread.is_alive()
230 230  
231 231 # @override superclass (Agent) method
232   - def exec_device_cmd_if_possible(self, cmd:Command):
  232 + def exec_device_cmd_if_possible(self, cmd:AgentCmd):
233 233  
234 234 self._set_status(self.STATUS_SPECIFIC_PROCESS)
235 235 #self.print(f"Starting execution of a DEVICE cmd {cmd}")
... ... @@ -567,7 +567,7 @@ class AgentDevice(Agent):
567 567  
568 568 # This method is also called DIRECTLY from routine_process().get_device_status() (NOT FROM A THREAD)
569 569 # @override parent class (Agent)
570   - def exec_device_cmd(self, cmd:Command):
  570 + def exec_device_cmd(self, cmd:AgentCmd):
571 571 #cmd = self._current_device_cmd
572 572 self.tprintd("*** DEVICE cmd name is", cmd.name)
573 573 self.tprintd("*** PASS IT TO DEVICE TYPE", cmd.device_type)
... ...
src/core/pyros_django/common/admin.py
... ... @@ -233,7 +233,7 @@ class AlbumAdmin(PyrosModelAdmin):
233 233 # Link the models to the admin interface
234 234  
235 235 # (EP added 10/7/19)
236   -admin.site.register(Command)
  236 +admin.site.register(AgentCmd)
237 237 admin.site.register(AgentLogs)
238 238 admin.site.register(AgentSurvey)
239 239 admin.site.register(AgentDeviceStatus)
... ...
src/core/pyros_django/common/models.py
... ... @@ -17,7 +17,7 @@ from model_utils import Choices
17 17 # Project imports
18 18 # DeviceCommand is used by class Command
19 19 sys.path.append("../../..")
20   -from src.device_controller.abstract_component.device_controller import DeviceCommand
  20 +from src.device_controller.abstract_component.device_controller import DeviceCmd
21 21  
22 22 '''
23 23 NOT USED - to be removed
... ... @@ -401,7 +401,7 @@ class Alert(Request):
401 401  
402 402  
403 403  
404   -class Command(models.Model):
  404 +class AgentCmd(models.Model):
405 405  
406 406 """
407 407 | id | sender | recipient | name | validity_duration (default=60) | s_deposit_time | r_read_time
... ... @@ -539,7 +539,7 @@ class Command(models.Model):
539 539 #s_deposit_time__gte = cls.get_peremption_date_from_now(),
540 540 )
541 541 if running_commands:
542   - Command.show_commands(running_commands)
  542 + AgentCmd.show_commands(running_commands)
543 543 running_commands.delete()
544 544 else: printd("<None>")
545 545  
... ... @@ -565,7 +565,7 @@ class Command(models.Model):
565 565 s_deposit_time__lt = now_minus_2sec
566 566 )
567 567 if pending_commands:
568   - Command.show_commands(pending_commands)
  568 + AgentCmd.show_commands(pending_commands)
569 569 pending_commands.delete()
570 570 else: printd("<None>")
571 571  
... ... @@ -649,7 +649,7 @@ class Command(models.Model):
649 649 else: printd("-", cmd.name, cmd)
650 650  
651 651  
652   - # -------------- Command INSTANCE METHODS --------------
  652 + # -------------- AgentCmd INSTANCE METHODS --------------
653 653  
654 654 def __str__(self):
655 655 #return (f"Commmand '{self.name}' ({self.state}) sent by agent {self.sender} to agent {self.recipient} at {self.s_deposit_time}")
... ... @@ -659,7 +659,7 @@ class Command(models.Model):
659 659 @property
660 660 def device_command(self):
661 661 if not self._device_command:
662   - self._device_command = DeviceCommand(self.full_name)
  662 + self._device_command = DeviceCmd(self.full_name)
663 663 #dc = self._device_command
664 664 #print("...DEVICE CMD:", dc.full_name, dc.name, dc.devtype, dc.args)
665 665 return self._device_command
... ...
src/core/pyros_django/monitoring/views.py
1 1 from django.http import HttpResponse
2 2 from django.shortcuts import render
3   -from common.models import Command
  3 +from common.models import AgentCmd
4 4  
5 5 # Create your views here.
6 6  
... ... @@ -41,7 +41,7 @@ def weather_config_update(request):
41 41 # <class 'list'>: ['monitor_name_switch', 'None', 'Came:/S/N_A5EM:/Power_input', 'Rain_boolean']
42 42 if "Error_code" in cmd_args:
43 43 something = 5/0
44   - Command.send_command('Dashboard', 'AgentM', cmd_name, cmd_args)
  44 + AgentCmd.send_command('Dashboard', 'AgentM', cmd_name, cmd_args)
45 45  
46 46 #TODO: Pour l'instant, on ne recupere pas encore ce retour
47 47  
... ...
src/device_controller/abstract_component/device_controller.py
... ... @@ -9,6 +9,7 @@ To be used as a base class (interface) for any concrete socket client telescope
9 9 # Standard library imports
10 10 #from enum import Enum
11 11 import copy
  12 +from dataclasses import dataclass, field
12 13 import functools
13 14 #import inspect
14 15 import logging
... ... @@ -18,6 +19,9 @@ import socket
18 19 import sys
19 20 import threading
20 21 import time
  22 +from typing import Dict
  23 +
  24 +
21 25  
22 26 # Third party imports
23 27  
... ... @@ -99,7 +103,7 @@ def recursive_search(f):
99 103 return wrapped
100 104  
101 105  
102   -class DeviceCommand:
  106 +class DeviceCmd:
103 107  
104 108 full_name:str = ''
105 109 name = None
... ... @@ -141,7 +145,7 @@ class DeviceCommand:
141 145 def is_generic(self):
142 146 #return type(self).is_generic_cmd_name(self.full_name)
143 147 return self.is_generic_cmd_name(self.full_name)
144   - #return DeviceCommand.is_generic_cmd_name(self.full_name)
  148 + #return DeviceCmd.is_generic_cmd_name(self.full_name)
145 149 #return self.name.startswith('do_') or self.name.startswith('get_') or self.name.startswith('set_')
146 150 '''
147 151  
... ... @@ -251,11 +255,8 @@ class UnexpectedCommandReturnCode(Exception):
251 255 class DeviceTimeoutException(Exception):
252 256 pass
253 257  
254   -#from dataclasses import dataclass, field
255   -from typing import Dict
256 258  
257 259  
258   -'''
259 260 @dataclass
260 261 class Cmd:
261 262 generic_name: str = 'generic name'
... ... @@ -265,7 +266,6 @@ class Cmd:
265 266 final_simul_response: str = 'simulator response'
266 267 immediate_responses: Dict[str, str] = field(default_factory=dict)
267 268 errors: Dict[str, str] = field(default_factory=dict)
268   -'''
269 269  
270 270 class Gen2NatCmds:
271 271 # To be set by constructor
... ... @@ -800,7 +800,7 @@ class DeviceController():
800 800 return dcc
801 801 raise DCCNotFoundException("DEVICE CONTROLLER COMPONENT NOT FOUND: "+dc_component_type)
802 802  
803   - def is_valid_cmd(self, cmd:DeviceCommand):
  803 + def is_valid_cmd(self, cmd:DeviceCmd):
804 804 self.printd("cmd.name is", cmd.name)
805 805 self.printd(cmd)
806 806 self.printd("generic ?", cmd.is_generic())
... ... @@ -811,23 +811,23 @@ class DeviceController():
811 811 self.is_valid_native_cmd(cmd)
812 812 )
813 813  
814   - def is_generic_but_UNIMPLEMENTED_cmd(self, cmd:DeviceCommand):
  814 + def is_generic_but_UNIMPLEMENTED_cmd(self, cmd:DeviceCmd):
815 815 return cmd.is_generic() and not self.is_implemented_generic_cmd(cmd)
816 816  
817 817 # WRAPPER methods
818   - def has_generic_cmd(self, cmd:DeviceCommand):
  818 + def has_generic_cmd(self, cmd:DeviceCmd):
819 819 #return self._my_cmds.get(cmd.name) is not None
820 820 return cmd.name in self._my_cmds.get()
821 821  
822   - def has_native_cmd(self, cmd:DeviceCommand)->bool:
  822 + def has_native_cmd(self, cmd:DeviceCmd)->bool:
823 823 #return self._my_cmds.get(cmd.name) is not None
824 824 return self._my_cmds.has_native_cmd(cmd.name)
825 825  
826   - def has_native_cmd_for_generic(self, generic_cmd:DeviceCommand):
  826 + def has_native_cmd_for_generic(self, generic_cmd:DeviceCmd):
827 827 return self._my_cmds.get_native_infos_for_generic_cmd(generic_cmd.name) not in [None, []]
828 828  
829 829 # check if generic cmd exists
830   - def is_valid_generic_cmd(self, cmd:DeviceCommand):
  830 + def is_valid_generic_cmd(self, cmd:DeviceCmd):
831 831 #printd("_my_cmds", self._my_cmds)
832 832 # 1) If a DCC given, return search result in this DCC commands
833 833 if cmd.devtype:
... ... @@ -849,7 +849,7 @@ class DeviceController():
849 849 '''
850 850  
851 851 # check if generic cmd exists and is implemented as a native cmd (in dictionary)
852   - def is_implemented_generic_cmd(self, cmd:DeviceCommand):
  852 + def is_implemented_generic_cmd(self, cmd:DeviceCmd):
853 853 self.printd("is implemented generic ?")
854 854 self.printd("cmd.devtype", cmd.devtype)
855 855 #printd("_my_cmds", self._my_cmds)
... ... @@ -877,7 +877,7 @@ class DeviceController():
877 877 return self.get_dc_component_for_type(cmd.devtype).has_native_cmd_for_generic(cmd)
878 878 '''
879 879  
880   - def is_valid_native_cmd(self, cmd:DeviceCommand)->bool:
  880 + def is_valid_native_cmd(self, cmd:DeviceCmd)->bool:
881 881 ##return self._my_cmds.is_valid_native_cmd(cmd.name)
882 882 # 1) If a DCC given, return search result in this DCC commands
883 883 if cmd.devtype:
... ... @@ -995,14 +995,14 @@ class DeviceController():
995 995 or
996 996 - FROM A THREAD from AgentDevice._thread_exec_specific_cmd().exec_specific_cmd()
997 997 '''
998   - #def execute_cmd(self, cmd:DeviceCommand)->GenericResult:
  998 + #def execute_cmd(self, cmd:DeviceCmd)->GenericResult:
999 999 def exec_cmd(self, raw_input_cmd:str)->GenericResult:
1000 1000 '''
1001 1001 :param raw_input_cmd:
1002 1002 '''
1003 1003  
1004 1004 #generic_cmd, args = self.is_generic_cmd(raw_input_cmd)
1005   - cmd = DeviceCommand(raw_input_cmd)
  1005 + cmd = DeviceCmd(raw_input_cmd)
1006 1006 self.tprintd("cmd is", cmd, raw_input_cmd)
1007 1007  
1008 1008 # GENERIC command (pyros grammar)
... ... @@ -1176,7 +1176,7 @@ class DeviceController():
1176 1176  
1177 1177  
1178 1178  
1179   - #def exec_generic_cmd(self, generic_cmd:DeviceCommand)->str:
  1179 + #def exec_generic_cmd(self, generic_cmd:DeviceCmd)->str:
1180 1180 ##def exec_generic_cmd(self, generic_cmd:str, values_to_set:str=None, dcc_type:str=None)->str:
1181 1181 def exec_generic_cmd(self, generic_cmd:str, values_to_set:str=None)->str:
1182 1182 ''' Execute a generic command
... ...
src/device_controller/concrete_component/gemini/gemini_controller.py
... ... @@ -22,7 +22,7 @@ from device_controller.abstract_component.device_controller import (
22 22 printd,
23 23 DeviceController,
24 24 Gen2NatCmds,
25   - #Cmd,
  25 + Cmd,
26 26 UnknownNativeCmdException, UnknownGenericCmdArgException
27 27 )
28 28  
... ... @@ -346,7 +346,6 @@ class DC_Gemini(DeviceController):
346 346 #
347 347 # VERSION 4 : Command class (Cmd)
348 348 #
349   - '''
350 349 get_ack2 = Cmd(
351 350 #generic_name =
352 351 'get_ack2',
... ... @@ -370,7 +369,6 @@ class DC_Gemini(DeviceController):
370 369 '1' : 'pb 1 ...',
371 370 }
372 371 )
373   - '''
374 372  
375 373  
376 374 # Utilisation, affichage
... ...