ploc tc mem write and tc mem read test

This commit is contained in:
2021-04-24 13:27:57 +02:00
parent 7310513805
commit 79e897b035
4 changed files with 20 additions and 19 deletions

View File

@ -1,7 +1,7 @@
import struct
from typing import Tuple
from config.object_ids import ObjIdIds
from pus_tc.ploc import PlocActionIds
from pus_tc.ploc import PlocReplyIds
def user_analyze_service_8_data(
@ -28,19 +28,17 @@ def user_analyze_service_8_data(
data_string = data_string.rstrip()
content_list = [data_string]
elif object_id == ObjIdIds.PLOC_ID:
return handle_ploc_replies(custom_data)
return handle_ploc_replies(action_id, custom_data)
else:
header_list = []
content_list = []
return header_list, content_list
def handle_ploc_replies(custom_data: bytearray) -> Tuple[list, list]:
def handle_ploc_replies(action_id: int, 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]
if action_id == PlocReplyIds.tm_mem_read_report:
header_list = ['PLOC Memory Address', 'PLOC Mem Len', 'PLOC Read Memory Data']
content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]]
return header_list, content_list