eive-tmtc/eive_tmtc/tmtc/tcs/brd_assy.py

58 lines
1.6 KiB
Python

from eive_tmtc.config.definitions import CustomServiceList
from eive_tmtc.config.object_ids import TCS_BOARD_ASS_ID
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 DefaultPusQueueHelper
from tmtccmd.tc.pus_200_fsfw_mode import Mode
class InfoAssy:
TCS_BOARD_ASS_NORMAL = "Switching TCS board assembly on"
TCS_BOARD_ASS_OFF = "Switching TCS board assembly off"
class OpCodeAssy:
TCS_BOARD_ASS_NORMAL = ["nml"]
TCS_BOARD_ASS_OFF = ["off"]
@tmtc_definitions_provider
def add_tcs_assy_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(
keys=OpCodeAssy.TCS_BOARD_ASS_NORMAL,
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
)
oce.add(
keys=OpCodeAssy.TCS_BOARD_ASS_OFF,
info=InfoAssy.TCS_BOARD_ASS_OFF,
)
defs.add_service(
name=CustomServiceList.TCS_ASS.value,
info="TCS Board Assembly",
op_code_entry=oce,
)
def pack_tcs_ass_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodeAssy.TCS_BOARD_ASS_NORMAL:
pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID,
mode=Mode.NORMAL,
submode=0,
q=q,
info=InfoAssy.TCS_BOARD_ASS_NORMAL,
)
if op_code in OpCodeAssy.TCS_BOARD_ASS_OFF:
pack_mode_cmd_with_info(
object_id=TCS_BOARD_ASS_ID,
mode=Mode.OFF,
submode=0,
q=q,
info=InfoAssy.TCS_BOARD_ASS_OFF,
)