]> git.basschouten.com Git - openhab-addons.git/blob
7acc73e215ae5f7e212f52e16e2e172e8c8b8d3f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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 import java.util.BitSet;
16
17 /**
18  * Available partition control types.
19  *
20  * @author Krzysztof Goworek - Initial contribution
21  */
22 public enum PartitionControl implements ControlType {
23     ARM_MODE_0(0x80),
24     ARM_MODE_1(0x81),
25     ARM_MODE_2(0x82),
26     ARM_MODE_3(0x83),
27     DISARM(0x84),
28     CLEAR_ALARM(0x85),
29     FORCE_ARM_MODE_0(0xa0),
30     FORCE_ARM_MODE_1(0xa1),
31     FORCE_ARM_MODE_2(0xa2),
32     FORCE_ARM_MODE_3(0xa3);
33
34     private byte controlCommand;
35     private BitSet stateBits;
36
37     PartitionControl(int controlCommand) {
38         this.controlCommand = (byte) controlCommand;
39         // for simplicity we just add all partition states here
40         this.stateBits = StateType.getStatesBitSet(PartitionState.values());
41     }
42
43     @Override
44     public byte getControlCommand() {
45         return controlCommand;
46     }
47
48     @Override
49     public ObjectType getObjectType() {
50         return ObjectType.PARTITION;
51     }
52
53     @Override
54     public BitSet getControlledStates() {
55         return stateBits;
56     }
57 }