SkyTEM BMAG / Mbed 2 deprecated BMAGThrRev

Dependencies:   mbed WDT MODSERIAL BME280

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ErrorHandler.h Source File

ErrorHandler.h

00001 #pragma once
00002 #include <string>
00003 #include "mbed.h"
00004 #include "BMAG/BMAG.h"
00005 #include "NMEA/NMEA.h"
00006 
00007 using std::string;
00008 
00009 enum ErrorState{NONE, NO_GPS, NO_FIX, NO_MAG_DATA, DISPLAY_VBAT_FIX, DISPLAY_MAG_MEASUREMENT, BATTERY_LOW, GPS_OVERRIDE_NEEDED};
00010 
00011 
00012 //! An Error Handler class
00013 /*!
00014     This class is used to handle error states, and display texts of the bmag usb logger.
00015 */
00016 class ErrorHandler{
00017 
00018 public:
00019     //constructor
00020     ErrorHandler();
00021     
00022     //constructor with display ptr
00023     ErrorHandler(string * batteryvoltage, bool * fix,BMAG * bmag, NMEA * gps);
00024     
00025     //get display lines
00026     string getLine1(void);
00027     string getLine2(void);
00028     
00029     //get mag time prompt status
00030     bool getMagTimePromtStatus(void);
00031     
00032     //sets errorstate and assigns the correct line values for display
00033     void setErrorState(ErrorState es);
00034     
00035     //gets errorstate
00036     ErrorState getErrorState(void);
00037       
00038     bool setMagTimePrompted;
00039         
00040 private:
00041     string errorStr1;
00042     string errorStr2;
00043     int magPromptCounter;
00044     char tmparr[15];
00045     bool * fixptr;
00046     string * batteryvoltageptr;
00047     BMAG * bmagptr;
00048     NMEA * gpsPtr;
00049     ErrorState currentState; 
00050 };