added tmtc commander files
This commit is contained in:
0
tmtc/config/__init__.py
Normal file
0
tmtc/config/__init__.py
Normal file
1
tmtc/config/custom_com_config.py
Normal file
1
tmtc/config/custom_com_config.py
Normal file
@ -0,0 +1 @@
|
||||
|
24
tmtc/config/custom_definitions.py
Normal file
24
tmtc/config/custom_definitions.py
Normal file
@ -0,0 +1,24 @@
|
||||
"""
|
||||
@brief This file transfers control of the custom definitions like modes to the user.
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
from enum import auto
|
||||
|
||||
|
||||
class CustomServiceList(enum.IntEnum):
|
||||
pass
|
||||
|
||||
|
||||
class SerialConfig(enum.Enum):
|
||||
SERIAL_PORT = auto()
|
||||
SERIAL_BAUD_RATE = auto()
|
||||
SERIAL_TIMEOUT = auto()
|
||||
SERIAL_COMM_TYPE = auto()
|
||||
|
||||
|
||||
class EthernetConfig(enum.Enum):
|
||||
SEND_ADDRESS = auto()
|
||||
RECV_ADDRESS = auto()
|
3
tmtc/config/custom_globals.py
Normal file
3
tmtc/config/custom_globals.py
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
|
||||
|
19
tmtc/config/custom_mode_op.py
Normal file
19
tmtc/config/custom_mode_op.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
@brief This file transfers control of custom mode handling to the user.
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
import sys
|
||||
|
||||
from tmtccmd.core.backend import TmTcHandler
|
||||
from tmtccmd.utility.logger import get_logger
|
||||
|
||||
LOGGER = get_logger()
|
||||
|
||||
|
||||
def perform_mode_operation_user(tmtc_backend: TmTcHandler, mode: int):
|
||||
"""
|
||||
Custom modes can be implemented here
|
||||
"""
|
||||
LOGGER.error(f"Unknown mode {mode}, Configuration error !")
|
||||
sys.exit()
|
73
tmtc/config/hook_base.py
Normal file
73
tmtc/config/hook_base.py
Normal file
@ -0,0 +1,73 @@
|
||||
import argparse
|
||||
from typing import Dict, Union, Tuple
|
||||
|
||||
from tmtccmd.config.definitions import ServiceOpCodeDictT
|
||||
from tmtccmd.config.hook import TmTcHookBase
|
||||
from tmtccmd.pus_tm.service_3_base import Service3Base
|
||||
|
||||
|
||||
class FsfwHookBase(TmTcHookBase):
|
||||
from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
||||
from tmtccmd.core.backend import TmTcHandler
|
||||
from tmtccmd.pus_tc.definitions import TcQueueT
|
||||
from tmtccmd.ecss.tm import PusTelemetry
|
||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter
|
||||
|
||||
def get_version(self) -> str:
|
||||
from config.version import SW_NAME, SW_VERSION, SW_SUBVERSION, SW_SUBSUBVERSION
|
||||
return f"{SW_NAME} {SW_VERSION}.{SW_SUBVERSION}.{SW_SUBSUBVERSION}"
|
||||
|
||||
def get_json_config_file_path(self) -> str:
|
||||
return "config/tmtc_config.json"
|
||||
|
||||
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
|
||||
from tmtccmd.config.globals import get_default_service_op_code_dict
|
||||
return get_default_service_op_code_dict()
|
||||
|
||||
def add_globals_pre_args_parsing(self, gui: bool = False):
|
||||
from tmtccmd.config.globals import set_default_globals_pre_args_parsing
|
||||
set_default_globals_pre_args_parsing(gui=gui, apid=0xef)
|
||||
|
||||
def add_globals_post_args_parsing(self, args: argparse.Namespace):
|
||||
from tmtccmd.config.globals import set_default_globals_post_args_parsing
|
||||
set_default_globals_post_args_parsing(args=args, json_cfg_path=self.get_json_config_file_path())
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str, tmtc_printer: TmTcPrinter) -> \
|
||||
Union[CommunicationInterface, None]:
|
||||
from tmtccmd.config.com_if import create_communication_interface_default
|
||||
return create_communication_interface_default(
|
||||
com_if_key=com_if_key, tmtc_printer=tmtc_printer, json_cfg_path=self.get_json_config_file_path()
|
||||
)
|
||||
|
||||
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
|
||||
print("No custom mode operation implemented")
|
||||
|
||||
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
|
||||
from pus_tc.tc_packing import pack_service_queue_user
|
||||
pack_service_queue_user(service=service, op_code=op_code, service_queue=service_queue)
|
||||
|
||||
def tm_user_factory_hook(self, raw_tm_packet: bytearray) -> Union[None, PusTelemetry]:
|
||||
from pus_tm.factory_hook import tm_user_factory_hook
|
||||
return tm_user_factory_hook(raw_tm_packet=raw_tm_packet)
|
||||
|
||||
def get_object_ids(self) -> Dict[bytes, list]:
|
||||
from config.object_ids import get_object_ids
|
||||
return get_object_ids()
|
||||
|
||||
@staticmethod
|
||||
def handle_service_8_telemetry(
|
||||
object_id: int, action_id: int, custom_data: bytearray
|
||||
) -> Tuple[list, list]:
|
||||
from pus_tm.service_8_handling import custom_service_8_handling
|
||||
return custom_service_8_handling(
|
||||
object_id=object_id, action_id=action_id, custom_data=custom_data
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def handle_service_3_housekeeping(
|
||||
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
|
||||
) -> Tuple[list, list, bytearray, int]:
|
||||
from pus_tm.service_3_hk_handling import service_3_hk_handling
|
||||
return service_3_hk_handling(
|
||||
object_id=object_id, set_id=set_id, hk_data=hk_data, service3_packet=service3_packet
|
||||
)
|
19
tmtc/config/object_ids.py
Normal file
19
tmtc/config/object_ids.py
Normal file
@ -0,0 +1,19 @@
|
||||
"""
|
||||
@brief This file transfers control of the object IDs to the user.
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
from typing import Dict
|
||||
|
||||
PUS_SERVICE_17_ID = bytes([0x53, 0x00, 0x00, 0x17])
|
||||
TEST_DEVICE_0_ID = bytes([0x44, 0x01, 0xAF, 0xFE])
|
||||
TEST_DEVICE_1_ID = bytes([0x44, 0x02, 0xAF, 0xFE])
|
||||
|
||||
|
||||
def get_object_ids() -> Dict[bytes, list]:
|
||||
object_id_dict = {
|
||||
PUS_SERVICE_17_ID: ["PUS Service 17"],
|
||||
TEST_DEVICE_0_ID: ["Test Device 0"],
|
||||
TEST_DEVICE_1_ID: ["Test Device 1"]
|
||||
}
|
||||
return object_id_dict
|
6
tmtc/config/tmtc_config.json
Normal file
6
tmtc/config/tmtc_config.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"COM_IF_KEY": "udp",
|
||||
"TCPIP_UDP_RECV_MAX_SIZE": 1500,
|
||||
"TCPIP_UDP_DEST_IP_ADDRESS": "127.0.0.1",
|
||||
"TCPIP_UDP_DEST_PORT": 7301
|
||||
}
|
4
tmtc/config/version.py
Normal file
4
tmtc/config/version.py
Normal file
@ -0,0 +1,4 @@
|
||||
SW_NAME = "fsfw-tmtc"
|
||||
SW_VERSION = 1
|
||||
SW_SUBVERSION = 2
|
||||
SW_SUBSUBVERSION = 0
|
Reference in New Issue
Block a user