diff --git a/config/definitions.py b/config/definitions.py index d6a75f9..53a8970 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -8,6 +8,7 @@ import enum PUS_APID = 0x65 +SPACE_PACKET_IDS = (0x08 << 8 | PUS_APID,) class CustomServiceList(enum.Enum): diff --git a/config/hook_implementations.py b/config/hook_implementations.py index bbc88ea..8c843ca 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -1,5 +1,6 @@ from typing import Union +from config.definitions import SPACE_PACKET_IDS from tmtccmd.config.definitions import ( ServiceOpCodeDictT, ) @@ -33,7 +34,7 @@ class EiveHookObject(TmTcHookBase): return create_communication_interface_default( com_if_key=com_if_key, json_cfg_path=self.json_cfg_path, - space_packet_ids=(0x0865,), + space_packet_ids=SPACE_PACKET_IDS, ) def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): diff --git a/deamon.py b/deamon.py new file mode 100644 index 0000000..99b42ea --- /dev/null +++ b/deamon.py @@ -0,0 +1,55 @@ +import sys +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 + from tmtccmd.logging.pus import create_tmtc_logger +except ImportError as error: + run_tmtc_commander = None + initialize_tmtc_commander = None + tb = traceback.format_exc() + print(tb) + print("Python tmtccmd submodule could not be imported") + sys.exit(1) + +try: + import spacepackets +except ImportError as error: + print(error) + print("Python spacepackets module could not be imported") + print( + 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation' + ) + sys.exit(1) + +from config.version import __version__ +from config.definitions import SPACE_PACKET_IDS +from tmtccmd.sendreceive.tm_listener import TmListener +from tmtccmd.com_if.tcpip_utilities import determine_tcpip_address +from tmtccmd.com_if.tcpip_tcp_com_if import TcpIpTcpComIF, TcpCommunicationType + + +def main(): + print(f"-- eive tmtc version {__version__} --") + print(f"-- spacepackets version {spacepackets.__version__} --") + com_if = TcpIpTcpComIF( + com_if_key="tcp", + com_type=TcpCommunicationType.SPACE_PACKETS, + space_packet_ids=SPACE_PACKET_IDS, + tm_polling_freqency=0.5, + max_recv_size=1500, + target_address=("localhost", 1536), + ) + tm_listener = TmListener(com_if=com_if, tm_timeout=2.0, tc_timeout_factor=2.0) + + +if __name__ == "__main__": + main() diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index e999f59..15f9ed2 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -83,7 +83,8 @@ def pre_tc_send_cb( ): if isinstance(queue_entry, bytes) or isinstance(queue_entry, bytearray): log_raw_pus_tc( - packet=queue_entry, srv_subservice=(queue_info.service, queue_info.subservice) + packet=queue_entry, + srv_subservice=(queue_info.service, queue_info.subservice), ) tc_info_string = f"Sent {queue_info}" LOGGER.info(tc_info_string) @@ -93,6 +94,7 @@ def pre_tc_send_cb( if queue_entry == QueueCommands.PRINT: file_logger.info(queue_info) + def pack_service_queue_user( service: Union[str, int], op_code: str, service_queue: TcQueueT ): diff --git a/tmtccmd b/tmtccmd index d503c8b..f3b6150 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit d503c8b8a95d107f482880a8ba692fdd8d46adbc +Subproject commit f3b6150d9c4ebf5d01b07f3642a36744580c12ef