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

Show/hide line numbers AbstractHandler.h Source File

AbstractHandler.h

00001 #ifndef __ABSTRACT_HANDLER_H__
00002 #define __ABSTRACT_HANDLER_H__
00003 
00004 #include "../timers.h"
00005 
00006 /*!
00007  * \brief The AbstractHandler class is inherited by all handlers. It forms the basis of any handler, by having
00008  * a simple \a run function, called in main.cpp, and a \a setRequest function which is used to set a request
00009  * specific to the reimplemented class.
00010  */
00011 class AbstractHandler
00012 {
00013 public:
00014     AbstractHandler(MyTimers *_timer) : m_timer(_timer) {}
00015     ~AbstractHandler() {}
00016 
00017     /*!
00018      * \brief run is inherited by each Handler class. It is called from the main while loop in main.cpp.
00019      * It runs through the state machine, specific to each Handler class.
00020      */
00021     virtual void run() = 0; // run the handler
00022 
00023     /*!
00024      * \brief setRequest sets a request that the handler will complete when it is able to
00025      * \param request unique to the reimplemented class (an enum) that will be completed in the state machine
00026      * \param message an optional array of information relevant to the \a request
00027      */
00028     virtual void setRequest(int request, void *data = 0) = 0;
00029 
00030 protected:
00031     MyTimers *m_timer;  ///< Handler classes use timers to pause in the state machine, and continue after delay has finished
00032 };
00033 
00034 #endif // __ABSTRACT_HANDLER_H__