eive-tmtc/config/hook.py
2022-07-05 02:12:54 +02:00

42 lines
1.4 KiB
Python

from typing import Optional
from config.definitions import SPACE_PACKET_IDS
from tmtccmd import TmTcCfgHookBase, CcsdsTmtcBackend
from tmtccmd.com_if import ComInterface
from tmtccmd.config import TmTcDefWrapper
from tmtccmd.utility.retval import RetvalDictT
from tmtccmd.utility.obj_id import ObjectIdDictT
from config.retvals import get_retval_dict
from pus_tc.cmd_definitions import get_eive_service_op_code_dict
class EiveHookObject(TmTcCfgHookBase):
def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path)
def get_tmtc_definitions(self) -> TmTcDefWrapper:
return get_eive_service_op_code_dict()
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
from tmtccmd.config.com_if import create_communication_interface_default
return create_communication_interface_default(
com_if_key=com_if_key,
json_cfg_path=self.json_cfg_path,
space_packet_ids=SPACE_PACKET_IDS,
)
def perform_mode_operation(self, tmtc_backend: CcsdsTmtcBackend, mode: int):
from config.custom_mode_op import custom_mode_operation
custom_mode_operation(tmtc_backend, mode)
def get_object_ids(self) -> ObjectIdDictT:
from config.object_ids import get_object_ids
return get_object_ids()
def get_retval_dict(self) -> RetvalDictT:
return get_retval_dict()