24#include <QStandardPaths>
26#include "flightlog/Flight.h"
27#include "flightlog/FlightDetector.h"
28#include "flightlog/TrackPoint.h"
29#include "positioning/PositionInfo.h"
30#include "units/Distance.h"
32using namespace Qt::Literals::StringLiterals;
161 static auto
trackFromIGC(const QByteArray& igcData, const QDate& date = {}) -> QList<TrackPoint>;
183 QGeoCoordinate m_lastCoordinate;
184 QDateTime m_lastTimestamp;
190 QList<TrackPoint> m_track;
198 static constexpr int maxTrackPoints = 100'000;
201 const QString m_trackDir {QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + u
"/tracks"_s};
DetectionState
Detection state for automatic takeoff/landing detection.
void processPositionUpdate(FlightDetector::DetectionState state, const Positioning::PositionInfo &info, Units::Distance pressureAltitude={})
Process a position update with the current detection state.
auto trackGeoPath() const -> QGeoPath
Get the current track as a list of coordinates.
auto loadTrackPath(const Flight &flight) const -> QList< QGeoCoordinate >
Load a track's coordinates from an IGC file.
QByteArray exportToIGC(const Flight &flight) const
Export a flight's track via the platform share dialog.
FlightRecorder(QObject *parent=nullptr)
Standard constructor.
static auto trackFromIGC(const QByteArray &igcData, const QDate &date={}) -> QList< TrackPoint >
Parse track points from IGC file content.
static auto toIGC(const Flight &flight, const QList< TrackPoint > &track) -> QByteArray
Generate IGC file content from flight metadata and track points.
bool saveTrack(Flight &flight)
Save the recorded track to an IGC file.
~FlightRecorder() override=default
Standard destructor.
void clearTrack()
Clear the in-memory track data.
void removeTrack(Flight &flight)
Delete the track file from disk.
void trackGeoPathChanged()
Emitted when a new track point has been recorded.
A single flight log entry.
Convenience class for distance computations.
static Q_INVOKABLE constexpr Units::Distance fromM(double distanceInM)
Constructs a distance.
static constexpr auto fromS(double timeInS)
Constructs a time.
A single point along a recorded flight track.