eive-tmtc/pus_tc/system/acs_ctrl.py
2022-08-16 11:44:49 +02:00

50 lines
1.5 KiB
Python

import enum
from config.definitions import CustomServiceList
from config.object_ids import ACS_CONTROLLER
from tmtccmd import DefaultProcedureInfo
from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper, OpCodeEntry
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
class SetIds(enum.IntEnum):
MGM_SET = 0
class OpCodes:
REQUEST_MGM_HK = ["0", "req-mgm-hk"]
ENABLE_MGM_HK = ["1", "enable-hk"]
DISABLE_MGM_HK = ["1", "enable-hk"]
class Info:
REQUEST_MGM_HK = "Request MGM HK once"
ENABLE_MGM_HK = "Enable MGM HK data generation"
DISABLE_MGM_HK = "Disable MGM HK data generation"
@tmtc_definitions_provider
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=OpCodes.REQUEST_MGM_HK, info=Info.REQUEST_MGM_HK)
oce.add(keys=OpCodes.ENABLE_MGM_HK, info=Info.ENABLE_MGM_HK)
oce.add(keys=OpCodes.DISABLE_MGM_HK, info=Info.DISABLE_MGM_HK)
defs.add_service(
name=CustomServiceList.ACS_CTRL.value,
info="ACS Controller",
op_code_entry=oce
)
@service_provider(CustomServiceList.ACS_CTRL.value)
def pack_acs_ctrl_command(
_info: DefaultProcedureInfo,
q: DefaultPusQueueHelper,
op_code: str
):
if op_code in OpCodes.REQUEST_MGM_HK:
sid = make_sid(ACS_CONTROLLER, SetIds.MGM_SET)
q.add_log_cmd("Requesting one MGM HK packet")
q.add_pus_tc(generate_one_hk_command(sid))