Go to the documentation of this file.
   37 #include <boost/spirit/include/qi_binary.hpp> 
   47     namespace qi = boost::spirit::qi;
 
   52         qi::parse(buffer, buffer + 8, qi::little_bin_double, val);
 
   61     [[nodiscard]] 
bool parseDouble(
const std::string& 
string, 
double& value)
 
   69         qi::parse(buffer, buffer + 4, qi::little_bin_float, val);
 
   78     [[nodiscard]] 
bool parseFloat(
const std::string& 
string, 
float& value)
 
   93         qi::parse(buffer, buffer + 2, qi::little_word, val);
 
  102     [[nodiscard]] 
bool parseInt16(
const std::string& 
string, int16_t& value,
 
  113             intermd <= std::numeric_limits<int16_t>::max() &&
 
  114             intermd >= std::numeric_limits<int16_t>::min())
 
  116             value = 
static_cast<int16_t
>(intermd);
 
  126         qi::parse(buffer, buffer + 4, qi::little_dword, val);
 
  135     [[nodiscard]] 
bool parseInt32(
const std::string& 
string, int32_t& value,
 
  146     [[nodiscard]] 
bool parseUInt8(
const std::string& 
string, uint8_t& value,
 
  157             intermd <= std::numeric_limits<uint8_t>::max())
 
  159             value = 
static_cast<uint8_t
>(intermd);
 
  169         qi::parse(buffer, buffer + 2, qi::little_word, val);
 
  178     [[nodiscard]] 
bool parseUInt16(
const std::string& 
string, uint16_t& value,
 
  189             intermd <= std::numeric_limits<uint16_t>::max())
 
  191             value = 
static_cast<uint16_t
>(intermd);
 
  201         qi::parse(buffer, buffer + 4, qi::little_dword, val);
 
  210     [[nodiscard]] 
bool parseUInt32(
const std::string& 
string, uint32_t& value,
 
  223         uint32_t hours = 
static_cast<uint32_t
>(utc_double) / 10000;
 
  224         uint32_t minutes = (
static_cast<uint32_t
>(utc_double) - hours * 10000) / 100;
 
  226         return utc_double - 
static_cast<double>(hours * 10000 + minutes * 100) +
 
  227                static_cast<double>(hours * 3600 + minutes * 60);
 
  237         uint32_t whole_degrees = 
static_cast<uint32_t
>(dms) / 100;
 
  238         double minutes = dms - 
static_cast<double>(whole_degrees * 100);
 
  239         return static_cast<double>(whole_degrees) + minutes / 60.0;
 
  260         time_t time_now = time(0);
 
  266         timeinfo = gmtime(&time_now);
 
  268         uint32_t hours = 
static_cast<uint32_t
>(utc_double) / 10000;
 
  269         uint32_t minutes = (
static_cast<uint32_t
>(utc_double) - hours * 10000) / 100;
 
  271             (
static_cast<uint32_t
>(utc_double) - hours * 10000 - minutes * 100);
 
  274         timeinfo->tm_hour = hours;  
 
  275         timeinfo->tm_min = minutes; 
 
  276         timeinfo->tm_sec = seconds; 
 
  288         return timegm(timeinfo);
 
  295         if (period_user == 0)
 
  297         else if (period_user < 1000)
 
  298             return "msec" + std::to_string(period_user);
 
  299         else if (period_user <= 60000)
 
  300             return "sec" + std::to_string(period_user / 1000);
 
  302             return "min" + std::to_string(period_user / 60000);
 
  305     [[nodiscard]] uint16_t 
getCrc(
const std::vector<uint8_t>& message)
 
  310     [[nodiscard]] uint16_t 
getId(
const std::vector<uint8_t>& message)
 
  314         constexpr uint16_t mask = 8191;
 
  320     [[nodiscard]] uint16_t 
getLength(
const std::vector<uint8_t>& message)
 
  325     [[nodiscard]] uint32_t 
getTow(
const std::vector<uint8_t>& message)
 
  330     [[nodiscard]] uint16_t 
getWnc(
const std::vector<uint8_t>& message)
 
  
bool toInt32(const std::string &string, int32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever integer type your system h...
bool toDouble(const std::string &string, double &value)
Interprets the contents of "string" as a floating point number of type double It stores the "string"'...
uint32_t getTow(const std::vector< uint8_t > &message)
Get the time of week in ms of the SBF message.
std::time_t convertUTCtoUnix(double utc_double)
Converts UTC time from the without-colon-delimiter format to Unix Epoch time (a number-of-seconds-sin...
std::string convertUserPeriodToRxCommand(uint32_t period_user)
Transforms the input polling period [milliseconds] into a std::string number that can be appended to ...
uint16_t getWnc(const std::vector< uint8_t > &message)
Get the GPS week counter of the SBF message.
int32_t parseInt32(const uint8_t *buffer)
Converts a 4-byte-buffer into a signed 32-bit integer.
float parseFloat(const uint8_t *buffer)
Converts a 4-byte-buffer into a float.
uint16_t getLength(const std::vector< uint8_t > &message)
Get the length of the SBF message.
double convertUTCDoubleToSeconds(double utc_double)
Converts UTC time from the without-colon-delimiter format to the number-of-seconds-since-midnight for...
uint16_t getCrc(const std::vector< uint8_t > &message)
Get the CRC of the SBF message.
uint32_t parseUInt32(const uint8_t *buffer)
Converts a 4-byte-buffer into an unsigned 32-bit integer.
uint16_t parseUInt16(const uint8_t *buffer)
Converts a 2-byte-buffer into an unsigned 16-bit integer.
Declares utility functions used when parsing messages.
uint16_t getId(const std::vector< uint8_t > &message)
Get the ID of the SBF message.
double convertDMSToDegrees(double dms)
Converts latitude or longitude from the DMS notation (in the without-colon-delimiter format),...
bool toUInt32(const std::string &string, uint32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your...
Declares lower-level string utility functions used when parsing messages.
bool parseUInt8(const std::string &string, uint8_t &value, int32_t base=10)
Interprets the contents of "string" as a unsigned integer number of type uint8_t.
int16_t parseInt16(const uint8_t *buffer)
Converts a 2-byte-buffer into a signed 16-bit integer.
double parseDouble(const uint8_t *buffer)
Converts an 8-byte-buffer into a double.
bool toFloat(const std::string &string, float &value)
Interprets the contents of "string" as a floating point number of type float.