Merge remote-tracking branch 'origin/meier_framework' into mueller_framework

This commit is contained in:
Robin Müller 2020-05-13 12:53:25 +02:00
commit 19e51575cf
4 changed files with 96 additions and 1 deletions

View File

@ -14,7 +14,8 @@ enum FW_MESSAGE_TYPE {
MONITORING,
MEMORY,
PARAMETER,
FW_MESSAGES_COUNT
FW_MESSAGES_COUNT,
FILE_SYSTEM_MESSAGE
};
}

View File

@ -0,0 +1,28 @@
/*
* FileSystemMessage.cpp
*
* Created on: 19.01.2020
* Author: Jakob Meier
*/
#include "FileSystemMessage.h"
#include <framework/objectmanager/ObjectManagerIF.h>
ReturnValue_t FileSystemMessage::setWriteToFileCommand(CommandMessage* message,
MessageQueueId_t replyQueueId, store_address_t storageID) {
message->setCommand(WRITE_TO_FILE);
message->setParameter(replyQueueId);
message->setParameter2(storageID.raw);
return HasReturnvaluesIF::RETURN_OK;
}
store_address_t FileSystemMessage::getStoreID(const CommandMessage* message) {
store_address_t temp;
temp.raw = message->getParameter2();
return temp;
}
MessageQueueId_t FileSystemMessage::getReplyQueueId(const CommandMessage* message){
return message->getParameter();
}

View File

@ -0,0 +1,30 @@
/*
* FileSystemMessage.h
*
* Created on: 19.01.2020
* Author: Jakob Meier
*/
#ifndef FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_
#define FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_
#include <framework/ipc/CommandMessage.h>
#include <framework/storagemanager/StorageManagerIF.h>
#include <framework/objectmanager/SystemObject.h>
class FileSystemMessage {
private:
FileSystemMessage(); //A private ctor inhibits instantiation
public:
static const uint8_t MESSAGE_ID = MESSAGE_TYPE::FILE_SYSTEM_MESSAGE;
static const Command_t CREATE_FILE = MAKE_COMMAND_ID( 0x01 );
static const Command_t DELETE_FILE = MAKE_COMMAND_ID( 0x02 );
static const Command_t WRITE_TO_FILE = MAKE_COMMAND_ID( 0x80 );
static ReturnValue_t setWriteToFileCommand(CommandMessage* message, MessageQueueId_t replyToQueue, store_address_t storageID );
static store_address_t getStoreID( const CommandMessage* message );
static MessageQueueId_t getReplyQueueId(const CommandMessage* message);
};
#endif /* FRAMEWORK_MEMORY_FILESYSTEMMESSAGE_H_ */

36
memory/HasFileSystemIF.h Normal file
View File

@ -0,0 +1,36 @@
/*
* HasFileSystemIF.h
*
* Created on: 19.01.2020
* Author: Jakob Meier
*/
#ifndef FRAMEWORK_MEMORY_HASFILESYSTEMIF_H_
#define FRAMEWORK_MEMORY_HASFILESYSTEMIF_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
class HasFileSystemIF {
public:
virtual ~HasFileSystemIF() {}
/**
* Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object
*/
virtual MessageQueueId_t getCommandQueue() const = 0;
/**
* Function to write to a file
* @param dirname Directory of the file
* @param filename The filename of the file
* @param data The data to write to the file
* @param size The size of the data to write
* @param packetNumber Counts the number of packets. For large files the write procedure must be split in multiple calls to writeToFile
*/
virtual ReturnValue_t writeToFile(const char* dirname, char* filename, const uint8_t* data, uint32_t size, uint16_t packetNumber) = 0;
virtual ReturnValue_t createFile(const char* dirname, const char* filename, const uint8_t* data, uint32_t size) = 0;
virtual ReturnValue_t deleteFile(const char* dirname, const char* filename) = 0;
};
#endif /* FRAMEWORK_MEMORY_HASFILESYSTEMIF_H_ */