Removed redundant string parsing

Newer sdbusplus builds support the converting of enumerations
to read directly as an std::string which eliminates the need
to unnecessarily parse them as strings.

Signed-off-by: Corey Hardesty <corey.hardesty@icloud.com>
Change-Id: Ic58b0ebac9c4769cc6aff291e9a1a48dcb16ed18
diff --git a/host_check.cpp b/host_check.cpp
index f834c42..2bdcb1f 100644
--- a/host_check.cpp
+++ b/host_check.cpp
@@ -9,6 +9,7 @@
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/exception.hpp>
 #include <xyz/openbmc_project/Condition/HostFirmware/server.hpp>
+#include <xyz/openbmc_project/State/Chassis/server.hpp>
 
 #include <cstdio>
 #include <cstdlib>
@@ -47,6 +48,7 @@
 // running over it
 bool checkFirmwareConditionRunning(sdbusplus::bus::bus& bus)
 {
+    using FirmwareCondition = HostFirmware::FirmwareCondition;
     // Find all implementations of host firmware condition interface
     auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
                                       MAPPER_INTERFACE, "GetSubTree");
@@ -100,13 +102,12 @@
 
                 auto response = bus.call(method);
 
-                std::variant<std::string> currentFwCond;
-                response.read(currentFwCond);
+                std::variant<FirmwareCondition> currentFwCondV;
+                response.read(currentFwCondV);
+                auto currentFwCond =
+                    std::get<FirmwareCondition>(currentFwCondV);
 
-                if (std::get<std::string>(currentFwCond) ==
-                    "xyz.openbmc_project.Condition.HostFirmware."
-                    "FirmwareCondition."
-                    "Running")
+                if (currentFwCond == FirmwareCondition::Running)
                 {
                     return true;
                 }
@@ -131,17 +132,19 @@
 
     try
     {
+        using PowerState =
+            sdbusplus::xyz::openbmc_project::State::server::Chassis::PowerState;
         auto method = bus.new_method_call(svcname.c_str(), objpath.c_str(),
                                           PROPERTY_INTERFACE, "Get");
         method.append(CHASSIS_STATE_INTF, CHASSIS_STATE_POWER_PROP);
 
         auto response = bus.call(method);
 
-        std::variant<std::string> currentPowerState;
-        response.read(currentPowerState);
+        std::variant<PowerState> currentPowerStateV;
+        response.read(currentPowerStateV);
+        auto currentPowerState = std::get<PowerState>(currentPowerStateV);
 
-        if (std::get<std::string>(currentPowerState) ==
-            "xyz.openbmc_project.State.Chassis.PowerState.On")
+        if (currentPowerState == PowerState::On)
         {
             return true;
         }
diff --git a/host_reset_recovery.cpp b/host_reset_recovery.cpp
index aa26916..7898622 100644
--- a/host_reset_recovery.cpp
+++ b/host_reset_recovery.cpp
@@ -8,6 +8,7 @@
 #include <sdbusplus/exception.hpp>
 #include <xyz/openbmc_project/Logging/Create/server.hpp>
 #include <xyz/openbmc_project/Logging/Entry/server.hpp>
+#include <xyz/openbmc_project/State/Boot/Progress/server.hpp>
 
 #include <cstdlib>
 #include <fstream>
@@ -41,25 +42,27 @@
 {
     try
     {
+        using ProgressStages = sdbusplus::xyz::openbmc_project::State::Boot::
+            server::Progress::ProgressStages;
+
         auto method = bus.new_method_call(HOST_STATE_SVC, HOST_STATE_PATH,
                                           PROPERTY_INTERFACE, "Get");
         method.append(BOOT_STATE_INTF, BOOT_PROGRESS_PROP);
 
         auto response = bus.call(method);
 
-        std::variant<std::string> bootProgress;
-        response.read(bootProgress);
+        std::variant<ProgressStages> bootProgressV;
+        response.read(bootProgressV);
+        auto bootProgress = std::get<ProgressStages>(bootProgressV);
 
-        if (std::get<std::string>(bootProgress) ==
-            "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
-            "Unspecified")
+        if (bootProgress == ProgressStages::Unspecified)
         {
             info("Host was not booting before BMC reboot");
             return false;
         }
 
         info("Host was booting before BMC reboot: {BOOTPROGRESS}",
-             "BOOTPROGRESS", std::get<std::string>(bootProgress));
+             "BOOTPROGRESS", bootProgress);
     }
     catch (const sdbusplus::exception::exception& e)
     {