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 DualSideSubmodes 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 from tmtccmd.tc.decorator import ServiceProviderParams from tmtccmd.tc.pus_200_fsfw_modes import Modes class SusOpCodes: SUS_ASS_NOM_SIDE = ["0", "nom"] SUS_ASS_RED_SIDE = ["1", "red"] SUS_ASS_DUAL_MODE = ["2", "dual"] SUS_ASS_OFF = ["3", "off"] @service_provider(CustomServiceList.SUS_BRD_ASS) def pack_sus_cmds(p: ServiceProviderParams): op_code = p.op_code q = p.queue_helper if op_code in SusOpCodes.SUS_ASS_NOM_SIDE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Modes.NORMAL, submode=DualSideSubmodes.A_SIDE, q=q, info="Switching to SUS board to nominal side", ) if op_code in SusOpCodes.SUS_ASS_RED_SIDE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Modes.NORMAL, submode=DualSideSubmodes.B_SIDE, q=q, info="Switching to SUS board to redundant side", ) if op_code in SusOpCodes.SUS_ASS_OFF: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Modes.OFF, submode=0, q=q, info="Switching SUS board off", ) if op_code in SusOpCodes.SUS_ASS_DUAL_MODE: pack_mode_cmd_with_info( object_id=SUS_BOARD_ASS_ID, mode=Modes.NORMAL, submode=DualSideSubmodes.DUAL_SIDE, q=q, info="Switching to SUS board to dual side", ) @tmtc_definitions_provider def add_sus_board_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add( keys=SusOpCodes.SUS_ASS_NOM_SIDE, info="Switch SUS board to nominal side", ) oce.add( keys=SusOpCodes.SUS_ASS_RED_SIDE, info="Switch SUS board to redundant side", ) oce.add( keys=SusOpCodes.SUS_ASS_OFF, info="Switch off SUS board", ) oce.add( keys=SusOpCodes.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, )