action: use PDI type
Rather than define our own enumeration for the LED Actions,
reuse the one from Led.Physical's dbus interface.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I4615bed9e87c61d2632fe790bd50892a7f51e2ab
diff --git a/manager/json-parser.hpp b/manager/json-parser.hpp
index 76d84c7..4388a21 100644
--- a/manager/json-parser.hpp
+++ b/manager/json-parser.hpp
@@ -62,8 +62,8 @@
{
assert(action == "On" || action == "Blink");
- return action == "Blink" ? phosphor::led::Layout::Blink
- : phosphor::led::Layout::On;
+ return action == "Blink" ? phosphor::led::Layout::Action::Blink
+ : phosphor::led::Layout::Action::On;
}
/** @brief Validate the Priority of an LED is same across ALL groups
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index cd87bc2..2c93333 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -88,15 +88,15 @@
Layout::Action LampTest::getActionFromString(const std::string& str)
{
- Layout::Action action = Layout::Off;
+ Layout::Action action = Layout::Action::Off;
if (str == "xyz.openbmc_project.Led.Physical.Action.On")
{
- action = Layout::On;
+ action = Layout::Action::On;
}
else if (str == "xyz.openbmc_project.Led.Physical.Action.Blink")
{
- action = Layout::Blink;
+ action = Layout::Action::Blink;
}
return action;
@@ -151,10 +151,11 @@
}
phosphor::led::Layout::Action action = getActionFromString(state);
- if (action != phosphor::led::Layout::Off)
+ if (action != phosphor::led::Layout::Action::Off)
{
phosphor::led::Layout::LedAction ledAction{
- name, action, dutyOn, period, phosphor::led::Layout::On};
+ name, action, dutyOn, period,
+ phosphor::led::Layout::Action::On};
physicalLEDStatesPriorToLampTest.emplace(ledAction);
}
}
diff --git a/manager/ledlayout.hpp b/manager/ledlayout.hpp
index f12e0b5..6d617b4 100644
--- a/manager/ledlayout.hpp
+++ b/manager/ledlayout.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include <xyz/openbmc_project/Led/Physical/server.hpp>
+
#include <map>
#include <set>
#include <string>
@@ -13,15 +15,8 @@
*/
namespace Layout
{
-/** @brief Define possible actions on a given LED.
- * For the BLINK operation, follow 50-50 duty cycle
- */
-enum Action
-{
- Off,
- On,
- Blink,
-};
+
+using Action = sdbusplus::xyz::openbmc_project::Led::server::Physical::Action;
/** @brief Name of the LED and it's proposed action.
* This structure is supplied as configuration at build time