]> git.basschouten.com Git - openhab-addons.git/blob
559257bac8df105e9ff80862339d35302a0460a7
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
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
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.digiplex.internal.communication.events;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.openhab.binding.digiplex.internal.communication.DigiplexResponse;
17
18 /**
19  * Common ancestor for all events received from Digiplex system
20  *
21  * @author Robert Michalak - Initial contribution
22  *
23  */
24 @NonNullByDefault
25 public abstract class AbstractEvent implements DigiplexResponse {
26
27     private int areaNo;
28
29     public AbstractEvent(int areaNo) {
30         this.areaNo = areaNo;
31     }
32
33     public int getAreaNo() {
34         return areaNo;
35     }
36
37     public boolean isForArea(int areaNo) {
38         if (this.areaNo == 0 || this.areaNo == areaNo) {
39             return true;
40         }
41         // TODO: According to documentation: areaNo = 255 - Occurs in at least one area enabled in the system.
42         // I did never encounter 255 on my system though (EVO192).
43         // 15 is returned instead, which (I believe) has the same meaning.
44         return (this.areaNo == 15 || this.areaNo == 255);
45     }
46 }