mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
Ref T709, changed DBus function to get/setSettingsJson, disambiguate from get/setSettings (returning CSettings)
This commit is contained in:
committed by
Mat Sutcliffe
parent
77883edf9c
commit
79f347cc1b
@@ -1063,7 +1063,7 @@ namespace BlackSimPlugin
|
|||||||
if (!m_serviceProxy) { return false; }
|
if (!m_serviceProxy) { return false; }
|
||||||
CXSwiftBusSettings s = m_xSwiftBusServerSettings.get();
|
CXSwiftBusSettings s = m_xSwiftBusServerSettings.get();
|
||||||
s.setCurrentUtcTime();
|
s.setCurrentUtcTime();
|
||||||
m_serviceProxy->setSettings(s.toXSwiftBusJsonStringQt());
|
m_serviceProxy->setSettingsJson(s.toXSwiftBusJsonStringQt());
|
||||||
CLogMessage(this).info(u"Send settings: %1") << s.toQString(true);
|
CLogMessage(this).info(u"Send settings: %1") << s.toQString(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1076,7 +1076,7 @@ namespace BlackSimPlugin
|
|||||||
if (!this->isConnected()) { return s; }
|
if (!this->isConnected()) { return s; }
|
||||||
if (!m_serviceProxy) { return s; }
|
if (!m_serviceProxy) { return s; }
|
||||||
|
|
||||||
const QString json = m_serviceProxy->getSettings();
|
const QString json = m_serviceProxy->getSettingsJson();
|
||||||
s.parseXSwiftBusStringQt(json);
|
s.parseXSwiftBusStringQt(json);
|
||||||
ok = true;
|
ok = true;
|
||||||
return s;
|
return s;
|
||||||
|
|||||||
@@ -506,19 +506,19 @@ namespace BlackSimPlugin
|
|||||||
m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
|
m_dbusInterface->callDBusAsync(QLatin1String("getSpeedBrakeRatio"), setterCallback(o_speedBrakeRatio));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CXSwiftBusServiceProxy::getSettings() const
|
QString CXSwiftBusServiceProxy::getSettingsJson() const
|
||||||
{
|
{
|
||||||
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettings"));
|
return m_dbusInterface->callDBusRet<QString>(QLatin1String("getSettingsJson"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusServiceProxy::getSettingsAsync(QString *o_jsonSettings)
|
void CXSwiftBusServiceProxy::getSettingsJsonAsync(QString *o_jsonSettings)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBusAsync(QLatin1String("getSettings"), setterCallback(o_jsonSettings));
|
m_dbusInterface->callDBusAsync(QLatin1String("getSettingsJson"), setterCallback(o_jsonSettings));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXSwiftBusServiceProxy::setSettings(const QString &json)
|
void CXSwiftBusServiceProxy::setSettingsJson(const QString &json)
|
||||||
{
|
{
|
||||||
m_dbusInterface->callDBus(QLatin1String("setSettings"), json);
|
m_dbusInterface->callDBus(QLatin1String("setSettingsJson"), json);
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -389,12 +389,12 @@ namespace BlackSimPlugin
|
|||||||
|
|
||||||
//! \copydoc XSwiftBus::CService::getSettings
|
//! \copydoc XSwiftBus::CService::getSettings
|
||||||
//! @{
|
//! @{
|
||||||
QString getSettings() const;
|
QString getSettingsJson() const;
|
||||||
void getSettingsAsync(QString *o_jsonSettings);
|
void getSettingsJsonAsync(QString *o_jsonSettings);
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! \copydoc XSwiftBus::CService::setSettings
|
//! \copydoc XSwiftBus::CService::setSettings
|
||||||
void setSettings(const QString &json);
|
void setSettingsJson(const QString &json);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -157,15 +157,15 @@ namespace XSwiftBus
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CService::getSettings() const
|
std::string CService::getSettingsJson() const
|
||||||
{
|
{
|
||||||
return s_settingsProvider->getSettings().toXSwiftBusJsonString();
|
return this->getSettings().toXSwiftBusJsonString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CService::setSettings(const std::string &jsonString)
|
void CService::setSettingsJson(const std::string &jsonString)
|
||||||
{
|
{
|
||||||
const CSettings s(jsonString);
|
const CSettings s(jsonString);
|
||||||
s_settingsProvider->setSettings(s);
|
this->setSettings(s);
|
||||||
INFO_LOG("Received settings " + s.convertToString());
|
INFO_LOG("Received settings " + s.convertToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -666,14 +666,14 @@ namespace XSwiftBus
|
|||||||
toggleMessageBoxVisibility();
|
toggleMessageBoxVisibility();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.getMethodName() == "getSettings")
|
else if (message.getMethodName() == "getSettingsJson")
|
||||||
{
|
{
|
||||||
queueDBusCall([ = ]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
sendDBusReply(sender, serial, getSettings());
|
sendDBusReply(sender, serial, getSettingsJson());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.getMethodName() == "setSettings")
|
else if (message.getMethodName() == "setSettingsJson")
|
||||||
{
|
{
|
||||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||||
std::string json;
|
std::string json;
|
||||||
@@ -681,7 +681,7 @@ namespace XSwiftBus
|
|||||||
message.getArgument(json);
|
message.getArgument(json);
|
||||||
queueDBusCall([ = ]()
|
queueDBusCall([ = ]()
|
||||||
{
|
{
|
||||||
setSettings(json);
|
setSettingsJson(json);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -235,10 +235,10 @@ namespace XSwiftBus
|
|||||||
void setDisappearMessageWindow(bool enabled) { m_disappearMessageWindow = enabled; }
|
void setDisappearMessageWindow(bool enabled) { m_disappearMessageWindow = enabled; }
|
||||||
|
|
||||||
//! Get settings in JSON format
|
//! Get settings in JSON format
|
||||||
std::string getSettings() const;
|
std::string getSettingsJson() const;
|
||||||
|
|
||||||
//! Set settings
|
//! Set settings
|
||||||
void setSettings(const std::string &jsonString);
|
void setSettingsJson(const std::string &jsonString);
|
||||||
|
|
||||||
//! Perform generic processing
|
//! Perform generic processing
|
||||||
int process();
|
int process();
|
||||||
|
|||||||
Reference in New Issue
Block a user