mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
Ref T723 [xswiftbus] Expose configuration to enable/disable TCAS traffic
This commit is contained in:
@@ -41,6 +41,11 @@ namespace BlackMisc
|
|||||||
m_debug = on;
|
m_debug = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CXSwiftBusConfigWriter::setTcasEnabled(bool on)
|
||||||
|
{
|
||||||
|
m_tcas = on;
|
||||||
|
}
|
||||||
|
|
||||||
void CXSwiftBusConfigWriter::updateInAllXPlaneVersions()
|
void CXSwiftBusConfigWriter::updateInAllXPlaneVersions()
|
||||||
{
|
{
|
||||||
updateInXPlane9();
|
updateInXPlane9();
|
||||||
@@ -85,6 +90,9 @@ namespace BlackMisc
|
|||||||
ts << endl;
|
ts << endl;
|
||||||
ts << "# Render phase debugging - to help diagnose crashes" << endl;
|
ts << "# Render phase debugging - to help diagnose crashes" << endl;
|
||||||
ts << "debug = " << boolToOnOff(m_debug) << endl;
|
ts << "debug = " << boolToOnOff(m_debug) << endl;
|
||||||
|
ts << endl;
|
||||||
|
ts << "# TCAS traffic - to disable in case of crashes" << endl;
|
||||||
|
ts << "tcas = " << boolToOnOff(m_debug) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ namespace BlackMisc
|
|||||||
//! Set debug on/off
|
//! Set debug on/off
|
||||||
void setDebugMode(bool on);
|
void setDebugMode(bool on);
|
||||||
|
|
||||||
|
//! Set TCAS on/off
|
||||||
|
void setTcasEnabled(bool on);
|
||||||
|
|
||||||
//! Update xswiftbus.conf in all known X-Plane versions (XP9 - XP11 are supported)
|
//! Update xswiftbus.conf in all known X-Plane versions (XP9 - XP11 are supported)
|
||||||
void updateInAllXPlaneVersions();
|
void updateInAllXPlaneVersions();
|
||||||
|
|
||||||
@@ -56,6 +59,7 @@ namespace BlackMisc
|
|||||||
QString m_dbusAddress = "127.0.0.1";
|
QString m_dbusAddress = "127.0.0.1";
|
||||||
QString m_dbusPort = "45001";
|
QString m_dbusPort = "45001";
|
||||||
bool m_debug = false;
|
bool m_debug = false;
|
||||||
|
bool m_tcas = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ namespace XSwiftBus
|
|||||||
else if (stringCompareCaseInsensitive(key, "dbusAddress")) { valid = parseDBusAddress(value); }
|
else if (stringCompareCaseInsensitive(key, "dbusAddress")) { valid = parseDBusAddress(value); }
|
||||||
else if (stringCompareCaseInsensitive(key, "dbusPort")) { valid = parseDBusPort(value); }
|
else if (stringCompareCaseInsensitive(key, "dbusPort")) { valid = parseDBusPort(value); }
|
||||||
else if (stringCompareCaseInsensitive(key, "debug")) { valid = parseDebug(value); }
|
else if (stringCompareCaseInsensitive(key, "debug")) { valid = parseDebug(value); }
|
||||||
|
else if (stringCompareCaseInsensitive(key, "tcasTraffic")) { valid = parseTcas(value); }
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARNING_LOG("xswiftbus.conf line " + std::to_string(lineNo) + ": Unknown variable " + value + "!");
|
WARNING_LOG("xswiftbus.conf line " + std::to_string(lineNo) + ": Unknown variable " + value + "!");
|
||||||
@@ -129,6 +130,12 @@ namespace XSwiftBus
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CConfig::parseTcas(const std::string &value)
|
||||||
|
{
|
||||||
|
m_tcas = stringCompareCaseInsensitive(value, "on");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string CConfig::dbusModeToString(DBusMode mode)
|
std::string CConfig::dbusModeToString(DBusMode mode)
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
|||||||
@@ -53,11 +53,15 @@ namespace XSwiftBus
|
|||||||
//! Get debug on/off
|
//! Get debug on/off
|
||||||
bool getDebugMode() const { return m_debug; }
|
bool getDebugMode() const { return m_debug; }
|
||||||
|
|
||||||
|
//! Get tcas traffic on/off
|
||||||
|
bool getTcasEnabled() const { return m_tcas; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool parseDBusMode(const std::string &value);
|
bool parseDBusMode(const std::string &value);
|
||||||
bool parseDBusAddress(const std::string &value);
|
bool parseDBusAddress(const std::string &value);
|
||||||
bool parseDBusPort(const std::string &value);
|
bool parseDBusPort(const std::string &value);
|
||||||
bool parseDebug(const std::string &value);
|
bool parseDebug(const std::string &value);
|
||||||
|
bool parseTcas(const std::string &value);
|
||||||
|
|
||||||
static std::string dbusModeToString(DBusMode mode);
|
static std::string dbusModeToString(DBusMode mode);
|
||||||
|
|
||||||
@@ -66,6 +70,7 @@ namespace XSwiftBus
|
|||||||
std::string m_dbusAddress = "127.0.0.1";
|
std::string m_dbusAddress = "127.0.0.1";
|
||||||
int m_dbusPort = 45001;
|
int m_dbusPort = 45001;
|
||||||
bool m_debug = false;
|
bool m_debug = false;
|
||||||
|
bool m_tcas = true;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -255,6 +255,10 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
return s_instance->getConfig().getDebugMode() ? 1 : 0;
|
return s_instance->getConfig().getDebugMode() ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(section, "debug") == 0 && strcmp(name, "tcas_traffic") == 0)
|
||||||
|
{
|
||||||
|
return s_instance->getConfig().getTcasEnabled() ? 1 : 0;
|
||||||
|
}
|
||||||
return def;
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,3 +9,6 @@ dbusPort = 45001
|
|||||||
|
|
||||||
# Render phase debugging - to help diagnose crashes
|
# Render phase debugging - to help diagnose crashes
|
||||||
debug = off
|
debug = off
|
||||||
|
|
||||||
|
# TCAS traffic - to disable in case of crashes
|
||||||
|
tcas = on
|
||||||
|
|||||||
Reference in New Issue
Block a user