]> git.basschouten.com Git - openhab-addons.git/blob
9061ece559812ec2e9cc2170d3ae63ecf1b60e62
[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.satel.internal.types;
14
15 /**
16  * Available zone states.
17  *
18  * @author Krzysztof Goworek - Initial contribution
19  */
20 public enum ZoneState implements StateType {
21     VIOLATION(0x00),
22     TAMPER(0x01),
23     ALARM(0x02),
24     TAMPER_ALARM(0x03),
25     ALARM_MEMORY(0x04),
26     TAMPER_ALARM_MEMORY(0x05),
27     BYPASS(0x06),
28     NO_VIOLATION_TROUBLE(0x07),
29     LONG_VIOLATION_TROUBLE(0x08),
30     ISOLATE(0x26),
31     MASKED(0x28),
32     MASKED_MEMORY(0x29);
33
34     private byte refreshCommand;
35
36     ZoneState(int refreshCommand) {
37         this.refreshCommand = (byte) refreshCommand;
38     }
39
40     @Override
41     public byte getRefreshCommand() {
42         return refreshCommand;
43     }
44
45     @Override
46     public int getPayloadLength(boolean extendedCmd) {
47         return extendedCmd ? 32 : 16;
48     }
49
50     @Override
51     public ObjectType getObjectType() {
52         return ObjectType.ZONE;
53     }
54
55     @Override
56     public int getStartByte() {
57         return 0;
58     }
59
60     @Override
61     public int getBytesCount(boolean extendedCmd) {
62         return getPayloadLength(extendedCmd);
63     }
64 }