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
MeasurementHandler Class Reference
The MeasurementHandler class forms the link between data generation and data output, and stores settings. More...
#include <measurementhandler.h>
Inherits AbstractHandler.
Public Types | |
enum | request_t { measreq_MeasReqNone, measreq_DhtResult, measreq_DhtError, measreq_Status } |
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 | |
MyTimers * | m_timer |
Handler classes use timers to pause in the state machine, and continue after delay has finished. |
Detailed Description
The MeasurementHandler class forms the link between data generation and data output, and stores settings.
Receives requests from GroveDht22 when a new measurement has been taken or error has occurred. This handler then sends that information on to UsbComms for printing that information to terminal and SdHandler for printing that information to the CSV data file.
This handler also determines if the necessary conditions have been met to send an SMS. This is based on last measurement, the set alert threshold, and time since last alert was sent. An SMS is sent using GprsHandler.
Other requests from inputs asking for current measurement states (such as the latest measurement) may come from UsbComms or GprsHandler. The string inspection and matching is handled here, and responses sent to the data outputs.
Flashes LED4 constantly to inform that normal operation is occurring.
Definition at line 31 of file measurementhandler.h.
Member Enumeration Documentation
enum request_t |
- Enumerator:
Definition at line 46 of file measurementhandler.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 37 of file measurementhandler.cpp.
void setRequest | ( | int | request, |
void * | data = 0 |
||
) | [virtual] |
setRequest sets a request that the handler will complete when it is able to
- Parameters:
-
request unique to the reimplemented class (an enum) that will be completed in the state machine message an optional array of information relevant to the request
Implements AbstractHandler.
Field Documentation
Handler classes use timers to pause in the state machine, and continue after delay has finished.
Definition at line 31 of file AbstractHandler.h.
Generated on Tue Jul 12 2022 23:07:44 by 1.7.2