]> git.basschouten.com Git - openhab-addons.git/blob
5421a912f4de8b69d0f15bbadbd14fad38286246
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.avmfritz.internal.dto;
14
15 import java.util.List;
16
17 import javax.xml.bind.annotation.XmlAccessType;
18 import javax.xml.bind.annotation.XmlAccessorType;
19 import javax.xml.bind.annotation.XmlElement;
20 import javax.xml.bind.annotation.XmlType;
21
22 /**
23  * See {@link AVMFritzBaseModel}.
24  *
25  * @author Robert Bausdorf - Initial contribution
26  * @author Christoph Weitkamp - Added support for groups
27  */
28 @XmlAccessorType(XmlAccessType.FIELD)
29 @XmlType(name = "device")
30 public class DeviceModel extends AVMFritzBaseModel {
31
32     private TemperatureModel temperature;
33     private HumidityModel humidity;
34     private AlertModel alert;
35
36     @XmlElement(name = "button", type = ButtonModel.class)
37     private List<ButtonModel> buttons;
38
39     private ETSUnitInfoModel etsiunitinfo;
40
41     public TemperatureModel getTemperature() {
42         return temperature;
43     }
44
45     public void setTemperature(TemperatureModel temperatureModel) {
46         this.temperature = temperatureModel;
47     }
48
49     public HumidityModel getHumidity() {
50         return humidity;
51     }
52
53     public void setTemperature(HumidityModel humidityModel) {
54         this.humidity = humidityModel;
55     }
56
57     public AlertModel getAlert() {
58         return alert;
59     }
60
61     public void setAlert(AlertModel alertModel) {
62         this.alert = alertModel;
63     }
64
65     public List<ButtonModel> getButtons() {
66         return buttons == null ? List.of() : buttons;
67     }
68
69     public void setButtons(List<ButtonModel> buttons) {
70         this.buttons = buttons;
71     }
72
73     public ETSUnitInfoModel getEtsiunitinfo() {
74         return etsiunitinfo;
75     }
76
77     public void setEtsiunitinfo(ETSUnitInfoModel etsiunitinfo) {
78         this.etsiunitinfo = etsiunitinfo;
79     }
80
81     @Override
82     public String toString() {
83         return new StringBuilder().append(super.toString()).append(temperature).append(",").append(humidity).append(",")
84                 .append(alert).append(",").append(getButtons()).append(",").append(etsiunitinfo).append("]").toString();
85     }
86
87     @XmlAccessorType(XmlAccessType.FIELD)
88     @XmlType(propOrder = { "etsideviceid", "unittype", "interfaces" })
89     public static class ETSUnitInfoModel {
90         public static final String HAN_FUN_UNITTYPE_SIMPLE_BUTTON = "273";
91         public static final String HAN_FUN_UNITTYPE_SIMPLE_DETECTOR = "512";
92         public static final String HAN_FUN_UNITTYPE_MAGNETIC_CONTACT = "513";
93         public static final String HAN_FUN_UNITTYPE_OPTICAL_CONTACT = "514";
94         public static final String HAN_FUN_UNITTYPE_MOTION_DETECTOR = "515";
95         public static final String HAN_FUN_UNITTYPE_SMOKE_DETECTOR = "516";
96         public static final String HAN_FUN_UNITTYPE_FLOOD_DETECTOR = "518";
97         public static final String HAN_FUN_UNITTYPE_GLAS_BREAK_DETECTOR = "519";
98         public static final String HAN_FUN_UNITTYPE_VIBRATION_DETECTOR = "520";
99
100         public static final String HAN_FUN_INTERFACE_ALERT = "256";
101         public static final String HAN_FUN_INTERFACE_KEEP_ALIVE = "277";
102         public static final String HAN_FUN_INTERFACE_SIMPLE_BUTTON = "772";
103
104         private String etsideviceid;
105         private String unittype;
106         private String interfaces;
107
108         public String getEtsideviceid() {
109             return etsideviceid;
110         }
111
112         public void setEtsideviceid(String etsideviceid) {
113             this.etsideviceid = etsideviceid;
114         }
115
116         public String getUnittype() {
117             return unittype;
118         }
119
120         public void setUnittype(String unittype) {
121             this.unittype = unittype;
122         }
123
124         public String getInterfaces() {
125             return interfaces;
126         }
127
128         public void setInterfaces(String interfaces) {
129             this.interfaces = interfaces;
130         }
131
132         @Override
133         public String toString() {
134             return new StringBuilder().append("[etsideviceid=").append(etsideviceid).append(",unittype=")
135                     .append(unittype).append(",interfaces=").append(interfaces).append("]").toString();
136         }
137     }
138 }