mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Long live FsdClient
This commit is contained in:
90
samples/fsd/main.cpp
Normal file
90
samples/fsd/main.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Copyright (C) 2018
|
||||
* swift project Community / Contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
//! \ingroup samplefsd
|
||||
|
||||
#include "blackcore/fsd/fsdclient.h"
|
||||
#include "blackmisc/network/clientprovider.h"
|
||||
#include "blackmisc/simulation/ownaircraftproviderdummy.h"
|
||||
#include "blackmisc/simulation/remoteaircraftproviderdummy.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QThread>
|
||||
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackCore::Fsd;
|
||||
|
||||
//! main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication qa(argc, argv);
|
||||
|
||||
|
||||
|
||||
COwnAircraftProviderDummy::instance()->updateOwnCallsign("BER368");
|
||||
|
||||
FSDClient client(CClientProviderDummy::instance(), COwnAircraftProviderDummy::instance(), CRemoteAircraftProviderDummy::instance(), &qa);
|
||||
client.setClientName("Test Client");
|
||||
client.setHostApplication("None");
|
||||
client.setVersion(0, 8);
|
||||
QString key("727d1efd5cb9f8d2c28372469d922bb4");
|
||||
client.setClientIdAndKey(0xb9ba, key.toLocal8Bit());
|
||||
client.setClientCapabilities(Capabilities::AtcInfo | Capabilities::AircraftInfo | Capabilities::AircraftConfig);
|
||||
|
||||
const CUser user("1234567", "Test user - EDDM", "", "123456");
|
||||
CServer server("fsd.swift-project.org", 6809, user);
|
||||
server.setServerType(CServer::FSDServerVatsim);
|
||||
client.setServer(server);
|
||||
client.setSimType(SimType::XPLANE10);
|
||||
client.setPilotRating(PilotRating::Student);
|
||||
client.printToConsole(true);
|
||||
|
||||
/*client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:V:voice.vacc.ch/loww_f_app\r\n");
|
||||
client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:Wien Director, Servus\r\n");
|
||||
client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:CALLSIGN ONLY\r\n");
|
||||
client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:For charts visit www.vacc-austria.org\r\n");
|
||||
client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:Z:z\r\n");
|
||||
client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:E:6\r\n");
|
||||
client.sendFsdMessage("$CRN1234:BAW345:CAPS:INTERIMPOS=1:MODELDESC=1:ATCINFO=1:STEALTH=1:ACCONFIG=1\r\n");
|
||||
client.sendFsdMessage("#SBBAW106:LHA449:PI:GEN:EQUIPMENT=B744:AIRLINE=BAW:LIVERY=UNION\r\n");
|
||||
client.sendFsdMessage("#SBGEC55F:DESWL:FSIPIR:1::MD11:12.93209:-0.01354:3648.00000:4.CB8FB1E0.984745A0::PMDG MD-11F Lufthansa Cargo WOW\r\n");
|
||||
client.sendFsdMessage("#TMAFR529:@20500&@26000:taxi to entry N1 via M A4\r\n");
|
||||
client.sendFsdMessage("$CQDLH123:BER368:ACC:json config\r\n");
|
||||
client.sendFsdMessage("$CQDLH123:@94836:ACC:{\"request\":\"full\"}\r\n");
|
||||
client.sendFsdMessage("#SBAUA417C:LHA449:PI:X:0:1:~B737");
|
||||
client.sendFsdMessage("#SBBER368:someone:I:47.29946:14.45892:41082:473:4278194872\r\n");
|
||||
client.sendFsdMessage("$CQURRR_R_APP:@94835:SC:VTD740:ÈËÑ\r\n");
|
||||
client.sendFsdMessage("@N:SVA732:346:1:53.10591:2.50108:37010:529:4261225460:42\r\n");
|
||||
client.sendFsdMessage("$CRLHA449:LOWW_TWR:RN:Peter Buchegger - LOWL:NONE:1\r\n");*/
|
||||
|
||||
client.connectToServer();
|
||||
|
||||
while (client.getConnectionStatus() == CConnectionStatus::Disconnected)
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
QThread::msleep(100);
|
||||
}
|
||||
|
||||
bool functionTestsDone = false;
|
||||
while (client.getConnectionStatus() == CConnectionStatus::Connected)
|
||||
{
|
||||
QThread::msleep(100);
|
||||
if (!functionTestsDone)
|
||||
{
|
||||
/*client.sendFlightPlan(FlightType::VFR, "B744", 420, "EGLL", 1530, 1535, "FL350", "KORD", 8, 15,
|
||||
9, 30, "NONE", "Unit Test", "EGLL.KORD");
|
||||
client.sendClientQuery(ClientQueryType::FP, "SERVER", { "BER368" });*/
|
||||
functionTestsDone = true;
|
||||
}
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
return qa.exec();
|
||||
}
|
||||
Reference in New Issue
Block a user