fsfw-example-tmtc-common/config/hook_implementation.py

34 lines
1.1 KiB
Python
Raw Normal View History

2022-07-03 20:58:32 +02:00
from abc import abstractmethod
from typing import Optional
2021-10-13 12:08:50 +02:00
2022-07-03 20:58:32 +02:00
from tmtccmd import BackendBase
from tmtccmd.com_if import ComInterface
2022-08-17 17:23:02 +02:00
from tmtccmd.config import TmTcCfgHookBase, TmtcDefinitionWrapper, default_json_path
2022-07-27 14:40:25 +02:00
from tmtccmd.util import ObjectIdDictT, RetvalDictT
2021-07-14 00:28:33 +02:00
2022-05-18 23:40:13 +02:00
2022-07-03 20:58:32 +02:00
class CommonFsfwHookBase(TmTcCfgHookBase):
def __init__(self, json_cfg_path: Optional[str] = None):
if json_cfg_path is None:
json_cfg_path = default_json_path()
2022-05-18 23:40:13 +02:00
super().__init__(json_cfg_path=json_cfg_path)
2021-07-14 00:28:33 +02:00
2022-07-03 20:58:32 +02:00
@abstractmethod
2022-08-17 17:23:02 +02:00
def get_tmtc_definitions(self) -> TmtcDefinitionWrapper:
2022-07-03 20:58:32 +02:00
pass
2021-12-14 15:46:00 +01:00
2022-07-03 20:58:32 +02:00
@abstractmethod
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
pass
2021-07-14 00:28:33 +02:00
2022-07-03 20:58:32 +02:00
def perform_mode_operation(self, tmtc_backend: BackendBase, mode: int):
2021-07-14 00:28:33 +02:00
print("No custom mode operation implemented")
2022-05-20 11:08:46 +02:00
def get_object_ids(self) -> ObjectIdDictT:
2021-07-14 00:28:33 +02:00
from common_tmtc.config.object_ids import get_object_ids
2021-12-14 15:46:00 +01:00
2021-07-14 00:28:33 +02:00
return get_object_ids()
2022-05-18 23:40:13 +02:00
def get_retval_dict(self) -> RetvalDictT:
return self.get_retval_dict()