mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-19 03:45:30 +08:00
Ref T709, added DBus signatures and use CSettings class in service class
* CSettings objects will be shared among all services (traffic, weather, service) * It is "global" for plugin
This commit is contained in:
committed by
Mat Sutcliffe
parent
94f519961b
commit
f6690136f2
@@ -40,7 +40,7 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
QString CXSwiftBusServiceProxy::getVersionNumber()
|
QString CXSwiftBusServiceProxy::getVersionNumber()
|
||||||
{
|
{
|
||||||
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getVersionNumber"));
|
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getVersionNumber"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
|
void CXSwiftBusServiceProxy::getOwnAircraftSituationData(XPlaneData *o_xplaneData)
|
||||||
@@ -505,5 +505,20 @@ namespace BlackSimPlugin
|
|||||||
{
|
{
|
||||||
m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
|
m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CXSwiftBusServiceProxy::getSettings() const
|
||||||
|
{
|
||||||
|
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettings"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXSwiftBusServiceProxy::getSettingsAsync(QString *o_jsonSettings)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBusAsync(QLatin1String("getSettings"), setterCallback(o_jsonSettings));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXSwiftBusServiceProxy::setSettings(const QString &json)
|
||||||
|
{
|
||||||
|
m_dbusInterface->callDBus(QLatin1String("setSettings"), json);
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -386,8 +386,17 @@ namespace BlackSimPlugin
|
|||||||
double getSpeedBrakeRatio() const;
|
double getSpeedBrakeRatio() const;
|
||||||
void getSpeedBrakeRatioAsync(double *o_speedBrakeRatio);
|
void getSpeedBrakeRatioAsync(double *o_speedBrakeRatio);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XSwiftBus::CService::getSettings
|
||||||
|
//! @{
|
||||||
|
QString getSettings() const;
|
||||||
|
void getSettingsAsync(QString *o_jsonSettings);
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc XSwiftBus::CService::setSettings
|
||||||
|
void setSettings(const QString &json);
|
||||||
};
|
};
|
||||||
}
|
} // ns
|
||||||
}
|
} // ns
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -16,15 +16,16 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
inline std::string xswiftbusServiceName() {
|
{
|
||||||
|
inline std::string xswiftbusServiceName()
|
||||||
|
{
|
||||||
return std::string("org.swift-project.xswiftbus");
|
return std::string("org.swift-project.xswiftbus");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace XSwiftBus
|
namespace XSwiftBus
|
||||||
{
|
{
|
||||||
|
|
||||||
CPlugin::CPlugin()
|
CPlugin::CPlugin()
|
||||||
: m_dbusConnection(std::make_shared<CDBusConnection>()), m_menu(CMenu::mainMenu().subMenu("XSwiftBus"))
|
: m_dbusConnection(std::make_shared<CDBusConnection>()), m_menu(CMenu::mainMenu().subMenu("XSwiftBus"))
|
||||||
{
|
{
|
||||||
@@ -39,18 +40,18 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
m_service->toggleMessageBoxVisibility();
|
m_service->toggleMessageBoxVisibility();
|
||||||
});
|
});
|
||||||
m_popupMessageWindowMenuItem = m_messageWindowSubMenu.checkableItem("Pop up Window on new Message", true, [this] (bool checked)
|
m_popupMessageWindowMenuItem = m_messageWindowSubMenu.checkableItem("Pop up Window on new Message", true, [this](bool checked)
|
||||||
{
|
{
|
||||||
m_popupMessageWindowMenuItem.setChecked(!checked);
|
m_popupMessageWindowMenuItem.setChecked(!checked);
|
||||||
m_service->setPopupMessageWindow(!checked);
|
m_service->setPopupMessageWindow(!checked);
|
||||||
});
|
});
|
||||||
m_disappearMessageWindowMenuItem = m_messageWindowSubMenu.checkableItem("Hide Message Window after 5s", true, [this] (bool checked)
|
m_disappearMessageWindowMenuItem = m_messageWindowSubMenu.checkableItem("Hide Message Window after 5s", true, [this](bool checked)
|
||||||
{
|
{
|
||||||
m_disappearMessageWindowMenuItem.setChecked(!checked);
|
m_disappearMessageWindowMenuItem.setChecked(!checked);
|
||||||
m_service->setDisappearMessageWindow(!checked);
|
m_service->setDisappearMessageWindow(!checked);
|
||||||
});
|
});
|
||||||
m_planeViewSubMenu = m_menu.subMenu("Follow Plane View");
|
m_planeViewSubMenu = m_menu.subMenu("Follow Plane View");
|
||||||
planeViewOwnAircraftMenuItem = m_planeViewSubMenu.item("Own Aircraft", [this]
|
m_planeViewOwnAircraftMenuItem = m_planeViewSubMenu.item("Own Aircraft", [this]
|
||||||
{
|
{
|
||||||
m_traffic->setFollowedAircraft(m_traffic->ownAircraftString());
|
m_traffic->setFollowedAircraft(m_traffic->ownAircraftString());
|
||||||
});
|
});
|
||||||
@@ -96,9 +97,9 @@ namespace XSwiftBus
|
|||||||
|
|
||||||
readConfig();
|
readConfig();
|
||||||
|
|
||||||
m_service = std::make_unique<CService>();
|
m_service = std::make_unique<CService>(m_pluginSettings);
|
||||||
m_traffic = std::make_unique<CTraffic>();
|
m_traffic = std::make_unique<CTraffic>(m_pluginSettings);
|
||||||
m_weather = std::make_unique<CWeather>();
|
m_weather = std::make_unique<CWeather>(m_pluginSettings);
|
||||||
|
|
||||||
m_traffic->setPlaneViewMenu(m_planeViewSubMenu);
|
m_traffic->setPlaneViewMenu(m_planeViewSubMenu);
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,11 @@
|
|||||||
#include "dbusdispatcher.h"
|
#include "dbusdispatcher.h"
|
||||||
#include "dbusserver.h"
|
#include "dbusserver.h"
|
||||||
#include "datarefs.h"
|
#include "datarefs.h"
|
||||||
#include "XPLM/XPLMCamera.h"
|
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include "XPLM/XPLMCamera.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
@@ -55,9 +57,10 @@ namespace XSwiftBus
|
|||||||
void onAircraftRepositioned();
|
void onAircraftRepositioned();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CConfig m_pluginConfig;
|
CConfig m_pluginConfig;
|
||||||
CDBusDispatcher m_dbusDispatcher;
|
CDBusDispatcher m_dbusDispatcher;
|
||||||
std::unique_ptr<CDBusServer> m_dbusP2PServer;
|
CSettings m_pluginSettings;
|
||||||
|
std::unique_ptr<CDBusServer> m_dbusP2PServer;
|
||||||
std::shared_ptr<CDBusConnection> m_dbusConnection;
|
std::shared_ptr<CDBusConnection> m_dbusConnection;
|
||||||
std::unique_ptr<CService> m_service;
|
std::unique_ptr<CService> m_service;
|
||||||
std::unique_ptr<CTraffic> m_traffic;
|
std::unique_ptr<CTraffic> m_traffic;
|
||||||
@@ -65,12 +68,12 @@ namespace XSwiftBus
|
|||||||
CMenu m_menu;
|
CMenu m_menu;
|
||||||
CMenuItem m_startServerMenuItem;
|
CMenuItem m_startServerMenuItem;
|
||||||
CMenuItem m_showHideLabelsMenuItem;
|
CMenuItem m_showHideLabelsMenuItem;
|
||||||
CMenu m_messageWindowSubMenu;
|
CMenu m_messageWindowSubMenu;
|
||||||
CMenuItem m_toggleMessageWindowMenuItem;
|
CMenuItem m_toggleMessageWindowMenuItem;
|
||||||
CMenuItem m_popupMessageWindowMenuItem;
|
CMenuItem m_popupMessageWindowMenuItem;
|
||||||
CMenuItem m_disappearMessageWindowMenuItem;
|
CMenuItem m_disappearMessageWindowMenuItem;
|
||||||
CMenu m_planeViewSubMenu;
|
CMenu m_planeViewSubMenu;
|
||||||
CMenuItem planeViewOwnAircraftMenuItem;
|
CMenuItem m_planeViewOwnAircraftMenuItem;
|
||||||
|
|
||||||
DataRef<xplane::data::sim::atc::atis_enabled> m_atisEnabled;
|
DataRef<xplane::data::sim::atc::atis_enabled> m_atisEnabled;
|
||||||
decltype(m_atisEnabled.get()) m_atisSaved = 0;
|
decltype(m_atisEnabled.get()) m_atisSaved = 0;
|
||||||
|
|||||||
@@ -6,11 +6,14 @@
|
|||||||
* or distributed except according to the terms contained in the LICENSE file.
|
* or distributed except according to the terms contained in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "blackmisc/simulation/xplane/qtfreeutils.h"
|
||||||
|
|
||||||
#include <XPLM/XPLMPlanes.h>
|
#include <XPLM/XPLMPlanes.h>
|
||||||
#include <XPLM/XPLMUtilities.h>
|
#include <XPLM/XPLMUtilities.h>
|
||||||
#include "blackmisc/simulation/xplane/qtfreeutils.h"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
// clazy:excludeall=reserve-candidates
|
// clazy:excludeall=reserve-candidates
|
||||||
@@ -19,8 +22,7 @@ using namespace BlackMisc::Simulation::XPlane::QtFreeUtils;
|
|||||||
|
|
||||||
namespace XSwiftBus
|
namespace XSwiftBus
|
||||||
{
|
{
|
||||||
|
CService::CService(CSettings &settings) : CDBusObject(), m_pluginSettings(settings)
|
||||||
CService::CService() : CDBusObject()
|
|
||||||
{
|
{
|
||||||
updateAirportsInRange();
|
updateAirportsInRange();
|
||||||
}
|
}
|
||||||
@@ -155,10 +157,20 @@ namespace XSwiftBus
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CService::getSettings() const
|
||||||
|
{
|
||||||
|
return m_pluginSettings.toXSwiftBusJsonString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CService::setSettings(const std::string &jsonString)
|
||||||
|
{
|
||||||
|
m_pluginSettings.parseXSwiftBusString(jsonString);
|
||||||
|
}
|
||||||
|
|
||||||
void CService::readAirportsDatabase()
|
void CService::readAirportsDatabase()
|
||||||
{
|
{
|
||||||
auto first = XPLMFindFirstNavAidOfType(xplm_Nav_Airport);
|
auto first = XPLMFindFirstNavAidOfType(xplm_Nav_Airport);
|
||||||
auto last = XPLMFindLastNavAidOfType(xplm_Nav_Airport);
|
auto last = XPLMFindLastNavAidOfType(xplm_Nav_Airport);
|
||||||
if (first != XPLM_NAV_NOT_FOUND)
|
if (first != XPLM_NAV_NOT_FOUND)
|
||||||
{
|
{
|
||||||
for (auto i = first; i <= last; ++i)
|
for (auto i = first; i <= last; ++i)
|
||||||
@@ -652,6 +664,24 @@ namespace XSwiftBus
|
|||||||
toggleMessageBoxVisibility();
|
toggleMessageBoxVisibility();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (message.getMethodName() == "getSettings")
|
||||||
|
{
|
||||||
|
queueDBusCall([ = ]()
|
||||||
|
{
|
||||||
|
sendDBusReply(sender, serial, getSettings());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (message.getMethodName() == "setSettings")
|
||||||
|
{
|
||||||
|
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||||
|
std::string json;
|
||||||
|
message.beginArgumentRead();
|
||||||
|
message.getArgument(json);
|
||||||
|
queueDBusCall([ = ]()
|
||||||
|
{
|
||||||
|
setSettings(json);
|
||||||
|
});
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Unknown message. Tell DBus that we cannot handle it
|
// Unknown message. Tell DBus that we cannot handle it
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "datarefs.h"
|
#include "datarefs.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "navdatareference.h"
|
#include "navdatareference.h"
|
||||||
|
#include "settings.h"
|
||||||
#include <XPLM/XPLMNavigation.h>
|
#include <XPLM/XPLMNavigation.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
@@ -37,7 +38,7 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CService();
|
CService(CSettings &settings);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CService() override = default;
|
~CService() override = default;
|
||||||
@@ -234,6 +235,12 @@ namespace XSwiftBus
|
|||||||
//! Enable/disable message window disappearing again after 5 seconds
|
//! Enable/disable message window disappearing again after 5 seconds
|
||||||
void setDisappearMessageWindow(bool enabled) { m_disappearMessageWindow = enabled; }
|
void setDisappearMessageWindow(bool enabled) { m_disappearMessageWindow = enabled; }
|
||||||
|
|
||||||
|
//! Get settings in JSON format
|
||||||
|
std::string getSettings() const;
|
||||||
|
|
||||||
|
//! Set settings
|
||||||
|
void setSettings(const std::string &jsonString);
|
||||||
|
|
||||||
//! Perform generic processing
|
//! Perform generic processing
|
||||||
int process();
|
int process();
|
||||||
|
|
||||||
@@ -249,12 +256,13 @@ namespace XSwiftBus
|
|||||||
const std::vector<double> &lats, const std::vector<double> &lons, const std::vector<double> &alts);
|
const std::vector<double> &lats, const std::vector<double> &lons, const std::vector<double> &alts);
|
||||||
|
|
||||||
CMessageBoxControl m_messages { 16, 16, 16 };
|
CMessageBoxControl m_messages { 16, 16, 16 };
|
||||||
bool m_popupMessageWindow = true;
|
bool m_popupMessageWindow = true;
|
||||||
bool m_disappearMessageWindow = true;
|
bool m_disappearMessageWindow = true;
|
||||||
std::chrono::system_clock::time_point m_disappearMessageWindowTime;
|
std::chrono::system_clock::time_point m_disappearMessageWindowTime;
|
||||||
std::vector<CNavDataReference> m_airports;
|
std::vector<CNavDataReference> m_airports;
|
||||||
void readAirportsDatabase();
|
CSettings &m_pluginSettings;
|
||||||
|
|
||||||
|
void readAirportsDatabase();
|
||||||
std::vector<CNavDataReference> findClosestAirports(int number, double latitude, double longitude);
|
std::vector<CNavDataReference> findClosestAirports(int number, double latitude, double longitude);
|
||||||
|
|
||||||
StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath;
|
StringDataRef<xplane::data::sim::aircraft::view::acf_livery_path> m_liveryPath;
|
||||||
|
|||||||
@@ -45,14 +45,17 @@ namespace XSwiftBus
|
|||||||
surfaces.lights.timeOffset = static_cast<uint16_t>(std::rand() % 0xffff);
|
surfaces.lights.timeOffset = static_cast<uint16_t>(std::rand() % 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
CTraffic::CTraffic() :
|
// *INDENT-OFF*
|
||||||
|
CTraffic::CTraffic(CSettings &settings) :
|
||||||
CDBusObject(),
|
CDBusObject(),
|
||||||
|
m_pluginSettings(settings),
|
||||||
m_followPlaneViewNextCommand("org/swift-project/xswiftbus/follow_next_plane", "Changes plane view to follow next plane in sequence", [this] { followNextPlane(); }),
|
m_followPlaneViewNextCommand("org/swift-project/xswiftbus/follow_next_plane", "Changes plane view to follow next plane in sequence", [this] { followNextPlane(); }),
|
||||||
m_followPlaneViewPreviousCommand("org/swift-project/xswiftbus/follow_previous_plane", "Changes plane view to follow previous plane in sequence", [this] { followPreviousPlane(); })
|
m_followPlaneViewPreviousCommand("org/swift-project/xswiftbus/follow_previous_plane", "Changes plane view to follow previous plane in sequence", [this] { followPreviousPlane(); })
|
||||||
{
|
{
|
||||||
XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this);
|
XPLMRegisterDrawCallback(drawCallback, xplm_Phase_Airplanes, 1, this);
|
||||||
XPLMRegisterKeySniffer(spaceKeySniffer, 1, this);
|
XPLMRegisterKeySniffer(spaceKeySniffer, 1, this);
|
||||||
}
|
}
|
||||||
|
// *INDENT-ON*
|
||||||
|
|
||||||
CTraffic::~CTraffic()
|
CTraffic::~CTraffic()
|
||||||
{
|
{
|
||||||
@@ -394,7 +397,7 @@ namespace XSwiftBus
|
|||||||
plane->surfaces.lights.bcnLights = beaconLights.at(i);
|
plane->surfaces.lights.bcnLights = beaconLights.at(i);
|
||||||
plane->surfaces.lights.strbLights = strobeLights.at(i);
|
plane->surfaces.lights.strbLights = strobeLights.at(i);
|
||||||
plane->surfaces.lights.navLights = navLights.at(i);
|
plane->surfaces.lights.navLights = navLights.at(i);
|
||||||
plane->surfaces.lights.flashPattern = lightPatterns.at(i);
|
plane->surfaces.lights.flashPattern = static_cast<unsigned int>(lightPatterns.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "datarefs.h"
|
#include "datarefs.h"
|
||||||
#include "terrainprobe.h"
|
#include "terrainprobe.h"
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "XPMPMultiplayer.h"
|
#include "XPMPMultiplayer.h"
|
||||||
#include "XPLMCamera.h"
|
#include "XPLMCamera.h"
|
||||||
#include <XPLM/XPLMDisplay.h>
|
#include <XPLM/XPLMDisplay.h>
|
||||||
@@ -36,7 +37,7 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CTraffic();
|
CTraffic(CSettings &settings);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CTraffic() override;
|
~CTraffic() override;
|
||||||
@@ -146,6 +147,7 @@ namespace XSwiftBus
|
|||||||
bool m_initialized = false;
|
bool m_initialized = false;
|
||||||
bool m_enabledMultiplayer = false;
|
bool m_enabledMultiplayer = false;
|
||||||
CTerrainProbe m_terrainProbe;
|
CTerrainProbe m_terrainProbe;
|
||||||
|
CSettings &m_pluginSettings;
|
||||||
|
|
||||||
void emitSimFrame();
|
void emitSimFrame();
|
||||||
void emitPlaneAdded(const std::string &callsign);
|
void emitPlaneAdded(const std::string &callsign);
|
||||||
@@ -182,7 +184,6 @@ namespace XSwiftBus
|
|||||||
const std::string &livery_, const std::string &modelName_);
|
const std::string &livery_, const std::string &modelName_);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
std::unordered_map<std::string, Plane *> m_planesByCallsign;
|
std::unordered_map<std::string, Plane *> m_planesByCallsign;
|
||||||
std::unordered_map<void *, Plane *> m_planesById;
|
std::unordered_map<void *, Plane *> m_planesById;
|
||||||
std::vector<std::string> m_followPlaneViewSequence;
|
std::vector<std::string> m_followPlaneViewSequence;
|
||||||
|
|||||||
@@ -13,8 +13,9 @@
|
|||||||
|
|
||||||
namespace XSwiftBus
|
namespace XSwiftBus
|
||||||
{
|
{
|
||||||
CWeather::CWeather()
|
CWeather::CWeather(CSettings &settings) : m_pluginSettings(settings)
|
||||||
{
|
{
|
||||||
|
// void
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Set cloud layer
|
//! Set cloud layer
|
||||||
@@ -63,7 +64,7 @@ namespace XSwiftBus
|
|||||||
|
|
||||||
const char *introspection_weather =
|
const char *introspection_weather =
|
||||||
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
|
||||||
#include "org.swift_project.xswiftbus.weather.xml"
|
#include "org.swift_project.xswiftbus.weather.xml"
|
||||||
;
|
;
|
||||||
|
|
||||||
DBusHandlerResult CWeather::dbusMessageHandler(const CDBusMessage &message_)
|
DBusHandlerResult CWeather::dbusMessageHandler(const CDBusMessage &message_)
|
||||||
@@ -84,7 +85,7 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
if (message.getMethodName() == "isUsingRealWeather")
|
if (message.getMethodName() == "isUsingRealWeather")
|
||||||
{
|
{
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
sendDBusReply(sender, serial, isUsingRealWeather());
|
sendDBusReply(sender, serial, isUsingRealWeather());
|
||||||
});
|
});
|
||||||
@@ -95,7 +96,7 @@ namespace XSwiftBus
|
|||||||
bool enable = false;
|
bool enable = false;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(enable);
|
message.getArgument(enable);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setUseRealWeather(enable);
|
setUseRealWeather(enable);
|
||||||
});
|
});
|
||||||
@@ -106,7 +107,7 @@ namespace XSwiftBus
|
|||||||
double visibilityM = 10.0;
|
double visibilityM = 10.0;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(visibilityM);
|
message.getArgument(visibilityM);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setVisibility(visibilityM);
|
setVisibility(visibilityM);
|
||||||
});
|
});
|
||||||
@@ -117,7 +118,7 @@ namespace XSwiftBus
|
|||||||
int degreesC = 10;
|
int degreesC = 10;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(degreesC);
|
message.getArgument(degreesC);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setTemperature(degreesC);
|
setTemperature(degreesC);
|
||||||
});
|
});
|
||||||
@@ -128,7 +129,7 @@ namespace XSwiftBus
|
|||||||
int degreesC = 10;
|
int degreesC = 10;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(degreesC);
|
message.getArgument(degreesC);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setDewPoint(degreesC);
|
setDewPoint(degreesC);
|
||||||
});
|
});
|
||||||
@@ -139,7 +140,7 @@ namespace XSwiftBus
|
|||||||
double inHg = 29.92;
|
double inHg = 29.92;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(inHg);
|
message.getArgument(inHg);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setQNH(inHg);
|
setQNH(inHg);
|
||||||
});
|
});
|
||||||
@@ -150,7 +151,7 @@ namespace XSwiftBus
|
|||||||
double precipRatio = 0.0;
|
double precipRatio = 0.0;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(precipRatio);
|
message.getArgument(precipRatio);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setPrecipitationRatio(precipRatio);
|
setPrecipitationRatio(precipRatio);
|
||||||
});
|
});
|
||||||
@@ -161,7 +162,7 @@ namespace XSwiftBus
|
|||||||
double cbRatio = 0.0;
|
double cbRatio = 0.0;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(cbRatio);
|
message.getArgument(cbRatio);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setThunderstormRatio(cbRatio);
|
setThunderstormRatio(cbRatio);
|
||||||
});
|
});
|
||||||
@@ -173,7 +174,7 @@ namespace XSwiftBus
|
|||||||
double turbulenceRatio = 0.0;
|
double turbulenceRatio = 0.0;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(turbulenceRatio);
|
message.getArgument(turbulenceRatio);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setTurbulenceRatio(turbulenceRatio);
|
setTurbulenceRatio(turbulenceRatio);
|
||||||
});
|
});
|
||||||
@@ -184,7 +185,7 @@ namespace XSwiftBus
|
|||||||
int friction = 10;
|
int friction = 10;
|
||||||
message.beginArgumentRead();
|
message.beginArgumentRead();
|
||||||
message.getArgument(friction);
|
message.getArgument(friction);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setRunwayFriction(friction);
|
setRunwayFriction(friction);
|
||||||
});
|
});
|
||||||
@@ -203,7 +204,7 @@ namespace XSwiftBus
|
|||||||
message.getArgument(tops);
|
message.getArgument(tops);
|
||||||
message.getArgument(type);
|
message.getArgument(type);
|
||||||
message.getArgument(coverage);
|
message.getArgument(coverage);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setCloudLayer(layer, base, tops, type, coverage);
|
setCloudLayer(layer, base, tops, type, coverage);
|
||||||
});
|
});
|
||||||
@@ -226,7 +227,7 @@ namespace XSwiftBus
|
|||||||
message.getArgument(shearDirectionDeg);
|
message.getArgument(shearDirectionDeg);
|
||||||
message.getArgument(shearSpeedKt);
|
message.getArgument(shearSpeedKt);
|
||||||
message.getArgument(turbulence);
|
message.getArgument(turbulence);
|
||||||
queueDBusCall([=]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setWindLayer(layer, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence);
|
setWindLayer(layer, altitudeM, directionDeg, speedKt, shearDirectionDeg, shearSpeedKt, turbulence);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include "dbusobject.h"
|
#include "dbusobject.h"
|
||||||
#include "datarefs.h"
|
#include "datarefs.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
//! \cond PRIVATE
|
//! \cond PRIVATE
|
||||||
#define XSWIFTBUS_WEATHER_INTERFACENAME "org.swift_project.xswiftbus.weather"
|
#define XSWIFTBUS_WEATHER_INTERFACENAME "org.swift_project.xswiftbus.weather"
|
||||||
@@ -24,7 +25,6 @@
|
|||||||
|
|
||||||
namespace XSwiftBus
|
namespace XSwiftBus
|
||||||
{
|
{
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* XSwiftBus weather object which is accessible through DBus
|
* XSwiftBus weather object which is accessible through DBus
|
||||||
*/
|
*/
|
||||||
@@ -32,7 +32,7 @@ namespace XSwiftBus
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CWeather();
|
CWeather(CSettings &settings);
|
||||||
|
|
||||||
//! DBus interface name
|
//! DBus interface name
|
||||||
static const std::string &InterfaceName()
|
static const std::string &InterfaceName()
|
||||||
@@ -103,6 +103,8 @@ namespace XSwiftBus
|
|||||||
virtual DBusHandlerResult dbusMessageHandler(const CDBusMessage &message) override;
|
virtual DBusHandlerResult dbusMessageHandler(const CDBusMessage &message) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CSettings &m_pluginSettings;
|
||||||
|
|
||||||
DataRef<xplane::data::sim::weather::use_real_weather_bool> m_useRealWeather;
|
DataRef<xplane::data::sim::weather::use_real_weather_bool> m_useRealWeather;
|
||||||
DataRef<xplane::data::sim::weather::visibility_reported_m> m_visibilityM;
|
DataRef<xplane::data::sim::weather::visibility_reported_m> m_visibilityM;
|
||||||
DataRef<xplane::data::sim::weather::rain_percent> m_precipRatio;
|
DataRef<xplane::data::sim::weather::rain_percent> m_precipRatio;
|
||||||
|
|||||||
Reference in New Issue
Block a user