file system message taken over

This commit is contained in:
Robin Müller 2020-09-19 19:41:41 +02:00
parent 718502c04b
commit 44989ada64
2 changed files with 63 additions and 17 deletions

View File

@ -5,24 +5,60 @@
* Author: Jakob Meier * Author: Jakob Meier
*/ */
#include "FileSystemMessage.h" #include <framework/memory/FileSystemMessage.h>
#include "../objectmanager/ObjectManagerIF.h" #include <framework/objectmanager/ObjectManagerIF.h>
ReturnValue_t FileSystemMessage::setWriteToFileCommand(CommandMessage* message,
MessageQueueId_t replyQueueId, store_address_t storageID) { ReturnValue_t FileSystemMessage::setDeleteFileCommand(
message->setCommand(WRITE_TO_FILE); CommandMessage* message, store_address_t storageID) {
message->setParameter(replyQueueId); message->setCommand(DELETE_FILE);
message->setParameter2(storageID.raw); message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
store_address_t FileSystemMessage::getStoreID(const CommandMessage* message) { ReturnValue_t FileSystemMessage::setCreateDirectoryCommand(
CommandMessage* message, store_address_t storageID) {
message->setCommand(CREATE_DIRECTORY);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemMessage::setDeleteDirectoryCommand(
CommandMessage* message, store_address_t storageID) {
message->setCommand(DELETE_DIRECTORY);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemMessage::setWriteCommand(CommandMessage* message,
store_address_t storageID) {
message->setCommand(WRITE);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemMessage::setReadCommand(CommandMessage* message,
store_address_t storageID) {
message->setCommand(READ);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
ReturnValue_t FileSystemMessage::setReadReply(CommandMessage* message,
store_address_t storageID) {
message->setCommand(READ_REPLY);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
store_address_t FileSystemMessage::getStoreId(const CommandMessage* message) {
store_address_t temp; store_address_t temp;
temp.raw = message->getParameter2(); temp.raw = message->getParameter2();
return temp; return temp;
} }
MessageQueueId_t FileSystemMessage::getReplyQueueId(const CommandMessage* message){ void FileSystemMessage::setCompletionReply(CommandMessage* message,
return message->getParameter(); Command_t completionStatus) {
message->setCommand(completionStatus);
} }

View File

@ -8,9 +8,9 @@
#ifndef FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_ #ifndef FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_
#define FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_ #define FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_
#include "../ipc/CommandMessage.h" #include <framework/ipc/CommandMessage.h>
#include "../storagemanager/StorageManagerIF.h" #include <framework/storagemanager/StorageManagerIF.h>
#include "../objectmanager/SystemObject.h" #include <framework/objectmanager/SystemObject.h>
class FileSystemMessage { class FileSystemMessage {
private: private:
@ -19,12 +19,22 @@ public:
static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE;
static const Command_t CREATE_FILE = MAKE_COMMAND_ID( 0x01 ); static const Command_t CREATE_FILE = MAKE_COMMAND_ID( 0x01 );
static const Command_t DELETE_FILE = MAKE_COMMAND_ID( 0x02 ); static const Command_t DELETE_FILE = MAKE_COMMAND_ID( 0x02 );
static const Command_t WRITE_TO_FILE = MAKE_COMMAND_ID( 0x80 ); static const Command_t CREATE_DIRECTORY = MAKE_COMMAND_ID( 0x09 );
static const Command_t DELETE_DIRECTORY = MAKE_COMMAND_ID( 0x0A );
static ReturnValue_t setWriteToFileCommand(CommandMessage* message, MessageQueueId_t replyToQueue, store_address_t storageID ); static const Command_t WRITE = MAKE_COMMAND_ID( 0x80 );
static store_address_t getStoreID( const CommandMessage* message ); static const Command_t READ = MAKE_COMMAND_ID( 0x81 );
static MessageQueueId_t getReplyQueueId(const CommandMessage* message); static const Command_t READ_REPLY = MAKE_COMMAND_ID( 0x82 );
static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(5);
static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(6);
static ReturnValue_t setDeleteFileCommand(CommandMessage* message, store_address_t storageID);
static ReturnValue_t setCreateDirectoryCommand(CommandMessage* message, store_address_t storageID);
static ReturnValue_t setDeleteDirectoryCommand(CommandMessage* message, store_address_t storageID);
static ReturnValue_t setWriteCommand(CommandMessage* message, store_address_t storageID);
static ReturnValue_t setReadCommand(CommandMessage* message, store_address_t storageID);
static ReturnValue_t setReadReply(CommandMessage* message, store_address_t storageID);
static store_address_t getStoreId( const CommandMessage* message );
static void setCompletionReply(CommandMessage* message, Command_t completionStatus);
}; };
#endif /* FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_ */ #endif /* FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_ */