Enroute Flight Navigation
A navigation app for VFR pilots
AirplaneFlightDetector.h
1/***************************************************************************
2 * Copyright (C) 2026 by Stefan Kebekus *
3 * stefan.kebekus@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21#pragma once
22
23#include "flightlog/FlightDetector.h"
24
25using namespace Qt::Literals::StringLiterals;
26
27namespace Flightlog {
28
49{
50 Q_OBJECT
51
52public:
57 explicit AirplaneFlightDetector(QObject* parent = nullptr);
58
60 ~AirplaneFlightDetector() override = default;
61
62 [[nodiscard]] auto detectionState() const -> DetectionState override { return m_detectionState; }
63
65
66 void endFlight() override;
67
68 void resetDetection() override;
69
70private:
71 Q_DISABLE_COPY_MOVE(AirplaneFlightDetector)
72
73 DetectionState m_detectionState {Idle};
74
75 // Pending data accumulated during TakeoffPhase / InFlight / LandingPhase
76 QString m_pendingDepartureICAO;
77 QGeoCoordinate m_pendingDepartureCoordinate;
78 QDateTime m_pendingStartTime;
79 Units::Distance m_pendingDepartureElevation;
80
81 // Pending data accumulated during LandingPhase
82 QDateTime m_landingPhaseEntryTime;
83 int m_landingCount {0};
84
85 // Detection thresholds
86 static constexpr double defaultTakeoffSpeedKMH = 50.0;
87 static constexpr double airfieldProximityM = 5000.0;
88 static constexpr double altitudeGainFT = 200.0;
89 static constexpr double landingAltitudeAGLFT = 100.0;
90 static constexpr double maxTakeoffAltitudeAGLFT = 500.0;
91 static constexpr double takeoffAbortSpeedFactor = 0.5;
92 static constexpr double maxFlightDurationH = 18.0;
93 static constexpr qint64 takeoffConfirmTimeoutS = 60;
94 static constexpr qint64 landingConfirmTimeoutS = 60;
95
96 // Helpers
97 [[nodiscard]] auto aircraftMinimumSpeed() const -> Units::Speed;
98 void clearPendingState();
99};
100
101} // namespace Flightlog
void endFlight() override
Manually end the current in-flight recording.
auto detectionState() const -> DetectionState override
Current detection state.
~AirplaneFlightDetector() override=default
Standard destructor.
void processPositionUpdate(const Positioning::PositionInfo &info) override
Process a position update.
AirplaneFlightDetector(QObject *parent=nullptr)
Standard constructor.
void resetDetection() override
Reset the detection state to Idle.
DetectionState
Detection state for automatic takeoff/landing detection.
FlightDetector(QObject *parent=nullptr)
Standard constructor.
Geographic position.
Convenience class for distance computations.
Definition Distance.h:35
Conversion between units used in aviation.
Definition Angle.h:34