mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 18:55:38 +08:00
Adaptions to latest vatlib
The latest vatlib fixes some ambigious methods in the interface and makes them more clear. Additional it adds a severity level to the log handlers. Both causing the header to be source incompatible and therefore need smaller changes in swift.
This commit is contained in:
committed by
Klaus Basan
parent
0760a67138
commit
afed33dbbf
@@ -48,7 +48,7 @@ namespace BlackCore
|
|||||||
Q_ASSERT_X(m_fsdTextCodec, "CNetworkVatlib", "Missing default wire text encoding");
|
Q_ASSERT_X(m_fsdTextCodec, "CNetworkVatlib", "Missing default wire text encoding");
|
||||||
//TODO reinit m_fsdTextCodec from WireTextEncoding config setting if present
|
//TODO reinit m_fsdTextCodec from WireTextEncoding config setting if present
|
||||||
|
|
||||||
Vat_SetNetworkErrorHandler(CNetworkVatlib::networkErrorHandler);
|
Vat_SetNetworkLogHandler(SeverityError, CNetworkVatlib::networkLogHandler);
|
||||||
|
|
||||||
connect(&m_processingTimer, SIGNAL(timeout()), this, SLOT(process()));
|
connect(&m_processingTimer, SIGNAL(timeout()), this, SLOT(process()));
|
||||||
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(update()));
|
connect(&m_updateTimer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
@@ -74,8 +74,8 @@ namespace BlackCore
|
|||||||
clientCapabilities));
|
clientCapabilities));
|
||||||
|
|
||||||
Vat_SetStateChangeHandler(m_net.data(), onConnectionStatusChanged, this);
|
Vat_SetStateChangeHandler(m_net.data(), onConnectionStatusChanged, this);
|
||||||
Vat_SetMessageHandler(m_net.data(), onTextMessageReceived, this);
|
Vat_SetTextMessageHandler(m_net.data(), onTextMessageReceived, this);
|
||||||
Vat_SetRadioHandler(m_net.data(), onRadioMessageReceived, this);
|
Vat_SetRadioMessageHandler(m_net.data(), onRadioMessageReceived, this);
|
||||||
Vat_SetDeletePilotHandler(m_net.data(), onPilotDisconnected, this);
|
Vat_SetDeletePilotHandler(m_net.data(), onPilotDisconnected, this);
|
||||||
Vat_SetDeleteAtcHandler(m_net.data(), onControllerDisconnected, this);
|
Vat_SetDeleteAtcHandler(m_net.data(), onControllerDisconnected, this);
|
||||||
Vat_SetPilotPositionHandler(m_net.data(), onPilotPositionUpdate, this);
|
Vat_SetPilotPositionHandler(m_net.data(), onPilotPositionUpdate, this);
|
||||||
@@ -83,9 +83,9 @@ namespace BlackCore
|
|||||||
Vat_SetAtcPositionHandler(m_net.data(), onAtcPositionUpdate, this);
|
Vat_SetAtcPositionHandler(m_net.data(), onAtcPositionUpdate, this);
|
||||||
Vat_SetKillHandler(m_net.data(), onKicked, this);
|
Vat_SetKillHandler(m_net.data(), onKicked, this);
|
||||||
Vat_SetPongHandler(m_net.data(), onPong, this);
|
Vat_SetPongHandler(m_net.data(), onPong, this);
|
||||||
Vat_SetACARSDataHandler(m_net.data(), onMetarReceived, this);
|
Vat_SetMetarResponseHandler(m_net.data(), onMetarReceived, this);
|
||||||
Vat_SetInfoRequestHandler(m_net.data(), onInfoQueryRequestReceived, this);
|
Vat_SetInfoRequestHandler(m_net.data(), onInfoQueryRequestReceived, this);
|
||||||
Vat_SetInfoReplyHandler(m_net.data(), onInfoQueryReplyReceived, this);
|
Vat_SetInfoResponseHandler(m_net.data(), onInfoQueryReplyReceived, this);
|
||||||
Vat_SetInfoCAPSReplyHandler(m_net.data(), onCapabilitiesReplyReceived, this);
|
Vat_SetInfoCAPSReplyHandler(m_net.data(), onCapabilitiesReplyReceived, this);
|
||||||
Vat_SetControllerAtisHandler(m_net.data(), onAtisReplyReceived, this);
|
Vat_SetControllerAtisHandler(m_net.data(), onAtisReplyReceived, this);
|
||||||
Vat_SetFlightPlanHandler(m_net.data(), onFlightPlanReceived, this);
|
Vat_SetFlightPlanHandler(m_net.data(), onFlightPlanReceived, this);
|
||||||
@@ -134,7 +134,8 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
// Normal / Stealth mode
|
// Normal / Stealth mode
|
||||||
VatPilotPosition pos;
|
VatPilotPosition pos;
|
||||||
pos.altitudeAdjust = 0; // TODO: this needs to be calculated
|
// TODO: we need to distinguish true and pressure altitude
|
||||||
|
pos.altitudePressure = ownAircraft().getAltitude().value(CLengthUnit::ft());
|
||||||
pos.altitudeTrue = ownAircraft().getAltitude().value(CLengthUnit::ft());
|
pos.altitudeTrue = ownAircraft().getAltitude().value(CLengthUnit::ft());
|
||||||
pos.heading = ownAircraft().getHeading().value(CAngleUnit::deg());
|
pos.heading = ownAircraft().getHeading().value(CAngleUnit::deg());
|
||||||
pos.pitch = ownAircraft().getPitch().value(CAngleUnit::deg());
|
pos.pitch = ownAircraft().getPitch().value(CAngleUnit::deg());
|
||||||
@@ -564,7 +565,7 @@ namespace BlackCore
|
|||||||
void CNetworkVatlib::sendMetarQuery(const BlackMisc::Aviation::CAirportIcao &airportIcao)
|
void CNetworkVatlib::sendMetarQuery(const BlackMisc::Aviation::CAirportIcao &airportIcao)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(isConnected(), "CNetworkVatlib", "Can't send to server when disconnected");
|
Q_ASSERT_X(isConnected(), "CNetworkVatlib", "Can't send to server when disconnected");
|
||||||
Vat_RequestACARS(m_net.data(), toFSD(airportIcao.asString()));
|
Vat_RequestMetar(m_net.data(), toFSD(airportIcao.asString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNetworkVatlib::sendWeatherDataQuery(const BlackMisc::Aviation::CAirportIcao &airportIcao)
|
void CNetworkVatlib::sendWeatherDataQuery(const BlackMisc::Aviation::CAirportIcao &airportIcao)
|
||||||
@@ -974,7 +975,7 @@ namespace BlackCore
|
|||||||
emit cbvar_cast(cbvar)->icaoCodesReplyReceived(cbvar_cast(cbvar)->fromFSD(callsign), icao);
|
emit cbvar_cast(cbvar)->icaoCodesReplyReceived(cbvar_cast(cbvar)->fromFSD(callsign), icao);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNetworkVatlib::networkErrorHandler(const char *message)
|
void CNetworkVatlib::networkLogHandler(SeverityLevel /** severity **/, const char *message)
|
||||||
{
|
{
|
||||||
CLogMessage(static_cast<CNetworkVatlib *>(nullptr)).error(message);
|
CLogMessage(static_cast<CNetworkVatlib *>(nullptr)).error(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ namespace BlackCore
|
|||||||
bool isDisconnected() const { return m_status != vatStatusConnecting && m_status != vatStatusConnected; }
|
bool isDisconnected() const { return m_status != vatStatusConnecting && m_status != vatStatusConnected; }
|
||||||
static QString convertToUnicodeEscaped(const QString &str);
|
static QString convertToUnicodeEscaped(const QString &str);
|
||||||
static VatSimType convertToSimType(BlackSim::CSimulatorInfo &simInfo);
|
static VatSimType convertToSimType(BlackSim::CSimulatorInfo &simInfo);
|
||||||
static void networkErrorHandler(const char *message);
|
static void networkLogHandler(SeverityLevel severity, const char *message);
|
||||||
|
|
||||||
struct JsonPackets
|
struct JsonPackets
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace BlackCore
|
|||||||
m_audioService(Vat_CreateAudioService()),
|
m_audioService(Vat_CreateAudioService()),
|
||||||
m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), 3782))
|
m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), 3782))
|
||||||
{
|
{
|
||||||
Vat_SetVoiceErrorHandler(CVoiceVatlib::voiceErrorHandler);
|
Vat_SetVoiceLogHandler(SeverityError, CVoiceVatlib::voiceLogHandler);
|
||||||
|
|
||||||
// do processing
|
// do processing
|
||||||
this->startTimer(10);
|
this->startTimer(10);
|
||||||
@@ -147,7 +147,7 @@ namespace BlackCore
|
|||||||
Vat_ExecuteTasks(m_audioService.data());
|
Vat_ExecuteTasks(m_audioService.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVoiceVatlib::voiceErrorHandler(const char *message)
|
void CVoiceVatlib::voiceLogHandler(SeverityLevel /** severity **/, const char *message)
|
||||||
{
|
{
|
||||||
CLogMessage(static_cast<CVoiceVatlib*>(nullptr)).error(message);
|
CLogMessage(static_cast<CVoiceVatlib*>(nullptr)).error(message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace BlackCore
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void voiceErrorHandler(const char *message);
|
static void voiceLogHandler(SeverityLevel severity, const char *message);
|
||||||
|
|
||||||
QScopedPointer<VatAudioService_tag, VatAudioServiceDeleter> m_audioService;
|
QScopedPointer<VatAudioService_tag, VatAudioServiceDeleter> m_audioService;
|
||||||
QScopedPointer<VatUDPAudioPort_tag, VatUDPAudioPortDeleter> m_udpPort;
|
QScopedPointer<VatUDPAudioPort_tag, VatUDPAudioPortDeleter> m_udpPort;
|
||||||
|
|||||||
Reference in New Issue
Block a user