From 8f8fd06a93212e69193d53903f4f4a16cac99131 Mon Sep 17 00:00:00 2001
From: Robin Mueller <robin.mueller.m@gmail.com>
Date: Thu, 3 Dec 2020 12:54:03 +0100
Subject: [PATCH] separate internal error reporter test

---
 ...cclient_Service_3_IntErrorReporter_Test.xml} |  4 ++--
 tc/obsw_pus_tc_packer.py                        |  2 +-
 tc/obsw_tc_service3.py                          | 17 ++++++++++-------
 3 files changed, 13 insertions(+), 10 deletions(-)
 rename .idea/runConfigurations/{tmtcclient_Service_3_Serial_.xml => tmtcclient_Service_3_IntErrorReporter_Test.xml} (79%)

diff --git a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml b/.idea/runConfigurations/tmtcclient_Service_3_IntErrorReporter_Test.xml
similarity index 79%
rename from .idea/runConfigurations/tmtcclient_Service_3_Serial_.xml
rename to .idea/runConfigurations/tmtcclient_Service_3_IntErrorReporter_Test.xml
index 15d51da..77e6aeb 100644
--- a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml
+++ b/.idea/runConfigurations/tmtcclient_Service_3_IntErrorReporter_Test.xml
@@ -1,5 +1,5 @@
 <component name="ProjectRunConfigurationManager">
-  <configuration default="false" name="tmtcclient Service 3 Serial " type="PythonConfigurationType" factoryName="Python" folderName="Serial Service Test">
+  <configuration default="false" name="tmtcclient Service 3 IntErrorReporter Test" type="PythonConfigurationType" factoryName="Python" folderName="Serial Service Test">
     <module name="tmtc" />
     <option name="INTERPRETER_OPTIONS" value="" />
     <option name="PARENT_ENVS" value="true" />
@@ -13,7 +13,7 @@
     <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="-m 3 -s 3 -c 1 -t 3 --hk" />
+    <option name="PARAMETERS" value="-m 3 -s 3 -c 1 -t 3 -o ie --hk" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
     <option name="MODULE_MODE" value="false" />
diff --git a/tc/obsw_pus_tc_packer.py b/tc/obsw_pus_tc_packer.py
index 92ff578..58f58e1 100644
--- a/tc/obsw_pus_tc_packer.py
+++ b/tc/obsw_pus_tc_packer.py
@@ -40,7 +40,7 @@ class ServiceQueuePacker:
         if service == 2:
             return pack_service2_test_into(service_queue)
         if service == 3:
-            return pack_service3_test_into(service_queue)
+            return pack_service3_test_into(service_queue, op_code)
         if service == 5:
             return pack_service5_test_into(service_queue)
         if service == 8:
diff --git a/tc/obsw_tc_service3.py b/tc/obsw_tc_service3.py
index 4ecda48..758d702 100644
--- a/tc/obsw_tc_service3.py
+++ b/tc/obsw_tc_service3.py
@@ -6,7 +6,7 @@
 @date   02.05.2020
 """
 import struct
-from typing import Deque
+from typing import Deque, Union
 from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
 import config.tmtcc_config as g
 
@@ -27,12 +27,15 @@ number_of_parameters = struct.pack('>B', 5)
 sid_internal_err_rprtr = make_sid(g.INTERNAL_ERROR_REPORTER_ID, 0)
 
 
-def pack_service3_test_into(tc_queue: Deque) -> Deque:
-    tc_queue.appendleft(("print", "Testing Service 3"))
-    # Predefined packet testing
-    pack_test_device_test(tc_queue)
-    # pack_thermal_sensor_tests(tc_queue)
-    pack_internal_error_reporter_tests(tc_queue)
+def pack_service3_test_into(tc_queue: Deque, op_code: Union[str, int] = 0) -> Deque:
+    if op_code.lower() == "ie":
+        tc_queue.appendleft(("print", "Testing Internal Error Reporter"))
+        pack_internal_error_reporter_tests(tc_queue)
+    else:
+        tc_queue.appendleft(("print", "Testing Service 3"))
+        # Predefined packet testing
+        pack_test_device_test(tc_queue)
+        # pack_thermal_sensor_tests(tc_queue)
     tc_queue.appendleft(("export", "log/tmtc_log_service3.txt"))
     return tc_queue
 
-- 
GitLab