changes for updated fsfw
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
@ -133,8 +133,9 @@ ReturnValue_t FileSystemHandler::initialize() {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const char *filename,
|
||||
const uint8_t *data, size_t size, uint16_t packetNumber, void *args) {
|
||||
ReturnValue_t FileSystemHandler::appendToFile(const char* repositoryPath,
|
||||
const char* filename, const uint8_t* data, size_t size,
|
||||
uint16_t packetNumber, FileSystemArgsIF* args) {
|
||||
// A double slash between repo and filename should not be an issue, so add it in any case
|
||||
std::string fullPath = currentMountPrefix + std::string(repositoryPath) + "/" +
|
||||
std::string(filename);
|
||||
@ -149,8 +150,8 @@ ReturnValue_t FileSystemHandler::appendToFile(const char *repositoryPath, const
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const char *filename,
|
||||
const uint8_t *data, size_t size, void *args) {
|
||||
ReturnValue_t FileSystemHandler::createFile(const char* repositoryPath,
|
||||
const char* filename, const uint8_t* data, size_t size, FileSystemArgsIF* args) {
|
||||
std::string fullPath;
|
||||
bool useMountPrefix = true;
|
||||
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||
@ -171,8 +172,8 @@ ReturnValue_t FileSystemHandler::createFile(const char *repositoryPath, const ch
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const char *filename,
|
||||
void *args) {
|
||||
ReturnValue_t FileSystemHandler::removeFile(const char* repositoryPath,
|
||||
const char* filename, FileSystemArgsIF* args) {
|
||||
std::string fullPath;
|
||||
bool useMountPrefix = true;
|
||||
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||
@ -193,7 +194,8 @@ ReturnValue_t FileSystemHandler::removeFile(const char *repositoryPath, const ch
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, void *args) {
|
||||
ReturnValue_t FileSystemHandler:: createDirectory(const char* repositoryPath, const char* dirname,
|
||||
bool createParentDirs, FileSystemArgsIF* args) {
|
||||
std::string fullPath;
|
||||
bool useMountPrefix = true;
|
||||
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||
@ -202,6 +204,7 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi
|
||||
}
|
||||
|
||||
fullPath += std::string(repositoryPath);
|
||||
fullPath += "/" + std::string(dirname);
|
||||
if(std::filesystem::exists(fullPath)) {
|
||||
return DIRECTORY_ALREADY_EXISTS;
|
||||
}
|
||||
@ -212,8 +215,8 @@ ReturnValue_t FileSystemHandler::createDirectory(const char *repositoryPath, voi
|
||||
return GENERIC_FILE_ERROR;
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
|
||||
bool deleteRecurively, void *args) {
|
||||
ReturnValue_t FileSystemHandler::removeDirectory(const char* repositoryPath, const char* dirname,
|
||||
bool deleteRecurively, FileSystemArgsIF* args) {
|
||||
std::string fullPath;
|
||||
bool useMountPrefix = true;
|
||||
parseCfg(reinterpret_cast<FsCommandCfg*>(args), useMountPrefix);
|
||||
@ -222,6 +225,7 @@ ReturnValue_t FileSystemHandler::removeDirectory(const char *repositoryPath,
|
||||
}
|
||||
|
||||
fullPath += std::string(repositoryPath);
|
||||
fullPath += "/" + std::string(dirname);
|
||||
if(not std::filesystem::exists(fullPath)) {
|
||||
return DIRECTORY_DOES_NOT_EXIST;
|
||||
}
|
||||
@ -268,3 +272,9 @@ void FileSystemHandler::parseCfg(FsCommandCfg *cfg, bool& useMountPrefix) {
|
||||
useMountPrefix = cfg->useMountPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t FileSystemHandler::renameFile(const char *repositoryPath, const char *oldFilename,
|
||||
const char *newFilename, FileSystemArgsIF *args) {
|
||||
// TODO: Implement
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class FileSystemHandler: public SystemObject,
|
||||
public ExecutableObjectIF,
|
||||
public HasFileSystemIF {
|
||||
public:
|
||||
struct FsCommandCfg {
|
||||
struct FsCommandCfg: public FileSystemArgsIF {
|
||||
// Can be used to automatically use mount prefix of active SD card.
|
||||
// Otherwise, the operator has to specify the full path to the mounted SD card as well.
|
||||
bool useMountPrefix = false;
|
||||
@ -35,18 +35,20 @@ public:
|
||||
* @return MessageQueueId_t of the object
|
||||
*/
|
||||
MessageQueueId_t getCommandQueue() const override;
|
||||
|
||||
ReturnValue_t appendToFile(const char* repositoryPath,
|
||||
const char* filename, const uint8_t* data, size_t size,
|
||||
uint16_t packetNumber, void* args = nullptr) override;
|
||||
uint16_t packetNumber, FileSystemArgsIF* 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;
|
||||
size_t size = 0, FileSystemArgsIF* args = nullptr) override;
|
||||
ReturnValue_t removeFile(const char* repositoryPath,
|
||||
const char* filename, void* args = nullptr) override;
|
||||
ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) override;
|
||||
ReturnValue_t removeDirectory(const char* repositoryPath, bool deleteRecurively = false,
|
||||
void* args = nullptr) override;
|
||||
const char* filename, FileSystemArgsIF* args = nullptr) override;
|
||||
ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname,
|
||||
bool createParentDirs, FileSystemArgsIF* args = nullptr) override;
|
||||
ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname,
|
||||
bool deleteRecurively = false, FileSystemArgsIF* args = nullptr) override;
|
||||
ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename,
|
||||
const char* newFilename, FileSystemArgsIF* args = nullptr) override;
|
||||
|
||||
private:
|
||||
CoreController* coreCtrl = nullptr;
|
||||
|
Reference in New Issue
Block a user