psu: Add code to get pollInterval from JSON file
Add in a helper function to open JSON file and parse out the configuration
properties. Use the helper function to get the pollInterval in the constructor.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: Ia8cf1c148a1685e2e09703c02e469a0bff034af5
diff --git a/phosphor-power-supply/main.cpp b/phosphor-power-supply/main.cpp
index 2622c6a..03ff3db 100644
--- a/phosphor-power-supply/main.cpp
+++ b/phosphor-power-supply/main.cpp
@@ -22,7 +22,7 @@
#include <filesystem>
-using namespace phosphor::power::manager;
+using namespace phosphor::power;
int main(int argc, char* argv[])
{
@@ -57,9 +57,7 @@
// handle both sd_events (for the timers) and dbus signals.
bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
- // TODO: Should get polling interval from JSON file.
- auto pollInterval = std::chrono::milliseconds(1000);
- PSUManager manager(bus, event, pollInterval);
+ manager::PSUManager manager(bus, event, configfile);
return manager.run();
}