config: allow led priority to be Off
This makes the configuration more flexible and eliminates the edge case.
I don't see why this should not be possible.
Change-Id: I28e33535539b3214e18d7816314656df5d3c370e
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/manager/json-parser.hpp b/manager/json-parser.hpp
index e17568b..8f2832b 100644
--- a/manager/json-parser.hpp
+++ b/manager/json-parser.hpp
@@ -18,7 +18,6 @@
using Json = nlohmann::json;
// Priority for a particular LED needs to stay SAME across all groups
-// phosphor::led::Layout::Action can only be one of `Blink` and `On`
using PriorityMap =
std::unordered_map<std::string,
std::optional<phosphor::led::Layout::Action>>;
@@ -56,14 +55,25 @@
*
* @param[in] action - action string
*
- * @return Action - action enum (On/Blink)
+ * @return Action - action enum (On/Off/Blink)
*/
phosphor::led::Layout::Action getAction(const std::string& action)
{
- assert(action == "On" || action == "Blink");
+ if (action == "On")
+ {
+ return phosphor::led::Layout::Action::On;
+ }
+ if (action == "Off")
+ {
+ return phosphor::led::Layout::Action::Off;
+ }
+ if (action == "Blink")
+ {
+ return phosphor::led::Layout::Action::Blink;
+ }
- return action == "Blink" ? phosphor::led::Layout::Action::Blink
- : phosphor::led::Layout::Action::On;
+ assert(false);
+ return phosphor::led::Layout::Action::Blink;
}
static std::string priorityToString(