Enroute Flight Navigation
A navigation app for VFR pilots
Flightlog::AirplaneFlightDetector Class Reference

Flight detection for powered aircraft. More...

#include <AirplaneFlightDetector.h>

Inheritance diagram for Flightlog::AirplaneFlightDetector:
Flightlog::FlightDetector

Public Member Functions

 AirplaneFlightDetector (QObject *parent=nullptr)
 Standard constructor.
 ~AirplaneFlightDetector () override=default
 Standard destructor.
auto detectionState () const -> DetectionState override
 Current detection state.
void processPositionUpdate (const Positioning::PositionInfo &info) override
 Process a position update.
void endFlight () override
 Manually end the current in-flight recording.
void resetDetection () override
 Reset the detection state to Idle.
Public Member Functions inherited from Flightlog::FlightDetector
 FlightDetector (QObject *parent=nullptr)
 Standard constructor.
 ~FlightDetector () override=default
 Standard destructor.

Additional Inherited Members

Public Types inherited from Flightlog::FlightDetector
enum  DetectionState : quint8 { Idle , TakeoffPhase , InFlight , LandingPhase }
 Detection state for automatic takeoff/landing detection. More...
Signals inherited from Flightlog::FlightDetector
void detectionStateChanged ()
 Emitted when the detection state changes.
void takeoffDetected (const QString &departureICAO, const QGeoCoordinate &departureCoordinate, const QDateTime &startTime, const QString &aircraftCallsign)
 Emitted when a takeoff is confirmed.
void landingDetected (const QString &arrivalICAO, const QGeoCoordinate &arrivalCoordinate, const QDateTime &landingTime, int landingCount)
 Emitted when a landing is confirmed.

Detailed Description

Flight detection for powered aircraft.

This detector implements a state machine suitable for powered aircraft (airplanes, motor gliders, etc.). It uses ground speed, altitude AGL, and proximity to ICAO airfields to detect takeoff and landing.

Detection criteria:

  • Takeoff: Ground speed exceeds the aircraft's configured minimum speed (default 50 km/h) within 5 km of an airfield, confirmed by altitude gain of at least 200 ft above airfield elevation within 60 seconds.
  • Landing: Altitude below 100 ft above airfield elevation within 5 km of an airfield, confirmed by speed dropping below the aircraft's configured minimum speed (default 50 km/h).
  • Go-around: While in LandingPhase, altitude gain > 200 ft above airfield elevation ends the current flight leg and starts a new one from the touch-and-go airport.
  • Abort: Speed drops below half the takeoff threshold or 60 seconds elapse in TakeoffPhase without altitude confirmation.

Definition at line 48 of file AirplaneFlightDetector.h.

Constructor & Destructor Documentation

◆ AirplaneFlightDetector()

Flightlog::AirplaneFlightDetector::AirplaneFlightDetector ( QObject * parent = nullptr)
explicit

Standard constructor.

Parameters
parentThe standard QObject parent pointer

Member Function Documentation

◆ detectionState()

auto Flightlog::AirplaneFlightDetector::detectionState ( ) const -> DetectionState
inlinenodiscardoverridevirtual

Current detection state.

Returns
The current detection state

Implements Flightlog::FlightDetector.

Definition at line 62 of file AirplaneFlightDetector.h.

◆ endFlight()

void Flightlog::AirplaneFlightDetector::endFlight ( )
overridevirtual

Manually end the current in-flight recording.

If the detector is in the InFlight or LandingPhase state, this creates a completed flight with the current UTC time as landing time and resolves the nearest airport if available. The accumulated landing count from LandingPhase is preserved. Resets the detection state to Idle.

Does nothing if the detection state is Idle or TakeoffPhase.

Implements Flightlog::FlightDetector.

◆ processPositionUpdate()

void Flightlog::AirplaneFlightDetector::processPositionUpdate ( const Positioning::PositionInfo & info)
overridevirtual

Process a position update.

Called on every position update when auto-detection is enabled. Subclasses implement the state machine transitions here.

Parameters
infoThe current position information

Implements Flightlog::FlightDetector.

◆ resetDetection()

void Flightlog::AirplaneFlightDetector::resetDetection ( )
overridevirtual

Reset the detection state to Idle.

Clears all pending detection data and returns to the Idle state. Used when auto-detection is disabled while detection is in progress.

Implements Flightlog::FlightDetector.


The documentation for this class was generated from the following file: