started new daemonic tmtc app

This commit is contained in:
Robin Müller 2022-05-16 18:35:36 +02:00
parent b81f756e4b
commit 1464b32e2d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 62 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import enum
PUS_APID = 0x65 PUS_APID = 0x65
SPACE_PACKET_IDS = (0x08 << 8 | PUS_APID,)
class CustomServiceList(enum.Enum): class CustomServiceList(enum.Enum):

View File

@ -1,5 +1,6 @@
from typing import Union from typing import Union
from config.definitions import SPACE_PACKET_IDS
from tmtccmd.config.definitions import ( from tmtccmd.config.definitions import (
ServiceOpCodeDictT, ServiceOpCodeDictT,
) )
@ -33,7 +34,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.json_cfg_path, 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): def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):

55
deamon.py Normal file
View File

@ -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()

View File

@ -83,7 +83,8 @@ def pre_tc_send_cb(
): ):
if isinstance(queue_entry, bytes) or isinstance(queue_entry, bytearray): if isinstance(queue_entry, bytes) or isinstance(queue_entry, bytearray):
log_raw_pus_tc( 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}" tc_info_string = f"Sent {queue_info}"
LOGGER.info(tc_info_string) LOGGER.info(tc_info_string)
@ -93,6 +94,7 @@ def pre_tc_send_cb(
if queue_entry == QueueCommands.PRINT: if queue_entry == QueueCommands.PRINT:
file_logger.info(queue_info) file_logger.info(queue_info)
def pack_service_queue_user( def pack_service_queue_user(
service: Union[str, int], op_code: str, service_queue: TcQueueT service: Union[str, int], op_code: str, service_queue: TcQueueT
): ):

@ -1 +1 @@
Subproject commit d503c8b8a95d107f482880a8ba692fdd8d46adbc Subproject commit f3b6150d9c4ebf5d01b07f3642a36744580c12ef