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.enocean.internal.config;
15 import java.security.InvalidParameterException;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
22 * @author Daniel Weber - Initial contribution
25 public class EnOceanChannelRockerSwitchConfigBase {
27 public String switchMode;
28 public String channel;
30 public enum SwitchMode {
32 RockerSwitch("rockerSwitch"),
33 ToggleDir1("toggleButtonDir1"),
34 ToggleDir2("toggleButtonDir2");
38 SwitchMode(String value) {
42 public String getValue() {
46 public static SwitchMode getSwitchMode(@Nullable String value) {
48 return SwitchMode.Unkown;
51 for (SwitchMode t : SwitchMode.values()) {
52 if (t.value.equals(value)) {
57 throw new InvalidParameterException("Unknown SwitchMode");
68 Channel(String value) {
72 public static Channel getChannel(@Nullable String value) {
74 return Channel.Unkown;
77 for (Channel t : Channel.values()) {
78 if (t.value.equals(value)) {
83 throw new InvalidParameterException("Unknown Channel");
87 public EnOceanChannelRockerSwitchConfigBase() {
88 switchMode = "rockerSwitch";
92 public SwitchMode getSwitchMode() {
93 return SwitchMode.getSwitchMode(switchMode);
96 public Channel getChannel() {
97 return Channel.getChannel(channel);