reworked param TM handling

This commit is contained in:
Robin Müller 2023-01-28 14:36:21 +01:00
parent fb6d5eeb80
commit 14ed2415a4
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -9,7 +9,9 @@ from tmtccmd import get_console_logger
from tmtccmd.logging.pus import RawTmtcTimedLogWrapper from tmtccmd.logging.pus import RawTmtcTimedLogWrapper
from tmtccmd.pus import VerificationWrapper from tmtccmd.pus import VerificationWrapper
from tmtccmd.tm import Service20FsfwTm, Service200FsfwTm from tmtccmd.tm import Service20FsfwTm, Service200FsfwTm
from tmtccmd.tm.pus_200_fsfw_modes import Subservice as ModeSubservices from tmtccmd.tm.pus_20_fsfw_params import Service20ParamDumpWrapper
from tmtccmd.pus.s20_fsfw_params_defs import CustomSubservice as ParamSubservice
from tmtccmd.tm.pus_200_fsfw_modes import Subservice as ModeSubservice
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
from .defs import PrintWrapper from .defs import PrintWrapper
@ -59,12 +61,22 @@ def pus_factory_hook(
tm_packet = Service20FsfwTm.unpack( tm_packet = Service20FsfwTm.unpack(
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty() raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
) )
dedicated_handler = False if tm_packet.subservice == ParamSubservice.TM_DUMP_REPLY:
param_wrapper = Service20ParamDumpWrapper(param_tm=tm_packet)
try:
param = param_wrapper.get_param()
pw.dlog(f"Parameters: {param}")
except ValueError as e:
pw.dlog(f"received {e} when trying to parse parameters")
except NotImplementedError as e:
pw.dlog(f"received {e} when trying to parse parameters")
else:
pw.dlog(f"unknown subservice {tm_packet.subservice} for parameter service")
elif service == 200: elif service == 200:
tm_packet = Service200FsfwTm.unpack( tm_packet = Service200FsfwTm.unpack(
raw_telemetry=packet, time_reader=CdsShortTimestamp.empty() raw_telemetry=packet, time_reader=CdsShortTimestamp.empty()
) )
if tm_packet.subservice == ModeSubservices.TM_CANT_REACH_MODE: if tm_packet.subservice == ModeSubservice.TM_CANT_REACH_MODE:
obj_id = tm_packet.object_id obj_id = tm_packet.object_id
obj_id_obj = obj_id_dict.get(obj_id) obj_id_obj = obj_id_dict.get(obj_id)
retval = tm_packet.return_value retval = tm_packet.return_value