eive-obsw/bsp_q7s/fs/FilesystemHelper.h

50 lines
1.5 KiB
C
Raw Normal View History

2022-01-06 18:05:21 +01:00
#ifndef BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
#define BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_
2022-01-10 16:18:18 +01:00
#include <string>
2022-03-27 13:07:18 +02:00
2022-03-23 11:13:59 +01:00
#include "commonClassIds.h"
2022-08-24 17:27:47 +02:00
#include "fsfw/returnvalues/returnvalue.h"
2022-01-06 18:05:21 +01:00
/**
2022-04-10 18:46:39 +02:00
* @brief This class implements often used functions related to the file system management.
2022-01-06 18:05:21 +01:00
*
* @author J. Meier
*/
2022-08-24 17:27:47 +02:00
class FilesystemHelper {
2022-03-27 13:07:18 +02:00
public:
static const uint8_t INTERFACE_ID = CLASS_ID::FILE_SYSTEM_HELPER;
//! [EXPORT] : [COMMENT] SD card specified with path string not mounted
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(0xA0);
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem
static const ReturnValue_t FILE_NOT_EXISTS = MAKE_RETURN_CODE(0xA1);
/**
2022-04-13 11:56:37 +02:00
* @brief In case the path points to a directory on the sd card, the function checks if the
2022-03-27 13:07:18 +02:00
* appropriate SD card is mounted.
*
* @param path Path to check
*
2022-08-24 17:27:47 +02:00
* @return returnvalue::OK if path points to SD card and the appropriate SD card is mounted or if
2022-03-27 13:07:18 +02:00
* path does not point to SD card.
* Return error code if path points to SD card and the corresponding SD card is not
* mounted.
*/
static ReturnValue_t checkPath(std::string path);
/**
* @brief Checks if the file exists on the filesystem.
*
2022-04-10 18:46:39 +02:00
* @param file File to check
2022-03-27 13:07:18 +02:00
*
2022-08-24 17:27:47 +02:00
* @return returnvalue::OK if file exists, otherwise return error code.
2022-03-27 13:07:18 +02:00
*/
static ReturnValue_t fileExists(std::string file);
2022-04-13 11:56:37 +02:00
private:
FilesystemHelper();
2022-01-06 18:05:21 +01:00
};
#endif /* BSP_Q7S_MEMORY_FILESYSTEMHELPER_H_ */