update for changed tmtccmd API

This commit is contained in:
Robin Müller 2022-04-06 11:43:17 +02:00
parent 3f5d77a5e5
commit b2acb7fec5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 22 additions and 44 deletions

View File

@ -13,8 +13,7 @@ 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,
set_default_globals_post_args_parsing,
set_default_globals_pre_args_parsing
)
from tmtccmd.logging import get_console_logger
@ -34,12 +33,3 @@ def set_globals_pre_args_parsing(gui: bool = False):
tm_apid=PUS_APID,
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
)
def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str):
set_default_globals_post_args_parsing(
args=args,
custom_services_list=[CustomServiceList],
custom_modes_list=[CustomModeList],
json_cfg_path=json_cfg_path,
)

View File

@ -21,34 +21,15 @@ from config.retvals import get_retval_dict
class EiveHookObject(TmTcHookBase):
def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path)
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict
service_op_code_dict = get_default_service_op_code_dict()
get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
return service_op_code_dict
def get_json_config_file_path(self) -> str:
"""The user can specify a path and filename for the JSON configuration file by overriding
this function.
:return:
"""
return "config/tmtc_config.json"
def add_globals_pre_args_parsing(self, gui: bool = False):
from config.globals_config import set_globals_pre_args_parsing
set_globals_pre_args_parsing(gui=gui)
def add_globals_post_args_parsing(self, args: argparse.Namespace):
from config.globals_config import add_globals_post_args_parsing
add_globals_post_args_parsing(
args=args, json_cfg_path=self.get_json_config_file_path()
)
def assign_communication_interface(
self, com_if_key: str
) -> Union[CommunicationInterface, None]:
@ -56,7 +37,7 @@ class EiveHookObject(TmTcHookBase):
return create_communication_interface_default(
com_if_key=com_if_key,
json_cfg_path=self.get_json_config_file_path(),
json_cfg_path=self.json_cfg_path,
space_packet_ids=(0x0865,),
)

View File

@ -31,6 +31,9 @@ import traceback
try:
import tmtccmd.runner as tmtccmd
from tmtccmd.config import default_json_path, SetupArgs
from tmtccmd.config.args import create_default_args_parser, add_default_tmtccmd_args, \
parse_default_input_arguments
from tmtccmd.ccsds.handler import CcsdsTmHandler, ApidHandler
from tmtccmd.logging import init_console_logger
except ImportError as error:
@ -61,21 +64,25 @@ from pus_tm.factory_hook import ccsds_tm_handler
def main():
print(f"-- eive tmtc version {__version__} --")
print(f"-- spacepackets version {spacepackets.__version__} --")
hook_obj = EiveHookObject()
tmtccmd.init_tmtccmd(hook_object=hook_obj)
tmtccmd.init_printout(False)
hook_obj = EiveHookObject(json_cfg_path=default_json_path())
arg_parser = create_default_args_parser()
add_default_tmtccmd_args(arg_parser)
args = parse_default_input_arguments(arg_parser, hook_obj)
setup_args = SetupArgs(hook_obj=hook_obj, use_gui=False, apid=PUS_APID, cli_args=args)
apid_handler = ApidHandler(
cb=ccsds_tm_handler, queue_len=50, user_args=None
)
ccsds_handler = CcsdsTmHandler()
init_console_logger()
pus_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
ccsds_handler.add_tm_handler(apid=PUS_APID, handler=pus_handler)
ccsds_handler.add_tm_handler(apid=PUS_APID, handler=apid_handler)
tmtccmd.setup(setup_args=setup_args)
tmtccmd.add_ccsds_handler(ccsds_handler)
tmtccmd.setup_tmtccmd(use_gui=False, reduced_printout=False)
tmtc_backend = tmtccmd.get_default_tmtc_backend(
hook_obj=hook_obj,
json_cfg_path=hook_obj.get_json_config_file_path(),
setup_args=setup_args,
tm_handler=ccsds_handler,
)
tmtc_backend.set_pre_send_cb(callable=pre_tc_send_cb, user_args=None)
tmtccmd.run_tmtccmd(False, tmtc_backend=tmtc_backend, run_setup=False)
tmtccmd.run(tmtc_backend=tmtc_backend)
if __name__ == "__main__":

@ -1 +1 @@
Subproject commit 306c1b8844ae120e3f2d9d7b47d4225444194933
Subproject commit ea87dae27aa623da2a90457df8d31cd308330818