diff --git a/README.md b/README.md index f59d238..7e25c8c 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ Date: 26/04/2019 Author: E. Pallier -VERSION: 0.20.41 +VERSION: 0.20.42 -Comment: AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table +Comment: plantUML diagrams créés récursivement dans les dossiers doc/ - Scenario de test : - lancer agents A et B en mode simu (option -t): ./pyros.py -t start agentA,agentB @@ -88,6 +88,7 @@ Comment: AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table - pour utiliser thread ou processus : il suffit de mettre la constante RUN_IN_THREAD de AgentA (ou AgentB ou AgentX) à False ou True - Historique des nouveautés implémentées : + - AgentDeviceTelescopeStatus : 1 seule ligne mise à jour dans la table - AgentDevice + AgentDeviceTelescopeStatus + AgentTelescopeRequester : - AgentDevice met à jour la table AgentDeviceTelescopeStatus - AgentTelescopeRequester interroge AgentDevice diff --git a/pyros.py b/pyros.py index c172f81..58e5fab 100755 --- a/pyros.py +++ b/pyros.py @@ -484,16 +484,10 @@ def _update_python_packages_from_requirements(): return res def _update_plantuml_diags(): - change_dir("src") - for entry in os.listdir("."): - if os.path.isdir(entry): - change_dir(entry) - if glob.glob("*.pu"): - fics = glob.glob("*.pu") - for fic in fics: - res = execProcessFromVenv("-m plantuml "+fic) - change_dir("..") - change_dir("..") + for dirpath, dirnames, files in os.walk('src'): + if os.path.basename(dirpath) == "doc": + diagrams = glob.glob(dirpath+os.sep+"*.pu") + for diag in diagrams: res = execProcessFromVenv("-m plantuml "+diag) return res def _migrate(): diff --git a/src/agent/AgentDevice.py b/src/agent/AgentDevice.py index 42a391d..76c01f0 100755 --- a/src/agent/AgentDevice.py +++ b/src/agent/AgentDevice.py @@ -8,7 +8,7 @@ import time ##from .Agent import Agent sys.path.append("..") from agent.Agent import Agent, extract_parameters -from common.models import AgentDeviceTelescopeStatus +from common.models import AgentDeviceTelescopeStatus, get_or_create_unique_row_from_model from devices_channel.client.telescope_controller_gemini import TelescopeControllerGEMINI ##log = L.setupLogger("AgentXTaskLogger", "AgentX") @@ -78,12 +78,15 @@ class AgentDevice(Agent): # Initialize the device table status # If table is empty, create a default 1st row + self._agent_device_telescope_status = get_or_create_unique_row_from_model(AgentDeviceTelescopeStatus) + """ if not AgentDeviceTelescopeStatus.objects.exists(): print("CREATE first row") self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.create(id=1) # Get 1st row (will be updated at each iteration by routine_process() with current device status) print("GET first row") self._agent_device_telescope_status = AgentDeviceTelescopeStatus.objects.get(id=1) + """ # Initialize the device socket # Port local AK 8085 = redirigé sur l’IP du tele 192.168.0.12 sur port 11110 diff --git a/src/agent/Agent_activity_diag.pu b/src/agent/Agent_activity_diag.pu deleted file mode 100644 index 61ad977..0000000 --- a/src/agent/Agent_activity_diag.pu +++ /dev/null @@ -1,83 +0,0 @@ - -@startuml - -' --- Agent ACTIVIY DIAGRAM (plantUML) --- - -' NEW syntax => http://plantuml.com/fr/activity-diagram-beta -' OLD syntax => http://plantuml.com/fr/activity-diagram-legacy -' (See also https://plantweb.readthedocs.io) -' (See also https://pythonhosted.org/plantuml) - -' What is the current version of PlantUML (and Java) used ? -' startuml -' version -' enduml - -' Exemple de skin utilisable (celui de ChemCam) : -' skinparam activity { -' StartColor red -' EndColor Silver -' BackgroundColor Peru -' BackgroundColor<< Begin >> Olive -' BorderColor Peru -' FontName Impact -' } - - -title -__**Agent.run() function : Activity Diagram**__ - -end title - - -start - -:DO_EXIT = False -DO_RESTART = True; - -while (DO_RESTART ?) is (yes) - :load_config(); - :init(); - :DO_MAIN_LOOP = True; - while (DO_MAIN_LOOP ?) is (yes) - partition main_loop() { - :reload_config(); - note right - only if changed - end note - - :log_agent_status(); - note right - Log this agent status in DB - end note - - :routine_process(); - - :cmd = get_next_valid_command(); - if (cmd ?) then - partition command_process(cmd) { - :cmd = general_process(cmd); - if (cmd ?) then - :specific_process(cmd); - else (no) - endif - note right - only if I am "active" - end note - } - else (no) - endif - if (DO_RESTART or DO_EXIT ?) then (yes) - :DO_MAIN_LOOP = False; - endif - - - - - } - endwhile (no) -endwhile (no) - -stop - -@enduml diff --git a/src/agent/doc/Agent_activity_diag.pu b/src/agent/doc/Agent_activity_diag.pu new file mode 100644 index 0000000..61ad977 --- /dev/null +++ b/src/agent/doc/Agent_activity_diag.pu @@ -0,0 +1,83 @@ + +@startuml + +' --- Agent ACTIVIY DIAGRAM (plantUML) --- + +' NEW syntax => http://plantuml.com/fr/activity-diagram-beta +' OLD syntax => http://plantuml.com/fr/activity-diagram-legacy +' (See also https://plantweb.readthedocs.io) +' (See also https://pythonhosted.org/plantuml) + +' What is the current version of PlantUML (and Java) used ? +' startuml +' version +' enduml + +' Exemple de skin utilisable (celui de ChemCam) : +' skinparam activity { +' StartColor red +' EndColor Silver +' BackgroundColor Peru +' BackgroundColor<< Begin >> Olive +' BorderColor Peru +' FontName Impact +' } + + +title +__**Agent.run() function : Activity Diagram**__ + +end title + + +start + +:DO_EXIT = False +DO_RESTART = True; + +while (DO_RESTART ?) is (yes) + :load_config(); + :init(); + :DO_MAIN_LOOP = True; + while (DO_MAIN_LOOP ?) is (yes) + partition main_loop() { + :reload_config(); + note right + only if changed + end note + + :log_agent_status(); + note right + Log this agent status in DB + end note + + :routine_process(); + + :cmd = get_next_valid_command(); + if (cmd ?) then + partition command_process(cmd) { + :cmd = general_process(cmd); + if (cmd ?) then + :specific_process(cmd); + else (no) + endif + note right + only if I am "active" + end note + } + else (no) + endif + if (DO_RESTART or DO_EXIT ?) then (yes) + :DO_MAIN_LOOP = False; + endif + + + + + } + endwhile (no) +endwhile (no) + +stop + +@enduml diff --git a/src/common/doc/models_Command_state_diag.pu b/src/common/doc/models_Command_state_diag.pu new file mode 100644 index 0000000..fc6ba02 --- /dev/null +++ b/src/common/doc/models_Command_state_diag.pu @@ -0,0 +1,42 @@ + +@startuml + +' --- Command STATE DIAGRAM --- +' (see http://plantuml.com/fr/state-diagram) + +title +__**models.Command class : State Diagram**__ + +end title + +[*] --> PENDING : **created by sender** + +' --- (1) PENDING --- +PENDING: + s_deposit_time \n+ r_read_time +PENDING --> RUNNING : **launched** +PENDING --> SKIPPED: **recipient is IDLE** +PENDING --> EXPIRED: **command is too old** +PENDING --> INVALIDATED: **cancelled by sender** + +' --- (2) RUNNING, SKIPPED, or EXPIRED --- +RUNNING: + r_start_time +RUNNING --> EXECUTED : **finished** +RUNNING --> KILLED: \l**aborted** \n(by sender or other allowed agent, \nwith command "abort" or "exit") + +SKIPPED: + end_time +SKIPPED --> [*] + +EXPIRED --> [*] +EXPIRED: + end_time \n+ killer_agent_name + +INVALIDATED --> [*] +INVALIDATED: + end_time \n+ killer_agent_name + +' --- (3) PROCESSED or KILLED --- +EXECUTED: + end_time +EXECUTED --> [*] + +KILLED --> [*] +KILLED: + end_time \n+ killer_agent_name + +@enduml diff --git a/src/common/models.py b/src/common/models.py index ec06e4f..73b8288 100644 --- a/src/common/models.py +++ b/src/common/models.py @@ -158,6 +158,12 @@ class Company(models.Model): """ +# --- +# --- Utility functions +# --- +def get_or_create_unique_row_from_model(model:models.Model): + return model.objects.get(id=1) if model.objects.exists() else model.objects.create(id=1) + """ ------------------------ diff --git a/src/common/models_Command_state_diag.pu b/src/common/models_Command_state_diag.pu deleted file mode 100644 index fc6ba02..0000000 --- a/src/common/models_Command_state_diag.pu +++ /dev/null @@ -1,42 +0,0 @@ - -@startuml - -' --- Command STATE DIAGRAM --- -' (see http://plantuml.com/fr/state-diagram) - -title -__**models.Command class : State Diagram**__ - -end title - -[*] --> PENDING : **created by sender** - -' --- (1) PENDING --- -PENDING: + s_deposit_time \n+ r_read_time -PENDING --> RUNNING : **launched** -PENDING --> SKIPPED: **recipient is IDLE** -PENDING --> EXPIRED: **command is too old** -PENDING --> INVALIDATED: **cancelled by sender** - -' --- (2) RUNNING, SKIPPED, or EXPIRED --- -RUNNING: + r_start_time -RUNNING --> EXECUTED : **finished** -RUNNING --> KILLED: \l**aborted** \n(by sender or other allowed agent, \nwith command "abort" or "exit") - -SKIPPED: + end_time -SKIPPED --> [*] - -EXPIRED --> [*] -EXPIRED: + end_time \n+ killer_agent_name - -INVALIDATED --> [*] -INVALIDATED: + end_time \n+ killer_agent_name - -' --- (3) PROCESSED or KILLED --- -EXECUTED: + end_time -EXECUTED --> [*] - -KILLED --> [*] -KILLED: + end_time \n+ killer_agent_name - -@enduml diff --git a/src/devices_channel/client/Device_controller_abstract_activity_diag.pu b/src/devices_channel/client/Device_controller_abstract_activity_diag.pu deleted file mode 100755 index d87f4af..0000000 --- a/src/devices_channel/client/Device_controller_abstract_activity_diag.pu +++ /dev/null @@ -1,177 +0,0 @@ - -@startuml - -' UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm) - -' PlantUML: -' - How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML -' - Eclipse plugin : http://plantuml.com/eclipse -' - class diagrams : http://plantuml.com/class-diagram -' - sequence diagrams : http://plantuml.com/sequence-diagram -' - state diagrams : http://plantuml.com/state-diagram -' - Use Case diagrams : http://plantuml.com/use-case-diagram -' - OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy -' - NEW Activity diagrams : http://plantuml.com/activity-diagram-beta -' - Pre-processing (include...) : http://plantuml.com/preprocessing -' - GANTT diagrams : http://plantuml.com/gantt-diagram -' - REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/ -' - For Python: -' - https://github.com/SamuelMarks/python-plantuml -' - https://pythonhosted.org/plantuml/ - -' UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html - - -title -__**DeviceController and ClientChannel classes diagram (1 - composition)**__ -(ClientChannel is a COMPONENT of DeviceController) -end title - - -/' Channels '/ -ClientChannel <|-- ClientSerial -ClientChannel <|-- ClientSocket -ClientChannel <|-- ClientUSB - -abstract class ClientChannel { - my_channel # socket or serial or usb... - {abstract} connect_to_server() - {abstract} read() - {abstract} put() - put_read() - {abstract} send_data() - {abstract} receive_data() - {abstract} close() -} - -class ClientSocket { - my_channel # (socket) - -- - connect_to_server() - send_data() - receive_data() - close() -} - - -/' Abstract Devices Controllers '/ -DeviceControllerAbstract o-- ClientChannel - -DeviceControllerAbstract <|-- TelescopeControllerAbstract -DeviceControllerAbstract <|-- PLCControllerAbstract -DeviceControllerAbstract <|-- CameraControllerAbstract - -abstract class DeviceControllerAbstract { - my_channel # socket or serial or usb... - _cmd = {start, stop, park...} - class GenericResult - -- - {abstract} connect_to_device() - {abstract} _format_data_to_send() - {abstract} _unformat_received_data() - available_commands() - execute() - execute_generic_cmd() - execute_native_cmd() - execute_native_cmd() - send_data() - receive_data() - --- - **Abstract GET/SET/DO commands :** - {abstract} get_timezone(), set_timezone() - {abstract} get_date(), set_date() - {abstract} get_time(), set_time() - {abstract} do_park() - {abstract} do_start() - {abstract} do_stop() - {abstract} do_init() -} - -abstract class TelescopeControllerAbstract { - _cmd = {get_ra, get_dec, do_goto...} - ---- - **Abstract GET/SET/DO commands :** - {abstract} get_ack() - {abstract} get_ra(), set_ra() - {abstract} get_dec(), set_dec() - get_radec(), set_radec() - {abstract} get_lat(), set_lat() - {abstract} get_long(), set_long() - {abstract} set_speed() - {abstract} do_warm_start() - {abstract} do_prec_refr() - ---- - **Generic MACRO commands:** - do_init() - do_goto() - do_move() -} - -abstract class PLCControllerAbstract { - _cmd = {get_status, set_light...} -} - -abstract class CameraControllerAbstract { - _cmd = {set_pose, do_start_acq...} -} - -/' Concrete Devices Controllers '/ - -TelescopeControllerAbstract <|-- TelescopeControllerMeade -TelescopeControllerAbstract <|-- TelescopeControllerGemini -TelescopeControllerAbstract <|-- TelescopeControllerColibri - -PLCControllerAbstract <|-- PLCControllerAK -PLCControllerAbstract <|-- PLCControllerColibri - -CameraControllerAbstract <|-- CameraControllerVIS_AK -CameraControllerAbstract <|-- CameraControllerCAGIRE -CameraControllerAbstract <|-- CameraControllerDDRAGO - -class TelescopeControllerGemini { - _cmd = {get_ra, get_dec, do_goto...} - format_data_to_send() - unformat_received_data() -} - -TelescopeControllerMeade : _cmd = {get_ra, get_dec, do_goto...} - -@enduml -''' - - -''' -@startuml - -title -__**DeviceController and ClientChannel classes diagram (2 - multi-inheritance)**__ -(TelescopeGemini heritates both from DeviceController and ClientChannel) - -end title - - -/' Abstract Devices Controllers '/ -DeviceControllerAbstract <|-- PLCControllerAbstract -DeviceControllerAbstract <|-- CameraControllerAbstract -DeviceControllerAbstract <|-- TelescopeControllerAbstract - -/' Concrete Devices Controllers '/ - -TelescopeControllerAbstract <|-- TelescopeControllerMeade -TelescopeControllerAbstract <|-- TelescopeControllerGemini -ClientSocket <|-- TelescopeControllerGemini -TelescopeControllerAbstract <|-- TelescopeControllerColibri - -PLCControllerAbstract <|-- PLCControllerAK -PLCControllerAbstract <|-- PLCControllerColibri - -CameraControllerAbstract <|-- CameraControllerVIS_AK -CameraControllerAbstract <|-- CameraControllerCAGIRE -CameraControllerAbstract <|-- CameraControllerDDRAGO - -/' Channels '/ -ClientChannel <|-- ClientSocket -ClientChannel <|-- ClientSerial -ClientChannel <|-- ClientUSB - -@enduml diff --git a/src/devices_channel/doc/Device_controller_abstract_activity_diag.pu b/src/devices_channel/doc/Device_controller_abstract_activity_diag.pu new file mode 100755 index 0000000..059b526 --- /dev/null +++ b/src/devices_channel/doc/Device_controller_abstract_activity_diag.pu @@ -0,0 +1,140 @@ + +@startuml + +/' +UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm) + +PlantUML: +- How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML +- Eclipse plugin : http://plantuml.com/eclipse +- class diagrams : http://plantuml.com/class-diagram +- sequence diagrams : http://plantuml.com/sequence-diagram +- state diagrams : http://plantuml.com/state-diagram +- Use Case diagrams : http://plantuml.com/use-case-diagram +- OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy +- NEW Activity diagrams : http://plantuml.com/activity-diagram-beta +- Pre-processing (include...) : http://plantuml.com/preprocessing +- GANTT diagrams : http://plantuml.com/gantt-diagram +- REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/ +- For Python: + - https://github.com/SamuelMarks/python-plantuml + - https://pythonhosted.org/plantuml/ + +UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html +'/ + +title +__**DeviceController and ClientChannel classes diagram (composition)**__ +(ClientChannel is a COMPONENT of DeviceController) +end title + + +/' Channels '/ +ClientChannel <|-- ClientSerial +ClientChannel <|-- ClientSocket +ClientChannel <|-- ClientUSB + +abstract class ClientChannel { + my_channel # socket or serial or usb... + {abstract} connect_to_server() + {abstract} read() + {abstract} put() + put_read() + {abstract} send_data() + {abstract} receive_data() + {abstract} close() +} + +class ClientSocket { + my_channel # (socket) + -- + connect_to_server() + send_data() + receive_data() + close() +} + + +/' Abstract Devices Controllers '/ +DeviceControllerAbstract o-- ClientChannel + +DeviceControllerAbstract <|-- TelescopeControllerAbstract +DeviceControllerAbstract <|-- PLCControllerAbstract +DeviceControllerAbstract <|-- CameraControllerAbstract + +abstract class DeviceControllerAbstract { + my_channel # socket or serial or usb... + _cmd = {start, stop, park...} + class GenericResult + -- + {abstract} connect_to_device() + {abstract} _format_data_to_send() + {abstract} _unformat_received_data() + available_commands() + execute() + execute_generic_cmd() + execute_native_cmd() + execute_native_cmd() + send_data() + receive_data() + --- + **Abstract GET/SET/DO commands :** + {abstract} get_timezone(), set_timezone() + {abstract} get_date(), set_date() + {abstract} get_time(), set_time() + {abstract} do_park() + {abstract} do_start() + {abstract} do_stop() + {abstract} do_init() +} + +abstract class TelescopeControllerAbstract { + _cmd = {get_ra, get_dec, do_goto...} + ---- + **Abstract GET/SET/DO commands :** + {abstract} get_ack() + {abstract} get_ra(), set_ra() + {abstract} get_dec(), set_dec() + get_radec(), set_radec() + {abstract} get_lat(), set_lat() + {abstract} get_long(), set_long() + {abstract} set_speed() + {abstract} do_warm_start() + {abstract} do_prec_refr() + ---- + **Generic MACRO commands:** + do_init() + do_goto() + do_move() +} + +abstract class PLCControllerAbstract { + _cmd = {get_status, set_light...} +} + +abstract class CameraControllerAbstract { + _cmd = {set_pose, do_start_acq...} +} + +/' Concrete Devices Controllers '/ + +TelescopeControllerAbstract <|-- TelescopeControllerMeade +TelescopeControllerAbstract <|-- TelescopeControllerGemini +TelescopeControllerAbstract <|-- TelescopeControllerColibri + +PLCControllerAbstract <|-- PLCControllerAK +PLCControllerAbstract <|-- PLCControllerColibri + +CameraControllerAbstract <|-- CameraControllerVIS_AK +CameraControllerAbstract <|-- CameraControllerCAGIRE +CameraControllerAbstract <|-- CameraControllerDDRAGO + +class TelescopeControllerGemini { + _cmd = {get_ra, get_dec, do_goto...} + format_data_to_send() + unformat_received_data() +} + +TelescopeControllerMeade : _cmd = {get_ra, get_dec, do_goto...} + +@enduml diff --git a/src/devices_channel/doc/Device_controller_abstract_activity_diag_multiinheritance.pu b/src/devices_channel/doc/Device_controller_abstract_activity_diag_multiinheritance.pu new file mode 100755 index 0000000..2cbf361 --- /dev/null +++ b/src/devices_channel/doc/Device_controller_abstract_activity_diag_multiinheritance.pu @@ -0,0 +1,58 @@ + +/' +UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm) + +PlantUML: +- How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML +- Eclipse plugin : http://plantuml.com/eclipse +- class diagrams : http://plantuml.com/class-diagram +- sequence diagrams : http://plantuml.com/sequence-diagram +- state diagrams : http://plantuml.com/state-diagram +- Use Case diagrams : http://plantuml.com/use-case-diagram +- OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy +- NEW Activity diagrams : http://plantuml.com/activity-diagram-beta +- Pre-processing (include...) : http://plantuml.com/preprocessing +- GANTT diagrams : http://plantuml.com/gantt-diagram +- REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/ +- For Python: + - https://github.com/SamuelMarks/python-plantuml + - https://pythonhosted.org/plantuml/ + +UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html +'/ + + +@startuml + +title +__**DeviceController and ClientChannel classes diagram (multi-inheritance)**__ +(TelescopeGemini heritates both from DeviceController and ClientChannel) + +end title + + +/' Abstract Devices Controllers '/ +DeviceControllerAbstract <|-- PLCControllerAbstract +DeviceControllerAbstract <|-- CameraControllerAbstract +DeviceControllerAbstract <|-- TelescopeControllerAbstract + +/' Concrete Devices Controllers '/ + +TelescopeControllerAbstract <|-- TelescopeControllerMeade +TelescopeControllerAbstract <|-- TelescopeControllerGemini +ClientSocket <|-- TelescopeControllerGemini +TelescopeControllerAbstract <|-- TelescopeControllerColibri + +PLCControllerAbstract <|-- PLCControllerAK +PLCControllerAbstract <|-- PLCControllerColibri + +CameraControllerAbstract <|-- CameraControllerVIS_AK +CameraControllerAbstract <|-- CameraControllerCAGIRE +CameraControllerAbstract <|-- CameraControllerDDRAGO + +/' Channels '/ +ClientChannel <|-- ClientSocket +ClientChannel <|-- ClientSerial +ClientChannel <|-- ClientUSB + +@enduml diff --git a/src/devices_channel/doc/device_controller_class_diagram.txt b/src/devices_channel/doc/device_controller_class_diagram.txt deleted file mode 100644 index 7fc68ce..0000000 --- a/src/devices_channel/doc/device_controller_class_diagram.txt +++ /dev/null @@ -1,141 +0,0 @@ -/' -UML class Diagram : can be displayed with PlantUML (plugin for Eclipse or for PyCharm) - -PlantUML: -- How to install : https://projects.irap.omp.eu/projects/pyros/wiki/Project_Development#PlantUML -- Eclipse plugin : http://plantuml.com/eclipse -- class diagrams : http://plantuml.com/class-diagram -- sequence diagrams : http://plantuml.com/sequence-diagram -- state diagrams : http://plantuml.com/state-diagram -- Use Case diagrams : http://plantuml.com/use-case-diagram -- OLD Activity diagrams : http://plantuml.com/activity-diagram-legacy -- NEW Activity diagrams : http://plantuml.com/activity-diagram-beta -- Pre-processing (include...) : http://plantuml.com/preprocessing -- GANTT diagrams : http://plantuml.com/gantt-diagram -- REAL WORLD EXAMPLES !!! : https://real-world-plantuml.com/ -- For Python: - - https://github.com/SamuelMarks/python-plantuml - - https://pythonhosted.org/plantuml/ - -UML diagrams theory : https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/index.html -'/ - - - -@startuml - -title -__**DeviceController and ClientChannel classes diagram (1 - composition)**__ -(ClientChannel is a COMPONENT of DeviceController) - -end title - -/' Channels '/ -ClientChannel <|-- ClientSerial -ClientChannel <|-- ClientSocket -ClientChannel <|-- ClientUSB - -abstract class ClientChannel { - my_channel # socket or serial or usb... - {abstract} connect_to_server() - {abstract} read() - {abstract} put() - put_read() - {abstract} send_data() - {abstract} receive_data() - {abstract} close() -} - -class ClientSocket { - my_channel # (socket) - -- - connect_to_server() - send_data() - receive_data() - close() -} - - -/' Abstract Devices Controllers '/ -DeviceControllerAbstract o-- ClientChannel - -DeviceControllerAbstract <|-- TelescopeControllerAbstract -DeviceControllerAbstract <|-- PLCControllerAbstract -DeviceControllerAbstract <|-- CameraControllerAbstract - -abstract class DeviceControllerAbstract { - my_channel # socket or serial or usb... - _cmd = {start, stop, park...} - class GenericResult - -- - {abstract} connect_to_device() - {abstract} format_data_to_send() - {abstract} unformat_received_data() - available_commands() - execute() - execute_generic_cmd() - execute_native_cmd() - execute_native_cmd() - send_data() - receive_data() - --- - **Abstract GET/SET/DO commands :** - {abstract} get_timezone(), set_timezone() - {abstract} get_date(), set_date() - {abstract} get_time(), set_time() - {abstract} do_park() - {abstract} do_start() - {abstract} do_stop() - {abstract} do_init() -} - -abstract class TelescopeControllerAbstract { - _cmd = {get_ra, get_dec, do_goto...} - ---- - **Abstract GET/SET/DO commands :** - {abstract} get_ack() - {abstract} get_ra(), set_ra() - {abstract} get_dec(), set_dec() - get_radec(), set_radec() - {abstract} get_lat(), set_lat() - {abstract} get_long(), set_long() - {abstract} set_speed() - {abstract} do_warm_start() - {abstract} do_prec_refr() - ---- - **Generic MACRO commands:** - do_init() - do_goto() - do_move() -} - -abstract class PLCControllerAbstract { - _cmd = {get_status, set_light...} -} - -abstract class CameraControllerAbstract { - _cmd = {set_pose, do_start_acq...} -} - -/' Concrete Devices Controllers '/ - -TelescopeControllerAbstract <|-- TelescopeControllerMeade -TelescopeControllerAbstract <|-- TelescopeControllerGemini -TelescopeControllerAbstract <|-- TelescopeControllerColibri - -PLCControllerAbstract <|-- PLCControllerAK -PLCControllerAbstract <|-- PLCControllerColibri - -CameraControllerAbstract <|-- CameraControllerVIS_AK -CameraControllerAbstract <|-- CameraControllerCAGIRE -CameraControllerAbstract <|-- CameraControllerDDRAGO - -class TelescopeControllerGemini { - _cmd = {get_ra, get_dec, do_goto...} - format_data_to_send() - unformat_received_data() -} - -TelescopeControllerMeade : _cmd = {get_ra, get_dec, do_goto...} - -@enduml diff --git a/src/devices_channel/doc/device_controller_class_diagram_multiinheritance.txt b/src/devices_channel/doc/device_controller_class_diagram_multiinheritance.txt deleted file mode 100644 index 076221b..0000000 --- a/src/devices_channel/doc/device_controller_class_diagram_multiinheritance.txt +++ /dev/null @@ -1,34 +0,0 @@ -@startuml - -title -__**DeviceController and ClientChannel classes diagram (2 - multi-inheritance)**__ -(TelescopeGemini heritates both from DeviceController and ClientChannel) - -end title - - -/' Abstract Devices Controllers '/ -DeviceControllerAbstract <|-- PLCControllerAbstract -DeviceControllerAbstract <|-- CameraControllerAbstract -DeviceControllerAbstract <|-- TelescopeControllerAbstract - -/' Concrete Devices Controllers '/ - -TelescopeControllerAbstract <|-- TelescopeControllerMeade -TelescopeControllerAbstract <|-- TelescopeControllerGemini -ClientSocket <|-- TelescopeControllerGemini -TelescopeControllerAbstract <|-- TelescopeControllerColibri - -PLCControllerAbstract <|-- PLCControllerAK -PLCControllerAbstract <|-- PLCControllerColibri - -CameraControllerAbstract <|-- CameraControllerVIS_AK -CameraControllerAbstract <|-- CameraControllerCAGIRE -CameraControllerAbstract <|-- CameraControllerDDRAGO - -/' Channels '/ -ClientChannel <|-- ClientSocket -ClientChannel <|-- ClientSerial -ClientChannel <|-- ClientUSB - -@enduml diff --git a/src/devices_channel/doc/generate_diagrams.sh b/src/devices_channel/doc/generate_diagrams.sh index 69f6b5a..0ae7c7a 100755 --- a/src/devices_channel/doc/generate_diagrams.sh +++ b/src/devices_channel/doc/generate_diagrams.sh @@ -2,4 +2,4 @@ # https://github.com/SamuelMarks/python-plantuml # https://pythonhosted.org/plantuml/ -python3 -m plantuml device_controller_class_diagram*.txt +python3 -m plantuml *.pu -- libgit2 0.21.2