call auto power restart when chassis power recovers

When the power status transitions from bad to good, call the Auto
Power-on Restart (APR) functionality to see if the system should be
automatically powered back on.

In most cases, a power issue to the system will result in the BMC
losing power as well. The APR functionality already runs as a part of
the BMC boot. However there are a few situations where the chassis power
may need to be turned off but the BMC will continue to operate on
standby power. This commit addresses that scenario, where once the
chassis power can be turned back on, the BMC runs the APR logic.

This allows systems to get up and running automatically after brownout
and UPS battery low issues.

Note that a change to phosphor-state-manager-systemd-links.inc is
required here to make the APR service a WantedBy vs. RequiredBy
relationship. Restarting a service that is required by multi-user.target
restarts all the other oneshot service in multi-user.target which is not
wanted here. This change will be included with the bump of this
function.

Tested:
- Verified system called APR when CurrentPowerStatus went from
  UninterruptiblePowerSupply to Good
- Verified system did not power on when APR was not set to AlwaysOn
- Verified system did power on when APR was set to AlwaysOn

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: If9a5e1a91eb8da6e39e021900ad07848eebbdd02
diff --git a/chassis_state_manager.hpp b/chassis_state_manager.hpp
index 82ad2d1..e282463 100644
--- a/chassis_state_manager.hpp
+++ b/chassis_state_manager.hpp
@@ -60,12 +60,15 @@
                          std::bind(&Chassis::pohCallback, this),
                          std::chrono::hours{1}, std::chrono::minutes{1})
     {
+
         subscribeToSystemdSignals();
 
         createSystemdTargetTable();
 
         restoreChassisStateChangeTime();
 
+        // No default in PDI so start at Good, skip D-Bus signal for now
+        currentPowerStatus(PowerStatus::Good, true);
         determineInitialState();
 
         restorePOHCounter(); // restore POHCounter from persisted file
@@ -129,6 +132,15 @@
      */
     void startUnit(const std::string& sysdUnit);
 
+    /** @brief Restart the systemd unit requested
+     *
+     * This function calls `RestartUnit` on the systemd unit given.
+     * This is useful when needing to restart a service that is already running
+     *
+     * @param[in] sysdUnit    - Systemd unit to restart
+     */
+    void restartUnit(const std::string& sysdUnit);
+
     /**
      * @brief Determine if target is active
      *