Follow up on Todo, move path out of base sensor
Not every sensor needs a sysfs path, because of that
move it out of the base class and into the classes that
need it.
Change-Id: I62b7df681e1ee889eb66e371d1cd6094097e9f21
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/ADCSensor.cpp b/src/ADCSensor.cpp
index a8d98ae..c94f251 100644
--- a/src/ADCSensor.cpp
+++ b/src/ADCSensor.cpp
@@ -64,10 +64,10 @@
const double scaleFactor, PowerState readState,
const std::string& sensorConfiguration,
std::optional<int> bridgeGpio) :
- Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
+ Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration,
"xyz.openbmc_project.Configuration.ADC", maxReading, minReading),
- objServer(objectServer), scaleFactor(scaleFactor),
+ objServer(objectServer), scaleFactor(scaleFactor), path(path),
readState(std::move(readState)), inputDev(io, open(path.c_str(), O_RDONLY)),
waitTimer(io), errCount(0), thresholdTimer(io, this), bridgeGpio(bridgeGpio)
{
diff --git a/src/CPUSensor.cpp b/src/CPUSensor.cpp
index 4c5eb8b..0920754 100644
--- a/src/CPUSensor.cpp
+++ b/src/CPUSensor.cpp
@@ -34,11 +34,11 @@
std::vector<thresholds::Threshold>&& _thresholds,
const std::string& sensorConfiguration, int cpuId,
bool show) :
- Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
+ Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
minReading),
objServer(objectServer), inputDev(io, open(path.c_str(), O_RDONLY)),
- waitTimer(io), show(show),
+ path(path), waitTimer(io), show(show),
privTcontrol(std::numeric_limits<double>::quiet_NaN()), errCount(0)
{
nameTcontrol = labelTcontrol;
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index 8779be0..a4aba4b 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -152,9 +152,9 @@
std::vector<thresholds::Threshold>&& thresholdData,
std::shared_ptr<ExitAirTempSensor>& parent) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
- "" /* todo: remove arg from base*/, std::move(thresholdData),
- sensorConfiguration, "xyz.openbmc_project.Configuration.ExitAirTemp",
- cfmMaxReading, cfmMinReading),
+ std::move(thresholdData), sensorConfiguration,
+ "xyz.openbmc_project.Configuration.ExitAirTemp", cfmMaxReading,
+ cfmMinReading),
dbusConnection(conn), parent(parent), objServer(objectServer)
{
sensorInterface =
@@ -471,9 +471,9 @@
sdbusplus::asio::object_server& objectServer,
std::vector<thresholds::Threshold>&& thresholdData) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
- "" /* todo: remove arg from base*/, std::move(thresholdData),
- sensorConfiguration, "xyz.openbmc_project.Configuration.ExitAirTemp",
- exitAirMaxReading, exitAirMinReading),
+ std::move(thresholdData), sensorConfiguration,
+ "xyz.openbmc_project.Configuration.ExitAirTemp", exitAirMaxReading,
+ exitAirMinReading),
dbusConnection(conn), objServer(objectServer)
{
sensorInterface = objectServer.add_interface(
diff --git a/src/HwmonTempSensor.cpp b/src/HwmonTempSensor.cpp
index 8472012..09161e4 100644
--- a/src/HwmonTempSensor.cpp
+++ b/src/HwmonTempSensor.cpp
@@ -40,11 +40,11 @@
boost::asio::io_service& io, const std::string& sensorName,
std::vector<thresholds::Threshold>&& _thresholds,
const std::string& sensorConfiguration) :
- Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
+ Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, maxReading,
minReading),
- objServer(objectServer), inputDev(io, open(path.c_str(), O_RDONLY)),
- waitTimer(io), errCount(0)
+ path(path), objServer(objectServer),
+ inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), errCount(0)
{
sensorInterface = objectServer.add_interface(
"/xyz/openbmc_project/sensors/temperature/" + name,
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index b8dd220..5c76e8b 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -57,9 +57,9 @@
std::vector<thresholds::Threshold>&& thresholdData,
uint8_t deviceAddress) :
Sensor(boost::replace_all_copy(sensorName, " ", "_"),
- "" /* todo: remove arg from base*/, std::move(thresholdData),
- sensorConfiguration, "xyz.openbmc_project.Configuration.ExitAirTemp",
- ipmbMaxReading, ipmbMinReading),
+ std::move(thresholdData), sensorConfiguration,
+ "xyz.openbmc_project.Configuration.ExitAirTemp", ipmbMaxReading,
+ ipmbMinReading),
objectServer(objectServer), dbusConnection(conn), waitTimer(io),
deviceAddress(deviceAddress)
{
diff --git a/src/PSUSensor.cpp b/src/PSUSensor.cpp
index 86997d3..fdd453a 100644
--- a/src/PSUSensor.cpp
+++ b/src/PSUSensor.cpp
@@ -36,10 +36,11 @@
const std::string& sensorConfiguration,
std::string& sensorTypeName, unsigned int factor,
double max, double min) :
- Sensor(boost::replace_all_copy(sensorName, " ", "_"), path,
+ Sensor(boost::replace_all_copy(sensorName, " ", "_"),
std::move(_thresholds), sensorConfiguration, objectType, max, min),
- objServer(objectServer), inputDev(io, open(path.c_str(), O_RDONLY)),
- waitTimer(io), errCount(0), sensorFactor(factor)
+ path(path), objServer(objectServer),
+ inputDev(io, open(path.c_str(), O_RDONLY)), waitTimer(io), errCount(0),
+ sensorFactor(factor)
{
std::string dbusPath = sensorPathPrefix + sensorTypeName + name;
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index bbd382f..aeef7c5 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -42,10 +42,9 @@
std::vector<thresholds::Threshold>&& _thresholds,
const std::string& sensorConfiguration,
const std::pair<size_t, size_t>& limits) :
- Sensor(boost::replace_all_copy(fanName, " ", "_"), path,
- std::move(_thresholds), sensorConfiguration, objectType,
- limits.second, limits.first),
- objServer(objectServer), presence(std::move(presenceSensor)),
+ Sensor(boost::replace_all_copy(fanName, " ", "_"), std::move(_thresholds),
+ sensorConfiguration, objectType, limits.second, limits.first),
+ path(path), objServer(objectServer), presence(std::move(presenceSensor)),
redundancy(redundancy), inputDev(io, open(path.c_str(), O_RDONLY)),
waitTimer(io), errCount(0)
{