QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
UBXEpochAssembler.h
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <chrono>
5#include <cstdint>
6#include <optional>
7
8#include "GPSProtocolEvent.h"
9
11
12namespace UBX {
13
17{
18public:
19 static constexpr std::chrono::microseconds MAX_AGE = std::chrono::milliseconds(200);
20
21 struct Epoch
22 {
23 uint32_t tow = 0;
24 uint64_t receipt = 0;
27 bool hasPvt = false;
28 bool highPrecision = false;
29 };
30
32 Epoch* find(uint32_t tow, GPSDecodeContext& context);
33
35 void expire(GPSDecodeContext& context);
36
38 void end(uint32_t tow, GPSDecodeContext& context);
39
40private:
41 void _orderOldestFirst();
42 void _finish(std::optional<Epoch>& epoch, GPSDecodeContext& context);
43
44 std::array<std::optional<Epoch>, 2> _epochs;
45 std::optional<uint32_t> _lastPublished;
46};
47
48} // namespace UBX
Epoch * find(uint32_t tow, GPSDecodeContext &context)
The epoch at tow, started now when new; nullptr for a time of week already published or too old.
void end(uint32_t tow, GPSDecodeContext &context)
Publishes the epoch at tow and the ones before it.
void expire(GPSDecodeContext &context)
Publishes epochs older than MAX_AGE.
static constexpr std::chrono::microseconds MAX_AGE
u-blox receivers over UBX: CFG-VALSET configuration from protocol 27, CFG-MSG and CFG-TMODE3 before i...
Decoded navigation plus whether the producer accepted its velocity solution.
bool hasPvt
NAV-PVT arrived; an epoch without it has no position to publish.