From afed33dbbfd444a067d069b9f574a5d9b1999264 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Thu, 19 Mar 2015 20:59:24 +0100 Subject: [PATCH] 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. --- src/blackcore/network_vatlib.cpp | 17 +++++++++-------- src/blackcore/network_vatlib.h | 2 +- src/blackcore/voice_vatlib.cpp | 4 ++-- src/blackcore/voice_vatlib.h | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/blackcore/network_vatlib.cpp b/src/blackcore/network_vatlib.cpp index 675be1448..5c6b22b9b 100644 --- a/src/blackcore/network_vatlib.cpp +++ b/src/blackcore/network_vatlib.cpp @@ -48,7 +48,7 @@ namespace BlackCore Q_ASSERT_X(m_fsdTextCodec, "CNetworkVatlib", "Missing default wire text encoding"); //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_updateTimer, SIGNAL(timeout()), this, SLOT(update())); @@ -74,8 +74,8 @@ namespace BlackCore clientCapabilities)); Vat_SetStateChangeHandler(m_net.data(), onConnectionStatusChanged, this); - Vat_SetMessageHandler(m_net.data(), onTextMessageReceived, this); - Vat_SetRadioHandler(m_net.data(), onRadioMessageReceived, this); + Vat_SetTextMessageHandler(m_net.data(), onTextMessageReceived, this); + Vat_SetRadioMessageHandler(m_net.data(), onRadioMessageReceived, this); Vat_SetDeletePilotHandler(m_net.data(), onPilotDisconnected, this); Vat_SetDeleteAtcHandler(m_net.data(), onControllerDisconnected, this); Vat_SetPilotPositionHandler(m_net.data(), onPilotPositionUpdate, this); @@ -83,9 +83,9 @@ namespace BlackCore Vat_SetAtcPositionHandler(m_net.data(), onAtcPositionUpdate, this); Vat_SetKillHandler(m_net.data(), onKicked, 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_SetInfoReplyHandler(m_net.data(), onInfoQueryReplyReceived, this); + Vat_SetInfoResponseHandler(m_net.data(), onInfoQueryReplyReceived, this); Vat_SetInfoCAPSReplyHandler(m_net.data(), onCapabilitiesReplyReceived, this); Vat_SetControllerAtisHandler(m_net.data(), onAtisReplyReceived, this); Vat_SetFlightPlanHandler(m_net.data(), onFlightPlanReceived, this); @@ -134,7 +134,8 @@ namespace BlackCore { // Normal / Stealth mode 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.heading = ownAircraft().getHeading().value(CAngleUnit::deg()); pos.pitch = ownAircraft().getPitch().value(CAngleUnit::deg()); @@ -564,7 +565,7 @@ namespace BlackCore void CNetworkVatlib::sendMetarQuery(const BlackMisc::Aviation::CAirportIcao &airportIcao) { 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) @@ -974,7 +975,7 @@ namespace BlackCore 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(nullptr)).error(message); } diff --git a/src/blackcore/network_vatlib.h b/src/blackcore/network_vatlib.h index b501b290a..e4ba45d1c 100644 --- a/src/blackcore/network_vatlib.h +++ b/src/blackcore/network_vatlib.h @@ -132,7 +132,7 @@ namespace BlackCore bool isDisconnected() const { return m_status != vatStatusConnecting && m_status != vatStatusConnected; } static QString convertToUnicodeEscaped(const QString &str); static VatSimType convertToSimType(BlackSim::CSimulatorInfo &simInfo); - static void networkErrorHandler(const char *message); + static void networkLogHandler(SeverityLevel severity, const char *message); struct JsonPackets { diff --git a/src/blackcore/voice_vatlib.cpp b/src/blackcore/voice_vatlib.cpp index c23e92da4..839cdc3e2 100644 --- a/src/blackcore/voice_vatlib.cpp +++ b/src/blackcore/voice_vatlib.cpp @@ -32,7 +32,7 @@ namespace BlackCore m_audioService(Vat_CreateAudioService()), m_udpPort(Vat_CreateUDPAudioPort(m_audioService.data(), 3782)) { - Vat_SetVoiceErrorHandler(CVoiceVatlib::voiceErrorHandler); + Vat_SetVoiceLogHandler(SeverityError, CVoiceVatlib::voiceLogHandler); // do processing this->startTimer(10); @@ -147,7 +147,7 @@ namespace BlackCore Vat_ExecuteTasks(m_audioService.data()); } - void CVoiceVatlib::voiceErrorHandler(const char *message) + void CVoiceVatlib::voiceLogHandler(SeverityLevel /** severity **/, const char *message) { CLogMessage(static_cast(nullptr)).error(message); } diff --git a/src/blackcore/voice_vatlib.h b/src/blackcore/voice_vatlib.h index a38e8d118..e557d8045 100644 --- a/src/blackcore/voice_vatlib.h +++ b/src/blackcore/voice_vatlib.h @@ -100,7 +100,7 @@ namespace BlackCore } }; - static void voiceErrorHandler(const char *message); + static void voiceLogHandler(SeverityLevel severity, const char *message); QScopedPointer m_audioService; QScopedPointer m_udpPort;