from eive_tmtc.config.definitions import CustomServiceList from eive_tmtc.config.object_ids import SUS_BOARD_ASS_ID from eive_tmtc.tmtc.acs.acs_board import DualSideSubmode from eive_tmtc.tmtc.common import pack_mode_cmd_with_info from tmtccmd.config.tmtc import ( tmtc_definitions_provider, TmtcDefinitionWrapper, OpCodeEntry, ) from tmtccmd.tc import service_provider, DefaultPusQueueHelper from tmtccmd.tc.decorator import ServiceProviderParams from tmtccmd.tc.pus_200_fsfw_modes import Mode class SusOpCode: SUS_ASS_NOM_SIDE = ["0", "nom"] SUS_ASS_RED_SIDE = ["1", "red"] SUS_ASS_DUAL_MODE = ["2", "dual"] SUS_ASS_OFF = ["3", "off"] def pack_sus_cmds(q: DefaultPusQueueHelper, op_code: str): if op_code in SusOpCode.SUS_ASS_NOM_SIDE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Mode.NORMAL, submode=DualSideSubmode.A_SIDE, q=q, info="Switching to SUS board to nominal side", ) if op_code in SusOpCode.SUS_ASS_RED_SIDE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Mode.NORMAL, submode=DualSideSubmode.B_SIDE, q=q, info="Switching to SUS board to redundant side", ) if op_code in SusOpCode.SUS_ASS_OFF: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Mode.OFF, submode=0, q=q, info="Switching SUS board off", ) if op_code in SusOpCode.SUS_ASS_DUAL_MODE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Mode.NORMAL, submode=DualSideSubmode.DUAL_SIDE, q=q, info="Switching to SUS board to dual side", ) @service_provider(CustomServiceList.SUS_BRD_ASS) def pack_sus_cmds_prvoider(p: ServiceProviderParams): op_code = p.op_code q = p.queue_helper pack_sus_cmds(q, op_code) @tmtc_definitions_provider def add_sus_board_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add( keys=SusOpCode.SUS_ASS_NOM_SIDE, info="Switch SUS board to nominal side", ) oce.add( keys=SusOpCode.SUS_ASS_RED_SIDE, info="Switch SUS board to redundant side", ) oce.add( keys=SusOpCode.SUS_ASS_OFF, info="Switch off SUS board", ) oce.add( keys=SusOpCode.SUS_ASS_DUAL_MODE, info="Switch SUS board to dual mode", ) defs.add_service( name=CustomServiceList.SUS_BRD_ASS.value, info="SUS Board Assembly", op_code_entry=oce, )