eive-tmtc/config/hook.py

45 lines
1.5 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 config.retvals import get_retval_dict
from pus_tc.cmd_definitions import get_eive_service_op_code_dict
from tmtccmd.util import ObjectIdDictT, RetvalDictT
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_com_interface_default,
create_com_interface_cfg_default,
)
cfg = create_com_interface_cfg_default(
com_if_key=com_if_key,
json_cfg_path=self.json_cfg_path,
space_packet_ids=SPACE_PACKET_IDS,
)
return create_com_interface_default(cfg)
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()