Bmag incl gps rettelse
Dependencies: mbed WDT MODSERIAL BME280
Diff: NMEA/NMEA.cpp
- Revision:
- 18:87f243168f05
- Parent:
- 5:11782a2008c2
- Child:
- 21:325cb82f1838
--- a/NMEA/NMEA.cpp Wed Apr 12 05:27:22 2017 +0000 +++ b/NMEA/NMEA.cpp Wed Apr 19 11:45:58 2017 +0000 @@ -1,6 +1,6 @@ #include "NMEA.h" -//constructor with a MODSERIAL pointer to the GPS comms as argument +//! NMEA, default constructor NMEA::NMEA(){ currentGGAString.resize(128); @@ -27,7 +27,14 @@ west = false; }; -//Returns true if GPS CRC corresponds to calculated CRC, else false. +//! ValidateData, method taking a text string for NMEA validation +/*! + ValidateData validates that the NMEA data string isn't corrupted. + (Verification of crc) + + \param cstStr An NMEA ascii string. + \return boolean return value, true if crc corresponds to own calculated crc, else false. +*/ bool NMEA::ValidateData(string cstStr){ //Temporary variables used locally only @@ -73,9 +80,12 @@ return false; }; +//! StoreString, method taking a text string as argument for further handling +/*! + StoreString, replaces current GPRMC or GGA string, with new valid GPRMC or GGA string. -//Store function to move GGA to currentGGAString, -//or GPRMC to currentGPRMCString + \param cstStr An NMEA ascii string. +*/ void NMEA::StoreString(string cstStr){ static std::string gga = "$GPGGA"; static std::string rmc = "$GPRMC"; @@ -101,7 +111,22 @@ }; -//Parser / formatter function to get current UTC timestamp from GPRMC +//! ParseCurrentUTCFromGPRMC, grabs UTC timestamp from current stored GPRMC string. +/*! + ParseCurrentUTCFromGPRMC, grabs UTC timestamp from current stored GPRMC string. + Stores the UTC timestamp in local text string. + + Depending on the format it will be saved as: + HH:MM:SS.FFF + In this case FFF are read values fom the string. + eg. 14:10:22.007 + + or + + HH:MM:SS.FFF + In this case FFF are predetermined values set to 0. + eg. 14:10:22.000 +*/ void NMEA::ParseCurrentUTCFromGPRMC(){ //getting utc from GPRMC string, assign to tmpStr @@ -160,7 +185,14 @@ }; -//Parser getting current Date from GPRMC +//! ParseCurrentDateFromGPRMC, grabs current date from current GPRMC string. +/*! + ParseCurrentDateFromGPRMC, grabs current date from current GPRMC string. + Stores the Date in a local text string. + + will be stored in the format: + YYYY/MM/DD +*/ void NMEA::ParseCurrentDateFromGPRMC(){ //Getting date from GPRMC string, assigning to tmpStr @@ -190,7 +222,13 @@ } }; -//Verification of gps fix, returns gps fix value character in ascii + +//! GGAFixVerification, returns gps fix indication. +/*! + GGAFixVerification verifies gga fix status in current GGA string. + + \return boolean value indicating GGA fix if true, else false. +*/ bool NMEA::GGAFixVerification(){ //accessing the string after the sixth comma, which is the gga fix column @@ -225,8 +263,10 @@ return false; }; - -//Parser getting current Latitude +//! ParseCurrentLatitudeFromGPRMC, grabs current latitude from current GPRMC string. +/*! + Converts the latitude into decimaldegrees and stores the current latitude. +*/ void NMEA::ParseCurrentLatitudeFromGPRMC(){ north = false; @@ -272,7 +312,10 @@ } }; -//Parser getting current Longitude +//! ParseCurrentLongitudeFromGPRMC, grabs current longitude from current GPRMC string. +/*! + Converts the longitude into decimaldegrees and stores the current longitude. +*/ void NMEA::ParseCurrentLongitudeFromGPRMC(){ east = false; @@ -320,6 +363,12 @@ }; + +//! getXFromNMEAString, grabs desired data column from NMEA string, stores it for further manipulation in tmpStr +/*! + \param desiredCommaCount integer designating which column to store + \param stringToParse string parameter containing the NMEA string. +*/ void NMEA::getXFromNMEAString(int desiredCommaCount, string stringToParse){ //clearing tmpStr