Add sensor object framework
Create a sensor object to store sensor monitoring specifications.
Tested:
Sensor objects are created and stored for each sensor
Change-Id: Idfa982f1bb8da888abbd473881870df4beec6824
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/mainloop.hpp b/mainloop.hpp
index d420c28..c3ed161 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -6,19 +6,16 @@
#include <experimental/optional>
#include <memory>
#include <sdbusplus/server.hpp>
+#include "types.hpp"
#include "hwmonio.hpp"
#include "sensorset.hpp"
#include "sysfs.hpp"
#include "interface.hpp"
#include "timer.hpp"
+#include "sensor.hpp"
static constexpr auto default_interval = 1000000;
-using Object = std::map<InterfaceType, std::experimental::any>;
-using ObjectInfo = std::tuple<sdbusplus::bus::bus*, std::string, Object>;
-using RetryIO = std::tuple<size_t, std::chrono::milliseconds>;
-using ObjectStateData = std::pair<std::string, ObjectInfo>;
-
static constexpr auto sensorID = 0;
static constexpr auto sensorLabel = 1;
using SensorIdentifiers = std::tuple<std::string, std::string>;
@@ -108,6 +105,9 @@
std::unique_ptr<phosphor::hwmon::Timer> timer;
/** @brief the sd_event structure */
sd_event* loop = nullptr;
+ /** @brief Store the specifications of sensor objects */
+ std::map<SensorSet::key_type,
+ std::unique_ptr<sensor::Sensor>> sensorObjects;
/**
* @brief Map of removed sensors