Added a handy way to retrieve the configuration of a config file without having to instantiate a parser - but I do not like it - might be removed in the future
This commit is contained in:
parent
ef2f986581
commit
e7cf2fa020
@ -54,3 +54,9 @@ boolean SDCardManager::isMounted()
|
|||||||
{
|
{
|
||||||
return _mounted;
|
return _mounted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFGDictionary<CFGParameterValue> *SDCardManager::getCFGFile(const char *cfgFile)
|
||||||
|
{
|
||||||
|
CFGFileParser cfgFileParser(*this, cfgFile);
|
||||||
|
return (CFGDictionary<CFGParameterValue> *) cfgFileParser.parseFile();
|
||||||
|
}
|
||||||
|
@ -2,21 +2,29 @@
|
|||||||
#define SDCARDMANAGER_H
|
#define SDCARDMANAGER_H
|
||||||
#include <SD.h>
|
#include <SD.h>
|
||||||
#include "definition.h"
|
#include "definition.h"
|
||||||
|
#include "CFGDictionary.h"
|
||||||
|
#include "CFGParameterValue.h"
|
||||||
|
#include "CFGFileParser.h"
|
||||||
|
|
||||||
class SDCardManager : public SDClass
|
class SDCardManager : public SDClass
|
||||||
{
|
{
|
||||||
friend class SAB;
|
friend class SAB;
|
||||||
public:
|
public:
|
||||||
SDCardManager(const Pin csPin, SPISettings cfg);
|
SDCardManager(const Pin csPin, SPISettings cfg);
|
||||||
|
|
||||||
double getSize(const SizeUnit sizeUnit = GBYTE);
|
double getSize(const SizeUnit sizeUnit = GBYTE);
|
||||||
boolean mountSD();
|
boolean mountSD();
|
||||||
void unMountSD();
|
void unMountSD();
|
||||||
|
|
||||||
boolean isMounted();
|
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:
|
protected:
|
||||||
SDCardManager();
|
SDCardManager();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Pin _csPin;
|
const Pin _csPin;
|
||||||
SPISettings _spiCfg;
|
SPISettings _spiCfg;
|
||||||
|
Loading…
Reference in New Issue
Block a user