mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-01 22:55:41 +08:00
[FSD] Style
This commit is contained in:
committed by
Mat Sutcliffe
parent
59c6a7ad93
commit
f38bfc5cf9
@@ -25,8 +25,7 @@ namespace BlackCore
|
||||
m_rating(rating),
|
||||
m_protocolRevision(protocolRevision),
|
||||
m_realName(realName)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
QStringList AddAtc::toTokens() const
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace BlackCore
|
||||
{ }
|
||||
|
||||
AtcDataUpdate::AtcDataUpdate(const QString &sender, int frequencykHz, CFacilityType facility, int visibleRange, AtcRating rating,
|
||||
double latitude, double longitude, int elevation) :
|
||||
double latitude, double longitude, int elevation) :
|
||||
MessageBase(sender, {}),
|
||||
m_frequencykHz(frequencykHz),
|
||||
m_facility(facility),
|
||||
@@ -40,7 +40,7 @@ namespace BlackCore
|
||||
tokens.push_back(toQString(m_facility));
|
||||
tokens.push_back(QString::number(m_visibleRange));
|
||||
tokens.push_back(toQString(m_rating));
|
||||
tokens.push_back(QString::number(m_latitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_latitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_longitude, 'f', 5));
|
||||
tokens.push_back(QString::number(m_elevation));
|
||||
return tokens;
|
||||
@@ -55,7 +55,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
AtcDataUpdate packet(tokens[0], tokens[1].toInt() + 100000, fromQString<CFacilityType>(tokens[2]), tokens[3].toInt(), fromQString<AtcRating>(tokens[4]),
|
||||
tokens[5].toDouble(), tokens[6].toDouble(), tokens[7].toInt());
|
||||
tokens[5].toDouble(), tokens[6].toDouble(), tokens[7].toInt());
|
||||
return packet;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace BlackCore
|
||||
{
|
||||
BlackMisc::CLogMessage(static_cast<AuthChallenge *>(nullptr)).warning(u"Wrong number of arguments.");
|
||||
return {};
|
||||
};
|
||||
}
|
||||
return AuthChallenge(tokens[0], tokens[1], tokens[2]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace BlackCore
|
||||
sendMessage(clientQuery);
|
||||
}
|
||||
|
||||
this->increaseStatisticsValue(QStringLiteral("sendClientQuery"), toQString(queryType));
|
||||
increaseStatisticsValue(QStringLiteral("sendClientQuery"), toQString(queryType));
|
||||
}
|
||||
|
||||
void CFSDClient::sendTextMessages(const CTextMessageList &messages)
|
||||
@@ -504,7 +504,7 @@ namespace BlackCore
|
||||
else { return; }
|
||||
const TextMessage textMessage(m_ownCallsign.asString(), receiver, message);
|
||||
sendMessage(textMessage);
|
||||
this->increaseStatisticsValue(QStringLiteral("sendTextMessages"));
|
||||
increaseStatisticsValue(QStringLiteral("sendTextMessages"));
|
||||
}
|
||||
|
||||
void CFSDClient::sendTextMessage(const QString &receiver, const QString &message)
|
||||
@@ -576,7 +576,7 @@ namespace BlackCore
|
||||
|
||||
void CFSDClient::sendPlaneInfoRequest(const CCallsign &receiver)
|
||||
{
|
||||
PlaneInfoRequest planeInfoRequest(m_ownCallsign.asString(), receiver.toQString());
|
||||
const PlaneInfoRequest planeInfoRequest(m_ownCallsign.asString(), receiver.toQString());
|
||||
sendMessage(planeInfoRequest);
|
||||
increaseStatisticsValue(QStringLiteral("sendPlaneInfoRequest"));
|
||||
}
|
||||
|
||||
@@ -80,16 +80,10 @@ namespace BlackCore
|
||||
void setValid(bool isValid) { m_isValid = isValid; }
|
||||
|
||||
protected:
|
||||
|
||||
// Meta data
|
||||
// MessageType messageType = MessageType::Unknown;
|
||||
|
||||
QString m_sender; //!< message sender
|
||||
QString m_receiver; //!< message receiver
|
||||
|
||||
bool m_isValid = true; //!< is valid?
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -165,11 +165,11 @@ namespace BlackMiscTest
|
||||
QCOMPARE(message.receiver(), QString("SERVER"));
|
||||
QCOMPARE(QString("7a57f2dd9d360d347b"), message.m_challengeKey);
|
||||
|
||||
QString stringRef("ABCD:SERVER:7a57f2dd9d360d347b");
|
||||
QString str = message.toTokens().join(":");
|
||||
const QString stringRef("ABCD:SERVER:7a57f2dd9d360d347b");
|
||||
const QString str = message.toTokens().join(":");
|
||||
QCOMPARE(str, stringRef);
|
||||
|
||||
QStringList tokens = QString("ABCD:SERVER:7a57f2dd9d360d347b").split(':');
|
||||
const QStringList tokens = QString("ABCD:SERVER:7a57f2dd9d360d347b").split(':');
|
||||
const AuthChallenge messageFromTokens = AuthChallenge::fromTokens(tokens);
|
||||
QCOMPARE(messageFromTokens, message);
|
||||
}
|
||||
@@ -181,13 +181,13 @@ namespace BlackMiscTest
|
||||
QCOMPARE(message.receiver(), QString("SERVER"));
|
||||
QCOMPARE(QString("7a57f2dd9d360d347b"), message.m_response);
|
||||
|
||||
QString stringRef("ABCD:SERVER:7a57f2dd9d360d347b");
|
||||
QString str = message.toTokens().join(":");
|
||||
const QString stringRef("ABCD:SERVER:7a57f2dd9d360d347b");
|
||||
const QString str = message.toTokens().join(":");
|
||||
QCOMPARE(str, stringRef);
|
||||
|
||||
const AuthResponse reference("ABCD", "SERVER", "7a57f2dd9d360d347b");
|
||||
|
||||
QStringList tokens = QString("ABCD:SERVER:7a57f2dd9d360d347b").split(':');
|
||||
const QStringList tokens = QString("ABCD:SERVER:7a57f2dd9d360d347b").split(':');
|
||||
const AuthResponse messageFromTokens = AuthResponse::fromTokens(tokens);
|
||||
QCOMPARE(messageFromTokens, message);
|
||||
|
||||
@@ -212,7 +212,7 @@ namespace BlackMiscTest
|
||||
|
||||
const ClientIdentification reference("ABCD", 0xe410, "Client", 1, 5, "1234567", "1108540872", "29bbc8b1398eb38e0139");
|
||||
|
||||
QStringList tokens = QString("ABCD:SERVER:e410:Client:1:5:1234567:1108540872:29bbc8b1398eb38e0139").split(':');
|
||||
const QStringList tokens = QString("ABCD:SERVER:e410:Client:1:5:1234567:1108540872:29bbc8b1398eb38e0139").split(':');
|
||||
const ClientIdentification messageFromTokens = ClientIdentification::fromTokens(tokens);
|
||||
QCOMPARE(messageFromTokens, message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user