2022-05-20 11:08:46 +02:00
|
|
|
from typing import Optional, Union
|
2021-10-13 12:08:50 +02:00
|
|
|
|
2021-07-14 00:28:33 +02:00
|
|
|
from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
|
|
|
from tmtccmd.config.definitions import ServiceOpCodeDictT
|
|
|
|
from tmtccmd.config.hook import TmTcHookBase
|
|
|
|
from tmtccmd.core.backend import TmTcHandler
|
2021-07-14 01:04:23 +02:00
|
|
|
from tmtccmd.tc.definitions import TcQueueT
|
2022-05-20 11:08:46 +02:00
|
|
|
from tmtccmd.utility.obj_id import ObjectIdDictT
|
2021-07-14 00:28:33 +02:00
|
|
|
|
2022-05-18 23:40:13 +02:00
|
|
|
from tmtccmd.utility.retval import RetvalDictT
|
|
|
|
|
|
|
|
from common_tmtc.config.definitions import TM_SP_IDS
|
2022-05-20 11:08:46 +02:00
|
|
|
from common_tmtc.pus_tc.cmd_definitions import common_fsfw_service_op_code_dict
|
|
|
|
|
|
|
|
|
|
|
|
class CommonFsfwHookBase(TmTcHookBase):
|
|
|
|
def pack_service_queue(
|
|
|
|
self, service: Union[int, str], op_code: str, service_queue: TcQueueT
|
|
|
|
):
|
|
|
|
from common_tmtc.pus_tc.tc_packing import common_service_queue_user
|
2021-07-14 00:28:33 +02:00
|
|
|
|
2022-05-20 11:08:46 +02:00
|
|
|
common_service_queue_user(
|
|
|
|
service=service, op_code=op_code, tc_queue=service_queue
|
|
|
|
)
|
2021-07-14 00:28:33 +02:00
|
|
|
|
2022-05-18 23:40:13 +02:00
|
|
|
def __init__(self, json_cfg_path: str):
|
|
|
|
super().__init__(json_cfg_path=json_cfg_path)
|
2021-07-14 00:28:33 +02:00
|
|
|
|
|
|
|
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
|
2022-05-20 11:08:46 +02:00
|
|
|
return common_fsfw_service_op_code_dict()
|
2021-07-14 00:28:33 +02:00
|
|
|
|
|
|
|
def assign_communication_interface(
|
2022-05-18 23:40:13 +02:00
|
|
|
self, com_if_key: str
|
2021-07-14 00:28:33 +02:00
|
|
|
) -> Optional[CommunicationInterface]:
|
|
|
|
from tmtccmd.config.com_if import create_communication_interface_default
|
2021-12-14 15:46:00 +01:00
|
|
|
|
2021-07-14 00:28:33 +02:00
|
|
|
return create_communication_interface_default(
|
2021-12-14 15:46:00 +01:00
|
|
|
com_if_key=com_if_key,
|
2022-05-18 23:40:13 +02:00
|
|
|
json_cfg_path=self.json_cfg_path,
|
|
|
|
space_packet_ids=TM_SP_IDS,
|
2021-07-14 00:28:33 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
|
|
|
|
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()
|