eive-obsw/bsp_q7s/memory/FileSystemHandler.h

58 lines
1.9 KiB
C
Raw Normal View History

2021-07-08 12:22:41 +02:00
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHANDLER_H_
2021-07-12 17:50:01 +02:00
#include "SdCardManager.h"
2021-07-12 16:32:14 +02:00
#include "OBSWConfig.h"
2021-07-08 12:32:24 +02:00
#include "fsfw/ipc/MessageQueueIF.h"
2021-07-08 12:22:41 +02:00
#include "fsfw/tasks/ExecutableObjectIF.h"
#include "fsfw/objectmanager/SystemObject.h"
#include "fsfw/memory/HasFileSystemIF.h"
2021-07-12 16:32:14 +02:00
#include <string>
2021-07-08 12:22:41 +02:00
class FileSystemHandler: public SystemObject,
public ExecutableObjectIF,
public HasFileSystemIF {
public:
FileSystemHandler(object_id_t fileSystemHandler);
2021-07-08 12:32:24 +02:00
virtual~ FileSystemHandler();
2021-07-08 12:22:41 +02:00
ReturnValue_t performOperation(uint8_t) override;
2021-07-12 17:23:32 +02:00
ReturnValue_t initialize() override;
2021-07-08 12:22:41 +02:00
/**
* Function to get the MessageQueueId_t of the implementing object
* @return MessageQueueId_t of the object
*/
2021-07-08 12:32:24 +02:00
MessageQueueId_t getCommandQueue() const override;
2021-07-08 12:22:41 +02:00
private:
2021-07-08 12:32:24 +02:00
MessageQueueIF* mq = nullptr;
2021-07-12 17:23:32 +02:00
std::string currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
2021-07-12 16:32:14 +02:00
static constexpr uint32_t FS_MAX_QUEUE_SIZE = config::OBSW_FILESYSTEM_HANDLER_QUEUE_SIZE;
2021-07-19 12:44:43 +02:00
2021-07-12 17:23:32 +02:00
SdCardManager* sdcMan = nullptr;
uint8_t opCounter = 0;
void fileSystemHandlerLoop();
void fileSystemCheckup();
2021-07-08 12:22:41 +02:00
ReturnValue_t appendToFile(const char* repositoryPath,
const char* filename, const uint8_t* data, size_t size,
uint16_t packetNumber, void* args = nullptr) override;
ReturnValue_t createFile(const char* repositoryPath,
const char* filename, const uint8_t* data = nullptr,
size_t size = 0, void* args = nullptr) override;
ReturnValue_t deleteFile(const char* repositoryPath,
const char* filename, void* args = nullptr) override;
2021-07-12 17:23:32 +02:00
ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) override;
ReturnValue_t removeDirectory(const char* repositoryPath, bool deleteRecurively = false,
void* args = nullptr) override;
2021-07-08 12:22:41 +02:00
};
#endif /* BSP_Q7S_MEMORY_FILESYSTEMMANAGER_H_ */