added subservices

This commit is contained in:
Robin Müller 2020-10-04 23:24:36 +02:00
parent 2b1029916b
commit a8a6d448ec
2 changed files with 44 additions and 8 deletions

View File

@ -22,13 +22,13 @@ void FileSystemMessage::setDeleteDirectoryCommand(
void FileSystemMessage::setWriteCommand(CommandMessage* message, void FileSystemMessage::setWriteCommand(CommandMessage* message,
store_address_t storageID) { store_address_t storageID) {
message->setCommand(WRITE); message->setCommand(APPEND_TO_FILE);
message->setParameter2(storageID.raw); message->setParameter2(storageID.raw);
} }
void FileSystemMessage::setReadCommand(CommandMessage* message, void FileSystemMessage::setReadCommand(CommandMessage* message,
store_address_t storageID) { store_address_t storageID) {
message->setCommand(READ); message->setCommand(READ_FROM_FILE);
message->setParameter2(storageID.raw); message->setParameter2(storageID.raw);
} }
@ -38,6 +38,12 @@ void FileSystemMessage::setReadReply(CommandMessage* message,
message->setParameter2(storageID.raw); 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 FileSystemMessage::getStoreId(const CommandMessage* message) {
store_address_t temp; store_address_t temp;
temp.raw = message->getParameter2(); temp.raw = message->getParameter2();
@ -58,3 +64,4 @@ ReturnValue_t FileSystemMessage::getFailureReply(
const CommandMessage *message) { const CommandMessage *message) {
return message->getParameter(); return message->getParameter();
} }

View File

@ -14,16 +14,45 @@ public:
FileSystemMessage() = delete; FileSystemMessage() = delete;
static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; 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 CREATE_FILE = MAKE_COMMAND_ID(1);
static const Command_t DELETE_FILE = MAKE_COMMAND_ID(2); 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<something>.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 CREATE_DIRECTORY = MAKE_COMMAND_ID(9);
static const Command_t DELETE_DIRECTORY = MAKE_COMMAND_ID(10); static const Command_t DELETE_DIRECTORY = MAKE_COMMAND_ID(10);
static const Command_t WRITE = MAKE_COMMAND_ID(128); static const Command_t RENAME_DIRECTORY = MAKE_COMMAND_ID(11);
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);
/** 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, static void setDeleteFileCommand(CommandMessage* message,
store_address_t storeId); store_address_t storeId);
static void setCreateDirectoryCommand(CommandMessage* message, static void setCreateDirectoryCommand(CommandMessage* message,