add off command

This commit is contained in:
Robin Müller 2022-09-28 17:01:26 +02:00
parent a7714747bc
commit 6caf06248b

View File

@ -27,6 +27,7 @@ class OpCodes:
FRAM = ["6", "fram"] FRAM = ["6", "fram"]
SWITCH_ON = ["7", "on"] SWITCH_ON = ["7", "on"]
SWITCH_OFF = ["8", "off"]
class ActionIds(enum.IntEnum): class ActionIds(enum.IntEnum):
@ -51,6 +52,7 @@ class Info:
FRAM = "Read FRAM" FRAM = "Read FRAM"
SWITCH_ON = "Switch Scex on" SWITCH_ON = "Switch Scex on"
SWITCH_OFF = "Switch Scex off"
@tmtc_definitions_provider @tmtc_definitions_provider
@ -65,6 +67,7 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD) oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
oce.add(keys=OpCodes.FRAM, info=Info.FRAM) oce.add(keys=OpCodes.FRAM, info=Info.FRAM)
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON) oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
defs.add_service( defs.add_service(
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
@ -84,6 +87,15 @@ def pack_scex_cmds(p: ServiceProviderParams):
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.ON, 0), app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.ON, 0),
) )
) )
if op_code in OpCodes.SWITCH_OFF:
q.add_log_cmd(Info.SWITCH_OFF)
q.add_pus_tc(
PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.OFF, 0),
)
)
if op_code in OpCodes.PING: if op_code in OpCodes.PING:
q.add_log_cmd(Info.PING) q.add_log_cmd(Info.PING)
app_data = bytes([0]) app_data = bytes([0])