From 536f704c5b7164959aa3f59bb2ddff815c904dc8 Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Wed, 7 Oct 2020 01:19:11 +0200
Subject: [PATCH] core update

---
 .../runConfigurations/tmtcclient_Single_Command_Serial.xml  | 2 +-
 config/obsw_config.py                                       | 1 +
 obsw_tmtc_client.py                                         | 4 ++--
 test/obsw_module_test.py                                    | 6 ++++--
 tmtc_core                                                   | 2 +-
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml b/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
index 1c72dd6..aa1a2f4 100644
--- a/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
+++ b/.idea/runConfigurations/tmtcclient_Single_Command_Serial.xml
@@ -13,7 +13,7 @@
     <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 2 -c 1 -t 5" />
+    <option name="PARAMETERS" value="-m 2 -c 1 -t 3" />
     <option name="SHOW_COMMAND_LINE" value="false" />
     <option name="EMULATE_TERMINAL" value="false" />
     <option name="MODULE_MODE" value="false" />
diff --git a/config/obsw_config.py b/config/obsw_config.py
index 0bc83a5..a92d079 100644
--- a/config/obsw_config.py
+++ b/config/obsw_config.py
@@ -20,6 +20,7 @@ Mission/Device specific information.
 # TODO: Automate / Autofill this file with the MIB parser
 
 # Object IDs
+PUS_SERVICE_17 = bytearray([0x53, 0x00, 0x00, 0x17])
 GPS0_DEVICE_ID = bytearray([0x44, 0x10, 0x1F, 0x00])
 GPS1_DEVICE_ID = bytearray([0x44, 0x20, 0x20, 0x00])
 DUMMY_DEVICE_ID = bytearray([0x44, 0x00, 0xAF, 0xFE])
diff --git a/obsw_tmtc_client.py b/obsw_tmtc_client.py
index 21785be..69eb88c 100755
--- a/obsw_tmtc_client.py
+++ b/obsw_tmtc_client.py
@@ -159,11 +159,11 @@ class TmTcHandler:
             self.prompt_mode()
 
         if self.mode == g.ModeList.ListenerMode:
-            if self.tm_listener.event_reply_received.is_set():
+            if self.tm_listener.reply_event():
                 LOGGER.info("TmTcHandler: Packets received.")
                 self.tmtc_printer.print_telemetry_queue(self.tm_listener.retrieve_tm_packet_queue())
                 self.tm_listener.clear_tm_packet_queue()
-                self.tm_listener.event_reply_received.clear()
+                self.tm_listener.clear_reply_event()
             self.command_received = True
 
         elif self.mode == g.ModeList.SingleCommandMode:
diff --git a/test/obsw_module_test.py b/test/obsw_module_test.py
index 07b97ce..fbdd1b6 100644
--- a/test/obsw_module_test.py
+++ b/test/obsw_module_test.py
@@ -240,10 +240,12 @@ class TestService(unittest.TestCase):
             if current_tm_info[TmDictionaryKeys.SERVICE] == 1:
                 self.scan_for_respective_tc(current_tm_info)
             # Here, the desired event Id or RID can be specified
+
             elif current_tm_info[TmDictionaryKeys.SERVICE] == 5:
                 # TODO: hardcoded values.. should be in config file
-                if (current_tm_info[TmDictionaryKeys.EVENT_ID] == 8300 and
-                        current_tm_info[TmDictionaryKeys.REPORTER_ID] == 0x51001700):
+                if current_tm_info[TmDictionaryKeys.EVENT_ID] == 9700 and \
+                        current_tm_info[TmDictionaryKeys.REPORTER_ID] == \
+                        (struct.unpack('>I', g.PUS_SERVICE_17)[0]):
                     self.event_counter = self.event_counter + 1
             elif current_tm_info[TmDictionaryKeys.SERVICE] == 17:
                 self.misc_counter = self.misc_counter + 1
diff --git a/tmtc_core b/tmtc_core
index 156030a..c1575e2 160000
--- a/tmtc_core
+++ b/tmtc_core
@@ -1 +1 @@
-Subproject commit 156030a9485ee7607b1b82711f37cf5bf91d25a3
+Subproject commit c1575e2bf8eb6b0a8c906cb84a544e9f8c75784d
-- 
GitLab