[TCAS] Fixed "mixed" values for debug/TCAS xswiftbus.conf file

Also only update if simulator XPlane is not connected, otherwise values are updated there
This allows to update the values BEFORE XPlane starts and avoids a restart
This commit is contained in:
Klaus Basan
2020-03-19 18:16:00 +01:00
committed by Mat Sutcliffe
parent 2607ebd7c6
commit 3d1dad989e
4 changed files with 34 additions and 14 deletions

View File

@@ -121,8 +121,8 @@ namespace BlackMisc
document.AddMember(JsonDrawingLabels, m_drawingLabels, a);
document.AddMember(JsonBundleTaxiLandingLights, m_bundleTaxiLandingLights, a);
document.AddMember(JsonFollowAircraftDistanceM, m_followAircraftDistanceM, a);
document.AddMember(JsonLogRenderPhases, m_logRenderPhases, a);
document.AddMember(JsonTcas, m_tcasEnabled, a);
document.AddMember(JsonLogRenderPhases, m_logRenderPhases, a);
document.AddMember(JsonTcas, m_tcasEnabled, a);
document.AddMember(JsonTerrainProbe, m_terrainProbeEnabled, a);
// document[CXSwiftBusSettingsQtFree::JsonDBusServerAddress].SetString(StringRef(m_dBusServerAddress.c_str(), m_dBusServerAddress.size()));

View File

@@ -73,11 +73,15 @@ namespace BlackMisc
void CXSwiftBusConfigWriter::writeTo(const QString &filePath)
{
// writing the file here (UI side) allows to overwrite the values
// before XPlane is started
// TCAS/log values MUST be changed before startup of the plugin
QString configFilePath = filePath + "/xswiftbus.conf";
QFile configFile(configFilePath);
configFile.remove();
if (configFile.open(QIODevice::WriteOnly))
{
// this code should be similar to XSwiftBus config.cpp
QTextStream ts(&configFile);
ts << "# DBus Mode - Options: p2p, session" << endl;
ts << "dbusMode = " << m_dbusMode << endl;
@@ -92,7 +96,12 @@ namespace BlackMisc
ts << "debug = " << boolToOnOff(m_debug) << endl;
ts << endl;
ts << "# TCAS traffic - to disable in case of crashes" << endl;
ts << "tcas = " << boolToOnOff(m_debug) << endl;
ts << "tcas = " << boolToOnOff(m_tcas) << endl;
// add comment as information
ts << endl;
ts << "# Updated by CXSwiftBusConfigWriter " << QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss") << " ";
ts << endl;
}
}
} // ns

View File

@@ -55,11 +55,11 @@ namespace BlackMisc
void writeTo(const QString &filePath);
private:
QString m_dbusMode = "p2p";
QString m_dbusMode = "p2p";
QString m_dbusAddress = "127.0.0.1";
QString m_dbusPort = "45001";
bool m_debug = false;
bool m_tcas = true;
QString m_dbusPort = "45001";
bool m_debug = false;
bool m_tcas = true;
};
}
}