From 8340d7ab7ba38d574c4e5f3b1f0869cae35072ca Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Fri, 30 Oct 2020 23:17:15 +0100
Subject: [PATCH] changed much

---
 .gitignore                                    |  2 +-
 .../tmtcclient_Binary_Upload_Serial.xml       |  2 +-
 .idea/runConfigurations/tmtcclient_CLI.xml    | 24 +++++
 .../tmtcclient_Clear_SD_Card_.xml             |  2 +-
 .../tmtcclient_Copy_Bootloader.xml            |  2 +-
 .../tmtcclient_Copy_OBSW_Update.xml           |  2 +-
 .../tmtcclient_Create_File_Struct_AT91.xml    |  2 +-
 .../tmtcclient_Disable_Periodic_Print_.xml    |  2 +-
 .../tmtcclient_Dummy_UDP.xml                  |  2 +-
 .../tmtcclient_Enable_Periodic_Print.xml      |  2 +-
 .../tmtcclient_Format_SD_Card_.xml            |  2 +-
 .../tmtcclient_GPS0_Serial.xml                |  2 +-
 .../tmtcclient_GPS1_Serial.xml                |  2 +-
 .idea/runConfigurations/tmtcclient_GUI.xml    |  4 +-
 .../tmtcclient_Hamming_from_FRAM.xml          |  2 +-
 .../tmtcclient_Hamming_from_SD.xml            |  2 +-
 .idea/runConfigurations/tmtcclient_Help.xml   |  2 +-
 .../tmtcclient_Listener_Serial.xml            |  2 +-
 .../tmtcclient_Lock_file.xml                  |  2 +-
 .../tmtcclient_Module_Test_Serial.xml         |  2 +-
 .../tmtcclient_PowerCycle_OBC_.xml            |  2 +-
 .../tmtcclient_Print_SD_Card.xml              |  2 +-
 .../tmtcclient_Reset_OBC.xml                  |  2 +-
 .../tmtcclient_Run_Time_Stats_OBC_.xml        |  2 +-
 .../tmtcclient_Service_17_QEMU.xml            |  2 +-
 .../tmtcclient_Service_17_Serial.xml          |  2 +-
 .../tmtcclient_Service_17_UDP.xml             |  2 +-
 .../tmtcclient_Service_200_UDP.xml            |  2 +-
 .../tmtcclient_Service_20_QEMU___.xml         |  2 +-
 .../tmtcclient_Service_2_QEMU.xml             |  2 +-
 .../tmtcclient_Service_2_Serial.xml           |  2 +-
 .../tmtcclient_Service_2_UDP.xml              |  2 +-
 .../tmtcclient_Service_3_QEMU_.xml            |  2 +-
 .../tmtcclient_Service_3_Serial_.xml          |  2 +-
 .../tmtcclient_Service_5_QEMU_.xml            |  2 +-
 .../tmtcclient_Service_5_Serial.xml           |  2 +-
 .../tmtcclient_Service_8_QEMU__.xml           |  2 +-
 .../tmtcclient_Service_8_Serial.xml           |  2 +-
 .../tmtcclient_Service_8_UDP.xml              |  2 +-
 .../tmtcclient_Service_9_Serial.xml           |  2 +-
 .../tmtcclient_Service_Dummy_QEMU.xml         |  2 +-
 .../tmtcclient_Service_GPS0_QEMU__.xml        |  2 +-
 .../tmtcclient_Service_GPS1_QEMU___.xml       |  2 +-
 .../tmtcclient_Single_Command.xml             |  2 +-
 .../tmtcclient_Single_Command_Serial.xml      |  2 +-
 .../tmtcclient_Software_QEMU_.xml             |  2 +-
 .../tmtcclient_Trigger_Exceptions.xml         |  2 +-
 .../tmtcclient_Unittest_QEMU.xml              |  2 +-
 .../tmtcclient_Unlock_File.xml                |  2 +-
 .../tmtcclient__Service_200_Serial.xml        |  2 +-
 {gui => archive}/obsw_backend_test.py         |  2 +-
 archive/obsw_pus_tm_base.py                   | 59 ------------
 config/obsw_config.py                         |  3 +-
 core/__init__.py                              |  0
 obsw_tmtc_client.py => core/tmtc_backend.py   | 93 +++----------------
 core/tmtc_client_core.py                      | 76 +++++++++++++++
 gui/obsw_tmtc_gui.py                          | 10 +-
 obsw_user_code.py                             | 45 ---------
 tmtc_client_cli.py                            |  7 ++
 tmtc_client_gui.py                            |  7 ++
 60 files changed, 185 insertions(+), 241 deletions(-)
 create mode 100644 .idea/runConfigurations/tmtcclient_CLI.xml
 rename {gui => archive}/obsw_backend_test.py (92%)
 delete mode 100644 archive/obsw_pus_tm_base.py
 create mode 100644 core/__init__.py
 rename obsw_tmtc_client.py => core/tmtc_backend.py (75%)
 mode change 100755 => 100644
 create mode 100755 core/tmtc_client_core.py
 delete mode 100644 obsw_user_code.py
 create mode 100644 tmtc_client_cli.py
 create mode 100644 tmtc_client_gui.py

diff --git a/.gitignore b/.gitignore
index 754bc9f..2817702 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-obsw_user_code.py
+config/obsw_user_code.py
 
 _build/*
 _dependencies/*
diff --git a/.idea/runConfigurations/tmtcclient_Binary_Upload_Serial.xml b/.idea/runConfigurations/tmtcclient_Binary_Upload_Serial.xml
index 0f71641..30c74ae 100644
--- a/.idea/runConfigurations/tmtcclient_Binary_Upload_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Binary_Upload_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 5 -c 1" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_CLI.xml b/.idea/runConfigurations/tmtcclient_CLI.xml
new file mode 100644
index 0000000..3fff92f
--- /dev/null
+++ b/.idea/runConfigurations/tmtcclient_CLI.xml
@@ -0,0 +1,24 @@
+<component name="ProjectRunConfigurationManager">
+  <configuration default="false" name="tmtcclient CLI" type="PythonConfigurationType" factoryName="Python">
+    <module name="tmtc" />
+    <option name="INTERPRETER_OPTIONS" value="" />
+    <option name="PARENT_ENVS" value="true" />
+    <envs>
+      <env name="PYTHONUNBUFFERED" value="1" />
+    </envs>
+    <option name="SDK_HOME" value="" />
+    <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
+    <option name="IS_MODULE_SDK" value="true" />
+    <option name="ADD_CONTENT_ROOTS" value="true" />
+    <option name="ADD_SOURCE_ROOTS" value="true" />
+    <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_cli.py" />
+    <option name="PARAMETERS" value="" />
+    <option name="SHOW_COMMAND_LINE" value="false" />
+    <option name="EMULATE_TERMINAL" value="false" />
+    <option name="MODULE_MODE" value="false" />
+    <option name="REDIRECT_INPUT" value="false" />
+    <option name="INPUT_FILE" value="" />
+    <method v="2" />
+  </configuration>
+</component>
\ No newline at end of file
diff --git a/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml b/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml
index 0625478..e38f563 100644
--- a/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml
+++ b/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o A20 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Copy_Bootloader.xml b/.idea/runConfigurations/tmtcclient_Copy_Bootloader.xml
index d91be38..d5b5e31 100644
--- a/.idea/runConfigurations/tmtcclient_Copy_Bootloader.xml
+++ b/.idea/runConfigurations/tmtcclient_Copy_Bootloader.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Img -o A11S -c 1 -t 4" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Copy_OBSW_Update.xml b/.idea/runConfigurations/tmtcclient_Copy_OBSW_Update.xml
index df307b8..a345911 100644
--- a/.idea/runConfigurations/tmtcclient_Copy_OBSW_Update.xml
+++ b/.idea/runConfigurations/tmtcclient_Copy_OBSW_Update.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Img -o A4U -c 1 -t 4" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Create_File_Struct_AT91.xml b/.idea/runConfigurations/tmtcclient_Create_File_Struct_AT91.xml
index cc27520..a62b751 100644
--- a/.idea/runConfigurations/tmtcclient_Create_File_Struct_AT91.xml
+++ b/.idea/runConfigurations/tmtcclient_Create_File_Struct_AT91.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o C0A -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml b/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml
index b664592..bdca4a4 100644
--- a/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml
+++ b/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 17 -o 130 -c 1 -t 2.2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Dummy_UDP.xml b/.idea/runConfigurations/tmtcclient_Dummy_UDP.xml
index f591aac..8d3a1fc 100644
--- a/.idea/runConfigurations/tmtcclient_Dummy_UDP.xml
+++ b/.idea/runConfigurations/tmtcclient_Dummy_UDP.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 3 -s Dummy -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml b/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml
index b7394cb..52fe3f3 100644
--- a/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml
+++ b/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 17 -o 129 -c 1 -t 2.2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml b/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml
index 050cb97..a891d9c 100644
--- a/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml
+++ b/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o A21 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml b/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml
index 7aa42a2..03a0694 100644
--- a/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s GPS0 -c 1 --hk -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml b/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml
index 2e914ff..fa042ec 100644
--- a/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s GPS1 -c 1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_GUI.xml b/.idea/runConfigurations/tmtcclient_GUI.xml
index 6ae7919..7dd7c34 100644
--- a/.idea/runConfigurations/tmtcclient_GUI.xml
+++ b/.idea/runConfigurations/tmtcclient_GUI.xml
@@ -12,8 +12,8 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
-    <option name="PARAMETERS" value="-m 0" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtc_client_gui.py" />
+    <option name="PARAMETERS" value="" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
     <option name="MODULE_MODE" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Hamming_from_FRAM.xml b/.idea/runConfigurations/tmtcclient_Hamming_from_FRAM.xml
index 86e6dbb..a2ae039 100644
--- a/.idea/runConfigurations/tmtcclient_Hamming_from_FRAM.xml
+++ b/.idea/runConfigurations/tmtcclient_Hamming_from_FRAM.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 1 -s Img -o P1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Hamming_from_SD.xml b/.idea/runConfigurations/tmtcclient_Hamming_from_SD.xml
index 43c2bce..dd2aec8 100644
--- a/.idea/runConfigurations/tmtcclient_Hamming_from_SD.xml
+++ b/.idea/runConfigurations/tmtcclient_Hamming_from_SD.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 1 -s Img -o P0 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Help.xml b/.idea/runConfigurations/tmtcclient_Help.xml
index 6aece90..6bc32bb 100644
--- a/.idea/runConfigurations/tmtcclient_Help.xml
+++ b/.idea/runConfigurations/tmtcclient_Help.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-h" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Listener_Serial.xml b/.idea/runConfigurations/tmtcclient_Listener_Serial.xml
index 8655ade..8e69b08 100644
--- a/.idea/runConfigurations/tmtcclient_Listener_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Listener_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 1 --hk -c 1" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Lock_file.xml b/.idea/runConfigurations/tmtcclient_Lock_file.xml
index dc7e019..b322ea8 100644
--- a/.idea/runConfigurations/tmtcclient_Lock_file.xml
+++ b/.idea/runConfigurations/tmtcclient_Lock_file.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o 5 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml
index 317ef3e..60552f2 100644
--- a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 6 -c 1 --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml b/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml
index b443130..3941b98 100644
--- a/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml
+++ b/.idea/runConfigurations/tmtcclient_PowerCycle_OBC_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Core -o A11 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml b/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml
index 5c359f0..6d95a0f 100644
--- a/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml
+++ b/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o A2 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Reset_OBC.xml b/.idea/runConfigurations/tmtcclient_Reset_OBC.xml
index 3e52938..37cfd48 100644
--- a/.idea/runConfigurations/tmtcclient_Reset_OBC.xml
+++ b/.idea/runConfigurations/tmtcclient_Reset_OBC.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Core -o A10 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Run_Time_Stats_OBC_.xml b/.idea/runConfigurations/tmtcclient_Run_Time_Stats_OBC_.xml
index 8e3e585..f5cac35 100644
--- a/.idea/runConfigurations/tmtcclient_Run_Time_Stats_OBC_.xml
+++ b/.idea/runConfigurations/tmtcclient_Run_Time_Stats_OBC_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Core -o A0 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_17_QEMU.xml b/.idea/runConfigurations/tmtcclient_Service_17_QEMU.xml
index 394ad5d..95d5fd3 100644
--- a/.idea/runConfigurations/tmtcclient_Service_17_QEMU.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_17_QEMU.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 17 -c 2 -t 2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml
index 9abd7b4..97bce72 100644
--- a/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 17 -c 1 -t 2.2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml b/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml
index f8ab43f..2061946 100644
--- a/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_17_UDP.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 3 -s 17 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_200_UDP.xml b/.idea/runConfigurations/tmtcclient_Service_200_UDP.xml
index cf246a4..069fe98 100644
--- a/.idea/runConfigurations/tmtcclient_Service_200_UDP.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_200_UDP.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 3 -s 200 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_20_QEMU___.xml b/.idea/runConfigurations/tmtcclient_Service_20_QEMU___.xml
index 506baac..779ce5b 100644
--- a/.idea/runConfigurations/tmtcclient_Service_20_QEMU___.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_20_QEMU___.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 20 -c 2 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_2_QEMU.xml b/.idea/runConfigurations/tmtcclient_Service_2_QEMU.xml
index 59d3683..30390e9 100644
--- a/.idea/runConfigurations/tmtcclient_Service_2_QEMU.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_2_QEMU.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 2 -c 2 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml
index 1ffb46d..47fae48 100644
--- a/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 2 -c 1 -t 3.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_2_UDP.xml b/.idea/runConfigurations/tmtcclient_Service_2_UDP.xml
index d592060..4375154 100644
--- a/.idea/runConfigurations/tmtcclient_Service_2_UDP.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_2_UDP.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 3 -s 2 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_3_QEMU_.xml b/.idea/runConfigurations/tmtcclient_Service_3_QEMU_.xml
index 2ec6365..9d4be2a 100644
--- a/.idea/runConfigurations/tmtcclient_Service_3_QEMU_.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_3_QEMU_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 3 -c 2 -t 2 --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml b/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml
index 92741a3..7ec8d32 100644
--- a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 3 -c 1 -t 3 --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_5_QEMU_.xml b/.idea/runConfigurations/tmtcclient_Service_5_QEMU_.xml
index 7669c7a..2458e89 100644
--- a/.idea/runConfigurations/tmtcclient_Service_5_QEMU_.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_5_QEMU_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 5 -c 2 -t 2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml
index 58a794a..68c10c8 100644
--- a/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 5 -c 1 -t 2.0" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml b/.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
index 90becd4..5ce38cc 100644
--- a/.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 8 -c 2 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml
index 7d9695d..fa99050 100644
--- a/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 8 -c 1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_8_UDP.xml b/.idea/runConfigurations/tmtcclient_Service_8_UDP.xml
index f7797b9..1da3af4 100644
--- a/.idea/runConfigurations/tmtcclient_Service_8_UDP.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_8_UDP.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -c 3 -s 8" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml
index 781448c..2e21799 100644
--- a/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 9 -c 1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_Dummy_QEMU.xml b/.idea/runConfigurations/tmtcclient_Service_Dummy_QEMU.xml
index 78e0911..1ca4f2f 100644
--- a/.idea/runConfigurations/tmtcclient_Service_Dummy_QEMU.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_Dummy_QEMU.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s Dummy -c 2 -t 2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_GPS0_QEMU__.xml b/.idea/runConfigurations/tmtcclient_Service_GPS0_QEMU__.xml
index e859a0a..33ec970 100644
--- a/.idea/runConfigurations/tmtcclient_Service_GPS0_QEMU__.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_GPS0_QEMU__.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s GPS0 -c 2 -t 2.5 --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Service_GPS1_QEMU___.xml b/.idea/runConfigurations/tmtcclient_Service_GPS1_QEMU___.xml
index 8a100cf..8e8b943 100644
--- a/.idea/runConfigurations/tmtcclient_Service_GPS1_QEMU___.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_GPS1_QEMU___.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s GPS1 -c 2 -t 2.5 --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Single_Command.xml b/.idea/runConfigurations/tmtcclient_Single_Command.xml
index 46d2403..9a116c2 100644
--- a/.idea/runConfigurations/tmtcclient_Single_Command.xml
+++ b/.idea/runConfigurations/tmtcclient_Single_Command.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 2 -c 3 --boardIP=127.0.0.1" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml b/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
index aa1a2f4..c70cef9 100644
--- a/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 2 -c 1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/.idea/runConfigurations/tmtcclient_Software_QEMU_.xml b/.idea/runConfigurations/tmtcclient_Software_QEMU_.xml
index 49a2418..12abc3e 100644
--- a/.idea/runConfigurations/tmtcclient_Software_QEMU_.xml
+++ b/.idea/runConfigurations/tmtcclient_Software_QEMU_.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 4 -c 2 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Trigger_Exceptions.xml b/.idea/runConfigurations/tmtcclient_Trigger_Exceptions.xml
index d8483e9..0853bdb 100644
--- a/.idea/runConfigurations/tmtcclient_Trigger_Exceptions.xml
+++ b/.idea/runConfigurations/tmtcclient_Trigger_Exceptions.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 17 -o 150 -c 1 -t 2.2" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Unittest_QEMU.xml b/.idea/runConfigurations/tmtcclient_Unittest_QEMU.xml
index 07cedcf..edae8f2 100644
--- a/.idea/runConfigurations/tmtcclient_Unittest_QEMU.xml
+++ b/.idea/runConfigurations/tmtcclient_Unittest_QEMU.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 5 -c 2 -t 5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient_Unlock_File.xml b/.idea/runConfigurations/tmtcclient_Unlock_File.xml
index d484de6..f01de12 100644
--- a/.idea/runConfigurations/tmtcclient_Unlock_File.xml
+++ b/.idea/runConfigurations/tmtcclient_Unlock_File.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s SD -o 6 -c 1 -t 2.5" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="true" />
diff --git a/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml b/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml
index 8613b8d..4fc80a1 100644
--- a/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml
@@ -12,7 +12,7 @@
     <option name="ADD_CONTENT_ROOTS" value="true" />
     <option name="ADD_SOURCE_ROOTS" value="true" />
     <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
-    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" />
+    <option name="SCRIPT_NAME" value="$PROJECT_DIR$/core/tmtc_client_core.py" />
     <option name="PARAMETERS" value="-m 3 -s 200 -c 1 --hk -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
diff --git a/gui/obsw_backend_test.py b/archive/obsw_backend_test.py
similarity index 92%
rename from gui/obsw_backend_test.py
rename to archive/obsw_backend_test.py
index d9e6c48..62a3c3e 100644
--- a/gui/obsw_backend_test.py
+++ b/archive/obsw_backend_test.py
@@ -9,7 +9,7 @@ LOGGER = get_logger()
 
 class TmTcBackend(Process):
     def __init__(self):
-        from obsw_tmtc_client import TmTcHandler
+        from core.tmtc_client_core import TmTcHandler
         super(TmTcBackend, self).__init__()
         self.address = ('localhost', 6000)     # family is deduced to be 'AF_INET'
         self.tmtc_backend = TmTcHandler()
diff --git a/archive/obsw_pus_tm_base.py b/archive/obsw_pus_tm_base.py
deleted file mode 100644
index 287c9cd..0000000
--- a/archive/obsw_pus_tm_base.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-Created on Wed Apr  4 11:44:48 2018
-Generic PUS packet class to deserialize raw PUS telemetry.
-@author: S. Gaisser
-"""
-
-import crcmod
-import datetime
-
-
-class ObswPusPacket:
-    def __init__(self, byte_array: bytearray):
-        self.__packet_raw = byte_array
-        self.PUSHeader = PUSPacketHeader(byte_array)
-        byte_array = byte_array[6:]
-        self.dataFieldHeader = OBSWPUSPacketDataFieldHeader(byte_array)
-        byte_array = byte_array[12:]
-        self.data = byte_array[:len(byte_array) - 2]
-        self.crc = byte_array[len(byte_array) - 2] << 8 | byte_array[len(byte_array) - 1]
-
-    def get_raw_packet(self) -> bytearray:
-        return self.__packet_raw
-
-    def append_pus_packet_header(self, array):
-        self.dataFieldHeader.printDataFieldHeader(array)
-        self.PUSHeader.printPusPacketHeader(array)
-
-    def append_pus_packet_header_column_headers(self, array):
-        self.dataFieldHeader.printDataFieldHeaderColumnHeader(array)
-        self.PUSHeader.printPusPacketHeaderColumnHeaders(array)
-
-    def getPacketSize(self):
-        # PusHeader Size + data size
-        size = PUSPacketHeader.headerSize + self.PUSHeader.length + 1
-        return size
-
-    def getService(self):
-        return self.dataFieldHeader.type
-
-    def getSubservice(self):
-        return self.dataFieldHeader.subtype
-
-    def getSSC(self):
-        return self.PUSHeader.sourceSequenceCount
-
-    def printData(self):
-        print(self.returnDataString())
-
-    def returnDataString(self):
-        strToPrint = "["
-        for byte in self.data:
-            strToPrint += str(hex(byte)) + " , "
-        strToPrint = strToPrint.rstrip(' , ')
-        strToPrint += ']'
-        return strToPrint
-
-
-
diff --git a/config/obsw_config.py b/config/obsw_config.py
index 3372243..fad6290 100644
--- a/config/obsw_config.py
+++ b/config/obsw_config.py
@@ -10,7 +10,6 @@
 import struct
 import pprint
 import logging
-from socket import INADDR_ANY
 from config.obsw_definitions import ModeList, ComIF
 
 """
@@ -172,6 +171,6 @@ def set_globals(args):
     G_TM_TIMEOUT = args.tm_timeout
     G_RESEND_TC = args.resend_tc
 
-    from obsw_user_code import global_setup_hook
+    from config.obsw_user_code import global_setup_hook
     global_setup_hook()
 
diff --git a/core/__init__.py b/core/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/obsw_tmtc_client.py b/core/tmtc_backend.py
old mode 100755
new mode 100644
similarity index 75%
rename from obsw_tmtc_client.py
rename to core/tmtc_backend.py
index f0421b2..1b16d20
--- a/obsw_tmtc_client.py
+++ b/core/tmtc_backend.py
@@ -1,101 +1,28 @@
-#!/usr/bin/python3
-# -*- coding: utf-8 -*-
-"""
-@brief  This client was developed by KSat for the SOURCE project to test the on-board software.
-@details
-This client features multiple sender/receiver modes and has been designed
-to be extensible and easy to use. This clien is based on the PUS standard for the format
-of telecommands and telemetry. It can also send TMTC via different interfaces like the
-serial interface (USB port) or ethernet interface.
-
-@license
-Copyright 2020 KSat e.V. Stuttgart
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-@manual
-Run this file with the -h flag to display options.
-"""
 import atexit
 import time
 import logging
 import sys
 from collections import deque
-from typing import Tuple, Union
-
 from config import obsw_config as g
-from config.obsw_config import set_globals
-from config.obsw_com_config import set_communication_interface
+from typing import Tuple, Union
 
+from tc.obsw_pus_tc_packer import ServiceQueuePacker, create_total_tc_queue
+from test.obsw_pus_service_test import run_selected_pus_tests
+from tmtc_core.utility.obsw_logger import get_logger
 from tmtc_core.tc.obsw_pus_tc_base import PusTcInfo
 from tmtc_core.sendreceive.obsw_single_command_sender_receiver import SingleCommandSenderReceiver
 from tmtc_core.sendreceive.obsw_sequential_sender_receiver import SequentialCommandSenderReceiver
 from tmtc_core.sendreceive.obsw_tm_listener import TmListener
 from tmtc_core.utility.obsw_tmtc_printer import TmTcPrinter
 from tmtc_core.utility.obsw_exit_handler import keyboard_interrupt_handler
-from tmtc_core.utility.obsw_logger import set_tmtc_logger, get_logger
+from config.obsw_com_config import set_communication_interface
 
-from test.obsw_pus_service_test import run_selected_pus_tests
-from tc.obsw_pus_tc_packer import create_total_tc_queue, ServiceQueuePacker
-from utility.obsw_args_parser import parse_input_arguments
 from utility.obsw_binary_uploader import BinaryFileUploader
 
-from obsw_user_code import command_preparation_hook
-import gui.obsw_tmtc_gui
+from config.obsw_user_code import command_preparation_hook
 
 LOGGER = get_logger()
 
-def main():
-    """
-    Main method, reads input arguments, sets global variables and start TMTC handler.
-    """
-    set_tmtc_logger()
-    LOGGER.info("Starting TMTC Client")
-
-    LOGGER.info("Parsing input arguments")
-    args = parse_input_arguments()
-
-    LOGGER.info("Setting global variables")
-    set_globals(args)
-
-    LOGGER.info("Starting TMTC Handler")
-
-    if g.G_MODE_ID == g.ModeList.GUIMode:
-        open_gui()
-    else:
-        tmtc_handler = TmTcHandler()
-        tmtc_handler.perform_operation()
-
-    # At some later point, the program will run permanently and be able to take commands.
-    # For now we put a permanent loop here so the program
-    # doesn't exit automatically (TM Listener is daemonic)
-    while True:
-        pass
-
-
-def open_gui():
-    tmtcGui = gui.obsw_tmtc_gui.TmTcGUI()
-    tmtcGui.run()
-    # sys.exit()
-
-
-def command_preparation() -> Tuple[bytearray, Union[None, PusTcInfo]]:
-    """
-    Prepare command for single command testing
-    :return:
-    """
-    return command_preparation_hook()
-
 
 class TmTcHandler:
     """
@@ -237,5 +164,9 @@ class TmTcHandler:
             self.mode = g.ModeList.ListenerMode
 
 
-if __name__ == "__main__":
-    main()
+def command_preparation() -> Tuple[bytearray, Union[None, PusTcInfo]]:
+    """
+    Prepare command for single command testing
+    :return:
+    """
+    return command_preparation_hook()
\ No newline at end of file
diff --git a/core/tmtc_client_core.py b/core/tmtc_client_core.py
new file mode 100755
index 0000000..346e1ab
--- /dev/null
+++ b/core/tmtc_client_core.py
@@ -0,0 +1,76 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+"""
+@brief  This client was developed by KSat for the SOURCE project to test the on-board software.
+@details
+This client features multiple sender/receiver modes and has been designed
+to be extensible and easy to use. This clien is based on the PUS standard for the format
+of telecommands and telemetry. It can also send TMTC via different interfaces like the
+serial interface (USB port) or ethernet interface.
+
+@license
+Copyright 2020 KSat e.V. Stuttgart
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+@manual
+Run this file with the -h flag to display options.
+"""
+import time
+
+from tmtc_core.utility.obsw_logger import set_tmtc_logger, get_logger
+
+from config.obsw_config import set_globals
+from core.tmtc_backend import TmTcHandler
+from utility.obsw_args_parser import parse_input_arguments
+
+LOGGER = get_logger()
+
+def run_tmtc_client(use_gui: bool):
+    """
+    Main method, reads input arguments, sets global variables and start TMTC handler.
+    """
+    set_tmtc_logger()
+    LOGGER.info("Starting TMTC Client")
+
+    if use_gui:
+        run_with_gui()
+
+    LOGGER.info("Parsing input arguments")
+    args = parse_input_arguments()
+
+    LOGGER.info("Setting global variables")
+    set_globals(args)
+
+    LOGGER.info("Starting TMTC Handler")
+
+    tmtc_handler = TmTcHandler()
+    tmtc_handler.perform_operation()
+
+    # At some later point, the program will run permanently and be able to take commands.
+    # For now we put a permanent loop here so the program
+    # doesn't exit automatically (TM Listener is daemonic)
+    while True:
+        pass
+
+
+def run_with_gui():
+    while True:
+        print("GUI net fertig")
+        time.sleep(2)
+    # tmtcGui = gui.obsw_tmtc_gui.TmTcGUI()
+    # tmtcGui.run()
+    # sys.exit()
+
+
+
diff --git a/gui/obsw_tmtc_gui.py b/gui/obsw_tmtc_gui.py
index ae29984..adc571c 100644
--- a/gui/obsw_tmtc_gui.py
+++ b/gui/obsw_tmtc_gui.py
@@ -14,7 +14,7 @@
     R. Mueller
 """
 from PyQt5.QtWidgets import *
-from obsw_tmtc_client import TmTcHandler
+
 from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
 from tmtc_core.utility.obsw_logger import get_logger
 from config import obsw_config
@@ -35,7 +35,8 @@ LOGGER = get_logger()
 
 class TmTcGUI:
     def __init__(self):
-        super(TmTcGUI, self).__init__()
+        pass
+        # super(TmTcGUI, self).__init__()
 
     def run(self):
         application = Application()
@@ -64,6 +65,7 @@ class SingleCommandTable(QTableWidget):
 
 
 class Application:
+    from core.tmtc_client_core import TmTcHandler
     tmtc_handler: TmTcHandler
 
     # TODO: this list should probably be inside an enum in the obsw_config.py
@@ -80,11 +82,13 @@ class Application:
 
     isBusy: bool
 
-    def __init__(self):
+    def __init__(self, tmtc_handler: TmTcHandler):
+        self.tmtc_handler = tmtc_handler
         obsw_config.G_SERVICE = 17
         obsw_config.G_COM_IF = obsw_config.ComIF.QEMU
 
     def init_tmtc_handler(self):
+        from core.tmtc_client_core import TmTcHandler
         self.tmtc_handler = TmTcHandler()
 
     def com_if_index_changed(self, index: int):
diff --git a/obsw_user_code.py b/obsw_user_code.py
deleted file mode 100644
index 4cfc48e..0000000
--- a/obsw_user_code.py
+++ /dev/null
@@ -1,45 +0,0 @@
-"""
-User defined code can be added here.
-"""
-from typing import Union, Tuple
-from tmtc_core.tc.obsw_pus_tc_base import PusTcInfo
-from enum import Enum
-
-
-# Yeah, I did not have a better idea yet..
-class Developer(Enum):
-    Robin = 0
-
-
-Developer = Developer.Robin
-
-
-def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]:
-    """
-    Can be used to pack user-defined commands.
-    """
-    if Developer == Developer.Robin:
-        return prepare_robins_commands()
-
-
-def global_setup_hook():
-    """
-    Can be used to alter the global variables in a custom defined way.
-    For example, device specific com ports or ethernet ports can be set here.
-    The global variables in the config.obsw_config file can be edited here
-    by using the handle.
-    For example: config.obsw_config.G_ETHERNET_SEND_ADDRESS = new_send_address
-    """
-    if Developer == Developer.Robin:
-        global_setup_hook_robin()
-
-
-def prepare_robins_commands():
-    from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
-    command = PusTelecommand(service=17, subservice=1, ssc=20)
-    return command.pack_command_tuple()
-
-
-def global_setup_hook_robin():
-    import config.obsw_config
-    pass
diff --git a/tmtc_client_cli.py b/tmtc_client_cli.py
new file mode 100644
index 0000000..a744b54
--- /dev/null
+++ b/tmtc_client_cli.py
@@ -0,0 +1,7 @@
+from core.tmtc_client_core import run_tmtc_client
+
+def main():
+    run_tmtc_client(False)
+
+if __name__ == "__main__":
+    main()
diff --git a/tmtc_client_gui.py b/tmtc_client_gui.py
new file mode 100644
index 0000000..f389a92
--- /dev/null
+++ b/tmtc_client_gui.py
@@ -0,0 +1,7 @@
+from core.tmtc_client_core import run_tmtc_client
+
+def main():
+    run_tmtc_client(True)
+
+if __name__ == "__main__":
+    main()
\ No newline at end of file
-- 
GitLab