]> git.basschouten.com Git - openhab-addons.git/blob
1bfbfb5b9c3b0f37e23a2d588a8d6ff9c1af1158
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.homematic.internal.model;
14
15 import org.apache.commons.lang.builder.ToStringBuilder;
16 import org.apache.commons.lang.builder.ToStringStyle;
17
18 /**
19  * Info object which holds gateway specific informations.
20  *
21  * @author Gerhard Riegler - Initial contribution
22  */
23 public class HmGatewayInfo {
24     public static final String ID_HOMEGEAR = "HOMEGEAR";
25     public static final String ID_CCU = "CCU";
26     public static final String ID_DEFAULT = "DEFAULT";
27
28     private String id;
29     private String type;
30     private String firmware;
31     private String address;
32     private boolean rfInterface;
33     private boolean wiredInterface;
34     private boolean cuxdInterface;
35     private boolean hmipInterface;
36     private boolean groupInterface;
37
38     /**
39      * Returns the id of the gateway type.
40      */
41     public String getId() {
42         return id;
43     }
44
45     /**
46      * Sets the id of the gateway type.
47      */
48     public void setId(String id) {
49         this.id = id;
50     }
51
52     /**
53      * Returns the type of the gateway.
54      */
55     public String getType() {
56         return type;
57     }
58
59     /**
60      * Sets the type of the server.
61      */
62     public void setType(String type) {
63         this.type = type;
64     }
65
66     /**
67      * Returns the firmware version of the gateway.
68      */
69     public String getFirmware() {
70         return firmware;
71     }
72
73     /**
74      * Sets the firmware version of the gateway.
75      */
76     public void setFirmware(String firmware) {
77         this.firmware = firmware;
78     }
79
80     /**
81      * Returns the address of the Homematic gateway.
82      */
83     public String getAddress() {
84         return address;
85     }
86
87     /**
88      * Sets the address of the Homematic gateway.
89      */
90     public void setAddress(String address) {
91         this.address = address;
92     }
93
94     /**
95      * Returns true, if the gateway is a Homegear gateway.
96      */
97     public boolean isHomegear() {
98         return ID_HOMEGEAR.equals(id);
99     }
100
101     /**
102      * Returns true, if the gateway is a CCU.
103      */
104     public boolean isCCU() {
105         return ID_CCU.equals(id);
106     }
107
108     /**
109      * Return true, if the gateway is a CCU1.
110      */
111     public boolean isCCU1() {
112         return "CCU".equals(type);
113     }
114
115     /**
116      * Returns true, if the gateway supports the CUxD interface.
117      */
118     public boolean isCuxdInterface() {
119         return cuxdInterface;
120     }
121
122     /**
123      * Sets the CUxD support of the gateway.
124      */
125     public void setCuxdInterface(boolean cuxdInterface) {
126         this.cuxdInterface = cuxdInterface;
127     }
128
129     /**
130      * Returns true, if the gateway supports the wired interface.
131      */
132     public boolean isWiredInterface() {
133         return wiredInterface;
134     }
135
136     /**
137      * Sets the wired support of the gateway.
138      */
139     public void setWiredInterface(boolean wiredInterface) {
140         this.wiredInterface = wiredInterface;
141     }
142
143     /**
144      * Returns true, if the gateway supports the HMIP interface.
145      */
146     public boolean isHmipInterface() {
147         return hmipInterface;
148     }
149
150     /**
151      * Sets the HMIP support of the gateway.
152      */
153     public void setHmipInterface(boolean hmipInterface) {
154         this.hmipInterface = hmipInterface;
155     }
156
157     /**
158      * Returns true, if the gateway supports the Group interface.
159      */
160     public boolean isGroupInterface() {
161         return groupInterface;
162     }
163
164     /**
165      * Sets the Group support of the gateway.
166      */
167     public void setGroupInterface(boolean groupInterface) {
168         this.groupInterface = groupInterface;
169     }
170
171     /**
172      * Returns true, if the gateway supports the RF interface.
173      */
174     public boolean isRfInterface() {
175         return rfInterface;
176     }
177
178     /**
179      * Sets the RF support of the gateway.
180      */
181     public void setRfInterface(boolean rfInterface) {
182         this.rfInterface = rfInterface;
183     }
184
185     @Override
186     public String toString() {
187         return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", id).append("type", type)
188                 .append("firmware", firmware).append("address", address).append("rf", rfInterface)
189                 .append("wired", wiredInterface).append("hmip", hmipInterface).append("cuxd", cuxdInterface)
190                 .append("group", groupInterface).toString();
191     }
192 }