mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
[FSD] Don't use CCallsign object to send incremental parts update to special receiver
A client query can be sent to any type of receiver, not only to valid callsigns. For example also to "@94835". This fixes the corrupted receiver for incremental aircraft parts.
This commit is contained in:
committed by
Mat Sutcliffe
parent
0e9297ff5f
commit
0b8db1a612
@@ -623,7 +623,9 @@ namespace BlackCore
|
||||
|
||||
void CFSDClient::sendAircraftConfiguration(const QString &receiver, const QString &aircraftConfigJson)
|
||||
{
|
||||
sendClientQuery(ClientQueryType::AircraftConfig, receiver, { aircraftConfigJson });
|
||||
if (aircraftConfigJson.size() == 0) { return; }
|
||||
const ClientQuery clientQuery(m_ownCallsign.asString(), receiver, ClientQueryType::AircraftConfig, { aircraftConfigJson });
|
||||
sendMessage(clientQuery);
|
||||
}
|
||||
|
||||
void CFSDClient::sendFsdMessage(const QString &message)
|
||||
@@ -766,8 +768,7 @@ namespace BlackCore
|
||||
|
||||
void CFSDClient::sendIncrementalAircraftConfig()
|
||||
{
|
||||
if (!this->isConnected()) { return; }
|
||||
if (!this->getSetupForServer().sendAircraftParts()) { return; }
|
||||
if (!m_unitTestMode && (!this->isConnected() || !this->getSetupForServer().sendAircraftParts())) { return; }
|
||||
const CAircraftParts currentParts(this->getOwnAircraftParts());
|
||||
|
||||
// If it hasn't changed, return
|
||||
|
||||
@@ -98,6 +98,7 @@ namespace BlackFsdTest
|
||||
void testSendPlaneInformation3();
|
||||
void testSendPlaneInformation4();
|
||||
void testSendAircraftConfiguration();
|
||||
void testSendIncrementalAircraftConfiguration();
|
||||
void testCom1FreqQueryResponse();
|
||||
void testPlaneInfoRequestResponse();
|
||||
void testAuth();
|
||||
@@ -714,6 +715,23 @@ namespace BlackFsdTest
|
||||
QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:XYZ:ACC:{\"request\":\"full\"}");
|
||||
}
|
||||
|
||||
void CTestFSDClient::testSendIncrementalAircraftConfiguration()
|
||||
{
|
||||
QSignalSpy spy(client, &CFSDClient::rawFsdMessage);
|
||||
|
||||
CAircraftParts parts = COwnAircraftProviderDummy::instance()->getOwnAircraftParts();
|
||||
parts.setGearDown(true);
|
||||
COwnAircraftProviderDummy::instance()->updateOwnParts(parts);
|
||||
|
||||
client->sendIncrementalAircraftConfig();
|
||||
|
||||
QCOMPARE(spy.count(), 1);
|
||||
QList<QVariant> arguments = spy.takeFirst();
|
||||
QCOMPARE(arguments.size(), 1);
|
||||
CRawFsdMessage fsdMessage = arguments.at(0).value<CRawFsdMessage>();
|
||||
QCOMPARE(fsdMessage.getRawMessage(), "FSD Sent=>$CQABCD:@94835:ACC:{\"config\":{\"gear_down\":true}}");
|
||||
}
|
||||
|
||||
void CTestFSDClient::testCom1FreqQueryResponse()
|
||||
{
|
||||
QSignalSpy spy(client, &CFSDClient::rawFsdMessage);
|
||||
|
||||
Reference in New Issue
Block a user