dbushelper: drop obsolete parameter from interface
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Idebae41e021f54c3670cc22aa6c784549a361c23
diff --git a/dbus/dbusactiveread.cpp b/dbus/dbusactiveread.cpp
index b21922c..689a85d 100644
--- a/dbus/dbusactiveread.cpp
+++ b/dbus/dbusactiveread.cpp
@@ -31,7 +31,7 @@
struct SensorProperties settings;
double value;
- _helper->getProperties(_bus, _service, _path, &settings);
+ _helper->getProperties(_service, _path, &settings);
value = settings.value * pow(10, settings.scale);
diff --git a/dbus/dbusconfiguration.cpp b/dbus/dbusconfiguration.cpp
index 341a204..bcdea89 100644
--- a/dbus/dbusconfiguration.cpp
+++ b/dbus/dbusconfiguration.cpp
@@ -392,12 +392,12 @@
const std::string& path = sensorConfig[info.inputs.front()].readPath;
DbusHelper helper(sdbusplus::bus::new_system());
- std::string service = helper.getService(bus, interface, path);
+ std::string service = helper.getService(interface, path);
double reading = 0;
try
{
- helper.getProperty(bus, service, path, interface,
- *thresholdProperty, reading);
+ helper.getProperty(service, path, interface, *thresholdProperty,
+ reading);
}
catch (const sdbusplus::exception::SdBusError& ex)
{
diff --git a/dbus/dbushelper.cpp b/dbus/dbushelper.cpp
index f8f087d..f7dbe41 100644
--- a/dbus/dbushelper.cpp
+++ b/dbus/dbushelper.cpp
@@ -39,8 +39,7 @@
/* TODO(venture): Basically all phosphor apps need this, maybe it should be a
* part of sdbusplus. There is an old version in libmapper.
*/
-std::string DbusHelper::getService(sdbusplus::bus::bus& bus,
- const std::string& intf,
+std::string DbusHelper::getService(const std::string& intf,
const std::string& path)
{
auto mapper =
@@ -74,8 +73,7 @@
return response.begin()->first;
}
-void DbusHelper::getProperties(sdbusplus::bus::bus& bus,
- const std::string& service,
+void DbusHelper::getProperties(const std::string& service,
const std::string& path,
struct SensorProperties* prop)
{
@@ -136,8 +134,7 @@
return;
}
-bool DbusHelper::thresholdsAsserted(sdbusplus::bus::bus& bus,
- const std::string& service,
+bool DbusHelper::thresholdsAsserted(const std::string& service,
const std::string& path)
{
diff --git a/dbus/dbushelper.hpp b/dbus/dbushelper.hpp
index 0831bd4..b4d3aa0 100644
--- a/dbus/dbushelper.hpp
+++ b/dbus/dbushelper.hpp
@@ -29,20 +29,18 @@
DbusHelper(DbusHelper&&) = default;
DbusHelper& operator=(DbusHelper&&) = default;
- std::string getService(sdbusplus::bus::bus& bus, const std::string& intf,
+ std::string getService(const std::string& intf,
const std::string& path) override;
- void getProperties(sdbusplus::bus::bus& bus, const std::string& service,
- const std::string& path,
+ void getProperties(const std::string& service, const std::string& path,
struct SensorProperties* prop) override;
- bool thresholdsAsserted(sdbusplus::bus::bus& bus,
- const std::string& service,
+ bool thresholdsAsserted(const std::string& service,
const std::string& path) override;
template <typename T>
- void getProperty(sdbusplus::bus::bus& bus, const std::string& service,
- const std::string& path, const std::string& interface,
+ void getProperty(const std::string& service, const std::string& path,
+ const std::string& interface,
const std::string& propertyName, T& prop)
{
namespace log = phosphor::logging;
diff --git a/dbus/dbushelper_interface.hpp b/dbus/dbushelper_interface.hpp
index c7c2c90..4dbf00c 100644
--- a/dbus/dbushelper_interface.hpp
+++ b/dbus/dbushelper_interface.hpp
@@ -1,7 +1,5 @@
#pragma once
-#include <sdbusplus/bus.hpp>
-
#include <cstdint>
#include <string>
@@ -26,8 +24,7 @@
*
* @warning Throws exception on dbus failure.
*/
- virtual std::string getService(sdbusplus::bus::bus& bus,
- const std::string& intf,
+ virtual std::string getService(const std::string& intf,
const std::string& path) = 0;
/** @brief Get all Sensor.Value properties for a service and path.
@@ -39,8 +36,7 @@
*
* @warning Throws exception on dbus failure.
*/
- virtual void getProperties(sdbusplus::bus::bus& bus,
- const std::string& service,
+ virtual void getProperties(const std::string& service,
const std::string& path,
struct SensorProperties* prop) = 0;
@@ -50,8 +46,7 @@
* @param[in] service - The service providing the interface.
* @param[in] path - The dbus path.
*/
- virtual bool thresholdsAsserted(sdbusplus::bus::bus& bus,
- const std::string& service,
+ virtual bool thresholdsAsserted(const std::string& service,
const std::string& path) = 0;
};
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index 84d1f93..ea47122 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -47,8 +47,6 @@
}
/* Need to get the scale and initial value */
- auto tempBus = sdbusplus::bus::new_system();
-
/* service == busname */
std::string path = getSensorPath(type, id);
@@ -57,10 +55,10 @@
try
{
- std::string service = helper->getService(tempBus, sensorintf, path);
+ std::string service = helper->getService(sensorintf, path);
- helper->getProperties(tempBus, service, path, &settings);
- failed = helper->thresholdsAsserted(tempBus, service, path);
+ helper->getProperties(service, path, &settings);
+ failed = helper->thresholdsAsserted(service, path);
}
catch (const std::exception& e)
{
diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp
index a6b2835..288cb1a 100644
--- a/dbus/dbuswrite.cpp
+++ b/dbus/dbuswrite.cpp
@@ -38,12 +38,11 @@
const std::string& path, int64_t min, int64_t max,
std::unique_ptr<DbusHelperInterface> helper)
{
- auto tempBus = sdbusplus::bus::new_system();
std::string connectionName;
try
{
- connectionName = helper->getService(tempBus, pwmInterface, path);
+ connectionName = helper->getService(pwmInterface, path);
}
catch (const std::exception& e)
{
@@ -93,12 +92,11 @@
int64_t max,
std::unique_ptr<DbusHelperInterface> helper)
{
- auto tempBus = sdbusplus::bus::new_system();
std::string connectionName;
try
{
- connectionName = helper->getService(tempBus, pwmInterface, path);
+ connectionName = helper->getService(pwmInterface, path);
}
catch (const std::exception& e)
{