|
Enroute Flight Navigation
A navigation app for VFR pilots
|
Flight log manager with pluggable automatic flight detection. More...
#include <FlightLog.h>
Signals | |
| void | flightsChanged () |
| Notifier signal. | |
| void | detectionStateChanged () |
| Notifier signal. | |
| void | displayedTrackPathChanged () |
| Notifier signal for displayedTrackPath and displayedTrackIndex. | |
| void | trackRecordingChanged () |
| Notifier signal. | |
| void | showCurrentFlightTraceChanged () |
| Notifier signal. | |
| void | takeoffDetected (const QString &time) |
| Emitted when a takeoff is detected. | |
| void | landingDetected (const QString &time) |
| Emitted when a landing is detected. | |
| void | saveError (const QString &message) |
| Emitted when saving the flight log file fails. | |
Public Member Functions | |
| FlightLog (QObject *parent=nullptr) | |
| Standard constructor. | |
| void | deferredInitialization () override |
| Non-constructor initialization. | |
| ~FlightLog () override=default | |
| Standard destructor. | |
| Q_INVOKABLE void | addFlight (const Flightlog::Flight &flight) |
| Add a new flight to the log. | |
| Q_INVOKABLE void | removeFlight (const QString &uuid) |
| Remove a flight from the log by UUID. | |
| Q_INVOKABLE void | removeFlights (const QStringList &uuids) |
| Remove multiple flights from the log by UUID. | |
| Q_INVOKABLE void | clearFlights () |
| Remove all flights from the log. | |
| Q_INVOKABLE void | updateFlight (const QString &uuid, const Flightlog::Flight &flight) |
| Update an existing flight in the log. | |
| Q_INVOKABLE void | endFlight () |
| Manually end the current in-flight recording. | |
| Q_INVOKABLE QString | lastArrivalICAO (const QString &aircraftCallsign) const |
| Find the last arrival ICAO for a given aircraft. | |
| Q_INVOKABLE QByteArray | exportToIGC (const QString &uuid) const |
| Get IGC track content for a flight. | |
| Q_INVOKABLE QByteArray | exportToForeFlight (const QStringList &uuids) const |
| Generate ForeFlight CSV content for selected flights. | |
| Q_INVOKABLE QByteArray | exportToJSON (const QStringList &uuids) const |
| Generate JSON content for selected flights. | |
| Q_INVOKABLE void | removeTrack (const QString &uuid) |
| Delete the recorded track for a flight. | |
| Q_INVOKABLE void | showTrack (const QString &uuid) |
| Show a flight's track on the map. | |
| Q_INVOKABLE void | hideTrack () |
| Hide the currently displayed track from the map. | |
| Public Member Functions inherited from GlobalObject | |
| GlobalObject (QObject *parent=nullptr) | |
| Standard constructor. | |
| ~GlobalObject () override=default | |
| Standard deconstructor. | |
Static Public Member Functions | |
| static Q_INVOKABLE Flightlog::Flight | createFlight (const QString &departureICAO, const QString &arrivalICAO, const QString &date, const QString &offBlockTimeStr, const QString &startTimeStr, const QString &landingTimeStr, const QString &onBlockTimeStr, const QString &pilotName, const QString &aircraftCallsign, const QString &comments) |
| Create a Flight value from individual field strings. | |
| static Q_INVOKABLE GeoMaps::Waypoint | nearestAirfield (const QGeoCoordinate &position={}, double proximityM=5000.0) |
| Find the nearest airfield within 5 km. | |
| Static Public Member Functions inherited from GlobalObject | |
| static void | clear () |
| Deletes all globally defined objects. | |
| static Q_INVOKABLE bool | canConstruct () |
| Indicates if the static methods are ready to be used. | |
| static Q_INVOKABLE Navigation::Clock * | clock () |
| Pointer to appplication-wide static Navigation::Clock instance. | |
| static Q_INVOKABLE DataManagement::DataManager * | dataManager () |
| Pointer to appplication-wide static GeoMaps::DataManager instance. | |
| static Q_INVOKABLE DemoRunner * | demoRunner () |
| Pointer to appplication-wide static DemoRunner instance. | |
| static Q_INVOKABLE Traffic::FlarmnetDB * | flarmnetDB () |
| Pointer to appplication-wide static FlarmnetDB instance. | |
| static Q_INVOKABLE Platform::FileExchange * | fileExchange () |
| Pointer to appplication-wide static FileExchange instance. | |
| static Q_INVOKABLE Flightlog::FlightLog * | flightLog () |
| Pointer to appplication-wide static FlightLog instance. | |
| static Q_INVOKABLE GeoMaps::GeoMapProvider * | geoMapProvider () |
| Pointer to appplication-wide static GeoMaps::GeoMapProvider instance. | |
| static Q_INVOKABLE GlobalSettings * | globalSettings () |
| Pointer to appplication-wide static Settings instance. | |
| static Q_INVOKABLE Librarian * | librarian () |
| Pointer to appplication-wide static librarian instance. | |
| static Q_INVOKABLE Platform::PlatformAdaptor * | platformAdaptor () |
| Pointer to appplication-wide static PlatformAdaptor instance. | |
| static Q_INVOKABLE Sensors * | sensors () |
| Pointer to appplication-wide static Navigation::Clock instance. | |
| static Q_INVOKABLE Navigation::Navigator * | navigator () |
| Pointer to appplication-wide static Navigation::Navigator instance. | |
| static Q_INVOKABLE Traffic::PasswordDB * | passwordDB () |
| Pointer to appplication-wide static PasswordDB instance. | |
| static Q_INVOKABLE Positioning::PositionProvider * | positionProvider () |
| Pointer to appplication-wide static PositionProvider instance. | |
| static Q_INVOKABLE NOTAM::NOTAMProvider * | notamProvider () |
| Pointer to appplication-wide static notification manager instance. | |
| static Q_INVOKABLE Notifications::NotificationManager * | notificationManager () |
| Pointer to appplication-wide static notification manager instance. | |
| static Q_INVOKABLE QNetworkAccessManager * | networkAccessManager () |
| Pointer to appplication-wide static QNetworkAccessManager instance. | |
| static Q_INVOKABLE DataManagement::SSLErrorHandler * | sslErrorHandler () |
| Pointer to appplication-wide static QNetworkAccessManager instance. | |
| static Q_INVOKABLE Traffic::TrafficDataProvider * | trafficDataProvider () |
| Pointer to appplication-wide static TrafficDataProvider instance. | |
| static Q_INVOKABLE GeoMaps::WaypointLibrary * | waypointLibrary () |
| Pointer to appplication-wide static WaypointLibrary instance. | |
| static Q_INVOKABLE Weather::WeatherDataProvider * | weatherDataProvider () |
| Pointer to appplication-wide static WeatherDataProvider instance. | |
Properties | |
| QList< Flightlog::Flight > | flights |
| List of all recorded flights, newest first. | |
| Flightlog::FlightDetector::DetectionState | detectionState |
| Current state of the automatic detection state machine. | |
| int | count |
| Number of recorded flights. | |
| QGeoPath | displayedTrackPath |
| Coordinates of the track currently displayed on the map. | |
| QString | displayedTrackUuid |
| UUID of the flight whose track is displayed, or empty string if none. | |
| bool | trackRecording |
| Whether GPS track recording is enabled. | |
| bool | showCurrentFlightTrace |
| Whether the live trace of the current flight is shown on map. | |
Flight log manager with pluggable automatic flight detection.
This class manages a persistent list of flight log entries and provides CRUD operations for flights. Automatic takeoff/landing detection is delegated to a FlightDetector subclass, which can be swapped at runtime to support different types of flying (e.g. powered aircraft, paragliders).
The detection state is forwarded from the active FlightDetector and exposed to QML via the detectionState property.
Definition at line 52 of file FlightLog.h.
|
explicit |
Standard constructor.
| parent | The standard QObject parent pointer |
| Q_INVOKABLE void Flightlog::FlightLog::addFlight | ( | const Flightlog::Flight & | flight | ) |
Add a new flight to the log.
The flight is prepended (newest first). Coordinates are resolved from the ICAO codes if possible.
| flight | The flight to add |
| Q_INVOKABLE void Flightlog::FlightLog::clearFlights | ( | ) |
Remove all flights from the log.
Deletes every flight entry and its associated track file, then saves and emits flightsChanged() once.
|
static |
Create a Flight value from individual field strings.
This factory method is intended for QML use, where constructing a Q_GADGET value type with all properties is cumbersome.
| departureICAO | ICAO code of departure airport |
| arrivalICAO | ICAO code of arrival airport |
| date | Date string in yyyy-MM-dd format |
| offBlockTimeStr | Off-block time string in HH:mm format, or empty |
| startTimeStr | Start time string in HH:mm format |
| landingTimeStr | Landing time string in HH:mm format |
| onBlockTimeStr | On-block time string in HH:mm format, or empty |
| pilotName | Pilot name, or empty |
| aircraftCallsign | Aircraft callsign (e.g. D-KEBE), or empty |
| comments | Free-text comments, or empty |
|
overridevirtual |
Non-constructor initialization.
This method is called by the static methods that create global instances immediately after the constructor returns. This class can be re-implemented to perform initialization steps that refer to other singleton objects.
Reimplemented from GlobalObject.
| Q_INVOKABLE void Flightlog::FlightLog::endFlight | ( | ) |
Manually end the current in-flight recording.
Delegates to the active FlightDetector. If the detector is in InFlight or LandingPhase state, it completes the flight entry with the current UTC time. Does nothing if not in InFlight or LandingPhase.
|
nodiscard |
Generate ForeFlight CSV content for selected flights.
Returns the CSV bytes ready for sharing. If uuids is empty, all flights are included.
| uuids | UUIDs of the flights to include; empty means all |
|
nodiscard |
Get IGC track content for a flight.
Returns the raw IGC file bytes ready for sharing. Returns an empty array if the flight has no track or the file cannot be read.
| uuid | UUID of the flight to export (with or without braces) |
|
nodiscard |
Generate JSON content for selected flights.
Returns the JSON bytes ready for sharing. Uses the same internal format as the persisted flight log file. If uuids is empty, all flights are included.
| uuids | UUIDs of the flights to include; empty means all |
|
signal |
Emitted when a landing is detected.
| time | The landing time as a human-readable UTC string (HH:mm) |
| Q_INVOKABLE QString Flightlog::FlightLog::lastArrivalICAO | ( | const QString & | aircraftCallsign | ) | const |
Find the last arrival ICAO for a given aircraft.
Searches the flight log for the most recent flight with the given aircraft callsign and returns its arrival ICAO code. Returns an empty string if no matching flight is found.
| aircraftCallsign | The callsign to search for |
|
static |
Find the nearest airfield within 5 km.
Returns the closest airfield (type "AD") to the given position, provided it is within proximityM metres. Returns an invalid Waypoint if none found. If no position is given (or an invalid one), the last valid coordinate from PositionProvider is used.
| position | The geographic position to search near (default: current GPS position) |
| proximityM | Maximum search radius in metres (default: 5000) |
| Q_INVOKABLE void Flightlog::FlightLog::removeFlight | ( | const QString & | uuid | ) |
Remove a flight from the log by UUID.
Does nothing if no flight with the given UUID exists.
| uuid | The UUID of the flight to remove (with or without braces) |
| Q_INVOKABLE void Flightlog::FlightLog::removeFlights | ( | const QStringList & | uuids | ) |
Remove multiple flights from the log by UUID.
Removes all flights whose UUIDs appear in uuids. Saves and emits flightsChanged() exactly once regardless of how many are removed. Does nothing if none of the UUIDs match.
| uuids | UUIDs of the flights to remove (with or without braces) |
| Q_INVOKABLE void Flightlog::FlightLog::removeTrack | ( | const QString & | uuid | ) |
Delete the recorded track for a flight.
Removes the IGC file from disk and clears the trackFile property on the flight entry.
| uuid | UUID of the flight whose track to delete (with or without braces) |
|
signal |
Emitted when saving the flight log file fails.
The previously saved flight log on disk remains intact, but the latest change could not be persisted.
| message | Human-readable error description |
| Q_INVOKABLE void Flightlog::FlightLog::showTrack | ( | const QString & | uuid | ) |
Show a flight's track on the map.
Loads the track if needed and sets it as the displayed track. Only one track can be displayed at a time.
| uuid | UUID of the flight whose track to show (with or without braces) |
|
signal |
Emitted when a takeoff is detected.
| time | The takeoff time as a human-readable UTC string (HH:mm) |
| Q_INVOKABLE void Flightlog::FlightLog::updateFlight | ( | const QString & | uuid, |
| const Flightlog::Flight & | flight ) |
Update an existing flight in the log.
Coordinates are re-resolved from the ICAO codes. If resolution fails, old coordinates are preserved.
| uuid | UUID of the flight to update (with or without braces) |
| flight | The updated flight data |
|
read |
Coordinates of the track currently displayed on the map.
Returns the geo path of the selected saved track, or the live recording track if in flight and no saved track is selected. Empty when no track is displayed.
Definition at line 108 of file FlightLog.h.
|
read |
UUID of the flight whose track is displayed, or empty string if none.
Computed from the displayed track file. Returns an empty string when showing the live track or no track.
Definition at line 116 of file FlightLog.h.
|
readwrite |
Whether the live trace of the current flight is shown on map.
When true, the current in-memory live track is exposed through displayedTrackPath while no saved track is selected. Default is true.
Definition at line 133 of file FlightLog.h.
|
readwrite |
Whether GPS track recording is enabled.
When true, the recorder captures track points during flight and saves them as IGC files on landing. Default is true.
Definition at line 124 of file FlightLog.h.