blob: 75c2d20658377f6af26255a951aca55db27443a8 [file] [log] [blame]
Vishwanatha Subbannaed490732016-12-20 15:59:29 +05301#pragma once
2
3#include <map>
4#include <set>
Vishwanatha Subbanna4b000d82017-05-03 18:44:16 +05305
Vishwanatha Subbannaed490732016-12-20 15:59:29 +05306namespace phosphor
7{
8namespace led
9{
10/** @namespace Layout
11 * @brief Depicts the LED and their mappings and group actions
12 */
13namespace Layout
14{
15 /** @brief Define possible actions on a given LED.
16 * For the BLINK operation, follow 50-50 duty cycle
17 */
18 enum Action
19 {
20 Off,
21 On,
22 Blink,
23 };
24
25 /** @brief Name of the LED and it's proposed action.
26 * This structure is supplied as configuration at build time
27 */
28 struct LedAction
29 {
30 std::string name;
31 Action action;
Vishwanatha Subbanna8a50a502017-01-20 18:42:21 +053032 uint8_t dutyOn;
33 uint16_t period;
Vishwanatha Subbanna4b000d82017-05-03 18:44:16 +053034 Action priority;
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053035
Vishwanatha Subbanna4b000d82017-05-03 18:44:16 +053036 // Order LEDs such that same LEDs are grouped next to
37 // each other and the same LEDs are in priority order
38 // with the highest priority coming first
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053039 bool operator<(const LedAction& right) const
40 {
41 if (name == right.name)
42 {
Vishwanatha Subbanna4b000d82017-05-03 18:44:16 +053043 if (action == right.action)
44 {
45 return false;
46 }
47 else if (action == priority)
48 {
49 return true;
50 }
Vishwanatha Subbannaed490732016-12-20 15:59:29 +053051 }
52 return name < right.name;
53 }
54 };
55} // namespace Layout
56} // namespace led
57} // namespace phosphor