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/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;