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