57 lines
1.3 KiB
C++
57 lines
1.3 KiB
C++
#ifndef BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
|
#define BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_
|
|
|
|
#include "definitions.h"
|
|
#include "returnvalues/classIds.h"
|
|
|
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
|
|
|
#include <cstdint>
|
|
|
|
class MutexIF;
|
|
|
|
/**
|
|
* @brief Manages handling of SD cards like switching them on or off or getting the current
|
|
* state
|
|
*/
|
|
class SdCardManager {
|
|
friend class SdCardAccess;
|
|
public:
|
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
|
|
|
|
static constexpr ReturnValue_t ALREADY_ON = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 0);
|
|
static constexpr ReturnValue_t ALREADY_OFF = HasReturnvaluesIF::makeReturnCode(INTERFACE_ID, 1);
|
|
|
|
virtual ~SdCardManager();
|
|
|
|
static void create();
|
|
|
|
/**
|
|
* Returns the single instance of the SD card manager.
|
|
*/
|
|
static SdCardManager* instance();
|
|
|
|
void setPreferredSdCard(sd::SdCard sdCard);
|
|
|
|
sd::SdCard getPreferredSdCard() const;
|
|
|
|
ReturnValue_t switchOnSdCard(sd::SdCard sdCard);
|
|
|
|
ReturnValue_t switchOffSdCard(sd::SdCard sdCard);
|
|
|
|
bool sdCardActive(sd::SdCard sdCard);
|
|
|
|
sd::SdCard getPreferedSdCard() const;
|
|
|
|
private:
|
|
SdCardManager();
|
|
|
|
void updateSdCardStateFile();
|
|
|
|
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
|
|
|
|
static SdCardManager* factoryInstance;
|
|
};
|
|
|
|
#endif /* BSP_Q7S_MEMORY_SDCARDACCESSMANAGER_H_ */
|