2 * Copyright (c) 2010-2022 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.qbus.internal;
15 import static org.openhab.binding.qbus.internal.QbusBindingConstants.*;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.qbus.internal.handler.QbusBistabielHandler;
20 import org.openhab.binding.qbus.internal.handler.QbusCO2Handler;
21 import org.openhab.binding.qbus.internal.handler.QbusDimmerHandler;
22 import org.openhab.binding.qbus.internal.handler.QbusRolHandler;
23 import org.openhab.binding.qbus.internal.handler.QbusSceneHandler;
24 import org.openhab.binding.qbus.internal.handler.QbusThermostatHandler;
25 import org.openhab.core.thing.Bridge;
26 import org.openhab.core.thing.Thing;
27 import org.openhab.core.thing.ThingTypeUID;
28 import org.openhab.core.thing.binding.BaseThingHandlerFactory;
29 import org.openhab.core.thing.binding.ThingHandler;
30 import org.openhab.core.thing.binding.ThingHandlerFactory;
31 import org.osgi.service.component.annotations.Component;
34 * The {@link qbusHandlerFactory} is responsible for creating things and thing
37 * @author Koen Schockaert - Initial Contribution
40 @Component(service = ThingHandlerFactory.class, configurationPid = "binding.qbus")
42 public class QbusHandlerFactory extends BaseThingHandlerFactory {
45 public boolean supportsThingType(ThingTypeUID thingTypeUID) {
46 return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID) || BRIDGE_THING_TYPES_UIDS.contains(thingTypeUID);
50 protected @Nullable ThingHandler createHandler(Thing thing) {
51 if (BRIDGE_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
52 QbusBridgeHandler handler = new QbusBridgeHandler((Bridge) thing);
54 } else if (SCENE_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
55 return new QbusSceneHandler(thing);
56 } else if (BISTABIEL_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
57 return new QbusBistabielHandler(thing);
58 } else if (THERMOSTAT_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
59 return new QbusThermostatHandler(thing);
60 } else if (DIMMER_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
61 return new QbusDimmerHandler(thing);
62 } else if (CO2_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
63 return new QbusCO2Handler(thing);
64 } else if (ROLLERSHUTTER_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
65 return new QbusRolHandler(thing);
66 } else if (ROLLERSHUTTER_SLATS_THING_TYPES_UIDS.contains(thing.getThingTypeUID())) {
67 return new QbusRolHandler(thing);