From a8a6d448ecc601fc74cefbc7b80736985b8ca06b Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 4 Oct 2020 23:24:36 +0200 Subject: [PATCH] added subservices --- memory/FileSystemMessage.cpp | 11 ++++++++-- memory/FileSystemMessage.h | 41 ++++++++++++++++++++++++++++++------ 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/memory/FileSystemMessage.cpp b/memory/FileSystemMessage.cpp index b01e1fc6..b9c426a8 100644 --- a/memory/FileSystemMessage.cpp +++ b/memory/FileSystemMessage.cpp @@ -22,13 +22,13 @@ void FileSystemMessage::setDeleteDirectoryCommand( void FileSystemMessage::setWriteCommand(CommandMessage* message, store_address_t storageID) { - message->setCommand(WRITE); + message->setCommand(APPEND_TO_FILE); message->setParameter2(storageID.raw); } void FileSystemMessage::setReadCommand(CommandMessage* message, store_address_t storageID) { - message->setCommand(READ); + message->setCommand(READ_FROM_FILE); message->setParameter2(storageID.raw); } @@ -38,6 +38,12 @@ void FileSystemMessage::setReadReply(CommandMessage* message, message->setParameter2(storageID.raw); } +void FileSystemMessage::setCreateFileCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CREATE_FILE); + message->setParameter2(storeId.raw); +} + store_address_t FileSystemMessage::getStoreId(const CommandMessage* message) { store_address_t temp; temp.raw = message->getParameter2(); @@ -58,3 +64,4 @@ ReturnValue_t FileSystemMessage::getFailureReply( const CommandMessage *message) { return message->getParameter(); } + diff --git a/memory/FileSystemMessage.h b/memory/FileSystemMessage.h index c098d407..4d77fd16 100644 --- a/memory/FileSystemMessage.h +++ b/memory/FileSystemMessage.h @@ -14,16 +14,45 @@ public: FileSystemMessage() = delete; static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; + /* PUS standard (ECSS-E-ST-70-41C15 2016 p.654) */ static const Command_t CREATE_FILE = MAKE_COMMAND_ID(1); static const Command_t DELETE_FILE = MAKE_COMMAND_ID(2); + /** Report file attributes */ + static const Command_t REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(3); + static const Command_t FILE_ATTRIBUTES_REPLY = MAKE_COMMAND_ID(4); + /** Command to lock a file, setting it read-only */ + static const Command_t LOCK_FILE = MAKE_COMMAND_ID(5); + /** Command to unlock a file, enabling further operations on it */ + static const Command_t UNLOCK_FILE = MAKE_COMMAND_ID(6); + /** + * Find file in repository, using a search pattern. + * Please note that * is the wildcard character. + * For example, when looking for all files which start with have the + * structure tm.bin, tm*.bin can be used. + */ + static const Command_t FIND_FILE = MAKE_COMMAND_ID(7); static const Command_t CREATE_DIRECTORY = MAKE_COMMAND_ID(9); - static const Command_t DELETE_DIRECTORY = MAKE_COMMAND_ID(10); - static const Command_t WRITE = MAKE_COMMAND_ID(128); - static const Command_t READ = MAKE_COMMAND_ID(129); - static const Command_t READ_REPLY = MAKE_COMMAND_ID(130); - static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(5); - static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(6); + static const Command_t DELETE_DIRECTORY = MAKE_COMMAND_ID(10); + static const Command_t RENAME_DIRECTORY = MAKE_COMMAND_ID(11); + /** Dump contents of a repository */ + static const Command_t DUMP_REPOSITORY = MAKE_COMMAND_ID(12); + /** Repository dump reply */ + static const Command_t DUMY_REPOSITORY_REPLY = MAKE_COMMAND_ID(13); + + static const Command_t APPEND_TO_FILE = MAKE_COMMAND_ID(128); + static const Command_t READ_FROM_FILE = MAKE_COMMAND_ID(129); + static const Command_t READ_REPLY = MAKE_COMMAND_ID(130); + + /** Dump the structure of the whole SD card as an ASCII file */ + static const Command_t DUMP_FILE_STRUCTURE = MAKE_COMMAND_ID(131); + + + static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(150); + static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(151); + + static void setCreateFileCommand(CommandMessage* message, + store_address_t storeId); static void setDeleteFileCommand(CommandMessage* message, store_address_t storeId); static void setCreateDirectoryCommand(CommandMessage* message,