mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +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; }
|
||||
CXSwiftBusSettings s = m_xSwiftBusServerSettings.get();
|
||||
s.setCurrentUtcTime();
|
||||
m_serviceProxy->setSettings(s.toXSwiftBusJsonStringQt());
|
||||
m_serviceProxy->setSettingsJson(s.toXSwiftBusJsonStringQt());
|
||||
CLogMessage(this).info(u"Send settings: %1") << s.toQString(true);
|
||||
return true;
|
||||
}
|
||||
@@ -1076,7 +1076,7 @@ namespace BlackSimPlugin
|
||||
if (!this->isConnected()) { return s; }
|
||||
if (!m_serviceProxy) { return s; }
|
||||
|
||||
const QString json = m_serviceProxy->getSettings();
|
||||
const QString json = m_serviceProxy->getSettingsJson();
|
||||
s.parseXSwiftBusStringQt(json);
|
||||
ok = true;
|
||||
return s;
|
||||
|
||||
@@ -506,19 +506,19 @@ namespace BlackSimPlugin
|
||||
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
|
||||
|
||||
@@ -389,12 +389,12 @@ namespace BlackSimPlugin
|
||||
|
||||
//! \copydoc XSwiftBus::CService::getSettings
|
||||
//! @{
|
||||
QString getSettings() const;
|
||||
void getSettingsAsync(QString *o_jsonSettings);
|
||||
QString getSettingsJson() const;
|
||||
void getSettingsJsonAsync(QString *o_jsonSettings);
|
||||
//! @}
|
||||
|
||||
//! \copydoc XSwiftBus::CService::setSettings
|
||||
void setSettings(const QString &json);
|
||||
void setSettingsJson(const QString &json);
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -157,15 +157,15 @@ namespace XSwiftBus
|
||||
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);
|
||||
s_settingsProvider->setSettings(s);
|
||||
this->setSettings(s);
|
||||
INFO_LOG("Received settings " + s.convertToString());
|
||||
}
|
||||
|
||||
@@ -666,14 +666,14 @@ namespace XSwiftBus
|
||||
toggleMessageBoxVisibility();
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "getSettings")
|
||||
else if (message.getMethodName() == "getSettingsJson")
|
||||
{
|
||||
queueDBusCall([ = ]()
|
||||
{
|
||||
sendDBusReply(sender, serial, getSettings());
|
||||
sendDBusReply(sender, serial, getSettingsJson());
|
||||
});
|
||||
}
|
||||
else if (message.getMethodName() == "setSettings")
|
||||
else if (message.getMethodName() == "setSettingsJson")
|
||||
{
|
||||
maybeSendEmptyDBusReply(wantsReply, sender, serial);
|
||||
std::string json;
|
||||
@@ -681,7 +681,7 @@ namespace XSwiftBus
|
||||
message.getArgument(json);
|
||||
queueDBusCall([ = ]()
|
||||
{
|
||||
setSettings(json);
|
||||
setSettingsJson(json);
|
||||
});
|
||||
}
|
||||
else
|
||||
|
||||
@@ -235,10 +235,10 @@ namespace XSwiftBus
|
||||
void setDisappearMessageWindow(bool enabled) { m_disappearMessageWindow = enabled; }
|
||||
|
||||
//! Get settings in JSON format
|
||||
std::string getSettings() const;
|
||||
std::string getSettingsJson() const;
|
||||
|
||||
//! Set settings
|
||||
void setSettings(const std::string &jsonString);
|
||||
void setSettingsJson(const std::string &jsonString);
|
||||
|
||||
//! Perform generic processing
|
||||
int process();
|
||||
|
||||
Reference in New Issue
Block a user