plocHandler test wip

This commit is contained in:
2021-04-11 11:08:52 +02:00
parent 754edffeae
commit aa52ed79ea
6 changed files with 88 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import struct
from typing import Tuple
from config.object_ids import ObjIdIds
from pus_tc.ploc import PlocActionIds
def user_analyze_service_8_data(
@ -25,7 +27,20 @@ def user_analyze_service_8_data(
data_string = data_string.rstrip(',')
data_string = data_string.rstrip()
content_list = [data_string]
elif object_id == ObjIdIds.PLOC_ID:
return handle_ploc_replies(custom_data)
else:
header_list = []
content_list = []
return header_list, content_list
def handle_ploc_replies(custom_data: bytearray) -> Tuple[list, list]:
header_list = []
content_list = []
action_id = struct.unpack('!I', custom_data[0:4])
if action_id == PlocActionIds.tc_mem_read:
header_list = ['PLOC Read Memory Data']
memory_data = struct.unpack('!I', custom_data[4:8])
content_list = [memory_data]
return header_list, content_list