21[[nodiscard]]
inline std::optional<GPSASCIILog>
gpsASCIILog(std::string_view line)
23 constexpr size_t CRC_DIGITS = 8;
24 const size_t star = line.rfind(
'*');
25 if (!line.starts_with(
'#') || star == std::string_view::npos || star + 1 + CRC_DIGITS != line.size()) {
29 if (!expected || *expected !=
QGC::crc32Update({
reinterpret_cast<const uint8_t*
>(line.data() + 1), star - 1})) {
32 const size_t semicolon = line.find(
';');
33 const size_t first = line.find(
',');
34 if (semicolon == std::string_view::npos || first == std::string_view::npos || first > semicolon) {
37 const size_t second = line.find_first_of(
",;", first + 1);
38 return GPSASCIILog{.
name = line.substr(1, first - 1), .source = line.substr(first + 1, second - first - 1)};
std::optional< GPSASCIILog > gpsASCIILog(std::string_view line)
std::optional< uint32_t > hexNumber(std::string_view digits)
The value of digits when every one is a hexadecimal digit, with no sign or prefix; nullopt otherwise.
constexpr uint32_t crc32Update(std::span< const uint8_t > bytes, uint32_t state=0)
Reflected CRC-32 update; the caller supplies the initial state and final complement policy.
The header fields receiver detection tells NovAtel-style ASCII logs apart by.
std::string_view name
The log name, such as "VERSIONA".
std::string_view source
The second header field: a port such as "COM1" from NovAtel-compatible receivers, CPU idle time from ...