Introduce interval configuration for sensor reads.
This introduces the ability to specify in the sensor label configuration
file, a specific sleep interval. The interval is in this file to allow
straightforward interval control over the sensors listed in that file.
Sensors grouped in the same file are treated as a group and run within
the same instance.
Tested: I tested setting the interval in one of four running
configurations and the change was picked up in that configuration while
the others ran at the default interval.
Resolves openbmc/phosphor-hwmon#5
Change-Id: Ia9e474bc446090c8ac95dc2e6bf23a4fd6ccf7b7
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/mainloop.hpp b/mainloop.hpp
index f48e590..d4ef2c4 100644
--- a/mainloop.hpp
+++ b/mainloop.hpp
@@ -7,6 +7,8 @@
#include "sensorset.hpp"
#include "interface.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>;
@@ -71,4 +73,6 @@
const char* _root;
/** @brief DBus object state. */
SensorState state;
+ /** @brief Sleep interval in microseconds. */
+ uint64_t _interval = default_interval;
};