diff --git a/.gitmodules b/.gitmodules index 8c20967..477ffc1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -2,3 +2,6 @@ path = tmtccmd url = https://github.com/robamu-org/tmtccmd.git +[submodule "spacepackets"] + path = spacepackets + url = https://github.com/robamu-org/py-spacepackets.git diff --git a/.idea/runConfigurations/Unittests_in_spacepackets.xml b/.idea/runConfigurations/Unittests_in_spacepackets.xml new file mode 100644 index 0000000..bf17647 --- /dev/null +++ b/.idea/runConfigurations/Unittests_in_spacepackets.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations/Unittests_in_tmtccmd.xml b/.idea/runConfigurations/Unittests_in_tmtccmd.xml new file mode 100644 index 0000000..f6549f0 --- /dev/null +++ b/.idea/runConfigurations/Unittests_in_tmtccmd.xml @@ -0,0 +1,18 @@ + + + + + \ No newline at end of file diff --git a/config/custom_hooks.py b/config/custom_hooks.py index 35405b4..1e49474 100644 --- a/config/custom_hooks.py +++ b/config/custom_hooks.py @@ -3,7 +3,7 @@ @details Template configuration file. Copy this folder to the TMTC commander root and adapt it to your needs. """ -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand def command_preparation_hook() -> PusTelecommand: diff --git a/config/globals_config.py b/config/globals_config.py index 3fc9b35..3872094 100644 --- a/config/globals_config.py +++ b/config/globals_config.py @@ -26,7 +26,7 @@ class CustomGlobalIds(enum.Enum): def set_globals_pre_args_parsing(gui: bool = False): set_default_globals_pre_args_parsing( - gui=gui, apid=PUS_APID, com_if_id=CoreComInterfaces.TCPIP_UDP.value) + gui=gui, tc_apid=PUS_APID, tm_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 4770d89..d80ab19 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -44,7 +44,7 @@ class EiveHookObject(TmTcHookBase): 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(), space_packet_id=0x0865 + json_cfg_path=self.get_json_config_file_path(), space_packet_ids=(0x0865,) ) def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): diff --git a/pus_tc/acs.py b/pus_tc/acs.py index 66f5ad6..4edd3bd 100644 --- a/pus_tc/acs.py +++ b/pus_tc/acs.py @@ -1,6 +1,7 @@ import enum from tmtccmd.tc.definitions import TcQueueT -from tmtccmd.pus.service_list import PusServices +from spacepackets.ecss.definitions import PusServices + from tmtccmd.tc.service_200_mode import pack_mode_data, Modes from tmtccmd.tc.packer import PusTelecommand from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID diff --git a/pus_tc/heater.py b/pus_tc/heater.py index 18adf80..795ebbb 100644 --- a/pus_tc/heater.py +++ b/pus_tc/heater.py @@ -7,7 +7,7 @@ """ from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand class SwitchNumbers: diff --git a/pus_tc/imtq.py b/pus_tc/imtq.py index 943157c..f459f16 100644 --- a/pus_tc/imtq.py +++ b/pus_tc/imtq.py @@ -8,7 +8,7 @@ from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py index e02bd58..0a713cc 100644 --- a/pus_tc/pdu1.py +++ b/pus_tc/pdu1.py @@ -7,7 +7,7 @@ import enum from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from gomspace.gomspace_common import * from pus_tc.p60dock import P60DockConfigTable from gomspace.gomspace_pdu_definitions import * diff --git a/pus_tc/ploc_memory_dumper.py b/pus_tc/ploc_memory_dumper.py index 60a4271..4618c44 100644 --- a/pus_tc/ploc_memory_dumper.py +++ b/pus_tc/ploc_memory_dumper.py @@ -11,7 +11,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand class ActionIds: diff --git a/pus_tc/ploc_mpsoc.py b/pus_tc/ploc_mpsoc.py index d7a2977..8c45df1 100644 --- a/pus_tc/ploc_mpsoc.py +++ b/pus_tc/ploc_mpsoc.py @@ -11,7 +11,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand class PlocTestProcedure: diff --git a/pus_tc/ploc_supervisor.py b/pus_tc/ploc_supervisor.py index 31f9627..9fff345 100644 --- a/pus_tc/ploc_supervisor.py +++ b/pus_tc/ploc_supervisor.py @@ -11,7 +11,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from tmtccmd.utility.logger import get_console_logger LOGGER = get_console_logger() diff --git a/pus_tc/ploc_upater.py b/pus_tc/ploc_upater.py index 6721013..31329d0 100644 --- a/pus_tc/ploc_upater.py +++ b/pus_tc/ploc_upater.py @@ -12,7 +12,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand latchup_id_dict = { diff --git a/pus_tc/rad_sensor.py b/pus_tc/rad_sensor.py index a462c13..9214484 100644 --- a/pus_tc/rad_sensor.py +++ b/pus_tc/rad_sensor.py @@ -9,7 +9,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from pus_tc.service_200_mode import pack_mode_data diff --git a/pus_tc/reaction_wheels.py b/pus_tc/reaction_wheels.py index 0c48491..c97760d 100644 --- a/pus_tc/reaction_wheels.py +++ b/pus_tc/reaction_wheels.py @@ -9,7 +9,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from pus_tc.service_200_mode import pack_mode_data diff --git a/pus_tc/service_200_mode.py b/pus_tc/service_200_mode.py index 4bc8cdb..08faad4 100644 --- a/pus_tc/service_200_mode.py +++ b/pus_tc/service_200_mode.py @@ -6,7 +6,7 @@ @date 02.05.2020 """ from tmtccmd.config.definitions import QueueCommands -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from tmtccmd.tc.packer import TcQueueT from tmtccmd.tc.service_200_mode import pack_mode_data from config.object_ids import TEST_DEVICE_ID diff --git a/pus_tc/star_tracker.py b/pus_tc/star_tracker.py index 8edb2ed..e11fab1 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -10,7 +10,7 @@ import struct from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand class StarTrackerActionIds: diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 4eef894..3c11be7 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -8,7 +8,7 @@ from tmtccmd.config.definitions import CoreServiceList from tmtccmd.utility.logger import get_console_logger from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.service_5_event import pack_generic_service5_test_into -from tmtccmd.tc.service_17_test import pack_service17_ping_command +from tmtccmd.pus.service_17_test import pack_service_17_ping_command from pus_tc.service_200_mode import pack_service200_test_into from pus_tc.p60dock import pack_p60dock_test_into @@ -42,7 +42,7 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu if service == CoreServiceList.SERVICE_5.value: return pack_generic_service5_test_into(tc_queue=service_queue) if service == CoreServiceList.SERVICE_17.value: - return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple()) + return service_queue.appendleft(pack_service_17_ping_command(ssc=1700).pack_command_tuple()) if service == CoreServiceList.SERVICE_200.value: return pack_service200_test_into(tc_queue=service_queue) if service == CustomServiceList.P60DOCK.value: @@ -125,5 +125,5 @@ def create_total_tc_queue_user() -> TcQueueT: os.mkdir("log") tc_queue = deque() pack_generic_service5_test_into(tc_queue) - tc_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple()) + tc_queue.appendleft(pack_service_17_ping_command(ssc=1700).pack_command_tuple()) return tc_queue diff --git a/pus_tc/tmp1075.py b/pus_tc/tmp1075.py index 48b2d65..6e8b65d 100644 --- a/pus_tc/tmp1075.py +++ b/pus_tc/tmp1075.py @@ -8,7 +8,7 @@ from tmtccmd.config.definitions import QueueCommands from tmtccmd.tc.packer import TcQueueT -from tmtccmd.ecss.tc import PusTelecommand +from spacepackets.ecss.tc import PusTelecommand from pus_tc.service_200_mode import pack_mode_data diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py index 0bdca81..646744f 100644 --- a/pus_tm/factory_hook.py +++ b/pus_tm/factory_hook.py @@ -4,13 +4,13 @@ it to your needs. """ from tmtccmd.tm.service_8_functional_cmd import Service8TM -from tmtccmd.ecss.tm import PusTelemetry +from spacepackets.ecss.tm import PusTelemetry from tmtccmd.utility.logger import get_console_logger -from tmtccmd.tm.service_1_verification import Service1TM +from tmtccmd.pus.service_1_verification import Service1TMExtended +from tmtccmd.pus.service_17_test import Service17TMExtended from tmtccmd.tm.service_3_housekeeping import Service3TM from tmtccmd.tm.service_5_event import Service5TM -from tmtccmd.tm.service_17_test import Service17TM from tmtccmd.utility.tmtc_printer import TmTcPrinter from config.definitions import PUS_APID @@ -27,7 +27,7 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter): service_type = raw_tm_packet[7] tm_packet = None if service_type == 1: - tm_packet = Service1TM.unpack(raw_telemetry=raw_tm_packet) + tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet) if service_type == 3: tm_packet = Service3TM.unpack(raw_telemetry=raw_tm_packet, custom_hk_handling=False) if service_type == 5: @@ -35,7 +35,7 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter): if service_type == 8: tm_packet = Service8TM.unpack(raw_telemetry=raw_tm_packet) if service_type == 17: - tm_packet = Service17TM.unpack(raw_telemetry=raw_tm_packet) + tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet) if tm_packet is None: LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory') tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet) diff --git a/spacepackets b/spacepackets new file mode 160000 index 0000000..b5068ce --- /dev/null +++ b/spacepackets @@ -0,0 +1 @@ +Subproject commit b5068ceb033b6a857d463d6d91aa8cbdf07913e9 diff --git a/tmtc_client_cli.py b/tmtc_client_cli.py index d3f5b15..3fc7ded 100755 --- a/tmtc_client_cli.py +++ b/tmtc_client_cli.py @@ -35,6 +35,7 @@ from pus_tm.factory_hook import ccsds_tm_handler try: from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler from tmtccmd.ccsds.handler import CcsdsTmHandler + import spacepackets except ImportError as error: run_tmtc_commander = None initialize_tmtc_commander = None @@ -46,7 +47,8 @@ except ImportError as error: def main(): hook_obj = EiveHookObject() - print(f"-- eive tmtc version {__version__}") + print(f'-- eive tmtc version {__version__} --') + print(f'-- spacepackets version {spacepackets.__version__} --') 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) diff --git a/tmtc_client_gui.py b/tmtc_client_gui.py index ddcfa07..09d363c 100755 --- a/tmtc_client_gui.py +++ b/tmtc_client_gui.py @@ -35,6 +35,7 @@ from pus_tm.factory_hook import ccsds_tm_handler try: from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler from tmtccmd.ccsds.handler import CcsdsTmHandler + import spacepackets except ImportError as error: run_tmtc_commander = None initialize_tmtc_commander = None @@ -47,6 +48,7 @@ except ImportError as error: def main(): hook_obj = EiveHookObject() print(f"-- eive tmtc version {__version__}") + print(f'-- spacepackets version {spacepackets.__version__} --') 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) diff --git a/tmtccmd b/tmtccmd index 6e6e5d5..a7299e7 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 6e6e5d56a0155f00508c8da506acc6891431ff2c +Subproject commit a7299e7a68936ce7fa1fdf004a6c2dd2c8073711