fsfw-example-hosted/tmtc/config/hook.py

26 lines
930 B
Python
Raw Normal View History

2022-07-03 21:00:28 +02:00
from typing import Optional
from common_tmtc.config.definitions import TM_SP_IDS
2022-05-20 11:09:13 +02:00
from common_tmtc.config.hook_implementation import CommonFsfwHookBase
2022-07-03 21:00:28 +02:00
from common_tmtc.pus_tc.cmd_definitions import common_fsfw_service_op_code_dict
from tmtccmd.com_if import ComInterface
2022-08-17 17:23:17 +02:00
from tmtccmd.config import TmtcDefinitionWrapper
2022-05-20 11:09:13 +02:00
class FsfwHookBase(CommonFsfwHookBase):
2022-08-17 17:23:17 +02:00
def get_tmtc_definitions(self) -> TmtcDefinitionWrapper:
2022-07-03 21:00:28 +02:00
return common_fsfw_service_op_code_dict()
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
2022-07-27 20:44:20 +02:00
from tmtccmd.config.com_if import (
create_com_interface_default,
create_com_interface_cfg_default,
)
2022-07-27 14:41:07 +02:00
cfg = create_com_interface_cfg_default(
2022-07-03 21:00:28 +02:00
com_if_key=com_if_key,
2022-09-12 09:23:30 +02:00
json_cfg_path=self.cfg_path,
2022-07-27 20:44:20 +02:00
space_packet_ids=TM_SP_IDS,
2022-05-20 11:09:13 +02:00
)
2022-07-27 14:41:07 +02:00
return create_com_interface_default(cfg)