Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
|
#include <SDManager.h>
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 |
Class used to manage interaction with the SD card read/writer on the Hypnos board
SDManager::SDManager | ( | Manager * | man, |
int | sd_chip_select | ||
) |
SDManager Constructor
man | Reference to the manager |
sd_chip_select | Pin to control the SD card on |
bool SDManager::begin | ( | ) |
Initialize the SD card
|
inline |
Checks if a file exists
fileName | The name of the file to check |
|
inline |
Get the current batch file name
|
inline |
Get the current batch we are ons
|
inline |
Get the default SD card file name
|
inline |
Has the SD card been initialized previously
|
inlineoverrideprotectedvirtual |
Implements Module.
bool SDManager::log | ( | DateTime | currentTime | ) |
Log the current sensor data to the SD card
currentTime | The current time provided by the RTC this allows us to set accurate modified/created times for files |
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
|
inlineoverrideprotectedvirtual |
Implements Module.
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
fileName | Name of the file to read from |
|
inline |
Sets the batch size and thus enables batch loggin
|
inline |
Log to a different name other than one matching the device name
bool SDManager::writeLineToFile | ( | const char * | filename, |
const char * | content | ||
) |
Write a single line to a file
filename | File to write to |
content | String to write to the line |