Enroute Flight Navigation
A navigation app for VFR pilots
Flightlog::FlightDetector Class Referenceabstract

Abstract base class for automatic flight detection strategies. More...

#include <FlightDetector.h>

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

Public Types

enum  DetectionState : quint8 { Idle , TakeoffPhase , InFlight , LandingPhase }
 Detection state for automatic takeoff/landing detection. More...

Signals

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.

Public Member Functions

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

Detailed Description

Abstract base class for automatic flight detection strategies.

This class defines the interface for automatic takeoff and landing detection. Concrete subclasses implement detection logic appropriate for different types of flying (e.g. powered aircraft, paragliders).

The detection state machine has four states:

  • Idle: On the ground, monitoring for takeoff.
  • TakeoffPhase: Takeoff indicators detected, waiting for confirmation.
  • InFlight: Confirmed airborne, monitoring for landing.
  • LandingPhase: Landing indicators detected, waiting for confirmation.

Subclasses decide how to transition between these states based on position, speed, altitude, and other sensor data.

Definition at line 45 of file FlightDetector.h.

Member Enumeration Documentation

◆ DetectionState

Detection state for automatic takeoff/landing detection.

This enum is shared by all detector implementations.

Enumerator
Idle 

On ground, monitoring for takeoff

TakeoffPhase 

Takeoff indicators detected, waiting for confirmation

InFlight 

Confirmed airborne, monitoring for landing

LandingPhase 

Landing indicators detected, waiting for confirmation

Definition at line 56 of file FlightDetector.h.

Constructor & Destructor Documentation

◆ FlightDetector()

Flightlog::FlightDetector::FlightDetector ( QObject * parent = nullptr)
inlineexplicit

Standard constructor.

Parameters
parentThe standard QObject parent pointer

Definition at line 69 of file FlightDetector.h.

Member Function Documentation

◆ detectionState()

virtual auto Flightlog::FlightDetector::detectionState ( ) const -> DetectionState
nodiscardpure virtual

Current detection state.

Returns
The current detection state

Implemented in Flightlog::AirplaneFlightDetector.

◆ endFlight()

virtual void Flightlog::FlightDetector::endFlight ( )
pure virtual

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.

Implemented in Flightlog::AirplaneFlightDetector.

◆ landingDetected

void Flightlog::FlightDetector::landingDetected ( const QString & arrivalICAO,
const QGeoCoordinate & arrivalCoordinate,
const QDateTime & landingTime,
int landingCount )
signal

Emitted when a landing is confirmed.

Emitted on LandingPhase → Idle transition, after speed drops below the confirmation threshold.

Parameters
arrivalICAOICAO code of the arrival airport (may be empty)
arrivalCoordinateCoordinate of the arrival airport
landingTimeThe landing time
landingCountNumber of landings (1 for normal, >1 for touch-and-go)

◆ processPositionUpdate()

virtual void Flightlog::FlightDetector::processPositionUpdate ( const Positioning::PositionInfo & info)
pure virtual

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

Implemented in Flightlog::AirplaneFlightDetector.

◆ resetDetection()

virtual void Flightlog::FlightDetector::resetDetection ( )
pure virtual

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.

Implemented in Flightlog::AirplaneFlightDetector.

◆ takeoffDetected

void Flightlog::FlightDetector::takeoffDetected ( const QString & departureICAO,
const QGeoCoordinate & departureCoordinate,
const QDateTime & startTime,
const QString & aircraftCallsign )
signal

Emitted when a takeoff is confirmed.

Parameters
departureICAOICAO code of the departure airport (may be empty)
departureCoordinateCoordinate of the departure airport
startTimeThe takeoff time
aircraftCallsignCallsign of the aircraft

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