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/include/ExitAirTempSensor.hpp b/include/ExitAirTempSensor.hpp
index e3c2ef5..2d69cec 100644
--- a/include/ExitAirTempSensor.hpp
+++ b/include/ExitAirTempSensor.hpp
@@ -42,7 +42,6 @@
boost::container::flat_map<std::string, double> tachReadings;
boost::container::flat_map<std::string, std::pair<double, double>>
tachRanges;
- std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
std::shared_ptr<sdbusplus::asio::dbus_interface> pwmLimitIface;
std::shared_ptr<sdbusplus::asio::dbus_interface> cfmLimitIface;
sdbusplus::asio::object_server& objServer;
@@ -81,7 +80,6 @@
std::vector<sdbusplus::bus::match::match> matches;
double inletTemp = std::numeric_limits<double>::quiet_NaN();
- std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
sdbusplus::asio::object_server& objServer;
std::chrono::time_point<std::chrono::system_clock> lastTime;
double getTotalCFM(void);
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index 3b3ee15..c3e7393 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -107,6 +107,5 @@
private:
sdbusplus::asio::object_server& objectServer;
- std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
boost::asio::deadline_timer waitTimer;
};
diff --git a/include/MCUTempSensor.hpp b/include/MCUTempSensor.hpp
index 74ba083..2f3aef4 100644
--- a/include/MCUTempSensor.hpp
+++ b/include/MCUTempSensor.hpp
@@ -31,6 +31,5 @@
private:
int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data);
sdbusplus::asio::object_server& objectServer;
- std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
boost::asio::deadline_timer waitTimer;
};
diff --git a/include/sensor.hpp b/include/sensor.hpp
index 7fa9300..6fd7e43 100644
--- a/include/sensor.hpp
+++ b/include/sensor.hpp
@@ -25,13 +25,14 @@
std::vector<thresholds::Threshold>&& thresholdData,
const std::string& configurationPath, const std::string& objectType,
const double max, const double min,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
PowerState readState = PowerState::always) :
name(std::regex_replace(name, std::regex("[^a-zA-Z0-9_/]+"), "_")),
configurationPath(configurationPath), objectType(objectType),
maxValue(max), minValue(min), thresholds(std::move(thresholdData)),
hysteresisTrigger((max - min) * 0.01),
- hysteresisPublish((max - min) * 0.0001), readState(readState),
- errCount(0)
+ hysteresisPublish((max - min) * 0.0001), dbusConnection(conn),
+ readState(readState), errCount(0)
{}
virtual ~Sensor() = default;
virtual void checkThresholds(void) = 0;
@@ -53,6 +54,7 @@
bool internalSet = false;
double hysteresisTrigger;
double hysteresisPublish;
+ std::shared_ptr<sdbusplus::asio::connection> dbusConnection;
PowerState readState;
size_t errCount;