2 * Copyright (c) 2010-2021 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.dmx.internal;
15 import static org.openhab.binding.dmx.internal.DmxBindingConstants.*;
17 import org.openhab.binding.dmx.internal.handler.ArtnetBridgeHandler;
18 import org.openhab.binding.dmx.internal.handler.ChaserThingHandler;
19 import org.openhab.binding.dmx.internal.handler.ColorThingHandler;
20 import org.openhab.binding.dmx.internal.handler.DimmerThingHandler;
21 import org.openhab.binding.dmx.internal.handler.Lib485BridgeHandler;
22 import org.openhab.binding.dmx.internal.handler.SacnBridgeHandler;
23 import org.openhab.binding.dmx.internal.handler.TunableWhiteThingHandler;
24 import org.openhab.core.thing.Bridge;
25 import org.openhab.core.thing.Thing;
26 import org.openhab.core.thing.ThingTypeUID;
27 import org.openhab.core.thing.binding.BaseThingHandlerFactory;
28 import org.openhab.core.thing.binding.ThingHandler;
29 import org.openhab.core.thing.binding.ThingHandlerFactory;
30 import org.osgi.service.component.annotations.Component;
33 * The {@link DmxHandlerFactory} is responsible for creating things and thing
36 * @author Jan N. Klug - Initial contribution
38 @Component(service = ThingHandlerFactory.class, configurationPid = "binding.dmx")
39 public class DmxHandlerFactory extends BaseThingHandlerFactory {
42 public boolean supportsThingType(ThingTypeUID thingTypeUID) {
43 return DmxBindingConstants.SUPPORTED_THING_TYPES.contains(thingTypeUID);
47 protected ThingHandler createHandler(Thing thing) {
48 ThingTypeUID thingTypeUID = thing.getThingTypeUID();
49 if (thingTypeUID.equals(THING_TYPE_ARTNET_BRIDGE)) {
50 ArtnetBridgeHandler handler = new ArtnetBridgeHandler((Bridge) thing);
52 } else if (thingTypeUID.equals(THING_TYPE_LIB485_BRIDGE)) {
53 Lib485BridgeHandler handler = new Lib485BridgeHandler((Bridge) thing);
55 } else if (thingTypeUID.equals(THING_TYPE_SACN_BRIDGE)) {
56 SacnBridgeHandler handler = new SacnBridgeHandler((Bridge) thing);
58 } else if (thingTypeUID.equals(THING_TYPE_DIMMER)) {
59 DimmerThingHandler handler = new DimmerThingHandler(thing);
61 } else if (thingTypeUID.equals(THING_TYPE_COLOR)) {
62 ColorThingHandler handler = new ColorThingHandler(thing);
64 } else if (thingTypeUID.equals(THING_TYPE_TUNABLEWHITE)) {
65 TunableWhiteThingHandler handler = new TunableWhiteThingHandler(thing);
67 } else if (thingTypeUID.equals(THING_TYPE_CHASER)) {
68 ChaserThingHandler handler = new ChaserThingHandler(thing);