From 4daddf72558d6f8b5ed186d56407357e2455a3e1 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 17:12:05 +0200 Subject: [PATCH 1/7] deleted tmtc_core folder --- tmtc_core | 1 - 1 file changed, 1 deletion(-) delete mode 160000 tmtc_core diff --git a/tmtc_core b/tmtc_core deleted file mode 160000 index bd46c5a..0000000 --- a/tmtc_core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bd46c5a85262140ab097b2704926745e1a0687d1 From 8fc67c26653df03f3352493bd0c744bc79928e1d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 16:46:31 +0200 Subject: [PATCH 2/7] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index b36f182..ad97810 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b36f182178cf7fa41b169b705eaf2364a1e29969 +Subproject commit ad97810cbae576e36a98f569af90467bfdca7a54 From 0b9bbf621212a05f656dc95b0d76f896d832db10 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 17:21:18 +0200 Subject: [PATCH 3/7] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index ad97810..9415eac 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit ad97810cbae576e36a98f569af90467bfdca7a54 +Subproject commit 9415eac9eeb17dffed31f3a7a1ef849902eeb5c1 From d241101d887e2910834a0a7e43edf58270191696 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 17:30:37 +0200 Subject: [PATCH 4/7] updated tmtc --- .gitignore | 6 +++++- config/definitions.py | 3 +++ config/globals_config.py | 5 +++-- config/hook_implementations.py | 3 ++- pus_tm/factory_hook.py | 28 +++++++++++++++++++--------- tmtc_client_cli.py | 17 ++++++++++++++++- tmtccmd | 2 +- 7 files changed, 49 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index ab65048..50cba5f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,8 @@ log /Lib /Scripts -/pyvenv.cfg \ No newline at end of file +/pyvenv.cfg +/bin +/lib +/lib64 +/share diff --git a/config/definitions.py b/config/definitions.py index 0b134c2..75b7b21 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -7,6 +7,9 @@ import enum +PUS_APID = 0x65 + + class CustomServiceList(enum.Enum): TEST_DEVICE = "test", P60DOCK = "p60dock" diff --git a/config/globals_config.py b/config/globals_config.py index c1199c6..b8274bb 100644 --- a/config/globals_config.py +++ b/config/globals_config.py @@ -9,7 +9,7 @@ import argparse # All globals can be added here and will be part of a globals dictionary. -from config.definitions import CustomServiceList +from config.definitions import CustomServiceList, PUS_APID from config.custom_mode_op import CustomModeList from tmtccmd.config.definitions import CoreComInterfaces from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \ @@ -25,7 +25,8 @@ class CustomGlobalIds(enum.Enum): def set_globals_pre_args_parsing(gui: bool = False): - set_default_globals_pre_args_parsing(gui=gui, apid=0x65, com_if_id=CoreComInterfaces.TCPIP_UDP.value) + set_default_globals_pre_args_parsing( + gui=gui, apid=PUS_APID, com_if_id=CoreComInterfaces.TCPIP_UDP.value) def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str): diff --git a/config/hook_implementations.py b/config/hook_implementations.py index e55836f..3b0e2ac 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -97,7 +97,8 @@ class EiveHookObject(TmTcHookBase): Union[CommunicationInterface, None]: from tmtccmd.config.com_if import create_communication_interface_default return create_communication_interface_default( - com_if_key=com_if_key, tmtc_printer=tmtc_printer, json_cfg_path=self.get_json_config_file_path() + com_if_key=com_if_key, tmtc_printer=tmtc_printer, + json_cfg_path=self.get_json_config_file_path() ) def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 1d10153..ab2b264 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -11,22 +11,32 @@ from tmtccmd.pus_tm.service_1_verification import Service1TM from tmtccmd.pus_tm.service_3_housekeeping import Service3TM from tmtccmd.pus_tm.service_5_event import Service5TM from tmtccmd.pus_tm.service_17_test import Service17TM +from tmtccmd.utility.tmtc_printer import TmTcPrinter + +from config.definitions import PUS_APID LOGGER = get_logger() -def tm_user_factory_hook(raw_tm_packet: bytearray) -> PusTelemetry: +def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None: + if apid == PUS_APID: + pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer) + + +def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter): service_type = raw_tm_packet[7] + tm_packet = None if service_type == 1: - return Service1TM(raw_tm_packet) + tm_packet = Service1TM(raw_tm_packet) if service_type == 3: - return Service3TM(raw_tm_packet) + tm_packet = Service3TM(raw_tm_packet) if service_type == 5: - return Service5TM(raw_tm_packet) + tm_packet = Service5TM(raw_tm_packet) if service_type == 8: - service_8_tm = Service8TM(raw_tm_packet) - return Service8TM(raw_tm_packet) + tm_packet = Service8TM(raw_tm_packet) if service_type == 17: - return Service17TM(raw_tm_packet) - LOGGER.info("The service " + str(service_type) + " is not implemented in Telemetry Factory") - return PusTelemetry(raw_tm_packet) + tm_packet = Service17TM(raw_tm_packet) + if tm_packet is None: + LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory') + tm_packet = PusTelemetry(raw_tm_packet) + tmtc_printer.print_telemetry(packet=tm_packet) diff --git a/tmtc_client_cli.py b/tmtc_client_cli.py index c481101..e31b5c4 100644 --- a/tmtc_client_cli.py +++ b/tmtc_client_cli.py @@ -26,13 +26,28 @@ limitations under the License. @author R. Mueller """ -from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander +import sys + from config.hook_implementations import EiveHookObject +from config.definitions import PUS_APID +from pus_tm.factory_hook import ccsds_tm_handler +try: + from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander + from tmtccmd.ccsds.handler import CcsdsTmHandler +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + print(error) + print("Python tmtccmd submodule could not be imported") + print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") + sys.exit(0) def main(): hook_obj = EiveHookObject() initialize_tmtc_commander(hook_object=hook_obj) + ccsds_handler = CcsdsTmHandler() + ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) run_tmtc_commander(False) diff --git a/tmtccmd b/tmtccmd index 9415eac..ec23093 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 9415eac9eeb17dffed31f3a7a1ef849902eeb5c1 +Subproject commit ec23093bff4c70ab0044f1bb049c64a2376ec927 From aaba7d58574e892a34fd1e9149eb80e09fca416e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 17:33:22 +0200 Subject: [PATCH 5/7] small fix --- tmtc_client_cli.py | 3 ++- tmtccmd | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tmtc_client_cli.py b/tmtc_client_cli.py index e31b5c4..283376e 100644 --- a/tmtc_client_cli.py +++ b/tmtc_client_cli.py @@ -32,7 +32,7 @@ from config.hook_implementations import EiveHookObject from config.definitions import PUS_APID from pus_tm.factory_hook import ccsds_tm_handler try: - from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander + from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler from tmtccmd.ccsds.handler import CcsdsTmHandler except ImportError as error: run_tmtc_commander = None @@ -48,6 +48,7 @@ def main(): initialize_tmtc_commander(hook_object=hook_obj) ccsds_handler = CcsdsTmHandler() ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) + add_ccsds_handler(ccsds_handler) run_tmtc_commander(False) diff --git a/tmtccmd b/tmtccmd index ec23093..b4358a1 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit ec23093bff4c70ab0044f1bb049c64a2376ec927 +Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a From 3927377e943a97aac6bc86cd060d528e323b8d8f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 17:36:37 +0200 Subject: [PATCH 6/7] bumped revision --- config/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/version.py b/config/version.py index e89aabb..ef8fd1f 100644 --- a/config/version.py +++ b/config/version.py @@ -1,4 +1,4 @@ SW_NAME = "eive" VERSION_MAJOR = 1 VERSION_MINOR = 6 -VERSION_SUBMINOR = 0 +VERSION_SUBMINOR = 1 From 5be05c2a929dfc908b8de61250e4db890b010fa5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 18:40:05 +0200 Subject: [PATCH 7/7] tmtccmd update --- tmtccmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtccmd b/tmtccmd index b4358a1..b0cf33b 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit b4358a15fd945a9e0103a707b2a2dc56c458b24a +Subproject commit b0cf33b8a6223247c5df38e5918ac8885c494c11