monitor: Support for running with power off

Put in the remaining changes necessary so that fan monitor doesn't need
to be killed when power turns off.

This includes things like:
* Support for starting before the Present property is on D-Bus.
* Support for starting before the config file name is available.
* Stopping any running timers when power is turned off.
* Checking the power off rules when power turns on.

Most, but not all, of the changes are common between the JSON and YAML
modes, but this only truly supported when compiled for JSON.

This also removes the init vs monitor modes of operation, if compiled
for JSON.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ic2c6848f24511c9dc763227e05bbebb4c8c80cd1
diff --git a/monitor/system.hpp b/monitor/system.hpp
index a0030da..e01d81a 100644
--- a/monitor/system.hpp
+++ b/monitor/system.hpp
@@ -49,7 +49,6 @@
 
     /**
      * Constructor
-     * Parses and populates the fan monitor trust groups and list of fans
      *
      * @param[in] mode - mode of fan monitor
      * @param[in] bus - sdbusplus bus object
@@ -100,6 +99,26 @@
      */
     void logShutdownError();
 
+    /**
+     * @brief Returns true if power is on
+     */
+    bool isPowerOn() const
+    {
+        return _powerState->isPowerOn();
+    }
+
+    /**
+     * @brief Parses and populates the fan monitor
+     *        trust groups and list of fans
+     *
+     * @param[in] confFile - The config file path
+     */
+    void start(
+#ifdef MONITOR_USE_JSON
+        const std::string& confFile
+#endif
+    );
+
   private:
     /* The mode of fan monitor */
     Mode _mode;
@@ -151,6 +170,11 @@
     ThermalAlertObject _thermalAlert;
 
     /**
+     * @brief If start() has been called
+     */
+    bool _started = false;
+
+    /**
      * @brief Captures tach sensor data as JSON for use in
      *        fan fault and fan missing event logs.
      *