2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.avmfritz.internal.dto;
15 import java.util.Collections;
16 import java.util.List;
18 import javax.xml.bind.annotation.XmlAccessType;
19 import javax.xml.bind.annotation.XmlAccessorType;
20 import javax.xml.bind.annotation.XmlAttribute;
21 import javax.xml.bind.annotation.XmlElement;
22 import javax.xml.bind.annotation.XmlElements;
23 import javax.xml.bind.annotation.XmlRootElement;
24 import javax.xml.bind.annotation.XmlType;
27 * This JAXB model class maps the XML response to an <b>getdevicelistinfos</b>
28 * command on a FRITZ!Box device. As of today, this class is able to to bind the
29 * devicelist version 1 (currently used by AVM) response:
32 * <devicelist version="1">
33 * <device identifier="##############" id="##" functionbitmask="2944" fwversion="03.83" manufacturer="AVM" productname=
35 * <present>1</present>
36 * <name>FRITZ!DECT 200 #1</name>
39 * <mode>manuell</mode>
41 * <devicelock>1</devicelock>
45 * <energy>166</energy>
48 * <celsius>255</celsius>
52 * <device identifier="##############" id="xx" functionbitmask="320" fwversion="03.50" manufacturer="AVM" productname=
54 * <present>1</present>
55 * <name>Comet DECT #1</name>
57 * <celsius>220</celsius>
58 * <offset>-10</offset>
64 * <komfort>42</komfort>
66 * <devicelock>0</devicelock>
67 * <errorcode>0</errorcode>
68 * <batterylow>0</batterylow>
70 * <endperiod>1484341200</endperiod>
71 * <tchange>28</tchange>
79 * @author Robert Bausdorf - Initial contribution
80 * @author Christoph Weitkamp - Added support for groups
82 @XmlAccessorType(XmlAccessType.FIELD)
84 @XmlRootElement(name = "devicelist")
85 public class DeviceListModel {
87 @XmlAttribute(name = "version")
88 private String apiVersion;
92 @XmlElement(name = "device", type = DeviceModel.class),
93 @XmlElement(name = "group", type = GroupModel.class)
96 private List<AVMFritzBaseModel> devices;
98 public List<AVMFritzBaseModel> getDevicelist() {
99 if (devices == null) {
100 devices = Collections.emptyList();
105 public void setDevicelist(List<AVMFritzBaseModel> devices) {
106 this.devices = devices;
109 public String getXmlApiVersion() {
114 public String toString() {
115 return new StringBuilder().append("[devices=").append(devices).append(",version=").append(apiVersion)
116 .append("]").toString();