v1.9.0 #53
@ -13,8 +13,7 @@ from config.definitions import CustomServiceList, PUS_APID
|
|||||||
from config.custom_mode_op import CustomModeList
|
from config.custom_mode_op import CustomModeList
|
||||||
from tmtccmd.config.definitions import CoreComInterfaces
|
from tmtccmd.config.definitions import CoreComInterfaces
|
||||||
from tmtccmd.config.globals import (
|
from tmtccmd.config.globals import (
|
||||||
set_default_globals_pre_args_parsing,
|
set_default_globals_pre_args_parsing
|
||||||
set_default_globals_post_args_parsing,
|
|
||||||
)
|
)
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
|
|
||||||
@ -34,12 +33,3 @@ def set_globals_pre_args_parsing(gui: bool = False):
|
|||||||
tm_apid=PUS_APID,
|
tm_apid=PUS_APID,
|
||||||
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
|
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,
|
|
||||||
)
|
|
||||||
|
@ -21,34 +21,15 @@ from config.retvals import get_retval_dict
|
|||||||
|
|
||||||
|
|
||||||
class EiveHookObject(TmTcHookBase):
|
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:
|
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
|
||||||
from tmtccmd.config.globals import get_default_service_op_code_dict
|
from tmtccmd.config.globals import get_default_service_op_code_dict
|
||||||
|
|
||||||
service_op_code_dict = 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)
|
get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
|
||||||
|
|
||||||
return 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(
|
def assign_communication_interface(
|
||||||
self, com_if_key: str
|
self, com_if_key: str
|
||||||
) -> Union[CommunicationInterface, None]:
|
) -> Union[CommunicationInterface, None]:
|
||||||
@ -56,7 +37,7 @@ class EiveHookObject(TmTcHookBase):
|
|||||||
|
|
||||||
return create_communication_interface_default(
|
return create_communication_interface_default(
|
||||||
com_if_key=com_if_key,
|
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,),
|
space_packet_ids=(0x0865,),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
25
tmtccli.py
25
tmtccli.py
@ -31,6 +31,9 @@ import traceback
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import tmtccmd.runner as tmtccmd
|
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.ccsds.handler import CcsdsTmHandler, ApidHandler
|
||||||
from tmtccmd.logging import init_console_logger
|
from tmtccmd.logging import init_console_logger
|
||||||
except ImportError as error:
|
except ImportError as error:
|
||||||
@ -61,21 +64,25 @@ from pus_tm.factory_hook import ccsds_tm_handler
|
|||||||
def main():
|
def main():
|
||||||
print(f"-- eive tmtc version {__version__} --")
|
print(f"-- eive tmtc version {__version__} --")
|
||||||
print(f"-- spacepackets version {spacepackets.__version__} --")
|
print(f"-- spacepackets version {spacepackets.__version__} --")
|
||||||
hook_obj = EiveHookObject()
|
tmtccmd.init_printout(False)
|
||||||
tmtccmd.init_tmtccmd(hook_object=hook_obj)
|
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()
|
ccsds_handler = CcsdsTmHandler()
|
||||||
init_console_logger()
|
ccsds_handler.add_tm_handler(apid=PUS_APID, handler=apid_handler)
|
||||||
pus_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
|
tmtccmd.setup(setup_args=setup_args)
|
||||||
ccsds_handler.add_tm_handler(apid=PUS_APID, handler=pus_handler)
|
|
||||||
tmtccmd.add_ccsds_handler(ccsds_handler)
|
tmtccmd.add_ccsds_handler(ccsds_handler)
|
||||||
tmtccmd.setup_tmtccmd(use_gui=False, reduced_printout=False)
|
|
||||||
tmtc_backend = tmtccmd.get_default_tmtc_backend(
|
tmtc_backend = tmtccmd.get_default_tmtc_backend(
|
||||||
hook_obj=hook_obj,
|
setup_args=setup_args,
|
||||||
json_cfg_path=hook_obj.get_json_config_file_path(),
|
|
||||||
tm_handler=ccsds_handler,
|
tm_handler=ccsds_handler,
|
||||||
)
|
)
|
||||||
tmtc_backend.set_pre_send_cb(callable=pre_tc_send_cb, user_args=None)
|
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__":
|
if __name__ == "__main__":
|
||||||
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
|||||||
Subproject commit 306c1b8844ae120e3f2d9d7b47d4225444194933
|
Subproject commit ea87dae27aa623da2a90457df8d31cd308330818
|
Loading…
Reference in New Issue
Block a user