A simple WIP that logs data from a Grove sensor, and can send and receive information over USB and SMS.

Dependencies:   DHT DS_1337 SDFileSystem USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

SdHandler Class Reference

The SdHandler class writes messages to file and handles SD card status. More...

#include <SdHandler.h>

Inherits AbstractHandler.

Public Types

enum  request_t { sdreq_SdNone, sdreq_LogData, sdreq_LogSystem }

Public Member Functions

void run ()
 run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.
void setRequest (int request, void *data=0)
 setRequest sets a request that the handler will complete when it is able to

Protected Attributes

MyTimersm_timer
 Handler classes use timers to pause in the state machine, and continue after delay has finished.

Detailed Description

The SdHandler class writes messages to file and handles SD card status.

A data CSV file is written with timestamps and the result from the GroveDht22. A system log, not yet fully implemented, tracks system events for debugging purposes.

Definition at line 15 of file SdHandler.h.


Member Enumeration Documentation

enum request_t
Enumerator:
sdreq_SdNone 

to init

sdreq_LogData 

Send struct containing a result and timestamp. This turns it into a line in a csv file.

sdreq_LogSystem 

write raw string to system logging file (errors, events, etc)

Definition at line 27 of file SdHandler.h.


Member Function Documentation

void run (  ) [virtual]

run is inherited by each Handler class. It is called from the main while loop in main.cpp. It runs through the state machine, specific to each Handler class.

Implements AbstractHandler.

Definition at line 41 of file SdHandler.cpp.

void setRequest ( int  request,
void *  data = 0 
) [virtual]

setRequest sets a request that the handler will complete when it is able to

Parameters:
requestunique to the reimplemented class (an enum) that will be completed in the state machine
messagean optional array of information relevant to the request

Implements AbstractHandler.

Definition at line 147 of file SdHandler.cpp.


Field Documentation

MyTimers* m_timer [protected, inherited]

Handler classes use timers to pause in the state machine, and continue after delay has finished.

Definition at line 31 of file AbstractHandler.h.