]> git.basschouten.com Git - openhab-addons.git/blob
f58ee8719244cbec7081d01acf7e36430eabc319
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 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.ism8.server;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17
18 /**
19  * The {@link DataPointFactory} creates the data points depending on the types
20  *
21  * @author Hans-Reiner Hoffmann - Initial contribution
22  */
23 @NonNullByDefault
24 public class DataPointFactory {
25
26     /**
27      * Creates the concrete data-point based on the type.
28      *
29      */
30     @Nullable
31     public static IDataPoint createDataPoint(int id, String knxType, String description) {
32         IDataPoint dataPoint = null;
33         switch (knxType) {
34             case "1.001":
35             case "1.002":
36             case "1.003":
37             case "1.009":
38                 dataPoint = new DataPointBool(id, knxType, description);
39                 break;
40             case "5.001":
41                 dataPoint = new DataPointScaling(id, knxType, description);
42                 break;
43             case "9.001":
44             case "9.002":
45             case "9.006":
46                 dataPoint = new DataPointValue(id, knxType, description);
47                 break;
48             case "13.002":
49                 dataPoint = new DataPointLongValue(id, knxType, description);
50                 break;
51             case "20.102":
52             case "20.103":
53             case "20.105":
54                 dataPoint = new DataPointByteValue(id, knxType, description);
55                 break;
56         }
57         return dataPoint;
58     }
59 }