Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
SDManager Class Reference

#include <SDManager.h>

Inheritance diagram for SDManager:
Inheritance graph
[legend]
Collaboration diagram for SDManager:
Collaboration graph
[legend]

Public Member Functions

 SDManager (Manager *man, int sd_chip_select)
 
bool begin ()
 
bool log (DateTime currentTime)
 
char * readFile (const char *fileName)
 
File & getFile (const char *fileName)
 
bool writeLineToFile (const char *filename, const char *content)
 
const char * getDefaultFilename ()
 
const char * getBatchFilename ()
 
bool hasSDInitialized ()
 
bool fileExists (const char *fileName)
 
void setBatchSize (int size)
 
int getCurrentBatch ()
 
void setLogName (const char *name)
 
int getCurrentFileNumber ()
 
- Public Member Functions inherited from Module
 Module (const char *modName)
 
void setModuleName (const char *modName)
 
virtual const char * getModuleName ()
 
virtual void printModuleName (const char *message)
 
virtual void initialize ()=0
 
virtual void measure ()=0
 
virtual void package ()=0
 
virtual void power_up ()=0
 
virtual void power_down ()=0
 
virtual void display_data ()
 

Protected Member Functions

void measure () override
 
void package () override
 
void initialize () override
 
void power_up () override
 
void power_down () override
 

Additional Inherited Members

- Public Attributes inherited from Module
bool moduleInitialized = true
 
int module_address = -1
 

Detailed Description

Class used to manage interaction with the SD card read/writer on the Hypnos board

Author
Will Richards

Constructor & Destructor Documentation

◆ SDManager()

SDManager::SDManager ( Manager man,
int  sd_chip_select 
)

SDManager Constructor

Parameters
manReference to the manager
sd_chip_selectPin to control the SD card on

Member Function Documentation

◆ begin()

bool SDManager::begin ( )

Initialize the SD card

◆ fileExists()

bool SDManager::fileExists ( const char *  fileName)
inline

Checks if a file exists

Parameters
fileNameThe name of the file to check

◆ getBatchFilename()

const char * SDManager::getBatchFilename ( )
inline

Get the current batch file name

◆ getCurrentBatch()

int SDManager::getCurrentBatch ( )
inline

Get the current batch we are ons

◆ getDefaultFilename()

const char * SDManager::getDefaultFilename ( )
inline

Get the default SD card file name

◆ hasSDInitialized()

bool SDManager::hasSDInitialized ( )
inline

Has the SD card been initialized previously

◆ initialize()

void SDManager::initialize ( )
inlineoverrideprotectedvirtual

Implements Module.

◆ log()

bool SDManager::log ( DateTime  currentTime)

Log the current sensor data to the SD card

Parameters
currentTimeThe current time provided by the RTC this allows us to set accurate modified/created times for files

◆ measure()

void SDManager::measure ( )
inlineoverrideprotectedvirtual

Implements Module.

◆ package()

void SDManager::package ( )
inlineoverrideprotectedvirtual

Implements Module.

◆ power_down()

void SDManager::power_down ( )
inlineoverrideprotectedvirtual

Implements Module.

◆ power_up()

void SDManager::power_up ( )
inlineoverrideprotectedvirtual

Implements Module.

◆ readFile()

char * SDManager::readFile ( const char *  fileName)

Read the contents of a given file on the SD card and return them as a string

YOU MUST FREE THIS BLOCK OF MEMORY AS IT IS 10kb

Parameters
fileNameName of the file to read from

◆ setBatchSize()

void SDManager::setBatchSize ( int  size)
inline

Sets the batch size and thus enables batch loggin

◆ setLogName()

void SDManager::setLogName ( const char *  name)
inline

Log to a different name other than one matching the device name

◆ writeLineToFile()

bool SDManager::writeLineToFile ( const char *  filename,
const char *  content 
)

Write a single line to a file

Parameters
filenameFile to write to
contentString to write to the line

The documentation for this class was generated from the following files: