1 #pragma once 2 3 #include <xyz/openbmc_project/Led/Physical/server.hpp> 4 5 #include <set> 6 #include <string> 7 #include <unordered_map> 8 9 namespace phosphor 10 { 11 namespace led 12 { 13 /** @namespace Layout 14 * @brief Depicts the LED and their mappings and group actions 15 */ 16 namespace Layout 17 { 18 19 using Action = sdbusplus::xyz::openbmc_project::Led::server::Physical::Action; 20 21 /** @brief Name of the LED and it's proposed action. 22 * This structure is supplied as configuration at build time 23 */ 24 struct LedAction 25 { 26 std::string name; 27 Action action; 28 uint8_t dutyOn; 29 uint16_t period; 30 std::optional<Action> priority; 31 32 // Order LEDs such that same LEDs are grouped next to 33 // each other and the same LEDs are in priority order 34 // with the highest priority coming first operator <phosphor::led::Layout::LedAction35 bool operator<(const LedAction& right) const 36 { 37 if (name == right.name) 38 { 39 if (action == right.action) 40 { 41 return false; 42 } 43 else if (action == priority) 44 { 45 return true; 46 } 47 } 48 return name < right.name; 49 } 50 }; 51 } // namespace Layout 52 53 using ActionSet = std::set<Layout::LedAction>; 54 55 } // namespace led 56 } // namespace phosphor 57