eive-tmtc/config/hook_implementations.py

58 lines
2.0 KiB
Python
Raw Normal View History

2022-04-09 18:44:04 +02:00
from typing import Union
2021-03-19 17:39:52 +01:00
2022-02-03 16:02:55 +01:00
from tmtccmd.config.definitions import (
ServiceOpCodeDictT,
)
from tmtccmd.tc.definitions import TcQueueT
2022-03-04 14:27:19 +01:00
from tmtccmd.utility.retval import RetvalDictT
from tmtccmd.pus.obj_id import ObjectIdDictT
2021-03-23 13:44:33 +01:00
from tmtccmd.com_if.com_interface_base import CommunicationInterface
from tmtccmd.core.backend import TmTcHandler
2021-05-17 17:42:04 +02:00
from tmtccmd.config.hook import TmTcHookBase
2021-05-17 17:59:24 +02:00
2022-03-04 14:27:19 +01:00
from config.retvals import get_retval_dict
2022-05-03 18:36:28 +02:00
from pus_tc.cmd_definitions import get_eive_service_op_code_dict
2021-03-19 17:39:52 +01:00
2021-03-19 17:42:36 +01:00
class EiveHookObject(TmTcHookBase):
2022-04-06 11:43:17 +02:00
def __init__(self, json_cfg_path: str):
super().__init__(json_cfg_path=json_cfg_path)
2021-05-17 17:42:04 +02:00
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict
2022-04-06 16:17:51 +02:00
2021-05-17 17:59:24 +02:00
service_op_code_dict = get_default_service_op_code_dict()
2021-09-07 13:28:36 +02:00
get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
2021-05-17 17:59:24 +02:00
return service_op_code_dict
2021-05-17 17:42:04 +02:00
2022-01-18 14:03:56 +01:00
def assign_communication_interface(
self, com_if_key: str
2022-01-18 14:03:56 +01:00
) -> Union[CommunicationInterface, None]:
2021-05-17 17:42:04 +02:00
from tmtccmd.config.com_if import create_communication_interface_default
2022-01-18 14:03:56 +01:00
2021-05-17 17:42:04 +02:00
return create_communication_interface_default(
2022-01-18 14:03:56 +01:00
com_if_key=com_if_key,
2022-04-06 11:43:17 +02:00
json_cfg_path=self.json_cfg_path,
2022-01-18 14:03:56 +01:00
space_packet_ids=(0x0865,),
2021-05-17 17:42:04 +02:00
)
2021-03-19 17:39:52 +01:00
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
from config.custom_mode_op import custom_mode_operation
2022-01-18 14:03:56 +01:00
2021-03-19 17:39:52 +01:00
custom_mode_operation(mode=mode, tmtc_backend=tmtc_backend)
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
from pus_tc.tc_packer_hook import pack_service_queue_user
2022-01-18 14:03:56 +01:00
pack_service_queue_user(
service=service, op_code=op_code, service_queue=service_queue
)
2021-03-19 17:39:52 +01:00
2022-03-04 14:27:19 +01:00
def get_object_ids(self) -> ObjectIdDictT:
2021-05-17 17:42:04 +02:00
from config.object_ids import get_object_ids
2022-03-04 14:44:13 +01:00
2021-05-17 17:42:04 +02:00
return get_object_ids()
2021-03-19 17:39:52 +01:00
2022-03-04 14:27:19 +01:00
def get_retval_dict(self) -> RetvalDictT:
return get_retval_dict()