import enum import struct from eive_tmtc.pus_tm.defs import PrintWrapper from tmtccmd.fsfw.tmtc_printer import get_validity_buffer_str class SetId(enum.IntEnum): ERROR_ID = 0 def handle_ier_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int): pw.dlog(f"Received internal error reporter HK data with set ID {set_id}") if set_id == SetId.ERROR_ID: fmt_str = "!III" inc_len = struct.calcsize(fmt_str) (tm_errors, queue_errors, store_hits) = struct.unpack( fmt_str, hk_data[:inc_len] ) pw.dlog(f"TM Errors: {tm_errors}") pw.dlog(f"Queue Errors: {queue_errors}") pw.dlog(f"Store Errors: {store_hits}") pw.dlog(get_validity_buffer_str(hk_data[inc_len:], 3))