diff --git a/config/definitions.py b/config/definitions.py index 326260e..3d062ac 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -43,6 +43,7 @@ class CustomServiceList(enum.Enum): PDEC_HANDLER = "pdec_handler" STR_IMG_HELPER = "str_img_helper" SYRLINKS = "syrlinks" + ACS_CTRL = "acs-ctrl" ACS_ASS = "acs-ass" SUS_ASS = "sus-ass" TCS = "tcs" diff --git a/pus_tc/system/acs_ctrl.py b/pus_tc/system/acs_ctrl.py new file mode 100644 index 0000000..862d005 --- /dev/null +++ b/pus_tc/system/acs_ctrl.py @@ -0,0 +1,44 @@ +import enum + +from config.definitions import CustomServiceList +from config.object_ids import ACS_CONTROLLER +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(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))