From fac3724c67a737517ee47d9aaf38b1c9b40b1ed3 Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Sun, 4 Oct 2020 23:25:08 +0200
Subject: [PATCH] improved names of functions

---
 tc/obsw_tc_service23.py         | 47 ++++++++++++++++-----------------
 utility/obsw_binary_uploader.py |  5 ++--
 2 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/tc/obsw_tc_service23.py b/tc/obsw_tc_service23.py
index 31d705f..9a14f98 100644
--- a/tc/obsw_tc_service23.py
+++ b/tc/obsw_tc_service23.py
@@ -11,17 +11,18 @@ from typing import Deque
 from tc.obsw_pus_tc_packer import PusTelecommand
 
 
-def generate_service23_subservice2_packet(filename: str, repositoryPath: str = "",
-                                          object_id=bytearray([])):
-    """ This function generates the application data field of a service 23/subservice 2 to
-        delete a file on a file-system-capable on-board memory.
-    : param filename: The name of the file to delete
-            repository_path: The path where the directory shall be created
-            objectID: The object ID of the memory handler which manages the file system
+def generate_rm_file_srv23_2_packet(filename: str, repository_path: str = "",
+                                    object_id=bytearray([])):
+    """
+    This function generates a packet which is used to delete a file on a
+    file-system-capable on-board memory.
+    @param filename: The name of the file to delete
+    @param repository_path: The path where the directory shall be created
+    @param object_id: The object ID of the memory handler which manages the file system
     :return The TC[23,2] PUS packet
     """
     data_to_pack = object_id
-    data_to_pack += bytearray(repositoryPath, 'utf-8')
+    data_to_pack += bytearray(repository_path, 'utf-8')
     # Add string terminator to repository_path
     data_to_pack.append(0)
     data_to_pack += bytearray(filename, 'utf-8')
@@ -30,13 +31,13 @@ def generate_service23_subservice2_packet(filename: str, repositoryPath: str = "
     return PusTelecommand(service=23, subservice=2, ssc=21, app_data=data_to_pack)
 
 
-def generate_service23_subservice9_packet(directory_name: str, repository_path: str = "",
-                                          object_id=bytearray([])):
-    """ This function generates the application data field of a service 23/subservice 9 packet.
-        This service can be used to create directories on file systems.
-    : param repository_path: The path where the directory shall be created
-            directoryName: The name of the directory to create
-            objectID: The object ID of the memory handler which manages the file system
+def generate_mkdir_srv23_9_packet(directory_name: str, repository_path: str = "",
+                                  object_id=bytearray([])):
+    """
+    This function generates a packet which is used to create directories on file systems.
+    @param directory_name: The path where the directory shall be created
+    @param repository_path: The name of the directory to create
+    @param object_id: The object ID of the memory handler which manages the file system
     :return
     """
     data_to_pack = object_id
@@ -49,11 +50,10 @@ def generate_service23_subservice9_packet(directory_name: str, repository_path:
     return PusTelecommand(service=23, subservice=9, ssc=21, app_data=data_to_pack)
 
 
-def generate_service23_subservice10_packet(directory_name: str, repository_path: str = "",
-                                           object_id=bytearray([])):
-    """ This function generates the application data field for a PUS packet with service
-        23 and subservie 10.
-        This service deletes the directory dirname.
+def generate_rmdir_srv23_10_packet(directory_name: str, repository_path: str = "",
+                                   object_id=bytearray([])):
+    """
+    This function generates a packet which deletes the a directory at the specified repository path.
     @param directory_name: Name of the directory to delete
     @param repository_path: Path to directory dirname
     @param object_id: object ID of the memory handler (e.g. SD Card Handler)
@@ -74,10 +74,9 @@ def generate_service23_subservice128_packet(
         file_data: bytearray = bytearray([]), init_ssc: int = 0,
         object_id: bytearray = g.SD_CARD_HANDLER_ID):
     """
-    This function generates PUS packets with service 23 and subservie 128 and packs the into the
-    supplied deque container.
-    Subservice 128 is a custom service to write data in a file. A new file will be created if not
-    already existing.
+    This function generates PUS packets which is used to write data in a file.
+    A new file will be created if not already existing. If the file already exists, this might
+    lead to
 
     If the file data is larger than the maximum allowed size of application data, this function
     will split the data into multiple packets and increment the initial SSC number by one for
diff --git a/utility/obsw_binary_uploader.py b/utility/obsw_binary_uploader.py
index 46f0d20..64cdde4 100644
--- a/utility/obsw_binary_uploader.py
+++ b/utility/obsw_binary_uploader.py
@@ -12,7 +12,8 @@ from tkinter import filedialog
 from collections import deque
 
 from tmtc_core.comIF.obsw_com_interface import CommunicationInterface
-from tc.obsw_tc_service23 import generate_service23_subservice128_packet
+from tc.obsw_tc_service23 import generate_service23_subservice128_packet, \
+    generate_rmdir_srv23_10_packet
 import config.obsw_config as g
 
 
@@ -48,7 +49,7 @@ def perform_binary_upload(comIF: CommunicationInterface):
 
     # Delete existing binary file first, otherwise data might be appeneded to otherwise
     # valid file which already exists.
-    # generate_service23_subservice1_packet()
+    generate_rmdir_srv23_10_packet()
 
     # We have to split the binary here first
     generate_service23_subservice128_packet(tc_queue, "BIN/AT91/BL", "bl.bin", 1024, data_to_read)
-- 
GitLab