Move DBus event processing from DBusConnection to DBusDispatcher

ref T291
This commit is contained in:
Roland Winklmeier
2018-07-26 22:26:45 +02:00
committed by Klaus Basan
parent 59da68da5e
commit a764fa0d03
6 changed files with 414 additions and 316 deletions

View File

@@ -68,7 +68,7 @@ namespace XSwiftBus
m_traffic->setPlaneViewMenu(m_planeViewSubMenu);
// Todo: retry if it fails
bool success = m_dbusConnection->connect(CDBusConnection::SessionBus, xswiftbusServiceName());
bool success = m_dbusConnection->connect(CDBusConnection::SessionBus);
if (!success)
{
@@ -76,6 +76,9 @@ namespace XSwiftBus
return;
}
m_dbusConnection->setDispatcher(&m_dbusDispatcher);
m_dbusConnection->requestName(xswiftbusServiceName());
m_service->setDBusConnection(m_dbusConnection);
m_service->registerDBusObjectPath(m_service->InterfaceName(), m_service->ObjectPath());
m_traffic->setDBusConnection(m_dbusConnection);
@@ -83,6 +86,7 @@ namespace XSwiftBus
m_weather->setDBusConnection(m_dbusConnection);
m_weather->registerDBusObjectPath(m_weather->InterfaceName(), m_weather->ObjectPath());
INFO_LOG("XSwiftBus started.");
}
@@ -117,6 +121,7 @@ namespace XSwiftBus
float CPlugin::flightLoopCallback(float, float, int, void *refcon)
{
auto *plugin = static_cast<CPlugin *>(refcon);
plugin->m_dbusDispatcher.runOnce();
if (plugin->m_service) { plugin->m_service->processDBus(); }
if (plugin->m_weather) { plugin->m_weather->processDBus(); }
if (plugin->m_traffic) { plugin->m_traffic->processDBus(); }