swift
Loading...
Searching...
No Matches
ownaircraftprovider.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2015 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6using namespace swift::misc::aviation;
7using namespace swift::misc::geo;
8using namespace swift::misc::physical_quantities;
9
10namespace swift::misc::simulation
11{
13 {
14 const bool changed1 = this->updateCockpit(aircraft.getCom1System(), aircraft.getCom2System(),
15 aircraft.getTransponder(), originator);
16 const bool changed2 = this->updateSelcal(aircraft.getSelcal(), originator);
17 return changed1 || changed2;
18 }
19
20 // pin vtables to this file
21 void COwnAircraftAware::anchor() {}
22
24 {
25 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
26 return this->provider()->getOwnAircraft();
27 }
28
30 {
31 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
32 return this->provider()->getOwnCallsign();
33 }
34
36 {
37 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
38 return this->provider()->getOwnComSystem(unit);
39 }
40
42 {
43 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
44 return this->provider()->getOwnTransponder();
45 }
46
48 {
49 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
50 return this->provider()->getOwnAircraftPosition();
51 }
52
54 {
55 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
56 return this->provider()->getOwnAircraftSituation();
57 }
58
60 {
61 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
62 return this->provider()->getOwnAircraftParts();
63 }
64
66 {
67 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
68 return this->provider()->getOwnAircraftModel();
69 }
70
72 {
73 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
74 return this->provider()->getDistanceToOwnAircraft(position);
75 }
76
77 bool COwnAircraftAware::updateCockpit(const CSimulatedAircraft &aircraft, const CIdentifier &originator)
78 {
79 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
80 return this->provider()->updateCockpit(aircraft, originator);
81 }
82
84 const CTransponder &transponder, const CIdentifier &originator)
85 {
86 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
87 return this->provider()->updateCockpit(com1, com2, transponder, originator);
88 }
89
91 const CIdentifier &originator)
92 {
93 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
94 return this->provider()->updateActiveComFrequency(frequency, comUnit, originator);
95 }
96
97 bool COwnAircraftAware::updateSelcal(const CSelcal &selcal, const CIdentifier &originator)
98 {
99 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
100 return this->provider()->updateSelcal(selcal, originator);
101 }
102
104 {
105 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
106 return this->provider()->updateOwnModel(model);
107 }
108
110 {
111 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
112 return this->provider()->updateOwnSituation(situation);
113 }
114
116 {
117 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
118 return this->provider()->updateOwnParts(parts);
119 }
120
122 {
123 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
124 return this->provider()->updateOwnCG(cg);
125 }
126
128 {
129 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
130 return this->provider()->updateOwnCallsign(callsign);
131 }
132
134 const CAirlineIcaoCode &airlineIcaoCode)
135 {
136 Q_ASSERT_X(this->provider(), Q_FUNC_INFO, "No object available");
137 return this->provider()->updateOwnIcaoCodes(aircraftIcaoData, airlineIcaoCode);
138 }
139} // namespace swift::misc::simulation
Value object encapsulating information identifying a component of a modular distributed swift process...
Definition identifier.h:29
Value object for ICAO classification.
Value object encapsulating information of aircraft's parts.
Value object encapsulating information of an aircraft's situation.
Value object for ICAO classification.
Value object encapsulating information of a callsign.
Definition callsign.h:30
COM system (aka "radio").
Definition comsystem.h:37
Value object for SELCAL.
Definition selcal.h:31
Geodetic coordinate, a position in 3D space relative to the reference geoid.
Physical unit length (length).
Definition length.h:18
Aircraft model (used by another pilot, my models on disk).
bool updateOwnParts(const aviation::CAircraftParts &parts)
Update own parts.
bool updateOwnModel(const swift::misc::simulation::CAircraftModel &model)
Update model.
bool updateOwnCG(const physical_quantities::CLength &cg)
Update own aircraft's CG (aka vertical offset).
aviation::CAircraftParts getOwnAircraftParts() const
Own aircraft's parts.
bool updateOwnCallsign(const aviation::CCallsign &callsign)
Update aircraft's callsign.
aviation::CAircraftSituation getOwnAircraftSituation() const
Own aircraft's position.
aviation::CCallsign getOwnCallsign() const
Own aircraft's callsign.
bool updateOwnIcaoCodes(const aviation::CAircraftIcaoCode &aircraftIcaoData, const aviation::CAirlineIcaoCode &airlineIcaoCode)
Update ICAO data.
aviation::CComSystem getOwnComSystem(aviation::CComSystem::ComUnit unit) const
Own aircraft COM unit.
bool updateOwnSituation(const aviation::CAircraftSituation &situation)
Update own situation.
swift::misc::physical_quantities::CLength getDistanceToOwnAircraft(const swift::misc::geo::ICoordinateGeodetic &position) const
Distance to own aircraft.
bool updateCockpit(const swift::misc::simulation::CSimulatedAircraft &aircraft, const swift::misc::CIdentifier &originator)
Update cockpit, but only send signals when applicable.
swift::misc::simulation::CAircraftModel getOwnAircraftModel() const
Own aircraft model.
aviation::CTransponder getOwnTransponder() const
Own aircraft XPDR.
swift::misc::geo::CCoordinateGeodetic getOwnAircraftPosition() const
Own aircraft's position.
bool updateSelcal(const aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)
Update cockpit, but only send signals when applicable.
CSimulatedAircraft getOwnAircraft() const
Own aircraft.
bool updateActiveComFrequency(const swift::misc::physical_quantities::CFrequency &frequency, aviation::CComSystem::ComUnit comUnit, const swift::misc::CIdentifier &originator)
Update cockpit, but only send signals when applicable.
Comprehensive information of an aircraft.
const aviation::CSelcal getSelcal() const
SELCAL.
const aviation::CComSystem & getCom2System() const
Get COM2 system.
const aviation::CComSystem & getCom1System() const
Get COM1 system.
const aviation::CTransponder & getTransponder() const
Get transponder.
virtual bool updateSelcal(const aviation::CSelcal &selcal, const swift::misc::CIdentifier &originator)=0
Update cockpit, but only send signals when applicable.
bool updateCockpit(const swift::misc::simulation::CSimulatedAircraft &aircraft, const swift::misc::CIdentifier &originator)
Update cockpit, but only send signals when applicable.