2 * Copyright (c) 2010-2022 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.math.BigDecimal;
17 import javax.xml.bind.annotation.XmlAccessType;
18 import javax.xml.bind.annotation.XmlAccessorType;
19 import javax.xml.bind.annotation.XmlRootElement;
20 import javax.xml.bind.annotation.XmlType;
23 * See {@link DeviceListModel}.
25 * @author Christoph Weitkamp - Initial contribution
27 @XmlAccessorType(XmlAccessType.FIELD)
28 @XmlType(propOrder = { "state" })
29 @XmlRootElement(name = "alert")
30 public class AlertModel {
31 public static final BigDecimal ON = BigDecimal.ONE;
32 public static final BigDecimal OFF = BigDecimal.ZERO;
34 private BigDecimal state;
36 public BigDecimal getState() {
40 public void setState(BigDecimal state) {
44 public boolean hasObstructionAlarmOccurred() {
45 return (state.intValue() & 1) != 0;
48 public boolean hasTemperaturAlarmOccurred() {
49 return (state.intValue() & 2) != 0;
52 public boolean hasUnknownAlarmOccurred() {
53 return ((state.intValue() & 255) >> 2) != 0;
57 public String toString() {
58 return new StringBuilder().append("[state=").append(state).append("]").toString();