more bugfixes

This commit is contained in:
2021-07-12 15:19:06 +02:00
committed by Robin Mueller
parent 9284398b8b
commit e0cf333a7d
4 changed files with 60 additions and 31 deletions

View File

@ -19,6 +19,8 @@ class MutexIF;
class SdCardManager {
friend class SdCardAccess;
public:
using SdStatusPair = std::pair<sd::SdStatus, sd::SdStatus>;
static constexpr uint8_t INTERFACE_ID = CLASS_ID::SD_CARD_MANAGER;
static constexpr ReturnValue_t ALREADY_ON =
@ -63,20 +65,24 @@ public:
* @param sdCard
* @param doMountSdCard Mount the SD card after switching it on, which is necessary
* to use it
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true);
ReturnValue_t switchOnSdCard(sd::SdCard sdCard, bool doMountSdCard = true,
SdStatusPair* statusPair = nullptr);
/**
* Switch off the specified SD card.
* @param sdCard
* @param doUnmountSdCard Unmount the SD card before switching the card off, which makes
* the operation safer
* @param statusPair If the status pair is already available, it can be passed here
* @return - RETURN_OK on success, ALREADY_ON if it is already on,
* SYSTEM_CALL_ERROR on system error
*/
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true);
ReturnValue_t switchOffSdCard(sd::SdCard sdCard, bool doUnmountSdCard = true,
SdStatusPair* statusPair = nullptr);
/**
* Update the state file or creates one if it does not exist. You need to call this
@ -97,7 +103,7 @@ public:
* should call #updateSdCardStateFile again in that case
* - STATUS_FILE_NEXISTS if the status file does not exist
*/
ReturnValue_t getSdCardActiveStatus(std::pair<sd::SdStatus, sd::SdStatus>& active);
ReturnValue_t getSdCardActiveStatus(SdStatusPair& active);
/**
* Mount the specified SD card. This is necessary to use it.
@ -120,8 +126,8 @@ private:
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
void processSdStatusLine(std::pair<sd::SdStatus, sd::SdStatus>& active,
std::string& line, uint8_t& idx, sd::SdCard& currentSd);
void processSdStatusLine(SdStatusPair& active, std::string& line, uint8_t& idx,
sd::SdCard& currentSd);
static SdCardManager* factoryInstance;
};