mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T723 [xswiftbus] Expose configuration for render phase debug messages
This commit is contained in:
@@ -36,6 +36,11 @@ namespace BlackMisc
|
||||
|
||||
}
|
||||
|
||||
void CXSwiftBusConfigWriter::setDebugMode(bool on)
|
||||
{
|
||||
m_debug = on;
|
||||
}
|
||||
|
||||
void CXSwiftBusConfigWriter::updateInAllXPlaneVersions()
|
||||
{
|
||||
updateInXPlane9();
|
||||
@@ -77,6 +82,9 @@ namespace BlackMisc
|
||||
ts << endl;
|
||||
ts << "# DBus server port - relevant for P2P mode only" << endl;
|
||||
ts << "dbusPort = " << m_dbusPort << endl;
|
||||
ts << endl;
|
||||
ts << "# Render phase debugging - to help diagnose crashes" << endl;
|
||||
ts << "debug = " << boolToOnOff(m_debug) << endl;
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -33,6 +33,9 @@ namespace BlackMisc
|
||||
//! Set new DBus address
|
||||
void setDBusAddress(const QString &dBusAddress);
|
||||
|
||||
//! Set debug on/off
|
||||
void setDebugMode(bool on);
|
||||
|
||||
//! Update xswiftbus.conf in all known X-Plane versions (XP9 - XP11 are supported)
|
||||
void updateInAllXPlaneVersions();
|
||||
|
||||
@@ -52,6 +55,7 @@ namespace BlackMisc
|
||||
QString m_dbusMode = "p2p";
|
||||
QString m_dbusAddress = "127.0.0.1";
|
||||
QString m_dbusPort = "45001";
|
||||
bool m_debug = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ namespace XSwiftBus
|
||||
if (stringCompareCaseInsensitive(key, "dbusMode")) { valid = parseDBusMode(value); }
|
||||
else if (stringCompareCaseInsensitive(key, "dbusAddress")) { valid = parseDBusAddress(value); }
|
||||
else if (stringCompareCaseInsensitive(key, "dbusPort")) { valid = parseDBusPort(value); }
|
||||
else if (stringCompareCaseInsensitive(key, "debug")) { valid = parseDebug(value); }
|
||||
else
|
||||
{
|
||||
WARNING_LOG("xswiftbus.conf line " + std::to_string(lineNo) + ": Unknown variable " + value + "!");
|
||||
@@ -115,6 +116,19 @@ namespace XSwiftBus
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CConfig::parseDebug(const std::string &value)
|
||||
{
|
||||
if (stringCompareCaseInsensitive(value, "on"))
|
||||
{
|
||||
m_debug = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_debug = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string CConfig::dbusModeToString(DBusMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
|
||||
@@ -50,10 +50,14 @@ namespace XSwiftBus
|
||||
//! Get current DBus server port
|
||||
int getDBusPort() const { return m_dbusPort; }
|
||||
|
||||
//! Get debug on/off
|
||||
bool getDebugMode() const { return m_debug; }
|
||||
|
||||
private:
|
||||
bool parseDBusMode(const std::string &value);
|
||||
bool parseDBusAddress(const std::string &value);
|
||||
bool parseDBusPort(const std::string &value);
|
||||
bool parseDebug(const std::string &value);
|
||||
|
||||
static std::string dbusModeToString(DBusMode mode);
|
||||
|
||||
@@ -61,6 +65,7 @@ namespace XSwiftBus
|
||||
DBusMode m_dbusMode = DBusP2P;
|
||||
std::string m_dbusAddress = "127.0.0.1";
|
||||
int m_dbusPort = 45001;
|
||||
bool m_debug = false;
|
||||
};
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace XSwiftBus
|
||||
//! Should stop
|
||||
bool shouldStop() const { return m_shouldStop; }
|
||||
|
||||
//! \copydoc XSwiftBus::CSettingsProvider::getConfig
|
||||
virtual const CConfig &getConfig() const override { return m_pluginConfig; }
|
||||
|
||||
private:
|
||||
CConfig m_pluginConfig;
|
||||
CDBusDispatcher m_dbusDispatcher;
|
||||
|
||||
@@ -45,5 +45,10 @@ namespace XSwiftBus
|
||||
{
|
||||
m_provider->setSettings(settings);
|
||||
}
|
||||
|
||||
const CConfig& CSettingsAware::getConfig() const
|
||||
{
|
||||
return m_provider->getConfig();
|
||||
}
|
||||
} // ns
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define BLACKMISC_XSWIFTBUS_CSETTINGS_H
|
||||
|
||||
#include "blackmisc/simulation/settings/xswiftbussettingsqtfree.h"
|
||||
#include "config.h"
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
|
||||
@@ -41,6 +42,9 @@ namespace XSwiftBus
|
||||
//! \threadsafe
|
||||
void setSettings(const CSettings &settings);
|
||||
|
||||
//! Get settings from xswiftbus.conf (needed during plugin initialization)
|
||||
virtual const CConfig &getConfig() const = 0;
|
||||
|
||||
private:
|
||||
mutable std::mutex m_settingsMutex;
|
||||
CSettings m_pluginSettings; //!< owner of the settings
|
||||
@@ -62,6 +66,9 @@ namespace XSwiftBus
|
||||
//! \copydoc CSettingsProvider::setSettings
|
||||
void setSettings(const CSettings &settings);
|
||||
|
||||
//! \copydoc CSettingsProvider::getConfig
|
||||
const CConfig &getConfig() const;
|
||||
|
||||
private:
|
||||
CSettingsProvider *m_provider = nullptr;
|
||||
};
|
||||
|
||||
@@ -251,6 +251,10 @@ namespace XSwiftBus
|
||||
// whether or not async loading is enabled: 1 means enabled, 0 means disabled
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(section, "debug") == 0 && strcmp(name, "render_phases") == 0)
|
||||
{
|
||||
return s_instance->getConfig().getDebugMode() ? 1 : 0;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,3 +6,6 @@ dbusAddress = 127.0.0.1
|
||||
|
||||
# DBus server port - relevant for P2P mode only
|
||||
dbusPort = 45001
|
||||
|
||||
# Render phase debugging - to help diagnose crashes
|
||||
debug = off
|
||||
|
||||
Reference in New Issue
Block a user