This commit is contained in:
@ -1,18 +1,16 @@
|
||||
import enum
|
||||
from typing import Tuple, Dict
|
||||
from typing import Dict, Tuple
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
from eive_tmtc.config.object_ids import EPS_SUBSYSTEM_ID
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
CmdTreeNode,
|
||||
)
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices, Mode
|
||||
from tmtccmd.tmtc import service_provider
|
||||
from tmtccmd.tmtc.decorator import ServiceProviderParams
|
||||
from tmtccmd.pus.s200_fsfw_mode import Mode
|
||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservices
|
||||
from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
|
||||
from eive_tmtc.config.object_ids import EPS_SUBSYSTEM_ID
|
||||
from eive_tmtc.tmtc.common import pack_mode_cmd_with_info
|
||||
|
||||
|
||||
class OpCode(str, enum.Enum):
|
||||
@ -33,12 +31,9 @@ HANDLER_LIST: Dict[str, Tuple[int, int, str]] = {
|
||||
}
|
||||
|
||||
|
||||
@service_provider(CustomServiceList.EPS_SS.value)
|
||||
def build_eps_subsystem_cmd(p: ServiceProviderParams):
|
||||
op_code = p.op_code
|
||||
q = p.queue_helper
|
||||
def build_eps_subsystem_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
info_prefix = "EPS Subsystem"
|
||||
if op_code in OpCode.REPORT_ALL_MODES:
|
||||
if cmd_str in OpCode.REPORT_ALL_MODES:
|
||||
q.add_log_cmd(f"{info_prefix}: {Info.REPORT_ALL_MODES}")
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -47,7 +42,7 @@ def build_eps_subsystem_cmd(p: ServiceProviderParams):
|
||||
app_data=EPS_SUBSYSTEM_ID,
|
||||
)
|
||||
)
|
||||
mode_info_tup = HANDLER_LIST.get(op_code)
|
||||
mode_info_tup = HANDLER_LIST.get(cmd_str)
|
||||
if mode_info_tup is None:
|
||||
return
|
||||
pack_mode_cmd_with_info(
|
||||
@ -59,10 +54,9 @@ def build_eps_subsystem_cmd(p: ServiceProviderParams):
|
||||
)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_eps_subsystem_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
for op_code, (_, _, info) in HANDLER_LIST.items():
|
||||
oce.add(op_code, info)
|
||||
oce.add(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES)
|
||||
defs.add_service(CustomServiceList.EPS_SS, "EPS Subsystem", oce)
|
||||
def create_eps_subsystem_node() -> CmdTreeNode:
|
||||
eps_node = CmdTreeNode("eps", "EPS Subsystem")
|
||||
for cmd_str, (_, _, info) in HANDLER_LIST.items():
|
||||
eps_node.add_child(CmdTreeNode(cmd_str, info))
|
||||
eps_node.add_child(CmdTreeNode(OpCode.REPORT_ALL_MODES, Info.REPORT_ALL_MODES))
|
||||
return eps_node
|
||||
|
Reference in New Issue
Block a user