trying new tc service decorator

This commit is contained in:
2022-08-12 22:33:16 +02:00
parent 3fa700804e
commit b9cdfdf6c8
9 changed files with 52 additions and 24 deletions

View File

@ -1,5 +1,7 @@
from config.definitions import CustomServiceList
from config.object_ids import BPX_HANDLER_ID
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd import DefaultProcedureInfo
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
@ -24,7 +26,10 @@ class BpxOpCodes:
REBOOT = ["4", "reboot"]
def pack_bpx_commands(q: DefaultPusQueueHelper, op_code: str):
@service_provider(CustomServiceList.BPX_BATTERY.value)
def pack_bpx_commands(
_info: DefaultProcedureInfo, q: DefaultPusQueueHelper, op_code: str
):
if op_code in BpxOpCodes.HK:
q.add_log_cmd("Requesting BPX battery HK set")
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)

View File

@ -7,8 +7,23 @@
"""
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from gomspace.gomspace_common import *
from gomspace.gomspace_common import (
GsInfo,
GomspaceOpCodes,
TableEntry,
Channel,
pack_set_param_command,
TableIds,
pack_get_param_command,
pack_gnd_wdt_reset_command,
pack_ping_command,
GomspaceDeviceActionIds,
pack_reboot_command,
SetIds,
)
from config.object_ids import P60_DOCK_HANDLER
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.util import ObjectIdU32
class P60OpCodes:
@ -85,7 +100,7 @@ class P60DockHkTable:
def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
objb = object_id.as_bytes
if op_code in P60OpCodes.STACK_3V3_ON:
q.add_log_cmd(GsInfo.STACK_3V3_ON)
q.add_log_cmd(P60Info.STACK_3V3_ON)
q.add_pus_tc(
pack_set_param_command(
objb,
@ -95,7 +110,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
)
)
if op_code in P60OpCodes.STACK_3V3_OFF:
q.add_log_cmd(GsInfo.STACK_3V3_OFF)
q.add_log_cmd(P60Info.STACK_3V3_OFF)
q.add_pus_tc(
pack_set_param_command(
objb,
@ -105,7 +120,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
)
)
if op_code in P60OpCodes.STACK_5V_ON:
q.add_log_cmd(GsInfo.STACK_5V_ON)
q.add_log_cmd(P60Info.STACK_5V_ON)
q.add_pus_tc(
pack_set_param_command(
objb,
@ -115,7 +130,7 @@ def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code:
)
)
if op_code in P60OpCodes.STACK_5V_OFF:
q.add_log_cmd(GsInfo.STACK_5V_OFF)
q.add_log_cmd(P60Info.STACK_5V_OFF)
q.add_pus_tc(
pack_set_param_command(
objb,

View File

@ -2,8 +2,9 @@ import enum
import json
from config.definitions import CustomServiceList
from tmtccmd import DefaultProcedureInfo
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
from config.object_ids import SCEX_HANDLER_ID
@ -62,7 +63,8 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
)
def pack_scex_cmds(q: DefaultPusQueueHelper, op_code: str):
@service_provider(CustomServiceList.SCEX.value)
def pack_scex_cmds(_info: DefaultProcedureInfo, q: DefaultPusQueueHelper, op_code: str):
if op_code in OpCodes.PING:
q.add_log_cmd(Info.PING)
app_data = bytes([0])