eive-tmtc/deamon.py

55 lines
1.6 KiB
Python

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 import __version__
from config.definitions import SPACE_PACKET_IDS
from tmtccmd.sendreceive.tm_listener import TmListener
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, seq_timeout=2.0)
if __name__ == "__main__":
main()