#ifndef SDCARDMANAGER_H
#define SDCARDMANAGER_H
#include <SD.h>
#include "definition.h"
#include "CFGDictionary.h"
#include "CFGParameterValue.h"
#include "CFGFileParser.h"

class SDCardManager : public SDClass
{
  friend class SAB;
  public:
    SDCardManager(const Pin csPin, uint32_t cfg);
    float getSize(const SizeUnit sizeUnit = GBYTE);
    boolean mountSD();
    void unMountSD();
    boolean isMounted();
    /*
     * Quick way to retrieve the keys and values of a config file.
     * If you need to performe other actions on the file, you will have to use the CFGFileParser object instead
     * Remember to free the returned object ie : delete
     */
    CFGDictionary<CFGParameterValue> *getCFGFile(const char *cfgFile);
    
  protected:
    SDCardManager();
    
  private:
    const Pin _csPin;
    uint32_t _spiCfg;
    boolean _mounted;
};

#endif //SDCARDMANAGER_H
