QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GPSDecodedData.h
Go to the documentation of this file.
1#pragma once
2
3#include <chrono>
4#include <cstdint>
5#include <map>
6#include <optional>
7
8#include "GPSProtocolEvent.h"
10
12namespace GPSDecodedData {
13GPSPositionReport position(const GPSDecodedPosition& source, const GPSIntegrityReport& diagnostic, uint64_t nowUs = 0);
14
21{
22public:
23 static constexpr std::chrono::milliseconds FRESHNESS_TIMEOUT{5000};
24
25 GPSSatelliteReport update(const GPSDecodedSatellites& source, uint64_t nowUs);
27 GPSSatelliteReport update(const GPSDecodedSatelliteUsage& source, uint64_t nowUs);
30 std::optional<GPSSatelliteReport> expire(uint64_t nowUs);
31
32private:
33 struct Count
34 {
36 uint64_t receivedAtUs = 0;
37 std::optional<int> value = std::nullopt;
38 };
39
40 struct Constellation
41 {
42 Count inView;
43 Count used;
44 };
45
46 static void _accept(Count& count, uint64_t receivedAtUs, std::optional<int> value, uint64_t nowUs);
47 bool _expire(uint64_t nowUs);
48 GPSSatelliteReport _report(bool countOnlyUsed) const;
49
50 std::map<GPSConstellation, Constellation> _constellations;
51 std::optional<int> _countOnlyUsed = std::nullopt;
52};
53} // namespace GPSDecodedData
GPSSatelliteReport update(const GPSDecodedSatellites &source, uint64_t nowUs)
std::optional< GPSSatelliteReport > expire(uint64_t nowUs)
static constexpr std::chrono::milliseconds FRESHNESS_TIMEOUT
How GPSDriver adapts decoded events to public reports.
GPSPositionReport position(const GPSDecodedPosition &source, const GPSIntegrityReport &diagnostic, uint64_t nowUs)
Decoded navigation plus whether the producer accepted its velocity solution.