eive-tmtc/pus_tm/service_8_hook.py
2021-05-17 17:42:04 +02:00

32 lines
1.1 KiB
Python

from typing import Tuple
from config.object_ids import PDU_2_HANDLER_ID
def user_analyze_service_8_data(
object_id: bytes, action_id: int, custom_data: bytearray) -> Tuple[list, list]:
"""
This function is called by the TMTC core if a Service 8 data reply (subservice 130)
is received. The user can return a tuple of two lists, where the first list
is a list of header strings to print and the second list is a list of values to print.
The TMTC core will take care of printing both lists and logging them.
@param object_id:
@param action_id:
@param custom_data:
@return:
"""
if object_id == PDU_2_HANDLER_ID:
header_list = ['PDU2 Service 8 Reply']
data_string = str()
for index in range(len(custom_data)):
data_string += str(hex(custom_data[index])) + " , "
data_string = data_string.rstrip()
data_string = data_string.rstrip(',')
data_string = data_string.rstrip()
content_list = [data_string]
else:
header_list = []
content_list = []
return header_list, content_list