update verif handler

This commit is contained in:
Robin Müller 2022-08-18 18:34:26 +02:00
parent 865ac0574f
commit 81a3abe850
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 23 additions and 10 deletions

View File

@ -17,7 +17,7 @@ from tmtccmd.logging import get_console_logger
from common_tmtc.config.object_ids import get_object_ids from common_tmtc.config.object_ids import get_object_ids
from common_tmtc.pus_tm.action_reply_handling import handle_action_reply from common_tmtc.pus_tm.action_reply_handling import handle_action_reply
from common_tmtc.pus_tm.event_handler import handle_event_packet from common_tmtc.pus_tm.event_handler import handle_event_packet
from common_tmtc.pus_tm.verification_handler import handle_service_1_packet from common_tmtc.pus_tm.verification_handler import handle_service_1_fsfw_packet
from common_tmtc.pus_tm.hk_handling import handle_hk_packet from common_tmtc.pus_tm.hk_handling import handle_hk_packet
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
@ -44,7 +44,7 @@ def pus_factory_hook(
obj_id_dict = get_object_ids() obj_id_dict = get_object_ids()
dedicated_handler = True dedicated_handler = True
if service == 1: if service == 1:
handle_service_1_packet(wrapper=wrapper, raw_tm=packet) handle_service_1_fsfw_packet(wrapper=wrapper, raw_tm=packet)
elif service == 2: elif service == 2:
tm_packet = Service2Tm.unpack(packet) tm_packet = Service2Tm.unpack(packet)
dedicated_handler = False dedicated_handler = False

View File

@ -1,19 +1,21 @@
from spacepackets.ecss.pus_1_verification import UnpackParams from spacepackets.ecss.pus_1_verification import UnpackParams, Service1Tm
from tmtccmd.pus import VerificationWrapper from tmtccmd.pus import VerificationWrapper
from tmtccmd.tm.pus_1_verification import Service1TmExtended from tmtccmd.tm.pus_1_verification import Service1TmExtended, Service1FsfwWrapper
from tmtccmd.logging import get_console_logger from tmtccmd.logging import get_console_logger
from common_tmtc.config.retvals import get_retval_dict from common_tmtc.config.retvals import get_retval_dict
LOGGER = get_console_logger() LOGGER = get_console_logger()
def handle_service_1_packet(wrapper: VerificationWrapper, raw_tm: bytes): def handle_service_1_fsfw_packet(wrapper: VerificationWrapper, raw_tm: bytes):
if wrapper.console_logger is None or wrapper.file_logger is None: if wrapper.console_logger is None or wrapper.file_logger is None:
raise ValueError( raise ValueError(
"Console logger or file logger not valid. Please set a valid one" "Console logger or file logger not valid. Please set a valid one"
) )
tm_packet = Service1TmExtended.unpack(data=raw_tm, params=UnpackParams(1, 1)) # Error code with length 2 is FSFW specific
tm_packet = Service1Tm.unpack(data=raw_tm, params=UnpackParams(1, 2))
fsfw_wrapper = Service1FsfwWrapper(tm_packet)
res = wrapper.verificator.add_tm(tm_packet) res = wrapper.verificator.add_tm(tm_packet)
if res is None: if res is None:
LOGGER.info( LOGGER.info(
@ -28,13 +30,24 @@ def handle_service_1_packet(wrapper: VerificationWrapper, raw_tm: bytes):
if tm_packet.has_failure_notice: if tm_packet.has_failure_notice:
retval_info = retval_dict.get(tm_packet.error_code.val) retval_info = retval_dict.get(tm_packet.error_code.val)
if retval_info is None: if retval_info is None:
raw_err = tm_packet.error_code.val
LOGGER.info( LOGGER.info(
f"No returnvalue information found for error code {tm_packet.error_code}" f"No returnvalue information found for error code with subsystem ID"
f" {(raw_err >> 8) & 0xff} and unique ID {raw_err & 0xff}"
) )
else: else:
retval_string = ( retval_string = (
f"Error Code information for code {tm_packet.error_code} | " f"Error Code information for code {tm_packet.error_code.val:#06x} | "
f"Name: {retval_info.name} | Info: {retval_info.info}" f"Name: {retval_info.name} | Info: {retval_info.info}"
) )
wrapper.console_logger.info(retval_string) error_param_1_str = (
wrapper.file_logger.info(retval_string) f"Error Parameter 1: hex {fsfw_wrapper.error_param_1:#010x} "
f"dec{fsfw_wrapper.error_param_1} "
)
error_param_2_str = (
f"Error Parameter 2: hex {fsfw_wrapper.error_param_2:#010x} "
f"dec {fsfw_wrapper.error_param_2}"
)
wrapper.dlog(retval_string)
wrapper.dlog(error_param_1_str)
wrapper.dlog(error_param_2_str)