#pragma once

#include <cstdint>
#include <string>

/** \file GPS_NMEA.hpp
 *
 * This file contains functions that are useful for working with GPS NMEA data
 */
namespace GPS_NMEA {

/// Given a FULL sentence (including $ and \r\n), compute the NMEA 0183 Checksum.
/// E.g. msg =
/// "$PUBX,00,081350.00,4717.113210,N,00833.915187,E,546.589,G3,2.1,2.0,0.007,77.52,0.007,,0.92,1.19,0.77,9,0,0*5F\r\n"
uint8_t computeChecksum(uint8_t* msg, size_t msg_len);

/// Given a FULL sentence (including $ and \r\n), determine if valid
/// @returns true if the checksum is valid, otherwise false
bool sentenceValid(uint8_t* msg, size_t msg_len);

/// Convert a NMEA Latitude string to a double
double lat2DD(std::string nmeaString);

/// Convert a NMEA Longitude string to a double
double lon2DD(std::string nmeaString);
}
