Move dbus connection into base sensor object
This seems common through most sensors, might as
well move it for consistency.
Tested: sensors operational as normal
Change-Id: I4e6c55cbb7171ee51700015f8c2ef8c05c90fb4e
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index aa7b50e..7afb2ab 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -56,7 +56,7 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration,
"xyz.openbmc_project.Configuration.ADC", maxReading, minReading,
- readState),
+ conn, readState),
std::enable_shared_from_this<ADCSensor>(), objServer(objectServer),
inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path),
scaleFactor(scaleFactor), bridgeGpio(std::move(bridgeGpio)),
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 4377bf9..684c430 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -44,7 +44,7 @@
bool show, double dtsOffset) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
- minReading, PowerState::on),
+ minReading, conn, PowerState::on),
objServer(objectServer), inputDev(io), waitTimer(io), path(path),
privTcontrol(std::numeric_limits<double>::quiet_NaN()),
dtsOffset(dtsOffset), show(show), pollTime(CPUSensor::sensorPollMs),
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 7197c4a..41d9a19 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -166,9 +166,9 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(thresholdData), sensorConfiguration,
"xyz.openbmc_project.Configuration.ExitAirTemp", cfmMaxReading,
- cfmMinReading, PowerState::on),
+ cfmMinReading, conn, PowerState::on),
std::enable_shared_from_this<CFMSensor>(), parent(parent),
- dbusConnection(conn), objServer(objectServer)
+ objServer(objectServer)
{
sensorInterface =
objectServer.add_interface("/xyz/openbmc_project/sensors/cfm/" + name,
@@ -494,9 +494,8 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(thresholdData), sensorConfiguration,
"xyz.openbmc_project.Configuration.ExitAirTemp", exitAirMaxReading,
- exitAirMinReading, PowerState::on),
- std::enable_shared_from_this<ExitAirTempSensor>(), dbusConnection(conn),
- objServer(objectServer)
+ exitAirMinReading, conn, PowerState::on),
+ std::enable_shared_from_this<ExitAirTempSensor>(), objServer(objectServer)
{
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/temperature/" + name,
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 35dc5f3..eaaa9e8 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -48,7 +48,7 @@
const std::string& sensorConfiguration, const PowerState powerState) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
- minReading, powerState),
+ minReading, conn, powerState),
std::enable_shared_from_this<HwmonTempSensor>(), objServer(objectServer),
inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), path(path)
{
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index a7c1e09..dccdffb 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -69,9 +69,8 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(thresholdData), sensorConfiguration,
"xyz.openbmc_project.Configuration.ExitAirTemp", ipmbMaxReading,
- ipmbMinReading, PowerState::on),
- deviceAddress(deviceAddress), objectServer(objectServer),
- dbusConnection(conn), waitTimer(io)
+ ipmbMinReading, conn, PowerState::on),
+ deviceAddress(deviceAddress), objectServer(objectServer), waitTimer(io)
{
std::string dbusPath = sensorPathPrefix + sensorTypeName + "/" + name;
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index 69a3226..6d94bd2 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -63,9 +63,9 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(thresholdData), sensorConfiguration,
"xyz.openbmc_project.Configuration.ExitAirTemp", mcuTempMaxReading,
- mcuTempMinReading),
+ mcuTempMinReading, conn),
busId(busId), mcuAddress(mcuAddress), tempReg(tempReg),
- objectServer(objectServer), dbusConnection(conn), waitTimer(io)
+ objectServer(objectServer), waitTimer(io)
{
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/temperature/" + name,
diff --git a/src/NVMeSensor.cpp b/src/NVMeSensor.cpp
index cbc88ec..46b2b52 100644
--- a/src/NVMeSensor.cpp
+++ b/src/NVMeSensor.cpp
@@ -432,7 +432,7 @@
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration,
"xyz.openbmc_project.Configuration.NVMe", maxReading, minReading,
- PowerState::on),
+ conn, PowerState::on),
objServer(objectServer), bus(busNumber)
{
sensorInterface = objectServer.add_interface(
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index f93846d..0086382 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -46,7 +46,8 @@
double max, double min, const std::string& label,
size_t tSize) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
- std::move(_thresholds), sensorConfiguration, objectType, max, min),
+ std::move(_thresholds), sensorConfiguration, objectType, max, min,
+ conn),
std::enable_shared_from_this<PSUSensor>(), objServer(objectServer),
inputDev(io), waitTimer(io), path(path), sensorFactor(factor)
{
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index acfe659..d39e92c 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -53,7 +53,7 @@
const std::pair<size_t, size_t>& limits,
const PowerState& powerState) :
Sensor(boost::replace_all_copy(fanName, " ", "_"), std::move(_thresholds),
- sensorConfiguration, objectType, limits.second, limits.first,
+ sensorConfiguration, objectType, limits.second, limits.first, conn,
powerState),
objServer(objectServer), redundancy(redundancy),
presence(std::move(presenceSensor)),