11 using namespace swift::misc::aviation;
13 namespace swift::core::fsd
15 EuroscopeSimData::EuroscopeSimData() =
default;
17 EuroscopeSimData::EuroscopeSimData(
const QString &sender,
const QString &model,
const QString &livery,
18 quint64 timestamp,
double latitude,
double longitude,
double altitude,
19 double heading,
int bank,
int pitch,
int groundSpeed,
bool onGround,
20 double gearPercent,
double thrustPercent,
22 :
MessageBase(sender, {}), m_model(model), m_livery(livery), m_timestamp(timestamp), m_latitude(latitude),
23 m_longitude(longitude), m_altitude(altitude), m_heading(heading), m_bank(bank), m_pitch(pitch),
24 m_groundSpeed(groundSpeed), m_onGround(onGround), m_gearPercent(gearPercent), m_thrustPercent(thrustPercent),
32 if (lights.isBeaconOn()) { n |= 0x002; }
33 if (lights.isCabinOn()) { n |= 0x400; }
34 if (lights.isLandingOn()) { n |= 0x020; }
35 if (lights.isLogoOn()) { n |= 0x200; }
36 if (lights.isNavOn()) { n |= 0x008; }
37 if (lights.isRecognitionOn()) { n |= 0x080; }
38 if (lights.isStrobeOn()) { n |= 0x004; }
39 if (lights.isTaxiOn()) { n |= 0x040; }
49 tokens.push_back(QString::number(
m_latitude,
'f', 7));
50 tokens.push_back(QString::number(
m_longitude,
'f', 7));
51 tokens.push_back(QString::number(
m_altitude,
'f', 1));
52 tokens.push_back(QString::number(
m_heading,
'f', 2));
53 tokens.push_back(QString::number(
m_bank));
54 tokens.push_back(QString::number(
m_pitch));
56 tokens.push_back(
m_onGround ? QStringLiteral(
"1") : QStringLiteral(
"0"));
59 tokens.push_back(QStringLiteral(
"0"));
60 tokens.push_back(QStringLiteral(
"0.0"));
61 tokens.push_back(QString::number(toFlags(
m_lights)));
67 if (tokens.size() < 18)
73 static constexpr
auto fromFlags = [](
int n) {
74 return CAircraftLights(n & 0x4, n & 0x20, n & 0x40, n & 0x2, n & 0x8, n & 0x200, n & 0x80, n & 0x400);
78 return EuroscopeSimData(tokens[1], tokens[2], tokens[3], tokens[4].toULongLong(), tokens[5].toDouble(),
79 tokens[6].toDouble(), tokens[7].toDouble(), tokens[8].toDouble(), tokens[9].toInt(),
80 tokens[10].toInt(), tokens[11].toInt(), tokens[12].toInt(), tokens[13].toDouble(),
81 tokens[14].toDouble(), fromFlags(tokens[17].toInt()));
Pilot data update broadcast by Euroscope Simulator every second.
double m_latitude
Properties.
QStringList toTokens() const
Message converted to tokens.
QString m_model
Properties.
QString m_livery
Properties.
double m_altitude
Properties.
double m_heading
Properties.
int m_thrustPercent
Properties.
int m_gearPercent
Properties.
static EuroscopeSimData fromTokens(const QStringList &tokens)
Construct from tokens.
swift::misc::aviation::CAircraftLights m_lights
Properties.
quint64 m_timestamp
Properties.
int m_groundSpeed
Properties.
bool m_onGround
Properties.
double m_longitude
Properties.
QString m_sender
message sender
Class for emitting a log message.
Derived & debug()
Set the severity to debug.
Value object encapsulating information about aircraft's lights.
Free functions in swift::misc.