diff --git a/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml b/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef06fbd2bf0631cded27814fedbeb9e33a9f5473 --- /dev/null +++ b/.idea/runConfigurations/tmtcclient_Clear_SD_Card_.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="tmtcclient Clear SD-Card " type="PythonConfigurationType" factoryName="Python" folderName="Serial SD-Card"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> + <option name="PARAMETERS" value="-m 3 -s 23 -o 181 -c 1 -t 2.5" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="true" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml b/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml new file mode 100644 index 0000000000000000000000000000000000000000..e0e21bcddaf8a461c63da367857aaa8d0a391429 --- /dev/null +++ b/.idea/runConfigurations/tmtcclient_Format_SD_Card_.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="tmtcclient Format SD-Card " type="PythonConfigurationType" factoryName="Python" folderName="Serial SD-Card"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> + <option name="PARAMETERS" value="-m 3 -s 23 -o 182 -c 1 -t 2.5" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="true" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml b/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml index 0f8cd5fea5235267554c57f05839890d0fdd1617..9b348c52082d9ea21d68ef83e485bd0ff3e682d7 100644 --- a/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_GPS0_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient GPS0 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient GPS0 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml b/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml index 1f8098a72d1b52a387c0256e35fa3cebdb4ccfae..41bf9f18b90668185d841cf50f12bdd0f4e7a9e1 100644 --- a/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_GPS1_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient GPS1 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient GPS1 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Listener_Serial.xml b/.idea/runConfigurations/tmtcclient_Listener_Serial.xml index c59efdb836593429d3c211d1ed21f814c1a13177..7c86eae62ccc11114e09d4cba653d1f338d83d22 100644 --- a/.idea/runConfigurations/tmtcclient_Listener_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Listener_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Listener Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Listener Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml index 61aa71dc850e5caf9c5bc54cb29b45ff3b63c73e..558b1831412fea42cd1fd9e2b42b0950ab54bbd2 100644 --- a/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Module_Test_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Module Test Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Module Test Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml b/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml new file mode 100644 index 0000000000000000000000000000000000000000..4a9950b20d30fdd1fdde241220f2e7fec5795f17 --- /dev/null +++ b/.idea/runConfigurations/tmtcclient_Print_SD_Card.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="tmtcclient Print SD-Card" type="PythonConfigurationType" factoryName="Python" folderName="Serial SD-Card"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> + <option name="PARAMETERS" value="-m 3 -s 23 -o 133 -c 1 -t 2.5" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="true" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml index 5145e3b7acd8d267540c2cc4214eb61b7c4c8f67..34f10f772b5aa653703d0eb784829f3a7f6290e9 100644 --- a/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Service_17_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 17 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 17 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml index 38316e0359a813bff39ae6574bb14beb0430e97e..cb47dfa84511ce63515e05aeb8f9ac8c9048b088 100644 --- a/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Service_2_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 2 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 2 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml b/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml index 7b0db83d4daea21024c7ef99394582f529ca1486..1eede5c64bc7a2f662ecd7f5a8bfbbca5ea33ba7 100644 --- a/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml +++ b/.idea/runConfigurations/tmtcclient_Service_3_Serial_.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 3 Serial " type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 3 Serial " type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml index aadf325a5002b612eaf8c56d8652bb56d02a7288..b8bd8b473be5993ae92fed585889696114694bfe 100644 --- a/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Service_5_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 5 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 5 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml index 1c96bce8f9e66fec8a1b6be5948348f2928904c7..06a9a4e6248af880006ab640d5ec8748e39ba91f 100644 --- a/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Service_8_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 8 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 8 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml b/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml index f755f02c30089f9d2bc2a6efb46f47f65ac9e3a7..1dc493d69c84528542181c202c97799332834250 100644 --- a/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Service_9_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 9 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 9 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Single_Command_Serial_.xml b/.idea/runConfigurations/tmtcclient_Single_Command_Serial_.xml index c59814017c5419b0cfa0d262228897e93ae23e4f..7be08452d4a8e4a1f2d47ae6b53bf44e7d2a4d33 100644 --- a/.idea/runConfigurations/tmtcclient_Single_Command_Serial_.xml +++ b/.idea/runConfigurations/tmtcclient_Single_Command_Serial_.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Single Command Serial " type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Single Command Serial " type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient_Software_Serial.xml b/.idea/runConfigurations/tmtcclient_Software_Serial.xml index 0dfd7b192a6af6da43bb59f26b4b1c33c7030405..c95fcb9261e1e597cecb637f69995daa4bd0fb71 100644 --- a/.idea/runConfigurations/tmtcclient_Software_Serial.xml +++ b/.idea/runConfigurations/tmtcclient_Software_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Software Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Software Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml b/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml index ec2175bfadade9795139b22a62d815dd0ffa752e..ca3689fb50e63f6a17d4256b848c8ed62d83a6ec 100644 --- a/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml +++ b/.idea/runConfigurations/tmtcclient__Service_200_Serial.xml @@ -1,5 +1,5 @@ <component name="ProjectRunConfigurationManager"> - <configuration default="false" name="tmtcclient Service 200 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Communication"> + <configuration default="false" name="tmtcclient Service 200 Serial" type="PythonConfigurationType" factoryName="Python" folderName="Serial Services"> <module name="tmtc" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PARENT_ENVS" value="true" /> diff --git a/config/obsw_config.py b/config/obsw_config.py index f1421d65989d0fb74a4395919ef27ece1d64ae5d..d45e1cc58d92bfa2ddd48b4da5431a09c3b76d22 100644 --- a/config/obsw_config.py +++ b/config/obsw_config.py @@ -61,6 +61,7 @@ LOGGER = logging.getLogger(G_TMTC_LOGGER_NAME) G_SCRIPT_MODE = 1 G_MODE_ID = 0 G_SERVICE = 17 +G_OP_CODE = 0 G_DISPLAY_MODE = "long" # General TMTC Settings @@ -111,9 +112,10 @@ G_TMTC_PRINTER = None # noinspection PyUnusedLocal def set_globals(args): - global G_ETHERNET_RECV_ADDRESS, G_ETHERNET_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, G_DISPLAY_MODE,\ - G_COM_IF, G_COM_PORT, G_SERIAL_TIMEOUT, G_TM_TIMEOUT, G_TC_SEND_TIMEOUT_FACTOR, \ - G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM + global G_ETHERNET_RECV_ADDRESS, G_ETHERNET_SEND_ADDRESS, G_SCRIPT_MODE, G_MODE_ID, G_SERVICE, \ + G_DISPLAY_MODE, G_COM_IF, G_COM_PORT, G_SERIAL_TIMEOUT, G_TM_TIMEOUT, \ + G_TC_SEND_TIMEOUT_FACTOR, G_PRINT_TO_FILE, G_PRINT_HK_DATA, G_PRINT_RAW_TM, G_PRINT_TM, \ + G_OP_CODE, G_RESEND_TC if args.mode == 0: LOGGER.info("GUI mode not implemented yet !") if args.shortDisplayMode: @@ -159,6 +161,7 @@ def set_globals(args): G_COM_PORT = args.com_port G_TM_TIMEOUT = args.tm_timeout G_RESEND_TC = args.resend_tc + G_OP_CODE = args.op_code from obsw_user_code import global_setup_hook global_setup_hook() diff --git a/obsw_tmtc_client.py b/obsw_tmtc_client.py index a84a19e1ba23bf566166ade3ae055f3fcdf85ec5..7a6cb3da69a33c685677b87cd3ac5280362408ce 100755 --- a/obsw_tmtc_client.py +++ b/obsw_tmtc_client.py @@ -179,7 +179,9 @@ class TmTcHandler: elif self.mode == g.ModeList.ServiceTestMode: service_queue = deque() service_queue_packer = ServiceQueuePacker() - service_queue_packer.pack_service_queue(g.G_SERVICE, service_queue) + op_code = g.G_OP_CODE + service_queue_packer.pack_service_queue( + service=g.G_SERVICE, service_queue=service_queue, op_code=op_code) if not self.communication_interface.valid: return LOGGER.info("Performing service command operation") diff --git a/tc/obsw_pus_tc_packer.py b/tc/obsw_pus_tc_packer.py index 23920defffab2162592f8143a8a002861c3f0126..9e009a20c22b46be073e99b624cc2070c8d0e5c3 100644 --- a/tc/obsw_pus_tc_packer.py +++ b/tc/obsw_pus_tc_packer.py @@ -14,7 +14,7 @@ from tc.obsw_tc_service2 import pack_service2_test_into from tc.obsw_tc_service3 import pack_service3_test_into from tc.obsw_tc_service8 import pack_service8_test_into from tc.obsw_tc_service9 import pack_service9_test_into -from tc.obsw_tc_service23 import pack_service23_test_into +from tc.obsw_tc_service23 import pack_service23_commands_into from tc.obsw_tc_service20 import pack_service20_test_into from tc.obsw_tc_service200 import pack_mode_data, pack_service200_test_into from tc.obsw_tc_service5_17 import pack_service5_test_into, pack_service17_test_into @@ -32,7 +32,7 @@ class ServiceQueuePacker: def __init__(self): pass - def pack_service_queue(self, service: Union[int, str], service_queue: TcQueueT): + def pack_service_queue(self, service: Union[int, str], op_code: int, service_queue: TcQueueT): if service == 2: return pack_service2_test_into(service_queue) if service == 3: @@ -48,7 +48,7 @@ class ServiceQueuePacker: if service == 20: return pack_service20_test_into(service_queue) if service == 23: - return pack_service23_test_into(service_queue) + return pack_service23_commands_into(service_queue, op_code) if service == 200: return pack_service200_test_into(service_queue) if service == "Dummy": diff --git a/tc/obsw_tc_service23.py b/tc/obsw_tc_service23.py index c5773c9306f36889c100f6721fbe7da4a2166fd1..04c8689cc640466b6a0c4b4f777fc352c444cacf 100644 --- a/tc/obsw_tc_service23.py +++ b/tc/obsw_tc_service23.py @@ -8,7 +8,7 @@ import math from enum import Enum import config.obsw_config as g -from typing import Deque +from typing import Deque, Union from tc.obsw_pus_tc_packer import PusTelecommand, TcQueueT from tmtc_core.utility.obsw_logger import get_logger @@ -66,11 +66,11 @@ class FileTransferHelper: # This will generater a telecommand to rename the old file, if it exists self.rename_old_file = False - def set_data(self, local_filename: str): + def set_data_from_file(self, local_filename: str): with open(local_filename, 'rb') as file: self.file_data = file.read() - def set_data(self, tc_data: bytearray): + def set_data_raw(self, tc_data: bytearray): self.file_data = tc_data def set_to_delete_old_file(self): @@ -205,7 +205,7 @@ def generate_format_sd_card_packet( def generate_create_file_srv23_1_packet( filename: str, repository_path: str, ssc: int, max_size_of_app_data: int, initial_data: bytearray = bytearray([]), - object_id: bytearray = g.SD_CARD_HANDLER_ID) -> PusTelecommand: + object_id: bytearray = g.SD_CARD_HANDLER_ID) -> Union[PusTelecommand, None]: if len(initial_data) > calculate_allowed_file_data_size( max_size_of_app_data, filename, repository_path): LOGGER.error("generate_create_file_srv23_1_packet: Initial data too large!") @@ -322,56 +322,62 @@ def generate_read_file_srv23_129_packet( return PusTelecommand(service=23, subservice=129, ssc=ssc, app_data=data_to_pack) -def pack_service23_test_into(tc_queue: Deque) -> Deque: +def pack_service23_commands_into(tc_queue: Deque, op_code: int) -> Deque: # sd_handler_id = g.SD_CARD_HANDLER_ID - tc_queue.appendleft(("print", "Testing Service 23")) - - tc_queue.append(("print", "Formatting file system")) - command = generate_format_sd_card_packet(ssc=2390) - tc_queue.appendleft(command.pack_command_tuple()) - - tc_queue.append(("print", "Create directory 'test'")) - command = generate_mkdir_srv23_9_packet(directory_name="test", repository_path="/", ssc=2300) - tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.append(("print", "Create subdirectory 'subdir' in 'test'")) - command = generate_mkdir_srv23_9_packet(repository_path="test", ssc=2301, - directory_name="subdir") - tc_queue.appendleft(command.pack_command_tuple()) - - tc_queue.appendleft(("print", "Create test.bin")) - command = generate_create_file_srv23_1_packet( - filename="test.bin", repository_path="test/subdir", ssc=2302, - initial_data=bytearray([0x01, 0x00, 0x01, 0x00]), - max_size_of_app_data=1024) - tc_queue.appendleft(command.pack_command_tuple()) - - tc_queue.appendleft(("print", "Printing file structure.")) - command = generate_print_sd_card_packet(ssc=2300) - tc_queue.appendleft(command.pack_command_tuple()) - - tc_queue.appendleft(("print", "Clearing SD card")) - command = generate_clear_sd_card_packet(ssc=2301) - tc_queue.appendleft(command.pack_command_tuple()) - - tc_queue.appendleft(("print", "Printing file structure")) - command = generate_print_sd_card_packet(ssc=2302) - tc_queue.appendleft(command.pack_command_tuple()) - - # tc_queue.appendleft(("print", "Read data of test.bin")) - # command = generate_read_file_srv23_129_packet("test/subdir", "test.bin", ssc=2303) - # tc_queue.appendleft(command.pack_command_tuple()) - # tc_queue.appendleft(("print", "Delete 'test.bin'")) - # command = generate_rm_file_srv23_2_packet(filename="test.bin", repository_path="test/subdir", - # ssc=2304) - # tc_queue.appendleft(command.pack_command_tuple()) - # tc_queue.appendleft(("print", "Delete 'subdir' directory")) - # command = generate_rmdir_srv23_10_packet(directory_name="subdir", repository_path="test", - # ssc=2305) - # tc_queue.appendleft(command.pack_command_tuple()) - # tc_queue.appendleft(("print", "Delete 'test' directory")) - # command = generate_rmdir_srv23_10_packet(directory_name="test", repository_path="/", - # ssc=2306) - # tc_queue.appendleft(command.pack_command_tuple()) + if op_code == 0: + tc_queue.appendleft(("print", "Testing Service 23")) + + tc_queue.append(("print", "Create directory 'test'")) + command = generate_mkdir_srv23_9_packet(directory_name="test", repository_path="/", ssc=2300) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.append(("print", "Create subdirectory 'subdir' in 'test'")) + command = generate_mkdir_srv23_9_packet(repository_path="test", ssc=2301, + directory_name="subdir") + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft(("print", "Create test.bin")) + command = generate_create_file_srv23_1_packet( + filename="test.bin", repository_path="test/subdir", ssc=2302, + initial_data=bytearray([0x01, 0x00, 0x01, 0x00]), + max_size_of_app_data=1024) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft(("print", "Printing file structure.")) + command = generate_print_sd_card_packet(ssc=2300) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft(("print", "Clearing SD card")) + command = generate_clear_sd_card_packet(ssc=2301) + tc_queue.appendleft(command.pack_command_tuple()) + + tc_queue.appendleft(("print", "Printing file structure")) + command = generate_print_sd_card_packet(ssc=2302) + tc_queue.appendleft(command.pack_command_tuple()) + + # tc_queue.appendleft(("print", "Read data of test.bin")) + # command = generate_read_file_srv23_129_packet("test/subdir", "test.bin", ssc=2303) + # tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft(("print", "Delete 'test.bin'")) + command = generate_rm_file_srv23_2_packet( + filename="test.bin", repository_path="test/subdir", ssc=2304) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft(("print", "Delete 'subdir' directory")) + command = generate_rmdir_srv23_10_packet(directory_name="subdir", repository_path="test", + ssc=2305) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft(("print", "Delete 'test' directory")) + command = generate_rmdir_srv23_10_packet(directory_name="test", repository_path="/", + ssc=2306) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == 133: + tc_queue.append(("print", "Printing active file system")) + command = generate_print_sd_card_packet(ssc=2300) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == 182: + tc_queue.append(("print", "Formatting active file system")) + command = generate_format_sd_card_packet(ssc=2300) + tc_queue.appendleft(command.pack_command_tuple()) + # tc_queue.appendleft(("print", "\r")) return tc_queue diff --git a/utility/obsw_args_parser.py b/utility/obsw_args_parser.py index eaacb7db4f80331a97fc9460325a26716cfc64ed..37694167e9734d257abac812652ca8e55e4367f9 100644 --- a/utility/obsw_args_parser.py +++ b/utility/obsw_args_parser.py @@ -24,6 +24,9 @@ def parse_input_arguments(): arg_parser.add_argument( '-c', '--com_if', type=int, help='Communication Interface. 0: Dummy Interface, 1: Serial, ' '2: QEMU, 3: UDP', default=2) + arg_parser.add_argument( + '-o', '--op_code', type=int, help='Operation code, which is passed to the TC ' + 'packer functions', default=0) arg_parser.add_argument('--clientIP', help='Client(Computer) IP. Default:\'\'', default='') arg_parser.add_argument( '--boardIP', help='Board IP. Default: Localhost 127.0.0.1', default="127.0.0.1") @@ -38,7 +41,7 @@ def parse_input_arguments(): '--np', dest='print_tm', help='Supply --np to suppress print output to console.', action='store_false') arg_parser.add_argument( - '-o', '--tc_timeout_factor', type=float, help='TC Timeout Factor. Multiplied with ' + '--tc_timeout_factor', type=float, help='TC Timeout Factor. Multiplied with ' 'TM Timeout, TC sent again after this time period. Default: 3.5', default=3.5) arg_parser.add_argument( '-r', '--rawDataPrint', help='Supply -r to print all raw TM data directly',