diff --git a/config/obsw_config.py b/config/obsw_config.py index ad17aea73e039eb2f6d3786aaea99d4aa43df65f..305b452a04bd9a55e36445fe1ca533681f3fee13 100644 --- a/config/obsw_config.py +++ b/config/obsw_config.py @@ -11,6 +11,7 @@ import struct import pprint from typing import Tuple import logging +from obsw_user_code import global_setup_hook """ Global service_type definitions @@ -166,4 +167,5 @@ def set_globals(args): G_PRINT_RAW_TM = args.rawDataPrint G_COM_PORT = args.com_port G_TM_TIMEOUT = args.tm_timeout + global_setup_hook() diff --git a/obsw_tmtc_client.py b/obsw_tmtc_client.py index b31983de2ffabefff6e49af57e331f0882c88e8e..793aa9a6e5c605243d8b0529d863c0465f395a49 100755 --- a/obsw_tmtc_client.py +++ b/obsw_tmtc_client.py @@ -60,11 +60,15 @@ import unittest import logging import sys from collections import deque +from typing import Tuple, Union from test import obsw_pus_service_test from config import obsw_config as g from config.obsw_config import set_globals from tc.obsw_pus_tc_packer import PusTelecommand, create_total_tc_queue, pack_service_queue +from tc.obsw_pus_tc_frame_packer import pack_tc_frame +from obsw_user_code import command_preparation_hook +from tc.obsw_pus_tc_base import PusTcInfo from sendreceive.obsw_single_command_sender_receiver import SingleCommandSenderReceiver from sendreceive.obsw_sequential_sender_receiver import SequentialCommandSenderReceiver @@ -120,15 +124,12 @@ def main(): pass -def command_preparation(): +def command_preparation() -> Tuple[bytearray, Union[None, PusTcInfo]]: """ Prepare command for single command testing :return: """ - # Direct command which triggers an additional step reply and one completion reply - # Single Command Testing - command = PusTelecommand(service=17, subservice=1, ssc=21) - return command.pack_command_tuple() + return command_preparation_hook() class TmTcHandler: diff --git a/obsw_user_code.py b/obsw_user_code.py new file mode 100644 index 0000000000000000000000000000000000000000..571ff27d696bc13fec49cfd10462277ab67d4c8c --- /dev/null +++ b/obsw_user_code.py @@ -0,0 +1,17 @@ +""" +User defined code can be added here. +""" +from typing import Tuple, Union +from tc.obsw_pus_tc_base import PusTcInfo + +def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]: + """ + Can be used to pack user-defined commands. + """ + pass + +def global_setup_hook(): + """ + Can be used to alter the global variables in a custom defined way. + """ + pass