aboutsummaryrefslogtreecommitdiff
path: root/NucLedController/LEDTransition.cs
blob: d96515869bd0cca60dff3ea428eec34122bc67e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System.Collections.Immutable;

namespace NucLedController
{
    sealed class LEDTransition
    {

        public static readonly ImmutableList<LEDTransition> AvailableTransitions = ImmutableList.Create(
            new LEDTransition("ALWAYS_ON", "Always on", 0x04),
            new LEDTransition("BLINK_1_HZ", "Blink at 1hz", 0x01),
            new LEDTransition("BLNIK_0.5_HZ", "Blink at 0.5hz", 0x05),
            new LEDTransition("BLINK_0.25_HZ", "Blink at 0.25hz", 0x02),
            new LEDTransition("FADE_1_HZ", "Fade at 1hz", 0x03),
            new LEDTransition("FADE_0.5_HZ", "Fade at 0.5hz", 0x07),
            new LEDTransition("FADE_0.25_HZ", "Fade at 0.25hz", 0x06)
        );

        public string Identifier { get; }
        public string DisplayName { get; }
        public byte ByteValue { get; }

        private LEDTransition(string identifier, string displayName, byte byteValue)
        {
            Identifier = identifier;
            DisplayName = displayName;
            ByteValue = byteValue;
        }

        public override string ToString()
        {
            return Identifier + ByteValue;
        }

        public static LEDTransition getLEDTransition(string identifier)
        {
            return AvailableTransitions.Find(c => c.Identifier == identifier);
        }
    }
}