swift
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
6
7#include <QCoreApplication>
8#include <QThread>
9
10#include "core/fsd/fsdclient.h"
14
15using namespace swift::misc::network;
16using namespace swift::misc::simulation;
17using namespace swift::core::fsd;
18
20int main(int argc, char *argv[])
21{
22 QCoreApplication qa(argc, argv);
24
27 client.setClientName("Test Client");
28 client.setHostApplication("None");
29 client.setVersion(0, 8);
30#ifdef SWIFT_VATSIM_SUPPORT
31 QString key("727d1efd5cb9f8d2c28372469d922bb4");
32 client.setClientIdAndKey(0xb9ba, key.toLocal8Bit());
33#endif
35
36 const CUser user("1234567", "Test user - EDDM", "", "123456");
37 CServer server("fsd.swift-project.org", 6809, user);
39 client.setServer(server);
42 client.printToConsole(true);
43
44 /*client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:V:voice.vacc.ch/loww_f_app\r\n");
45 client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:Wien Director, Servus\r\n");
46 client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:CALLSIGN ONLY\r\n");
47 client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:T:For charts visit www.vacc-austria.org\r\n");
48 client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:Z:z\r\n");
49 client.sendFsdMessage("$CRLOWW_F_APP:LHA449:ATIS:E:6\r\n");
50 client.sendFsdMessage("$CRN1234:BAW345:CAPS:INTERIMPOS=1:MODELDESC=1:ATCINFO=1:STEALTH=1:ACCONFIG=1\r\n");
51 client.sendFsdMessage("#SBBAW106:LHA449:PI:GEN:EQUIPMENT=B744:AIRLINE=BAW:LIVERY=UNION\r\n");
52 client.sendFsdMessage("#SBGEC55F:DESWL:FSIPIR:1::MD11:12.93209:-0.01354:3648.00000:4.CB8FB1E0.984745A0::PMDG MD-11F
53 Lufthansa Cargo WOW\r\n"); client.sendFsdMessage("#TMAFR529:@20500&@26000:taxi to entry N1 via M A4\r\n");
54 client.sendFsdMessage("$CQDLH123:BER368:ACC:json config\r\n");
55 client.sendFsdMessage("$CQDLH123:@94836:ACC:{\"request\":\"full\"}\r\n");
56 client.sendFsdMessage("#SBAUA417C:LHA449:PI:X:0:1:~B737");
57 client.sendFsdMessage("#SBBER368:someone:I:47.29946:14.45892:41082:473:4278194872\r\n");
58 client.sendFsdMessage("$CQURRR_R_APP:@94835:SC:VTD740:ÈËÑ\r\n");
59 client.sendFsdMessage("@N:SVA732:346:1:53.10591:2.50108:37010:529:4261225460:42\r\n");
60 client.sendFsdMessage("$CRLHA449:LOWW_TWR:RN:Peter Buchegger - LOWL:NONE:1\r\n");*/
61
62 client.connectToServer();
63
64 while (client.getConnectionStatus() == CConnectionStatus::Disconnected)
65 {
67 QThread::msleep(100);
68 }
69
70 bool functionTestsDone = false;
71 while (client.getConnectionStatus() == CConnectionStatus::Connected)
72 {
73 QThread::msleep(100);
74 if (!functionTestsDone) // cppcheck-suppress duplicateConditionalAssign
75 {
76 /*client.sendFlightPlan(FlightType::VFR, "B744", 420, "EGLL", 1530, 1535, "FL350", "KORD", 8, 15,
77 9, 30, "NONE", "Unit Test", "EGLL.KORD");
78 client.sendClientQuery(ClientQueryType::FP, "SERVER", { "BER368" });*/
79 functionTestsDone = true;
80 }
82 }
83
84 return qa.exec();
85}
FSD client Todo: Send (interim) data updates automatically Todo Check ':' in FSD messages....
Definition fsdclient.h:85
void setClientName(const QString &clientName)
Preset functions.
Definition fsdclient.h:102
void setServer(const swift::misc::network::CServer &server)
Preset functions.
void setClientCapabilities(Capabilities capabilities)
Preset functions.
Definition fsdclient.h:123
void printToConsole(bool on)
Debugging and UNIT tests.
Definition fsdclient.h:276
void setHostApplication(const QString &hostApplication)
Preset functions.
Definition fsdclient.h:107
void setPilotRating(PilotRating rating)
Preset functions.
Definition fsdclient.h:145
void setSimType(const swift::misc::simulation::CSimulatorInfo &simInfo)
Preset functions.
void setVersion(int major, int minor)
Preset functions.
Definition fsdclient.h:112
void connectToServer()
Connect/disconnect.
swift::misc::network::CConnectionStatus getConnectionStatus() const
Connection status.
Definition fsdclient.h:249
static CClientProviderDummy * instance()
Dummy instance.
static const CEcosystem & vatsim()
VATSIM eco system.
Definition ecosystem.cpp:26
Value object encapsulating information of a FSD server.
Definition server.h:28
void setEcosystem(const CEcosystem &ecosystem)
Set the ecosystem.
Definition server.cpp:66
Value object encapsulating information of a user.
Definition user.h:28
bool updateOwnCallsign(const swift::misc::aviation::CCallsign &callsign)
Update aircraft's callsign.
static COwnAircraftProviderDummy * instance()
Singleton.
static CRemoteAircraftProviderDummy * instance()
Singleton.
static const CSimulatorInfo & xplane()
Const simulator info objects.
@ AtcInfo
Can accept ATIS responses.
Definition enums.h:135
@ AircraftConfig
Aircraft Config.
Definition enums.h:172
@ AircraftInfo
Can send/receive modern model packets.
Definition enums.h:150
void processEvents(QEventLoop::ProcessEventsFlags flags)
QByteArray toLocal8Bit() const const
void msleep(unsigned long msecs)
int main(int argc, char *argv[])
main
Definition main.cpp:20