monitor: Use new JsonConfig object

To simplify handling the loading of config files, use the updated
JsonConfig object that populates the available compatibility values used
when retrieving the JSON file and loading it. The given load function is
called if compatibility values are found upon being constructed or after
an interfacesAdded signal is received, which then it can call
`getConfFile` to find the JSON config file to be loaded.

Change-Id: Ifc164d36c036cf0ff810018d40e8de52efc6ca58
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/monitor/main.cpp b/monitor/main.cpp
index fc19827..0949c77 100644
--- a/monitor/main.cpp
+++ b/monitor/main.cpp
@@ -71,9 +71,7 @@
 
 #ifdef MONITOR_USE_JSON
 
-    phosphor::fan::JsonConfig config(
-        bus, confAppName, confFileName,
-        std::bind(&System::start, &system, std::placeholders::_1));
+    phosphor::fan::JsonConfig config(std::bind(&System::start, &system));
 
     // Enable SIGHUP handling to reload JSON config
     stdplus::signal::block(SIGHUP);
diff --git a/monitor/system.cpp b/monitor/system.cpp
index a6af9bf..22279da 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -50,15 +50,13 @@
     _thermalAlert(bus, THERMAL_ALERT_OBJPATH)
 {}
 
-void System::start(
-#ifdef MONITOR_USE_JSON
-    const std::string& confFile
-#endif
-)
+void System::start()
 {
     _started = true;
     json jsonObj = json::object();
 #ifdef MONITOR_USE_JSON
+    auto confFile =
+        fan::JsonConfig::getConfFile(_bus, confAppName, confFileName);
     jsonObj = fan::JsonConfig::load(confFile);
 #endif
     // Retrieve and set trust groups within the trust manager
diff --git a/monitor/system.hpp b/monitor/system.hpp
index df03fe2..3b4c309 100644
--- a/monitor/system.hpp
+++ b/monitor/system.hpp
@@ -109,16 +109,9 @@
     }
 
     /**
-     * @brief Parses and populates the fan monitor
-     *        trust groups and list of fans
-     *
-     * @param[in] confFile - The config file path
+     * @brief Parses and populates the fan monitor trust groups and list of fans
      */
-    void start(
-#ifdef MONITOR_USE_JSON
-        const std::string& confFile
-#endif
-    );
+    void start();
 
   private:
     /* The mode of fan monitor */