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.tellstick.internal.live.xml;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlAttribute;
18 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
20 import org.tellstick.device.iface.Device;
21 import org.tellstick.enums.DeviceType;
24 * Class used to deserialize XML from Telldus Live.
26 * @author Jarle Hjortland - Initial contribution
28 @XmlAccessorType(XmlAccessType.FIELD)
29 public class TellstickNetDevice implements Device {
30 @XmlAttribute(name = "id")
32 private String protocol;
37 @XmlJavaTypeAdapter(value = NumberToBooleanMapper.class)
38 private Boolean online;
42 private String statevalue;
46 private boolean updated;
48 public TellstickNetDevice() {
51 public TellstickNetDevice(int id) {
61 public String getUUId() {
62 return Integer.toString(deviceId);
66 public String getProtocol() {
71 public String getModel() {
76 public DeviceType getDeviceType() {
77 return DeviceType.DEVICE;
81 public String getName() {
85 public void setId(int deviceId) {
86 this.deviceId = deviceId;
89 public void setProtocol(String protocol) {
90 this.protocol = protocol;
93 public void setModel(String model) {
97 public void setName(String name) {
101 public boolean getOnline() {
105 // @XmlJavaTypeAdapter(value = NumberToBooleanMapper.class)
106 public void setOnline(boolean online) {
107 this.online = online;
110 public void setUpdated(boolean b) {
114 public boolean isUpdated() {
118 public int getState() {
122 public void setState(int state) {
126 public String getStatevalue() {
130 public void setStatevalue(String statevalue) {
131 this.statevalue = statevalue;
135 public int hashCode() {
138 result = prime * result + deviceId;
143 public boolean equals(Object obj) {
150 if (getClass() != obj.getClass()) {
153 TellstickNetDevice other = (TellstickNetDevice) obj;
154 return deviceId == other.deviceId;
157 public int getMethods() {
161 public void setMethods(int methods) {
162 this.methods = methods;
166 public String toString() {
167 return "TellstickNetDevice [deviceId=" + deviceId + ", name=" + name + ", online=" + online + ", state=" + state
168 + ", statevalue=" + statevalue + ", updated=" + updated + "]";