|
Enroute Flight Navigation
A navigation app for VFR pilots
|
GPS track recorder and IGC file manager. More...
#include <FlightRecorder.h>
Signals | |
| void | trackGeoPathChanged () |
| Emitted when a new track point has been recorded. | |
Public Member Functions | |
| FlightRecorder (QObject *parent=nullptr) | |
| Standard constructor. | |
| ~FlightRecorder () override=default | |
| Standard destructor. | |
| void | processPositionUpdate (FlightDetector::DetectionState state, const Positioning::PositionInfo &info, Units::Distance pressureAltitude={}) |
| Process a position update with the current detection state. | |
| bool | saveTrack (Flight &flight) |
| Save the recorded track to an IGC file. | |
| void | clearTrack () |
| Clear the in-memory track data. | |
| 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. | |
| void | removeTrack (Flight &flight) |
| Delete the track file from disk. | |
| auto | trackGeoPath () const -> QGeoPath |
| Get the current track as a list of coordinates. | |
Static Public Member Functions | |
| static auto | toIGC (const Flight &flight, const QList< TrackPoint > &track) -> QByteArray |
| Generate IGC file content from flight metadata and track points. | |
| static auto | trackFromIGC (const QByteArray &igcData, const QDate &date={}) -> QList< TrackPoint > |
| Parse track points from IGC file content. | |
GPS track recorder and IGC file manager.
This class handles recording GPS track points during a flight, writing/reading IGC files, and exporting tracks via the platform share dialog. It applies distance and time filters to keep the number of recorded points reasonable.
Recording is driven by calling processPositionUpdate() with the current detection state on every position update. Track points are recorded during TakeoffPhase, InFlight, and LandingPhase states.
Definition at line 55 of file FlightRecorder.h.
|
explicit |
Standard constructor.
| parent | The standard QObject parent pointer |
| void Flightlog::FlightRecorder::clearTrack | ( | ) |
Clear the in-memory track data.
Frees the recorded track points from RAM. Call after saveTrack() and after caching the geo path for display.
|
nodiscard |
Export a flight's track via the platform share dialog.
Reads the IGC file and returns its raw content.
| flight | The flight whose track to export |
|
nodiscard |
Load a track's coordinates from an IGC file.
Reads the IGC file referenced by the flight's trackFile property and returns the coordinates for map display.
| flight | The flight whose track to load |
| void Flightlog::FlightRecorder::processPositionUpdate | ( | FlightDetector::DetectionState | state, |
| const Positioning::PositionInfo & | info, | ||
| Units::Distance | pressureAltitude = {} ) |
Process a position update with the current detection state.
Call this on every position update when auto-detection is enabled. The recorder decides whether and where to record based on the detection state and internal state transitions.
| state | Current detection state from the FlightDetector |
| info | The current position info |
| pressureAltitude | Pressure altitude, or an invalid Distance if unknown |
| void Flightlog::FlightRecorder::removeTrack | ( | Flight & | flight | ) |
Delete the track file from disk.
Removes the IGC file referenced by the flight's trackFile property and clears the trackFile. Does nothing if no trackFile is set.
| flight | The flight whose track to delete |
| bool Flightlog::FlightRecorder::saveTrack | ( | Flight & | flight | ) |
Save the recorded track to an IGC file.
Writes the recorder's in-memory track as an IGC file in the tracks directory, using metadata from the flight. Sets the trackFile property on the flight.
| flight | The flight whose metadata to use for the IGC headers |
|
static |
Generate IGC file content from flight metadata and track points.
Creates a complete IGC file with A-record, H-records (date, pilot, aircraft, recorder type), and B-records for each track point.
| flight | The flight whose metadata to use for headers |
| track | The track points to write as B-records |
|
static |
Parse track points from IGC file content.
Reads B-records and extracts position, altitude, and timestamp for each fix. Parses H-record date if no date is provided.
| igcData | The IGC file content |
| date | The flight date (optional, parsed from H-record if empty) |
|
nodiscard |
Get the current track as a list of coordinates.
Returns the coordinates of all recorded track points. Suitable for binding to a MapPolyline in QML.
|
signal |
Emitted when a new track point has been recorded.
Use this to update the live track display on the map.