swift
contextownaircraftimpl.cpp
1 // SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #include <QReadLocker>
7 #include <QWriteLocker>
8 #include <QtGlobal>
9 
10 // ----- cross context -----
14 // ----- cross context -----
15 
16 #include "core/application.h"
17 #include "core/db/databaseutils.h"
18 #include "core/webdataservices.h"
22 #include "misc/aviation/altitude.h"
23 #include "misc/aviation/callsign.h"
25 #include "misc/dbusserver.h"
26 #include "misc/geo/latitude.h"
27 #include "misc/geo/longitude.h"
28 #include "misc/logcategories.h"
29 #include "misc/logmessage.h"
31 #include "misc/network/server.h"
33 #include "misc/pq/units.h"
34 #include "misc/sequence.h"
36 #include "misc/statusmessage.h"
37 
38 using namespace swift::misc;
39 using namespace swift::misc::physical_quantities;
40 using namespace swift::misc::aviation;
41 using namespace swift::misc::network;
42 using namespace swift::misc::geo;
43 using namespace swift::misc::audio;
44 using namespace swift::misc::simulation;
45 using namespace swift::core;
46 using namespace swift::core::db;
47 
48 namespace swift::core::context
49 {
50  CContextOwnAircraft::CContextOwnAircraft(CCoreFacadeConfig::ContextMode mode, CCoreFacade *runtime)
51  : IContextOwnAircraft(mode, runtime), CIdentifiable(this)
52  {
53  Q_ASSERT(this->getRuntime());
54 
55  connect(&m_historyTimer, &QTimer::timeout, this, &CContextOwnAircraft::evaluateUpdateHistory);
56  this->setObjectName("CContextOwnAircraft");
57  m_historyTimer.setObjectName(this->objectName() + "::historyTimer");
58  m_historyTimer.start(2500);
59  m_situationHistory.setSortHint(CAircraftSituationList::TimestampLatestFirst);
60 
62 
63  if (sApp && sApp->getWebDataServices())
64  {
66  &CContextOwnAircraft::allSwiftWebDataRead);
67  }
68 
69  // Init own aircraft
70  this->initOwnAircraft();
71  }
72 
74  {
75  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
76  QReadLocker l(&m_lockAircraft);
77  return m_ownAircraft;
78  }
79 
81  {
82  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
83  QReadLocker l(&m_lockAircraft);
84  return m_ownAircraft.getComSystem(unit);
85  }
86 
88  {
89  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
90  QReadLocker l(&m_lockAircraft);
91  return m_ownAircraft.getTransponder();
92  }
93 
95  {
96  QReadLocker l(&m_lockAircraft);
97  return m_ownAircraft.getCallsign();
98  }
99 
101  {
102  QReadLocker l(&m_lockAircraft);
103  return m_ownAircraft.getPosition();
104  }
105 
107  {
108  QReadLocker l(&m_lockAircraft);
109  return m_ownAircraft.getSituation();
110  }
111 
113  {
114  QReadLocker l(&m_lockAircraft);
115  return m_ownAircraft.getParts();
116  }
117 
119  {
120  QReadLocker l(&m_lockAircraft);
121  return m_ownAircraft.getModel();
122  }
123 
125  {
126  return getOwnAircraft().calculateGreatCircleDistance(position);
127  }
128 
129  void CContextOwnAircraft::initOwnAircraft()
130  {
131  Q_ASSERT(this->getRuntime());
132  CSimulatedAircraft ownAircraft;
133  {
134  // use copy to minimize lock time
135  QReadLocker rl(&m_lockAircraft);
136  ownAircraft = m_ownAircraft;
137  }
138 
139  ownAircraft.initComSystems();
140  ownAircraft.initTransponder();
141  ownAircraft.setSituation(getDefaultSituation());
142  ownAircraft.setPilot(m_currentNetworkServer.get().getUser());
143 
144  // If we already have a model from somehwere, keep it, otherwise init default
145  ownAircraft.setModel(reverseLookupModel(ownAircraft.getModel()));
146  if (!ownAircraft.getAircraftIcaoCode().hasValidDesignator())
147  {
148  ownAircraft.setModel(getDefaultOwnAircraftModel());
149  }
150 
151  // override empty values
152  if (!ownAircraft.hasValidCallsign()) { ownAircraft.setCallsign(CCallsign("SWIFT")); }
153 
154  // update object
155  {
156  QWriteLocker l(&m_lockAircraft);
157  m_ownAircraft = ownAircraft;
158  }
159  }
160 
161  void CContextOwnAircraft::evaluateUpdateHistory()
162  {
163  if (!m_history) { return; }
164  if (!this->getIContextSimulator()) { return; }
165  if (!this->getIContextSimulator()->isSimulatorSimulating()) { return; }
166 
167  QReadLocker rl(&m_lockAircraft);
168  const CAircraftSituationList situations = m_situationHistory; // latest first
169  rl.unlock();
170 
171  constexpr int minElements = qRound(MaxHistoryElements * 0.75);
172  if (m_situationHistory.size() < minElements) { return; }
173 
174  // using copy to minimize lock time
175  // 500km/h => 1sec: 0.1388 km
176  // we check if there are situation for own aircraft outside the max.distance
177  static const CLength maxDistance(25, CLengthUnit::km());
178  const CAircraftSituation latest = situations.front();
179  const bool jumpDetected = situations.containsObjectOutsideRange(situations.front(), maxDistance);
180 
181  if (jumpDetected)
182  {
183  const CAircraftSituationList ownDistances = situations.findFarthest(1, latest);
184  const CLength distance = ownDistances.front().calculateGreatCircleDistance(latest);
185  {
186  QWriteLocker wl(&m_lockAircraft);
187  m_situationHistory.clear();
188  }
189  emit this->movedAircraft(distance);
190  }
191  }
192 
193  CAircraftModel CContextOwnAircraft::reverseLookupModel(const CAircraftModel &model)
194  {
195  bool modified = false;
196  const CAircraftModel reverseModel =
197  CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified);
198  return reverseModel;
199  }
200 
202  {
203  return updateOwnModel(model, this->identifier());
204  }
205 
206  bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model, const CIdentifier &identifier)
207  {
208  CAircraftModel updateModel(reverseLookupModel(model));
209  {
210  QWriteLocker l(&m_lockAircraft);
211  const bool changed = (m_ownAircraft.getModel() != updateModel);
212  if (!changed) { return false; }
213  m_ownAircraft.setModel(updateModel);
214  }
215 
216  // changed model
217  emit this->ps_changedModel(updateModel, identifier);
218  return true;
219  }
220 
222  {
223  QWriteLocker l(&m_lockAircraft);
224  // there is intentionally no equal check
225  m_ownAircraft.setSituation(situation);
226 
227  if (m_situationHistory.isEmpty() ||
228  qAbs(situation.getTimeDifferenceMs(m_situationHistory.front())) > MinHistoryDeltaMs)
229  {
230  m_situationHistory.push_frontKeepLatestAdjustedFirst(situation, true);
231  if (m_situationHistory.size() > MaxHistoryElements) { m_situationHistory.pop_back(); }
232  }
233  return true;
234  }
235 
237  {
238  QWriteLocker l(&m_lockAircraft);
239  const bool changed = (m_ownAircraft.getParts() != parts);
240  if (!changed) { return false; }
241  m_ownAircraft.setParts(parts);
242  return true;
243  }
244 
246  {
247  QWriteLocker l(&m_lockAircraft);
248  const bool changed = (m_ownAircraft.getModel().getCG() != cg);
249  if (!changed) { return false; }
250  m_ownAircraft.setCG(cg);
251  return true;
252  }
253 
255  const swift::misc::aviation::CAltitude &altitude,
256  const CAltitude &pressureAltitude)
257  {
258  if (isDebugEnabled())
259  {
260  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << position << altitude;
261  }
262  QWriteLocker l(&m_lockAircraft);
263  bool changed = (m_ownAircraft.getPosition() != position);
264  if (changed) { m_ownAircraft.setPosition(position); }
265 
266  if (m_ownAircraft.getAltitude() != altitude)
267  {
268  changed = true;
269  m_ownAircraft.setAltitude(altitude);
270  }
271 
272  if (m_ownAircraft.getPressureAltitude() != pressureAltitude)
273  {
274  changed = true;
275  m_ownAircraft.setPressureAltitude(pressureAltitude);
276  }
277  return changed;
278  }
279 
281  const CTransponder &transponder, const CIdentifier &originator)
282  {
283  if (isDebugEnabled())
284  {
285  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder;
286  }
287  bool changed {};
288  {
289  QWriteLocker l(&m_lockAircraft);
290  changed = m_ownAircraft.hasChangedCockpitData(com1, com2, transponder);
291  if (changed) { m_ownAircraft.setCockpit(com1, com2, transponder); }
292  }
293  if (changed) { emit this->changedAircraftCockpit(m_ownAircraft, originator); }
294  return changed;
295  }
296 
298  const CIdentifier &originator)
299  {
300  if (isDebugEnabled())
301  {
302  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << transponderMode;
303  }
304  bool changed {};
305  {
306  QWriteLocker l(&m_lockAircraft);
307  changed = m_ownAircraft.setTransponderMode(transponderMode);
308  }
309  if (changed) { emit this->changedAircraftCockpit(m_ownAircraft, originator); }
310  return changed;
311  }
312 
314  const CIdentifier &originator)
315  {
316  if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return false; }
317  if (!CComSystem::isValidComFrequency(frequency)) { return false; }
318  CComSystem com1, com2;
319  CTransponder xpdr;
320  {
321  QReadLocker l(&m_lockAircraft);
322  com1 = m_ownAircraft.getCom1System();
323  com2 = m_ownAircraft.getCom2System();
324  xpdr = m_ownAircraft.getTransponder();
325  }
326  if (unit == CComSystem::Com1) { com1.setFrequencyActive(frequency); }
327  else { com2.setFrequencyActive(frequency); }
328 
329  const bool changed = this->updateCockpit(com1, com2, xpdr, originator);
330  return changed;
331  }
332 
334  {
335  {
336  QWriteLocker l(&m_lockAircraft);
337  if (m_ownAircraft.getPilot() == pilot) { return false; }
338  m_ownAircraft.setPilot(pilot);
339  }
340  emit this->changedPilot(pilot);
341  return true;
342  }
343 
345  {
346  CTransponder xpdr;
347  CComSystem com1;
348  CComSystem com2;
349  {
350  QReadLocker l(&m_lockAircraft);
351  com1 = m_ownAircraft.getCom1System();
352  com2 = m_ownAircraft.getCom2System();
353  xpdr = m_ownAircraft.getTransponder();
354  }
355  xpdr.toggleTransponderMode();
356  this->updateCockpit(com1, com2, xpdr, this->identifier());
357  }
358 
360  {
361  return this->updateTransponderMode(mode, this->identifier());
362  }
363 
365  {
366  {
367  QWriteLocker l(&m_lockAircraft);
368  if (m_ownAircraft.getCallsign() == callsign) { return false; }
369  m_ownAircraft.setCallsign(callsign);
370  }
371  emit this->changedCallsign(callsign);
372  return true;
373  }
374 
376  const swift::misc::aviation::CAirlineIcaoCode &airlineIcaoCode)
377  {
378  {
379  QWriteLocker l(&m_lockAircraft);
380  if (!m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode)) { return false; }
381  }
382  emit this->changedAircraftIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
383  return true;
384  }
385 
386  bool CContextOwnAircraft::updateSelcal(const CSelcal &selcal, const CIdentifier &originator)
387  {
388  {
389  QWriteLocker l(&m_lockAircraft);
390  if (m_ownAircraft.getSelcal() == selcal) { return false; }
391  m_ownAircraft.setSelcal(selcal);
392  }
393  emit this->changedSelcal(selcal, originator);
394  return true;
395  }
396 
397  void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model, const CIdentifier &identifier)
398  {
399  this->updateOwnModel(model, identifier);
400  }
401 
402  void CContextOwnAircraft::xCtxChangedSimulatorStatus(int status)
403  {
404  const ISimulator::SimulatorStatus s = static_cast<ISimulator::SimulatorStatus>(status);
406  {
407  // connected
408  }
409  else
410  {
411  // disconnected
412  QWriteLocker l(&m_lockAircraft);
413  m_situationHistory.clear();
414  }
415  }
416 
417  void CContextOwnAircraft::actionToggleTransponder(bool keydown)
418  {
419  if (!keydown) { return; }
420  this->toggleTransponderMode();
421  }
422 
423  void CContextOwnAircraft::actionIdent(bool keydown)
424  {
425  if (this->getOwnTransponder().isInStandby()) { return; }
426  const CTransponder::TransponderMode m = keydown ? CTransponder::StateIdent : CTransponder::ModeC;
427  this->updateTransponderMode(m, this->identifier());
428  }
429 
430  void CContextOwnAircraft::allSwiftWebDataRead()
431  {
432  // we should already have received a reverse lookup model
433  // from the driver
434  }
435 
436  bool CContextOwnAircraft::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
437  {
438  Q_UNUSED(originator)
439  if (commandLine.isEmpty()) { return false; }
440  CSimpleCommandParser parser({ ".x", ".xpdr", // transponder
441  ".com1", ".com2", // com1, com2 frequencies
442  ".c1", ".c2", // com1, com2 frequencies
443  ".selcal" });
444  parser.parse(commandLine);
445  if (!parser.isKnownCommand()) { return false; }
446 
447  CSimulatedAircraft myAircraft(this->getOwnAircraft());
448  if (parser.matchesCommand(".x", ".xpdr") && parser.countParts() > 1)
449  {
450  CTransponder transponder = myAircraft.getTransponder();
451  int xprCode = parser.toInt(1);
452  if (CTransponder::isValidTransponderCode(xprCode))
453  {
454  transponder.setTransponderCode(xprCode);
455  // todo RW: replace originator
456  this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), transponder,
457  CIdentifier("commandline"));
458  return true;
459  }
460  else
461  {
462  CTransponder::TransponderMode mode = CTransponder::modeFromString(parser.part(1));
463  transponder.setTransponderMode(mode);
464  // todo RW: replace originator
465  this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), transponder,
466  CIdentifier("commandline"));
467  return true;
468  }
469  }
470  else if (parser.commandStartsWith("com") || parser.commandStartsWith("c"))
471  {
472  CFrequency frequency(parser.toDouble(1), CFrequencyUnit::MHz());
473  if (CComSystem::isValidComFrequency(frequency))
474  {
475  CComSystem com1 = myAircraft.getCom1System();
476  CComSystem com2 = myAircraft.getCom2System();
477  if (parser.commandEndsWith("1")) { com1.setFrequencyActive(frequency); }
478  else if (parser.commandEndsWith("2")) { com2.setFrequencyActive(frequency); }
479  else { return false; }
480  this->updateCockpit(com1, com2, myAircraft.getTransponder(), identifier());
481  return true;
482  }
483  }
484  else if (parser.matchesCommand(".selcal"))
485  {
486  if (CSelcal::isValidCode(parser.part(1)))
487  {
488  this->updateSelcal(parser.part(1), this->identifier());
489  return true;
490  }
491  }
492  return false;
493  }
494 } // namespace swift::core::context
SWIFT_CORE_EXPORT swift::core::CApplication * sApp
Single instance of application object.
Definition: application.cpp:71
CWebDataServices * getWebDataServices() const
Get the web data services.
ContextMode
How to handle a given context.
The class providing facades (the contexts) for all DBus relevant operations.
Definition: corefacade.h:57
void swiftDbAllDataRead()
All swift DB data have been read.
static bool isAnyConnectedStatus(SimulatorStatus status)
Any connected status?
Definition: simulator.cpp:597
bool setTransponderMode(swift::misc::aviation::CTransponder::TransponderMode mode)
Set XPDR mode.
swift::misc::simulation::CAircraftModel getOwnAircraftModel() const
Own aircraft model.
bool updateActiveComFrequency(const swift::misc::physical_quantities::CFrequency &frequency, swift::misc::aviation::CComSystem::ComUnit comUnit, const swift::misc::CIdentifier &originator)
Tune in a COM frequency.
swift::misc::aviation::CAircraftSituation getOwnAircraftSituation() const
Get own aircraft.
swift::misc::physical_quantities::CLength getDistanceToOwnAircraft(const swift::misc::geo::ICoordinateGeodetic &position) const
Distance to own aircraft.
bool updateTransponderMode(const swift::misc::aviation::CTransponder::TransponderMode &transponderMode, const swift::misc::CIdentifier &originator)
Update own transponder mode.
bool updateOwnPosition(const swift::misc::geo::CCoordinateGeodetic &position, const swift::misc::aviation::CAltitude &altitude, const swift::misc::aviation::CAltitude &pressureAltitude)
Update position.
swift::misc::aviation::CTransponder getOwnTransponder() const
Get own transponder.
bool updateOwnCallsign(const swift::misc::aviation::CCallsign &callsign)
Set callsign.
bool updateOwnIcaoCodes(const swift::misc::aviation::CAircraftIcaoCode &aircraftIcaoCode, const swift::misc::aviation::CAirlineIcaoCode &airlineIcaoCode)
Set ICAO data.
swift::misc::geo::CCoordinateGeodetic getOwnAircraftPosition() const
Own aircraft's position.
swift::misc::simulation::CSimulatedAircraft getOwnAircraft() const
Get own aircraft.
swift::misc::aviation::CCallsign getOwnCallsign() const
Own aircraft's callsign.
bool updateOwnSituation(const swift::misc::aviation::CAircraftSituation &situation)
Update own situation.
bool updateCockpit(const swift::misc::aviation::CComSystem &com1, const swift::misc::aviation::CComSystem &com2, const swift::misc::aviation::CTransponder &transponder, const swift::misc::CIdentifier &originator)
Update own cockpit.
bool updateOwnModel(const swift::misc::simulation::CAircraftModel &model)
Update model.
bool updateOwnParts(const swift::misc::aviation::CAircraftParts &parts)
Update own parts.
swift::misc::aviation::CAircraftParts getOwnAircraftParts() const
Own aircraft's parts.
bool updateOwnCG(const swift::misc::physical_quantities::CLength &cg)
Update own parts.
bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot)
Set current pilot.
swift::misc::aviation::CComSystem getOwnComSystem(swift::misc::aviation::CComSystem::ComUnit unit) const
Get own COM system.
bool updateSelcal(const swift::misc::aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)
Own SELCAL code.
CCoreFacade * getRuntime()
Runtime.
Definition: context.h:57
const IContextSimulator * getIContextSimulator() const
Context for simulator.
Definition: context.cpp:69
bool isDebugEnabled() const
Debug enabled?
Definition: context.cpp:59
void changedAircraftCockpit(const swift::misc::simulation::CSimulatedAircraft &aircraft, const swift::misc::CIdentifier &originator)
Aircraft cockpit update.
void changedPilot(const swift::misc::network::CUser &pilot)
Own pilot (aka the swift user) changed.
void changedCallsign(const swift::misc::aviation::CCallsign &callsign)
Own callsign was changed.
void changedAircraftIcaoCodes(const swift::misc::aviation::CAircraftIcaoCode &aircraftIcaoCode, const swift::misc::aviation::CAirlineIcaoCode &airlineIcaoCode)
Own ICAO was changed.
void movedAircraft(const swift::misc::physical_quantities::CLength &distance)
Aircraft has been moved from one location to another (changed scenery)
static swift::misc::simulation::CAircraftModel getDefaultOwnAircraftModel()
Default own aircraft.
static const swift::misc::aviation::CAircraftSituation & getDefaultSituation()
Default situation.
void changedSelcal(const swift::misc::aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)
Changed SELCAL code.
T get() const
Get a copy of the current value.
Definition: valuecache.h:408
Base class with a member CIdentifier to be inherited by a class which has an identity in the environm...
Definition: identifiable.h:24
const CIdentifier & identifier() const
Get identifier.
Definition: identifiable.h:27
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition: identifier.h:29
static const QString & contextSlot()
Context slots.
Definition: logcategories.h:87
Class for emitting a log message.
Definition: logmessage.h:27
Derived & debug()
Set the severity to debug.
size_type size() const
Returns number of elements in the sequence.
Definition: sequence.h:273
void pop_back()
Removes an element at the end of the sequence.
Definition: sequence.h:367
reference front()
Access the first element.
Definition: sequence.h:225
void clear()
Removes all elements in the sequence.
Definition: sequence.h:288
bool isEmpty() const
Synonym for empty.
Definition: sequence.h:285
Utility methods for simple line parsing used with the command line.
void parse(const QString &commandLine)
Parse.
qint64 getTimeDifferenceMs(qint64 compareTime) const
Time difference in ms.
void setSortHint(HintTimestampSort hint)
Set the hint.
void push_frontKeepLatestAdjustedFirst(const OBJ &value, bool replaceSameTimestamp=true, int maxElements=-1)
Insert as first element by keeping maxElements and the latest first.
Value object for ICAO classification.
bool hasValidDesignator() const
Valid aircraft designator?
Value object encapsulating information of aircraft's parts.
Definition: aircraftparts.h:26
Value object encapsulating information of an aircraft's situation.
Value object for ICAO classification.
Altitude as used in aviation, can be AGL or MSL altitude.
Definition: altitude.h:52
Value object encapsulating information of a callsign.
Definition: callsign.h:30
COM system (aka "radio")
Definition: comsystem.h:37
void setFrequencyActive(const physical_quantities::CFrequency &frequency)
Set active frequency.
Definition: comsystem.cpp:37
Value object for SELCAL.
Definition: selcal.h:31
void setTransponderCode(int transponderCode)
Set transponder code.
Definition: transponder.h:116
bool setTransponderMode(TransponderMode mode)
Set transponder mode.
Definition: transponder.cpp:97
void toggleTransponderMode()
Transponder mode toggled.
Definition: transponder.cpp:68
Geodetic coordinate, a position in 3D space relative to the reference geoid.
physical_quantities::CLength calculateGreatCircleDistance(const ICoordinateGeodetic &otherCoordinate) const
Great circle distance.
bool containsObjectOutsideRange(const ICoordinateGeodetic &coordinate, const physical_quantities::CLength &range) const
Any object in range?
Definition: geoobjectlist.h:74
CONTAINER findFarthest(int number, const ICoordinateGeodetic &coordinate) const
Find 0..n objects farthest to the given coordinate.
Value object encapsulating information of a user.
Definition: user.h:28
Physical unit length (length)
Definition: length.h:18
Aircraft model (used by another pilot, my models on disk)
Definition: aircraftmodel.h:71
const physical_quantities::CLength & getCG() const
Get center of gravity.
Comprehensive information of an aircraft.
void setCallsign(const aviation::CCallsign &callsign)
Set callsign.
const aviation::CSelcal getSelcal() const
SELCAL.
void setModel(const CAircraftModel &model)
Set model.
void initTransponder()
Meaningful default settings for Transponder.
const aviation::CAircraftSituation & getSituation() const
Get situation.
void setCockpit(const CSimulatedAircraft &aircraft)
Set COM unit (all values + transponder and SELCAL)
const aviation::CComSystem & getCom2System() const
Get COM2 system.
void initComSystems()
Meaningful default settings for COM Systems.
const aviation::CTransponder & getTransponder() const
Get transponder.
bool setTransponderMode(aviation::CTransponder::TransponderMode mode)
Set transponder mode.
bool setCG(const physical_quantities::CLength &cg)
Set the center of gravity.
void setSelcal(const aviation::CSelcal &selcal)
Own SELCAL code.
const aviation::CAltitude & getPressureAltitude() const
Get pressure altitude.
void setPosition(const geo::CCoordinateGeodetic &position)
Set position.
void setSituation(const aviation::CAircraftSituation &situation)
Set situation. Won't overwrite the velocity unless it held the default value.
void setPressureAltitude(const aviation::CAltitude &altitude)
Set pressure altitude.
const network::CUser & getPilot() const
Get user.
const aviation::CCallsign & getCallsign() const
Get callsign.
const aviation::CAircraftIcaoCode & getAircraftIcaoCode() const
Get aircraft ICAO info.
bool hasChangedCockpitData(const aviation::CComSystem &com1, const aviation::CComSystem &com2, const aviation::CTransponder &transponder) const
Changed cockpit data?
geo::CCoordinateGeodetic getPosition() const
Get position.
bool hasValidCallsign() const
Valid callsign?
const simulation::CAircraftModel & getModel() const
Get model (model used for mapping)
aviation::CComSystem getComSystem(aviation::CComSystem::ComUnit unit) const
Get COM unit.
void setParts(const aviation::CAircraftParts &parts)
Set aircraft parts.
bool setIcaoCodes(const aviation::CAircraftIcaoCode &aircraftIcaoCode, const aviation::CAirlineIcaoCode &airlineIcaoCode)
Set ICAO info.
const aviation::CAltitude & getAltitude() const
Get altitude.
const aviation::CComSystem & getCom1System() const
Get COM1 system.
const aviation::CAircraftParts & getParts() const
Get aircraft parts.
void setPilot(const network::CUser &user)
Set pilot.
void setAltitude(const aviation::CAltitude &altitude)
Set altitude.
bool parseCommandLine(const QString &commandLine, const swift::misc::CIdentifier &originator)
Parse a given command line.
Classes interacting with the swift database (aka "datastore").
Backend services of the swift project, like dealing with the network or the simulators.
Definition: actionbind.cpp:7
Free functions in swift::misc.
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void setObjectName(QAnyStringView name)
bool isEmpty() const const
void start()
void timeout()