2023-10-11 11:35:57 +02:00
|
|
|
import enum
|
|
|
|
from tmtccmd.config.tmtc import (
|
2023-11-28 17:34:34 +01:00
|
|
|
CmdTreeNode,
|
2023-10-11 11:35:57 +02:00
|
|
|
OpCodeEntry,
|
|
|
|
TmtcDefinitionWrapper,
|
|
|
|
tmtc_definitions_provider,
|
|
|
|
)
|
2023-11-10 19:23:06 +01:00
|
|
|
from tmtccmd.pus.s8_fsfw_action import create_action_cmd
|
|
|
|
from tmtccmd.tmtc import DefaultPusQueueHelper
|
2023-10-11 11:35:57 +02:00
|
|
|
|
|
|
|
from eive_tmtc.config.definitions import CustomServiceList
|
|
|
|
from eive_tmtc.config.object_ids import XIPHOS_WDT_ID
|
|
|
|
|
|
|
|
|
|
|
|
class OpCode:
|
|
|
|
ENABLE = "enable"
|
2023-10-11 11:38:45 +02:00
|
|
|
DISABLE = "disable"
|
2023-10-11 11:35:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Info:
|
|
|
|
ENABLE = "Enable WDT"
|
|
|
|
DISABLE = "Disable WDT"
|
|
|
|
|
|
|
|
|
|
|
|
class ActionId(enum.IntEnum):
|
|
|
|
ENABLE = 0
|
|
|
|
DISABLE = 1
|
|
|
|
|
|
|
|
|
2023-11-22 10:17:05 +01:00
|
|
|
def pack_wdt_commands(q: DefaultPusQueueHelper, cmd_str: str):
|
|
|
|
if cmd_str == OpCode.ENABLE:
|
2023-10-11 11:35:57 +02:00
|
|
|
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.ENABLE))
|
2023-11-22 10:17:05 +01:00
|
|
|
if cmd_str == OpCode.DISABLE:
|
2023-10-11 11:35:57 +02:00
|
|
|
q.add_pus_tc(create_action_cmd(XIPHOS_WDT_ID, ActionId.DISABLE))
|
|
|
|
|
|
|
|
|
2023-11-28 17:34:34 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-10-11 11:35:57 +02:00
|
|
|
@tmtc_definitions_provider
|
2023-10-11 11:37:48 +02:00
|
|
|
def add_xiphos_wdt_defs(defs: TmtcDefinitionWrapper):
|
2023-10-11 11:35:57 +02:00
|
|
|
oce = OpCodeEntry()
|
|
|
|
oce.add(keys=OpCode.ENABLE, info=Info.ENABLE)
|
2023-10-11 11:38:45 +02:00
|
|
|
oce.add(keys=OpCode.DISABLE, info=Info.DISABLE)
|
2023-10-11 11:35:57 +02:00
|
|
|
defs.add_service(
|
|
|
|
CustomServiceList.XIPHOS_WDT, info="Xiphos Watchdog Timer", op_code_entry=oce
|
|
|
|
)
|