SkyTEM BMAG / Mbed 2 deprecated BMAGThrRev

Dependencies:   mbed WDT MODSERIAL BME280

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers NMEA.h Source File

NMEA.h

00001 #pragma once
00002 #include "mbed.h"
00003 #include <string>
00004 
00005 using std::string;
00006 
00007 //! An NMEA handler class
00008 /*!
00009     This class is used to handle NMEA strings, from eg. a GPS device.
00010 */
00011 class NMEA{
00012 public:
00013     //default constructor
00014     NMEA();    
00015     
00016     //validate received data
00017     //returns true if valid
00018     bool ValidateData(string cstStr);
00019     
00020     //Store function to move GGA to currentGGAString, 
00021     //or GPRMC to currentGPRMCString
00022     void StoreString(string cstStr);
00023     
00024     //Parser getting current UTC timestamp from GPRMC
00025     void ParseCurrentUTCFromGPRMC(void);
00026     
00027     //Parser getting current Date from GPRMC
00028     void ParseCurrentDateFromGPRMC(void);
00029     
00030     //Parser getting current Latitude
00031     void ParseCurrentLatitudeFromGPRMC(void);
00032     
00033     //Parser getting current Longitude
00034     void ParseCurrentLongitudeFromGPRMC(void);
00035     
00036     void ParseCurrentAltitudeFromGGA(void);
00037     
00038     //Verification of gps fix, if fix is ok, return true, if not return false.
00039     bool GGAFixVerification(void);
00040     
00041     //get data string from NmeaString
00042     void getXFromNMEAString(int desiredCommaCount, string stringToParse);
00043     
00044     //getter method returning current UTC from NMEA class
00045     string getCurrentTime(void);
00046         
00047     
00048     string currentGGAString;
00049     string currentGPRMCString;
00050     string currentUTCFromGPRMC;
00051     string currentDATEFromGPRMC;
00052     string currentLatitude;
00053     string currentLongitude;  
00054     string currentAltitude;  
00055     string tmpStr;  
00056     
00057     int cnt_GPRMC;
00058     
00059     float longitudeDD;
00060     float latitudeDD;
00061 
00062 private:
00063 
00064     string chkSumGps;
00065     char iterationIndex;
00066     int GpsCheck;
00067     int chkSum;
00068 
00069     bool north, east, south, west;
00070     char tmpArrDeg[7];
00071     char tmpArrMin[7];
00072     char tmpLongitude[15]; 
00073     char tmpLatitude[15];  
00074 };