std::variant: Fix use of incompatible api
Refactors any uses of the mapbox variant specific api and converts them
to an api compatible with std::variant and mapbox variant.
Tested:
Built and run through the unit test suite.
Change-Id: Ie9b83fd638c495859fe98b5de86d9d3c7c1a27af
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index d721460..16cecec 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -89,7 +89,7 @@
goto fail;
}
- if (pgood == 1)
+ if (sdbusplus::message::variant_ns::get<int>(pgood) == 1)
{
log<level::INFO>("Initial Chassis State will be On",
entry("CHASSIS_CURRENT_POWER_STATE=%s",
@@ -204,14 +204,10 @@
}
result.read(currentState);
-
- if (currentState != ACTIVE_STATE && currentState != ACTIVATING_STATE)
- {
- // False - not active
- return false;
- }
- // True - active
- return true;
+ const auto& currentStateStr =
+ sdbusplus::message::variant_ns::get<std::string>(currentState);
+ return currentStateStr == ACTIVE_STATE ||
+ currentStateStr == ACTIVATING_STATE;
}
int Chassis::sysStateChange(sdbusplus::message::message& msg)