diff --git a/config/hook.py b/config/hook.py index 22eeadb..ca16430 100644 --- a/config/hook.py +++ b/config/hook.py @@ -3,7 +3,7 @@ from typing import Optional from config.definitions import SPACE_PACKET_IDS from tmtccmd import TmTcCfgHookBase, CcsdsTmtcBackend from tmtccmd.com_if import ComInterface -from tmtccmd.config import TmTcDefWrapper +from tmtccmd.config import TmtcDefinitionWrapper from config.retvals import get_retval_dict from pus_tc.cmd_definitions import get_eive_service_op_code_dict @@ -14,7 +14,7 @@ class EiveHookObject(TmTcCfgHookBase): def __init__(self, json_cfg_path: str): super().__init__(json_cfg_path=json_cfg_path) - def get_tmtc_definitions(self) -> TmTcDefWrapper: + def get_tmtc_definitions(self) -> TmtcDefinitionWrapper: return get_eive_service_op_code_dict() def assign_communication_interface(self, com_if_key: str) -> Optional[ComInterface]: diff --git a/deps/tmtccmd b/deps/tmtccmd index b2a4884..6c1ad79 160000 --- a/deps/tmtccmd +++ b/deps/tmtccmd @@ -1 +1 @@ -Subproject commit b2a48845e514f4c8305ae29dd3b98484ae270fa2 +Subproject commit 6c1ad79b00d2e4aa2f81bebcbe008c3300b6b1ae diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 4f36b61..5f14096 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -13,35 +13,35 @@ from pus_tc.devs.bpx_batt import BpxOpCodes from config.definitions import CustomServiceList from pus_tc.system.tcs import add_tcs_cmds -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions, execute_tmtc_def_functions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider, call_all_definitions_providers from tmtccmd.config.globals import get_default_tmtc_defs -def get_eive_service_op_code_dict() -> TmTcDefWrapper: +def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper: def_wrapper = get_default_tmtc_defs() - execute_tmtc_def_functions(def_wrapper) + call_all_definitions_providers(def_wrapper) return def_wrapper -@register_tmtc_definitions -def add_tmp_sens_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "TMP1075 Tests") defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce) defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce) -@register_tmtc_definitions -def add_pdec_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_pdec_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "PDEC Handler: Print CLCW") oce.add("1", "PDEC Handler: Print PDEC monitor") defs.add_service(CustomServiceList.PDEC_HANDLER.value, "PDEC Handler", oce) -@register_tmtc_definitions -def add_ccsds_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_ccsds_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "CCSDS Handler: Set low rate") oce.add("1", "CCSDS Handler: Set high rate") @@ -55,8 +55,8 @@ def add_ccsds_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.CCSDS_HANDLER.value, "CCSDS Handler", oce) -@register_tmtc_definitions -def add_str_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_str_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "Star Tracker: Mode On, Submode Bootloader") oce.add("1", "Star Tracker: Mode On, Submode Firmware") @@ -120,8 +120,8 @@ def add_str_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce) -@register_tmtc_definitions -def add_syrlinks_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_syrlinks_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "Syrlinks Handler: Set mode off") oce.add("1", "Syrlinks Handler: Set mode on") @@ -144,8 +144,8 @@ def add_syrlinks_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.SYRLINKS.value, "Syrlinks Handler", oce) -@register_tmtc_definitions -def add_bpx_cmd_definitions(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_bpx_cmd_definitions(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=BpxOpCodes.HK, info="Request BPX HK") oce.add(keys=BpxOpCodes.RST_BOOT_CNT, info="Reset Boot Count") @@ -161,8 +161,8 @@ def add_bpx_cmd_definitions(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_time_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_time_cmds(defs: TmtcDefinitionWrapper): from pus_tc.system.time import OpCodes, Info oce = OpCodeEntry() @@ -177,8 +177,8 @@ def add_time_cmds(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_imtq_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_imtq_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "Mode Off") oce.add("1", "Mode On") @@ -197,8 +197,8 @@ def add_imtq_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce) -@register_tmtc_definitions -def add_ploc_mpsoc_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "Ploc MPSoC: Set mode off") oce.add("1", "Ploc MPSoC: Set mode on") @@ -222,8 +222,8 @@ def add_ploc_mpsoc_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.PLOC_MPSOC.value, "Ploc MPSoC", oce) -@register_tmtc_definitions -def add_ploc_supv_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add("0", "PLOC Memory Dumper: MRAM dump") defs.add_service( @@ -276,8 +276,8 @@ def add_ploc_supv_cmds(defs: TmTcDefWrapper): defs.add_service(CustomServiceList.PLOC_SUPV.value, "PLOC Supervisor", oce) -@register_tmtc_definitions -def add_system_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_system_cmds(defs: TmtcDefinitionWrapper): from pus_tc.system.acs import AcsOpCodes, SusOpCodes import pus_tc.system.tcs as tcs import pus_tc.system.controllers as controllers diff --git a/pus_tc/devs/acu.py b/pus_tc/devs/acu.py index c05baf3..9f846c9 100644 --- a/pus_tc/devs/acu.py +++ b/pus_tc/devs/acu.py @@ -6,8 +6,8 @@ import struct from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( @@ -49,8 +49,8 @@ class Info: TEST = "ACU Test" -@register_tmtc_definitions -def add_acu_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_acu_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add( keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, diff --git a/pus_tc/devs/gps.py b/pus_tc/devs/gps.py index d56fe52..000d759 100644 --- a/pus_tc/devs/gps.py +++ b/pus_tc/devs/gps.py @@ -1,8 +1,8 @@ import enum from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command from tmtccmd.logging import get_console_logger @@ -25,8 +25,8 @@ class SetIds: HK = 0 -@register_tmtc_definitions -def add_gps_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_gps_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.RESET_GNSS, info=Info.RESET_GNSS) oce.add(keys=OpCodes.REQ_OS_HK, info=Info.REQ_OS_HK) diff --git a/pus_tc/devs/heater.py b/pus_tc/devs/heater.py index befe169..5d00185 100644 --- a/pus_tc/devs/heater.py +++ b/pus_tc/devs/heater.py @@ -7,8 +7,8 @@ import enum from config.definitions import CustomServiceList from config.object_ids import get_object_ids -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.util.obj_id import ObjectIdU32 from tmtccmd.tc.pus_201_fsfw_health import ( @@ -54,8 +54,8 @@ class ActionIds(enum.IntEnum): SWITCH_HEATER = 0 -@register_tmtc_definitions -def add_heater_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_heater_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.HEATER_CMD, info=Info.HEATER_CMD) oce.add(keys=OpCodes.HEATER_HEALTHY_CMD, info=Info.HEATER_HEALTHY_CMD) diff --git a/pus_tc/devs/plpcdu.py b/pus_tc/devs/plpcdu.py index 488e6a2..11ef5e0 100644 --- a/pus_tc/devs/plpcdu.py +++ b/pus_tc/devs/plpcdu.py @@ -4,9 +4,9 @@ import time from typing import Optional from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper +from tmtccmd.config import TmtcDefinitionWrapper -from tmtccmd.config.tmtc import OpCodeEntry, register_tmtc_definitions +from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( make_sid, @@ -115,8 +115,8 @@ class ParamIds(enum.IntEnum): INJECT_ALL_ON_FAILURE = 35 -@register_tmtc_definitions -def add_pl_pcdu_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.SWITCH_HPA_ON_PROC, info=Info.SWITCH_HPA_ON_PROC) oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON) diff --git a/pus_tc/devs/power.py b/pus_tc/devs/power.py index 90a5b35..dc3f885 100644 --- a/pus_tc/devs/power.py +++ b/pus_tc/devs/power.py @@ -8,15 +8,15 @@ from pus_tc.devs.common_power import ( PowerInfo, ) from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, P60Info from pus_tc.devs.acu import add_acu_cmds -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config.tmtc import tmtc_definitions_provider -@register_tmtc_definitions -def add_p60_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_p60_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=P60OpCodes.STACK_3V3_ON, info=P60Info.STACK_3V3_ON) oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=P60Info.STACK_3V3_OFF) @@ -35,8 +35,8 @@ def add_p60_cmds(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_power_cmd_defs(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_power_cmd_defs(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() add_pdu1_common_defs(oce) add_pdu2_common_defs(oce) @@ -50,8 +50,8 @@ def add_power_cmd_defs(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_pdu1_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_pdu1_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() add_pdu1_common_defs(oce) oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE) @@ -69,8 +69,8 @@ def add_pdu1_cmds(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_pdu2_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_pdu2_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() add_pdu2_common_defs(oce) oce.add( @@ -96,8 +96,7 @@ def add_pdu2_cmds(defs: TmTcDefWrapper): ) -@register_tmtc_definitions -def add_pcdu_cmds(defs: TmTcDefWrapper): +def add_pcdu_cmds(defs: TmtcDefinitionWrapper): add_p60_cmds(defs) add_pdu1_cmds(defs) add_pdu2_cmds(defs) diff --git a/pus_tc/devs/rad_sensor.py b/pus_tc/devs/rad_sensor.py index 5cf5d3a..949f9a8 100644 --- a/pus_tc/devs/rad_sensor.py +++ b/pus_tc/devs/rad_sensor.py @@ -11,8 +11,8 @@ from config.definitions import CustomServiceList from spacepackets.ecss.tc import PusTelecommand from pus_tc.service_200_mode import pack_mode_data, Modes -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid from tmtccmd.util import ObjectIdU32 @@ -47,8 +47,8 @@ class CommandIds: DISABLE_DEBUG_OUTPUT = 5 -@register_tmtc_definitions -def add_rad_sens_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_rad_sens_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(info=Info.ON, keys=OpCodes.ON) oce.add(info=Info.OFF, keys=OpCodes.OFF) diff --git a/pus_tc/devs/reaction_wheels.py b/pus_tc/devs/reaction_wheels.py index 53509db..d83d592 100644 --- a/pus_tc/devs/reaction_wheels.py +++ b/pus_tc/devs/reaction_wheels.py @@ -6,8 +6,8 @@ """ import struct -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_3_fsfw_hk import ( generate_one_hk_command, @@ -76,8 +76,8 @@ class RampTime: MS_1000 = 1000 -@register_tmtc_definitions -def add_rw_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_rw_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(info=InfoDevs.SPEED, keys=OpCodesDevs.SPEED) oce.add(info=InfoDevs.ON, keys=OpCodesDevs.ON) diff --git a/pus_tc/devs/rtd.py b/pus_tc/devs/rtd.py index bf1fd0b..692e781 100644 --- a/pus_tc/devs/rtd.py +++ b/pus_tc/devs/rtd.py @@ -3,8 +3,8 @@ from typing import Optional from config.definitions import CustomServiceList from pus_tc.devs.pdec_handler import CommandIds from spacepackets.ecss import PusTelecommand -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.util import ObjectIdU32 @@ -46,8 +46,8 @@ class Info: WIRTE_CONFIG = "Write config" -@register_tmtc_definitions -def specify_rtd_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def specify_rtd_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.ON, info=Info.ON) oce.add(keys=OpCodes.NORMAL, info=Info.NORMAL) diff --git a/pus_tc/devs/scex.py b/pus_tc/devs/scex.py index cf75e24..aa76ee3 100644 --- a/pus_tc/devs/scex.py +++ b/pus_tc/devs/scex.py @@ -2,10 +2,10 @@ import enum import json from config.definitions import CustomServiceList -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_8_funccmd import generate_action_command -from tmtccmd.config import OpCodeEntry, TmTcDefWrapper +from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper from config.object_ids import SCEX_HANDLER_ID @@ -45,8 +45,8 @@ class Info: FRAM = "Read FRAM" -@register_tmtc_definitions -def add_scex_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_scex_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.PING, info=Info.PING) oce.add(keys=OpCodes.ION_CMD, info=Info.ION_CMD) diff --git a/pus_tc/system/core.py b/pus_tc/system/core.py index b47a30d..112fae7 100644 --- a/pus_tc/system/core.py +++ b/pus_tc/system/core.py @@ -1,13 +1,13 @@ import enum from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper +from tmtccmd.config import TmtcDefinitionWrapper from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.logging import get_console_logger from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command -from tmtccmd.config.tmtc import OpCodeEntry, register_tmtc_definitions +from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider from config.object_ids import CORE_CONTROLLER_ID @@ -67,8 +67,8 @@ class Copy(enum.IntEnum): NONE = 2 -@register_tmtc_definitions -def add_core_controller_definitions(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_core_controller_definitions(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC) oce.add(keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC) diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py index e5799b4..5aee611 100644 --- a/pus_tc/system/proc.py +++ b/pus_tc/system/proc.py @@ -7,8 +7,8 @@ from typing import List from config.definitions import CustomServiceList from config.object_ids import get_object_ids from pus_tc.system.tcs import pack_tcs_sys_commands -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_11_tc_sched import ( @@ -127,8 +127,8 @@ def generic_print(q: DefaultPusQueueHelper, info: dict): q.add_log_cmd(f"Executing {info[1]} Procedure (OpCodes: {info[0]})") -@register_tmtc_definitions -def add_proc_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_proc_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() for proc_entry in PROC_INFO_DICT.values(): oce.add(keys=proc_entry[0], info=proc_entry[1]) diff --git a/pus_tc/system/tcs.py b/pus_tc/system/tcs.py index 61e3834..4130260 100644 --- a/pus_tc/system/tcs.py +++ b/pus_tc/system/tcs.py @@ -1,8 +1,8 @@ import enum from config.definitions import CustomServiceList -from tmtccmd.config import TmTcDefWrapper, OpCodeEntry -from tmtccmd.config.tmtc import register_tmtc_definitions +from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry +from tmtccmd.config.tmtc import tmtc_definitions_provider from tmtccmd.tc import DefaultPusQueueHelper from tmtccmd.tc.pus_200_fsfw_modes import Modes from tmtccmd.tc.pus_3_fsfw_hk import ( @@ -33,8 +33,8 @@ class SetIds(enum.IntEnum): SUS_TEMP_SENSORS = 2 -@register_tmtc_definitions -def add_tcs_cmds(defs: TmTcDefWrapper): +@tmtc_definitions_provider +def add_tcs_cmds(defs: TmtcDefinitionWrapper): oce = OpCodeEntry() oce.add( keys=OpCodes.TCS_BOARD_ASS_NORMAL,