]> git.basschouten.com Git - openhab-addons.git/blob
94a41563d01d7b592e931e2910ba6644e987dbc1
[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.knx.internal.channel;
14
15 import static org.openhab.binding.knx.internal.KNXBindingConstants.*;
16
17 import java.util.Objects;
18 import java.util.Set;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21
22 import tuwien.auto.calimero.dptxlator.DPTXlator8BitUnsigned;
23 import tuwien.auto.calimero.dptxlator.DPTXlatorBoolean;
24
25 /**
26  * rollershutter channel type description
27  *
28  * @author Simon Kaufmann - initial contribution and API.
29  *
30  */
31 @NonNullByDefault
32 class TypeRollershutter extends KNXChannelType {
33
34     TypeRollershutter() {
35         super(CHANNEL_ROLLERSHUTTER, CHANNEL_ROLLERSHUTTER_CONTROL);
36     }
37
38     @Override
39     protected String getDefaultDPT(String gaConfigKey) {
40         if (Objects.equals(gaConfigKey, UP_DOWN_GA)) {
41             return DPTXlatorBoolean.DPT_UPDOWN.getID();
42         }
43         if (Objects.equals(gaConfigKey, STOP_MOVE_GA)) {
44             return DPTXlatorBoolean.DPT_START.getID();
45         }
46         if (Objects.equals(gaConfigKey, POSITION_GA)) {
47             return DPTXlator8BitUnsigned.DPT_SCALING.getID();
48         }
49         throw new IllegalArgumentException("GA configuration '" + gaConfigKey + "' is not supported");
50     }
51
52     @Override
53     protected Set<String> getAllGAKeys() {
54         return Set.of(UP_DOWN_GA, STOP_MOVE_GA, POSITION_GA);
55     }
56 }