52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
import enum
|
|
from tmtccmd.config.tmtc import (
|
|
CmdTreeNode,
|
|
OpCodeEntry,
|
|
TmtcDefinitionWrapper,
|
|
tmtc_definitions_provider,
|
|
)
|
|
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
|
from tmtccmd.tmtc import DefaultPusQueueHelper
|
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
from eive_tmtc.config.object_ids import XIPHOS_WDT_ID
|
|
|
|
|
|
class OpCode:
|
|
ENABLE = "enable"
|
|
DISABLE = "disable"
|
|
|
|
|
|
class Info:
|
|
ENABLE = "Enable WDT"
|
|
DISABLE = "Disable WDT"
|
|
|
|
|
|
class ActionId(enum.IntEnum):
|
|
ENABLE = 0
|
|
DISABLE = 1
|
|
|
|
|
|
def pack_wdt_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
|
if cmd_str == OpCode.ENABLE:
|
|
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.ENABLE))
|
|
if cmd_str == OpCode.DISABLE:
|
|
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.DISABLE))
|
|
|
|
|
|
def create_wdt_node() -> CmdTreeNode:
|
|
node = CmdTreeNode("xiphos_wdt", "Xiphos Watchdog Timer")
|
|
node.add_child(CmdTreeNode(OpCode.ENABLE, Info.ENABLE))
|
|
node.add_child(CmdTreeNode(OpCode.DISABLE, Info.DISABLE))
|
|
return node
|
|
|
|
|
|
@tmtc_definitions_provider
|
|
def add_xiphos_wdt_defs(defs: TmtcDefinitionWrapper):
|
|
oce = OpCodeEntry()
|
|
oce.add(keys=OpCode.ENABLE, info=Info.ENABLE)
|
|
oce.add(keys=OpCode.DISABLE, info=Info.DISABLE)
|
|
defs.add_service(
|
|
CustomServiceList.XIPHOS_WDT, info="Xiphos Watchdog Timer", op_code_entry=oce
|
|
)
|