add command to get flash dir content

This commit is contained in:
Robin Müller 2023-05-04 11:51:50 +02:00
parent 0e9ebefc87
commit e0e9a310b9
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -22,6 +22,7 @@ from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams from tmtccmd.tc.decorator import ServiceProviderParams
from eive_tmtc.utility.input_helper import InputHelper from eive_tmtc.utility.input_helper import InputHelper
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -224,6 +225,16 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
q.add_log_cmd("PLOC MPSoC: Downlink pwr off") q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_DOWNLINK_PWR_OFF) data = object_id.as_bytes + struct.pack("!I", ActionId.TC_DOWNLINK_PWR_OFF)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCode.FLASH_GET_DIR_CONTENT:
q.add_log_cmd(f"{prefix}: {OpCode.FLASH_GET_DIR_CONTENT}")
dir_name = input("Please specify MPSoC directory name to get information for")
dir_name = bytearray(dir_name.encode("utf-8"))
dir_name.append(0)
return create_action_cmd(
object_id=object_id.as_bytes,
action_id=ActionId.TC_FLASH_DIR_GET_CONTENT,
user_data=dir_name,
)
if op_code == OpCode.REPLAY_WRITE_SEQ: if op_code == OpCode.REPLAY_WRITE_SEQ:
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}") q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
data = prepare_replay_write_sequence_cmd(object_id.as_bytes) data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
@ -330,7 +341,7 @@ def prepare_flash_base_cmd(action_id: int, object_id: bytes) -> bytearray:
return command return command
def prepare_flash_write_cmd(object_id : bytes) -> bytearray: def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
return prepare_flash_base_cmd(ActionId.TC_FLASH_WRITE_FULL_FILE, object_id) return prepare_flash_base_cmd(ActionId.TC_FLASH_WRITE_FULL_FILE, object_id)
@ -344,7 +355,7 @@ def prepare_flash_read_cmd(object_id: bytes) -> bytearray:
def prepare_flash_delete_cmd(object_id: bytes) -> bytearray: def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
file = get_mpsoc_file() file = get_mpsoc_file()
command = ( command = (
object_id + struct.pack("!I", ActionId.TC_FLASH_DELETE) + file.encode("utf-8") object_id + struct.pack("!I", ActionId.TC_FLASH_DELETE) + file.encode("utf-8")
) )
return bytearray(command) return bytearray(command)