2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.knx.internal.channel;
15 import static java.util.stream.Collectors.toSet;
16 import static org.openhab.binding.knx.internal.KNXBindingConstants.*;
19 import java.util.stream.Stream;
21 import org.eclipse.jdt.annotation.NonNullByDefault;
23 import tuwien.auto.calimero.dptxlator.DPTXlator3BitControlled;
24 import tuwien.auto.calimero.dptxlator.DPTXlator8BitUnsigned;
25 import tuwien.auto.calimero.dptxlator.DPTXlatorBoolean;
26 import tuwien.auto.calimero.dptxlator.DPTXlatorRGB;
29 * color channel type description
31 * @author Helmut Lehmeyer - initial contribution
35 class TypeColor extends KNXChannelType {
38 super(CHANNEL_COLOR, CHANNEL_COLOR_CONTROL);
42 protected Set<String> getAllGAKeys() {
43 return Stream.of(SWITCH_GA, POSITION_GA, INCREASE_DECREASE_GA, HSB_GA).collect(toSet());
47 protected String getDefaultDPT(String gaConfigKey) {
48 if (gaConfigKey.equals(HSB_GA)) {
49 return DPTXlatorRGB.DPT_RGB.getID();
51 if (gaConfigKey.equals(INCREASE_DECREASE_GA)) {
52 return DPTXlator3BitControlled.DPT_CONTROL_DIMMING.getID();
54 if (gaConfigKey.equals(SWITCH_GA)) {
55 return DPTXlatorBoolean.DPT_SWITCH.getID();
57 if (gaConfigKey.equals(POSITION_GA)) {
58 return DPTXlator8BitUnsigned.DPT_SCALING.getID();
60 throw new IllegalArgumentException("GA configuration '" + gaConfigKey + "' is not supported");