]> git.basschouten.com Git - openhab-addons.git/blob
1b9642b83f11994435df7aa3daacaefe3a906f31
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 /**
19  * digitalSTROM Application Groups.
20  * 
21  * <pre>
22     | Group ID | Name                  | Color   | Application                         |
23     | -------- | --------------------- | ------- | ----------------------------------- |
24     | 1        | Lights                | Yellow  | Room lights                         |
25     | 2        | Blinds                | Gray    | Blinds, curtains, shades, awnings   |
26     | 3        | Heating               | Blue    | Heating                             |
27     | 9        | Cooling               | Blue    | Cooling                             |
28     | 10       | Ventilation           | Blue    | Ventilation                         |
29     | 11       | Window                | Blue    | Windows                             |
30     | 12       | Recirculation         | Blue    | Ceiling fan, Fan coil units         |
31     | 64       | Apartment Ventilation | Blue    | Ventilation system                  |
32     | 48       | Temperature Control   | Blue    | Single room temperature control     |
33     | 4        | Audio                 | Cyan    | Playing music or radio              |
34     | 5        | Video                 | Magenta | TV, Video                           |
35     | 8        | Joker                 | Black   | Configurable                        |
36     | n/a      | Single Device         | White   | Various, individual per device      |
37     | n/a      | Security              | Red     | Security related functions, Alarms  |
38     | n/a      | Access                | Green   | Access related functions, door bell |
39  * </pre>
40  * 
41  * @author Rouven Schürch - Initial contribution
42  * @see <a href="https://developer.digitalstrom.org/Architecture/ds-basics.pdf">ds-basics.pdf</a> (Version 1.4/1.6),
43  *      chapter 3.2 (Group), Table 2.
44  *
45  */
46 public enum ApplicationGroup {
47
48     LIGHTS((short) 1, Color.YELLOW),
49     BLINDS((short) 2, Color.GREY),
50     HEATING((short) 3, Color.BLUE),
51     COOLING((short) 9, Color.BLUE),
52     VENTILATION((short) 10, Color.BLUE),
53     WINDOW((short) 11, Color.BLUE),
54     RECIRCULATION((short) 12, Color.BLUE),
55     APARTMENT_VENTILATION((short) 64, Color.BLUE),
56     TEMPERATURE_CONTROL((short) 48, Color.BLUE),
57     AUDIO((short) 4, Color.CYAN),
58     VIDEO((short) 5, Color.MAGENTA),
59     JOKER((short) 8, Color.BLACK),
60     SINGLE_DEVICE((short) -1, Color.WHITE),
61     SECURITY((short) -2, Color.RED),
62     ACCESS((short) -3, Color.GREEN),
63     UNDEFINED(null, Color.UNDEFINED);
64
65     public enum Color {
66         YELLOW,
67         GREY,
68         BLUE,
69         CYAN,
70         MAGENTA,
71         BLACK,
72         WHITE,
73         RED,
74         GREEN,
75         UNDEFINED
76     }
77
78     private Short groupId;
79
80     static final Map<Short, ApplicationGroup> APPLICATION_GROUPS = new HashMap<>();
81
82     private Color color;
83
84     static {
85         for (ApplicationGroup applications : ApplicationGroup.values()) {
86             APPLICATION_GROUPS.put(applications.getId(), applications);
87         }
88     }
89
90     private ApplicationGroup(Short groupId, Color color) {
91         this.groupId = groupId;
92         this.color = color;
93     }
94
95     public Short getId() {
96         return groupId;
97     }
98
99     /**
100      * Returns the corresponding ApplicationGroup or ApplicationGroup.UNDEFINED if
101      * there is no ApplicationGroup for the given groupId.
102      * 
103      * @param groupId
104      * @return ApplicationGroup or ApplicationGroup.UNDEFINED
105      */
106     public static ApplicationGroup getGroup(Short groupId) {
107         return APPLICATION_GROUPS.containsKey(groupId) ? APPLICATION_GROUPS.get(groupId) : ApplicationGroup.UNDEFINED;
108     }
109
110     public Color getColor() {
111         return color;
112     }
113 }