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.digiplex.internal.communication;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
19 * Response for {@link AreaStatusRequest}
21 * @author Robert Michalak - Initial contribution
24 public class AreaStatusResponse extends AbstractResponse {
26 public final int areaNo;
27 public final @Nullable AreaStatus status;
28 public final boolean zoneInMemory;
29 public final boolean trouble;
30 public final boolean ready;
31 public final boolean inProgramming;
32 public final boolean alarm;
33 public final boolean strobe;
35 private AreaStatusResponse(int areaNo, AreaStatus status, boolean zoneInMemory, boolean trouble, boolean ready,
36 boolean inProgramming, boolean alarm, boolean strobe) {
39 this.zoneInMemory = zoneInMemory;
40 this.trouble = trouble;
42 this.inProgramming = inProgramming;
47 private AreaStatusResponse(int areaNo) {
51 this.zoneInMemory = false;
54 this.inProgramming = false;
60 * Builds a response for a given areaNo. Indicates that request failed.
62 public static AreaStatusResponse failure(int areaNo) {
63 return new AreaStatusResponse(areaNo);
67 * Builds a response for a given parameters. Indicates that request was successful.
69 public static AreaStatusResponse success(int areaNo, AreaStatus status, boolean zoneInMemory, boolean trouble,
70 boolean ready, boolean inProgramming, boolean alarm, boolean strobe) {
71 return new AreaStatusResponse(areaNo, status, zoneInMemory, trouble, ready, inProgramming, alarm, strobe);
75 public void accept(DigiplexMessageHandler visitor) {
76 visitor.handleAreaStatusResponse(this);