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:
33 * <devicelist version="1">
34 * <device identifier="##############" id="##" functionbitmask="2944" fwversion="03.83" manufacturer="AVM" productname=
36 * <present>1</present>
37 * <name>FRITZ!DECT 200 #1</name>
40 * <mode>manuell</mode>
42 * <devicelock>1</devicelock>
46 * <energy>166</energy>
49 * <celsius>255</celsius>
53 * <device identifier="##############" id="xx" functionbitmask="320" fwversion="03.50" manufacturer="AVM" productname=
55 * <present>1</present>
56 * <name>Comet DECT #1</name>
58 * <celsius>220</celsius>
59 * <offset>-10</offset>
65 * <komfort>42</komfort>
67 * <devicelock>0</devicelock>
68 * <errorcode>0</errorcode>
69 * <batterylow>0</batterylow>
71 * <endperiod>1484341200</endperiod>
72 * <tchange>28</tchange>
80 * @author Robert Bausdorf - Initial contribution
81 * @author Christoph Weitkamp - Added support for groups
83 @XmlAccessorType(XmlAccessType.FIELD)
85 @XmlRootElement(name = "devicelist")
86 public class DeviceListModel {
88 @XmlAttribute(name = "version")
89 private String apiVersion;
93 @XmlElement(name = "device", type = DeviceModel.class),
94 @XmlElement(name = "group", type = GroupModel.class)
97 private List<AVMFritzBaseModel> devices;
99 public List<AVMFritzBaseModel> getDevicelist() {
100 if (devices == null) {
101 devices = Collections.emptyList();
106 public void setDevicelist(List<AVMFritzBaseModel> devices) {
107 this.devices = devices;
110 public String getXmlApiVersion() {
115 public String toString() {
116 return new StringBuilder().append("[devices=").append(devices).append(",version=").append(apiVersion)
117 .append("]").toString();