eive-tmtc/eive_tmtc/config/hook.py
2023-01-31 12:56:13 +01:00

45 lines
1.5 KiB
Python

from typing import Optional
from eive_tmtc.config.definitions import SPACE_PACKET_IDS
from tmtccmd import HookBase, CcsdsTmtcBackend
from tmtccmd.com import ComInterface
from tmtccmd.config import TmtcDefinitionWrapper
from eive_tmtc.config.retvals import get_retval_dict
from eive_tmtc.pus_tc.cmd_definitions import get_eive_service_op_code_dict
from tmtccmd.util import ObjectIdDictT, RetvalDictT
class EiveHookObject(HookBase):
def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path)
def get_tmtc_definitions(self) -> TmtcDefinitionWrapper:
return get_eive_service_op_code_dict()
def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]:
from tmtccmd.config.com 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.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 eive_tmtc.config.custom_mode_op import custom_mode_operation
custom_mode_operation(tmtc_backend, mode)
def get_object_ids(self) -> ObjectIdDictT:
from eive_tmtc.config.object_ids import get_object_ids
return get_object_ids()
def get_retval_dict(self) -> RetvalDictT:
return get_retval_dict()