mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
@@ -40,7 +40,7 @@ namespace BlackCore
|
||||
: INetwork(parent), COwnAircraftAware(ownAircraft),
|
||||
m_loginMode(LoginNormal),
|
||||
m_status(vatStatusIdle),
|
||||
m_fsdTextCodec(QTextCodec::codecForName("latin1")),
|
||||
m_fsdTextCodec(QTextCodec::codecForName(m_fsdTextCodecSetting.get().toLocal8Bit())),
|
||||
m_tokenBucket(10, CTime(5, CTimeUnit::s()), 1)
|
||||
{
|
||||
connect(this, &CNetworkVatlib::terminate, this, &INetwork::terminateConnection, Qt::QueuedConnection);
|
||||
@@ -48,7 +48,6 @@ namespace BlackCore
|
||||
|
||||
Q_ASSERT_X(m_fsdTextCodec, "CNetworkVatlib", "Missing default wire text encoding");
|
||||
Q_ASSERT_X(Vat_GetVersion() == VAT_LIBVATLIB_VERSION, "swift.network", "Wrong vatlib shared library installed");
|
||||
//TODO reinit m_fsdTextCodec from WireTextEncoding config setting if present
|
||||
|
||||
Vat_SetNetworkLogHandler(SeverityError, CNetworkVatlib::networkLogHandler);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackcoreexport.h"
|
||||
#include "network.h"
|
||||
#include "settings/network.h"
|
||||
#include "blackmisc/simulation/ownaircraftprovider.h"
|
||||
#include "token_bucket.h"
|
||||
#include <vatlib/vatlib2.h>
|
||||
@@ -181,12 +182,13 @@ namespace BlackCore
|
||||
static int const c_processingIntervalMsec = 100;
|
||||
static int const c_updateIntervalMsec = 5000;
|
||||
static int const c_logoffTimeoutSec = 5;
|
||||
QTextCodec *m_fsdTextCodec;
|
||||
|
||||
CSetting<Settings::Network::WireTextCodec> m_fsdTextCodecSetting { this };
|
||||
QTextCodec *m_fsdTextCodec = nullptr;
|
||||
|
||||
BlackMisc::Aviation::CAircraftParts m_sentAircraftConfig;
|
||||
QTimer m_scheduledConfigUpdate;
|
||||
CTokenBucket m_tokenBucket;
|
||||
|
||||
};
|
||||
|
||||
} //namespace BlackCore
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "blackcore/settingscache.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include <QTextCodec>
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -21,6 +22,19 @@ namespace BlackCore
|
||||
{
|
||||
namespace Network
|
||||
{
|
||||
//! Name of text codec to use with text in FSD protocol
|
||||
struct WireTextCodec : public CSettingTrait<QString>
|
||||
{
|
||||
//! \copydoc BlackCore::CSetting::key
|
||||
static const char *key() { return "network/wiretextcodec"; }
|
||||
|
||||
//! \copydoc BlackCore::CSetting::defaultValue
|
||||
static const QString &defaultValue() { static const QString dv("latin1"); return dv; }
|
||||
|
||||
//! \copydoc BlackCore::CSetting::isValid
|
||||
static bool isValid(const QString &value) { return QTextCodec::codecForName(qPrintable(value)); }
|
||||
};
|
||||
|
||||
//! Virtual air traffic servers
|
||||
struct TrafficServers : public CSettingTrait<BlackMisc::Network::CServerList>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user