]> git.basschouten.com Git - openhab-addons.git/blob
689f49565c203c30becd4e65dc1c34ecf26ec275
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.souliss.internal;
14
15 import static org.openhab.binding.souliss.internal.SoulissBindingConstants.*;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.binding.souliss.internal.handler.SoulissGatewayHandler;
20 import org.openhab.binding.souliss.internal.handler.SoulissT11Handler;
21 import org.openhab.binding.souliss.internal.handler.SoulissT12Handler;
22 import org.openhab.binding.souliss.internal.handler.SoulissT13Handler;
23 import org.openhab.binding.souliss.internal.handler.SoulissT14Handler;
24 import org.openhab.binding.souliss.internal.handler.SoulissT16Handler;
25 import org.openhab.binding.souliss.internal.handler.SoulissT18Handler;
26 import org.openhab.binding.souliss.internal.handler.SoulissT19Handler;
27 import org.openhab.binding.souliss.internal.handler.SoulissT1AHandler;
28 import org.openhab.binding.souliss.internal.handler.SoulissT22Handler;
29 import org.openhab.binding.souliss.internal.handler.SoulissT31Handler;
30 import org.openhab.binding.souliss.internal.handler.SoulissT41Handler;
31 import org.openhab.binding.souliss.internal.handler.SoulissT42Handler;
32 import org.openhab.binding.souliss.internal.handler.SoulissT51Handler;
33 import org.openhab.binding.souliss.internal.handler.SoulissT52Handler;
34 import org.openhab.binding.souliss.internal.handler.SoulissT53Handler;
35 import org.openhab.binding.souliss.internal.handler.SoulissT54Handler;
36 import org.openhab.binding.souliss.internal.handler.SoulissT55Handler;
37 import org.openhab.binding.souliss.internal.handler.SoulissT56Handler;
38 import org.openhab.binding.souliss.internal.handler.SoulissT57Handler;
39 import org.openhab.binding.souliss.internal.handler.SoulissT61Handler;
40 import org.openhab.binding.souliss.internal.handler.SoulissT62Handler;
41 import org.openhab.binding.souliss.internal.handler.SoulissT63Handler;
42 import org.openhab.binding.souliss.internal.handler.SoulissT64Handler;
43 import org.openhab.binding.souliss.internal.handler.SoulissT65Handler;
44 import org.openhab.binding.souliss.internal.handler.SoulissT66Handler;
45 import org.openhab.binding.souliss.internal.handler.SoulissT67Handler;
46 import org.openhab.binding.souliss.internal.handler.SoulissT68Handler;
47 import org.openhab.binding.souliss.internal.handler.SoulissTopicsHandler;
48 import org.openhab.core.thing.Bridge;
49 import org.openhab.core.thing.Thing;
50 import org.openhab.core.thing.ThingTypeUID;
51 import org.openhab.core.thing.binding.BaseThingHandlerFactory;
52 import org.openhab.core.thing.binding.ThingHandler;
53 import org.openhab.core.thing.binding.ThingHandlerFactory;
54 import org.osgi.service.component.annotations.Component;
55
56 /**
57  * The {@link SoulissHandlerFactory} is responsible for creating things and thingGeneric
58  * handlers. It fire when a new thingGeneric is added.
59  *
60  * @author Tonino Fazio - Initial contribution
61  * @author Luca Calcaterra - Refactor for OH3
62  */
63 @NonNullByDefault
64 @Component(configurationPid = "binding.souliss", service = ThingHandlerFactory.class)
65 public class SoulissHandlerFactory extends BaseThingHandlerFactory {
66
67     @Override
68     public boolean supportsThingType(ThingTypeUID thingTypeUID) {
69         return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
70     }
71
72     @Override
73     protected @Nullable ThingHandler createHandler(Thing thing) {
74         var thingTypeUID = thing.getThingTypeUID();
75
76         if (thingTypeUID.equals(GATEWAY_THING_TYPE)) {
77             return new SoulissGatewayHandler((Bridge) thing);
78         } else if (thingTypeUID.equals(T11_THING_TYPE)) {
79             return new SoulissT11Handler(thing);
80         } else if (thingTypeUID.equals(T12_THING_TYPE)) {
81             return new SoulissT12Handler(thing);
82         } else if (thingTypeUID.equals(T13_THING_TYPE)) {
83             return new SoulissT13Handler(thing);
84         } else if (thingTypeUID.equals(T14_THING_TYPE)) {
85             return new SoulissT14Handler(thing);
86         } else if (thingTypeUID.equals(T16_THING_TYPE)) {
87             return new SoulissT16Handler(thing);
88         } else if (thingTypeUID.equals(T18_THING_TYPE)) {
89             return new SoulissT18Handler(thing);
90         } else if (thingTypeUID.equals(T19_THING_TYPE)) {
91             return new SoulissT19Handler(thing);
92         } else if (thingTypeUID.equals(T1A_THING_TYPE)) {
93             return new SoulissT1AHandler(thing);
94         } else if (thingTypeUID.equals(T21_THING_TYPE) || (thingTypeUID.equals(T22_THING_TYPE))) {
95             return new SoulissT22Handler(thing);
96         } else if (thingTypeUID.equals(T31_THING_TYPE)) {
97             return new SoulissT31Handler(thing);
98         } else if (thingTypeUID.equals(T41_THING_TYPE)) {
99             return new SoulissT41Handler(thing);
100         } else if (thingTypeUID.equals(T42_THING_TYPE)) {
101             return new SoulissT42Handler(thing);
102         } else if (thingTypeUID.equals(T51_THING_TYPE)) {
103             return new SoulissT51Handler(thing);
104         } else if (thingTypeUID.equals(T52_THING_TYPE)) {
105             return new SoulissT52Handler(thing);
106         } else if (thingTypeUID.equals(T53_THING_TYPE)) {
107             return new SoulissT53Handler(thing);
108         } else if (thingTypeUID.equals(T54_THING_TYPE)) {
109             return new SoulissT54Handler(thing);
110         } else if (thingTypeUID.equals(T55_THING_TYPE)) {
111             return new SoulissT55Handler(thing);
112         } else if (thingTypeUID.equals(T56_THING_TYPE)) {
113             return new SoulissT56Handler(thing);
114         } else if (thingTypeUID.equals(T57_THING_TYPE)) {
115             return new SoulissT57Handler(thing);
116         } else if (thingTypeUID.equals(T61_THING_TYPE)) {
117             return new SoulissT61Handler(thing);
118         } else if (thingTypeUID.equals(T62_THING_TYPE)) {
119             return new SoulissT62Handler(thing);
120         } else if (thingTypeUID.equals(T63_THING_TYPE)) {
121             return new SoulissT63Handler(thing);
122         } else if (thingTypeUID.equals(T64_THING_TYPE)) {
123             return new SoulissT64Handler(thing);
124         } else if (thingTypeUID.equals(T65_THING_TYPE)) {
125             return new SoulissT65Handler(thing);
126         } else if (thingTypeUID.equals(T66_THING_TYPE)) {
127             return new SoulissT66Handler(thing);
128         } else if (thingTypeUID.equals(T67_THING_TYPE)) {
129             return new SoulissT67Handler(thing);
130         } else if (thingTypeUID.equals(T68_THING_TYPE)) {
131             return new SoulissT68Handler(thing);
132         } else if (thingTypeUID.equals(TOPICS_THING_TYPE)) {
133             return new SoulissTopicsHandler(thing);
134         }
135
136         return null;
137     }
138 }