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 
76  {
77  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
78  QReadLocker l(&m_lockAircraft);
79  return m_ownAircraft;
80  }
81 
83  {
84  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
85  QReadLocker l(&m_lockAircraft);
86  return m_ownAircraft.getComSystem(unit);
87  }
88 
90  {
91  if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO; }
92  QReadLocker l(&m_lockAircraft);
93  return m_ownAircraft.getTransponder();
94  }
95 
97  {
98  QReadLocker l(&m_lockAircraft);
99  return m_ownAircraft.getCallsign();
100  }
101 
103  {
104  QReadLocker l(&m_lockAircraft);
105  return m_ownAircraft.getPosition();
106  }
107 
109  {
110  QReadLocker l(&m_lockAircraft);
111  return m_ownAircraft.getSituation();
112  }
113 
115  {
116  QReadLocker l(&m_lockAircraft);
117  return m_ownAircraft.getParts();
118  }
119 
121  {
122  QReadLocker l(&m_lockAircraft);
123  return m_ownAircraft.getModel();
124  }
125 
127  {
128  return getOwnAircraft().calculateGreatCircleDistance(position);
129  }
130 
131  void CContextOwnAircraft::initOwnAircraft()
132  {
133  Q_ASSERT(this->getRuntime());
134  CSimulatedAircraft ownAircraft;
135  {
136  // use copy to minimize lock time
137  QReadLocker rl(&m_lockAircraft);
138  ownAircraft = m_ownAircraft;
139  }
140 
141  ownAircraft.initComSystems();
142  ownAircraft.initTransponder();
143  ownAircraft.setSituation(getDefaultSituation());
144  ownAircraft.setPilot(m_currentNetworkServer.get().getUser());
145 
146  // If we already have a model from somehwere, keep it, otherwise init default
147  ownAircraft.setModel(this->reverseLookupModel(ownAircraft.getModel()));
148  if (!ownAircraft.getAircraftIcaoCode().hasValidDesignator())
149  {
150  ownAircraft.setModel(getDefaultOwnAircraftModel());
151  }
152 
153  // override empty values
154  if (!ownAircraft.hasValidCallsign()) { ownAircraft.setCallsign(CCallsign("SWIFT")); }
155 
156  // update object
157  {
158  QWriteLocker l(&m_lockAircraft);
159  m_ownAircraft = ownAircraft;
160  }
161  }
162 
163  void CContextOwnAircraft::evaluateUpdateHistory()
164  {
165  if (!m_history) { return; }
166  if (!this->getIContextSimulator()) { return; }
167  if (!this->getIContextSimulator()->isSimulatorSimulating()) { return; }
168 
169  QReadLocker rl(&m_lockAircraft);
170  const CAircraftSituationList situations = m_situationHistory; // latest first
171  rl.unlock();
172 
173  constexpr int minElements = qRound(MaxHistoryElements * 0.75);
174  if (m_situationHistory.size() < minElements) { return; }
175 
176  // using copy to minimize lock time
177  // 500km/h => 1sec: 0.1388 km
178  // we check if there are situation for own aircraft outside the max.distance
179  static const CLength maxDistance(25, CLengthUnit::km());
180  const CAircraftSituation latest = situations.front();
181  const bool jumpDetected = situations.containsObjectOutsideRange(situations.front(), maxDistance);
182 
183  if (jumpDetected)
184  {
185  const CAircraftSituationList ownDistances = situations.findFarthest(1, latest);
186  const CLength distance = ownDistances.front().calculateGreatCircleDistance(latest);
187  {
188  QWriteLocker wl(&m_lockAircraft);
189  m_situationHistory.clear();
190  }
191  emit this->movedAircraft(distance);
192  }
193  }
194 
195  CAircraftModel CContextOwnAircraft::reverseLookupModel(const CAircraftModel &model)
196  {
197  bool modified = false;
198  const CAircraftModel reverseModel =
199  CDatabaseUtils::consolidateOwnAircraftModelWithDbData(model, false, &modified);
200  return reverseModel;
201  }
202 
204  {
205  return updateOwnModel(model, this->identifier());
206  }
207 
208  bool CContextOwnAircraft::updateOwnModel(const CAircraftModel &model, const CIdentifier &identifier)
209  {
210  CAircraftModel updateModel(this->reverseLookupModel(model));
211  {
212  QWriteLocker l(&m_lockAircraft);
213  const bool changed = (m_ownAircraft.getModel() != updateModel);
214  if (!changed) { return false; }
215  m_ownAircraft.setModel(updateModel);
216  }
217 
218  // changed model
219  emit this->ps_changedModel(updateModel, identifier);
220  return true;
221  }
222 
224  {
225  QWriteLocker l(&m_lockAircraft);
226  // there is intentionally no equal check
227  m_ownAircraft.setSituation(situation);
228 
229  if (m_situationHistory.isEmpty() ||
230  qAbs(situation.getTimeDifferenceMs(m_situationHistory.front())) > MinHistoryDeltaMs)
231  {
232  m_situationHistory.push_frontKeepLatestAdjustedFirst(situation, true);
233  if (m_situationHistory.size() > MaxHistoryElements) { m_situationHistory.pop_back(); }
234  }
235  return true;
236  }
237 
239  {
240  QWriteLocker l(&m_lockAircraft);
241  const bool changed = (m_ownAircraft.getParts() != parts);
242  if (!changed) { return false; }
243  m_ownAircraft.setParts(parts);
244  return true;
245  }
246 
248  {
249  QWriteLocker l(&m_lockAircraft);
250  const bool changed = (m_ownAircraft.getModel().getCG() != cg);
251  if (!changed) { return false; }
252  m_ownAircraft.setCG(cg);
253  return true;
254  }
255 
257  const swift::misc::aviation::CAltitude &altitude,
258  const CAltitude &pressureAltitude)
259  {
260  if (isDebugEnabled())
261  {
262  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << position << altitude;
263  }
264  QWriteLocker l(&m_lockAircraft);
265  bool changed = (m_ownAircraft.getPosition() != position);
266  if (changed) { m_ownAircraft.setPosition(position); }
267 
268  if (m_ownAircraft.getAltitude() != altitude)
269  {
270  changed = true;
271  m_ownAircraft.setAltitude(altitude);
272  }
273 
274  if (m_ownAircraft.getPressureAltitude() != pressureAltitude)
275  {
276  changed = true;
277  m_ownAircraft.setPressureAltitude(pressureAltitude);
278  }
279  return changed;
280  }
281 
283  const CTransponder &transponder, const CIdentifier &originator)
284  {
285  if (isDebugEnabled())
286  {
287  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << com1 << com2 << transponder;
288  }
289  bool changed;
290  {
291  QWriteLocker l(&m_lockAircraft);
292  changed = m_ownAircraft.hasChangedCockpitData(com1, com2, transponder);
293  if (changed) { m_ownAircraft.setCockpit(com1, com2, transponder); }
294  }
295  if (changed) { emit this->changedAircraftCockpit(m_ownAircraft, originator); }
296  return changed;
297  }
298 
300  const CIdentifier &originator)
301  {
302  if (isDebugEnabled())
303  {
304  CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << transponderMode;
305  }
306  bool changed;
307  {
308  QWriteLocker l(&m_lockAircraft);
309  changed = m_ownAircraft.setTransponderMode(transponderMode);
310  }
311  if (changed) { emit this->changedAircraftCockpit(m_ownAircraft, originator); }
312  return changed;
313  }
314 
316  const CIdentifier &originator)
317  {
318  if (unit != CComSystem::Com1 && unit != CComSystem::Com2) { return false; }
319  if (!CComSystem::isValidComFrequency(frequency)) { return false; }
320  CComSystem com1, com2;
321  CTransponder xpdr;
322  {
323  QReadLocker l(&m_lockAircraft);
324  com1 = m_ownAircraft.getCom1System();
325  com2 = m_ownAircraft.getCom2System();
326  xpdr = m_ownAircraft.getTransponder();
327  }
328  if (unit == CComSystem::Com1) { com1.setFrequencyActive(frequency); }
329  else { com2.setFrequencyActive(frequency); }
330 
331  const bool changed = this->updateCockpit(com1, com2, xpdr, originator);
332  return changed;
333  }
334 
336  {
337  {
338  QWriteLocker l(&m_lockAircraft);
339  if (m_ownAircraft.getPilot() == pilot) { return false; }
340  m_ownAircraft.setPilot(pilot);
341  }
342  emit this->changedPilot(pilot);
343  return true;
344  }
345 
347  {
348  CTransponder xpdr;
349  CComSystem com1;
350  CComSystem com2;
351  {
352  QReadLocker l(&m_lockAircraft);
353  com1 = m_ownAircraft.getCom1System();
354  com2 = m_ownAircraft.getCom2System();
355  xpdr = m_ownAircraft.getTransponder();
356  }
357  xpdr.toggleTransponderMode();
358  this->updateCockpit(com1, com2, xpdr, this->identifier());
359  }
360 
362  {
363  return this->updateTransponderMode(mode, this->identifier());
364  }
365 
367  {
368  {
369  QWriteLocker l(&m_lockAircraft);
370  if (m_ownAircraft.getCallsign() == callsign) { return false; }
371  m_ownAircraft.setCallsign(callsign);
372  }
373  emit this->changedCallsign(callsign);
374  return true;
375  }
376 
378  const swift::misc::aviation::CAirlineIcaoCode &airlineIcaoCode)
379  {
380  {
381  QWriteLocker l(&m_lockAircraft);
382  if (!m_ownAircraft.setIcaoCodes(aircraftIcaoCode, airlineIcaoCode)) { return false; }
383  }
384  emit this->changedAircraftIcaoCodes(aircraftIcaoCode, airlineIcaoCode);
385  return true;
386  }
387 
388  bool CContextOwnAircraft::updateSelcal(const CSelcal &selcal, const CIdentifier &originator)
389  {
390  {
391  QWriteLocker l(&m_lockAircraft);
392  if (m_ownAircraft.getSelcal() == selcal) { return false; }
393  m_ownAircraft.setSelcal(selcal);
394  }
395  emit this->changedSelcal(selcal, originator);
396  return true;
397  }
398 
399  void CContextOwnAircraft::xCtxChangedSimulatorModel(const CAircraftModel &model, const CIdentifier &identifier)
400  {
401  this->updateOwnModel(model, identifier);
402  }
403 
404  void CContextOwnAircraft::xCtxChangedSimulatorStatus(int status)
405  {
406  const ISimulator::SimulatorStatus s = static_cast<ISimulator::SimulatorStatus>(status);
408  {
409  // connected
410  }
411  else
412  {
413  // disconnected
414  QWriteLocker l(&m_lockAircraft);
415  m_situationHistory.clear();
416  }
417  }
418 
419  void CContextOwnAircraft::actionToggleTransponder(bool keydown)
420  {
421  if (!keydown) { return; }
422  this->toggleTransponderMode();
423  }
424 
425  void CContextOwnAircraft::actionIdent(bool keydown)
426  {
427  if (this->getOwnTransponder().isInStandby()) { return; }
428  const CTransponder::TransponderMode m = keydown ? CTransponder::StateIdent : CTransponder::ModeC;
429  this->updateTransponderMode(m, this->identifier());
430  }
431 
432  void CContextOwnAircraft::allSwiftWebDataRead()
433  {
434  // we should already have received a reverse lookup model
435  // from the driver
436  }
437 
438  bool CContextOwnAircraft::parseCommandLine(const QString &commandLine, const CIdentifier &originator)
439  {
440  Q_UNUSED(originator)
441  if (commandLine.isEmpty()) { return false; }
442  CSimpleCommandParser parser({ ".x", ".xpdr", // transponder
443  ".com1", ".com2", // com1, com2 frequencies
444  ".c1", ".c2", // com1, com2 frequencies
445  ".selcal" });
446  parser.parse(commandLine);
447  if (!parser.isKnownCommand()) { return false; }
448 
449  CSimulatedAircraft myAircraft(this->getOwnAircraft());
450  if (parser.matchesCommand(".x", ".xpdr") && parser.countParts() > 1)
451  {
452  CTransponder transponder = myAircraft.getTransponder();
453  int xprCode = parser.toInt(1);
454  if (CTransponder::isValidTransponderCode(xprCode))
455  {
456  transponder.setTransponderCode(xprCode);
457  // todo RW: replace originator
458  this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), transponder,
459  CIdentifier("commandline"));
460  return true;
461  }
462  else
463  {
464  CTransponder::TransponderMode mode = CTransponder::modeFromString(parser.part(1));
465  transponder.setTransponderMode(mode);
466  // todo RW: replace originator
467  this->updateCockpit(myAircraft.getCom1System(), myAircraft.getCom2System(), transponder,
468  CIdentifier("commandline"));
469  return true;
470  }
471  }
472  else if (parser.commandStartsWith("com") || parser.commandStartsWith("c"))
473  {
474  CFrequency frequency(parser.toDouble(1), CFrequencyUnit::MHz());
475  if (CComSystem::isValidComFrequency(frequency))
476  {
477  CComSystem com1 = myAircraft.getCom1System();
478  CComSystem com2 = myAircraft.getCom2System();
479  if (parser.commandEndsWith("1")) { com1.setFrequencyActive(frequency); }
480  else if (parser.commandEndsWith("2")) { com2.setFrequencyActive(frequency); }
481  else { return false; }
482  this->updateCockpit(com1, com2, myAircraft.getTransponder(), identifier());
483  return true;
484  }
485  }
486  else if (parser.matchesCommand(".selcal"))
487  {
488  if (CSelcal::isValidCode(parser.part(1)))
489  {
490  this->updateSelcal(parser.part(1), this->identifier());
491  return true;
492  }
493  }
494  return false;
495  }
496 } // 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
virtual bool setTransponderMode(swift::misc::aviation::CTransponder::TransponderMode mode)
Set XPDR mode.
virtual swift::misc::simulation::CAircraftModel getOwnAircraftModel() const
Own aircraft model.
virtual 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.
virtual swift::misc::aviation::CAircraftSituation getOwnAircraftSituation() const
Get own aircraft.
virtual swift::misc::physical_quantities::CLength getDistanceToOwnAircraft(const swift::misc::geo::ICoordinateGeodetic &position) const
Distance to own aircraft.
virtual bool updateTransponderMode(const swift::misc::aviation::CTransponder::TransponderMode &transponderMode, const swift::misc::CIdentifier &originator)
Update own transponder mode.
virtual bool updateOwnPosition(const swift::misc::geo::CCoordinateGeodetic &position, const swift::misc::aviation::CAltitude &altitude, const swift::misc::aviation::CAltitude &pressureAltitude)
Update position.
virtual swift::misc::aviation::CTransponder getOwnTransponder() const
Get own transponder.
virtual bool updateOwnCallsign(const swift::misc::aviation::CCallsign &callsign)
Set callsign.
virtual bool updateOwnIcaoCodes(const swift::misc::aviation::CAircraftIcaoCode &aircraftIcaoCode, const swift::misc::aviation::CAirlineIcaoCode &airlineIcaoCode)
Set ICAO data.
virtual swift::misc::geo::CCoordinateGeodetic getOwnAircraftPosition() const
Own aircraft's position.
virtual swift::misc::simulation::CSimulatedAircraft getOwnAircraft() const
Get own aircraft.
virtual swift::misc::aviation::CCallsign getOwnCallsign() const
Own aircraft's callsign.
virtual bool updateOwnSituation(const swift::misc::aviation::CAircraftSituation &situation)
Update own situation.
virtual void toggleTransponderMode()
Toggle XPDR mode.
virtual 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.
virtual bool updateOwnModel(const swift::misc::simulation::CAircraftModel &model)
Update model.
virtual bool updateOwnParts(const swift::misc::aviation::CAircraftParts &parts)
Update own parts.
virtual swift::misc::aviation::CAircraftParts getOwnAircraftParts() const
Own aircraft's parts.
virtual bool updateOwnCG(const swift::misc::physical_quantities::CLength &cg)
Update own parts.
virtual bool updateOwnAircraftPilot(const swift::misc::network::CUser &pilot)
Set current pilot.
virtual swift::misc::aviation::CComSystem getOwnComSystem(swift::misc::aviation::CComSystem::ComUnit unit) const
Get own COM system.
virtual 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.
virtual 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.