]> git.basschouten.com Git - openhab-addons.git/blob
ee742c8f74983c69a447d10a7cbc57672cf93f9c
[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 import java.util.BitSet;
16
17 /**
18  * Available output control types:
19  * <ul>
20  * <li>ON - sets an output</li>
21  * <li>OFF - resets an output</li>
22  * <li>TOGGLE - inverts output state</li>
23  * </ul>
24  *
25  * @author Krzysztof Goworek - Initial contribution
26  */
27 public enum OutputControl implements ControlType {
28     ON(0x88),
29     OFF(0x89),
30     TOGGLE(0x91);
31
32     private byte controlCommand;
33     private BitSet stateBits;
34
35     OutputControl(int controlCommand) {
36         this.controlCommand = (byte) controlCommand;
37         this.stateBits = StateType.getStatesBitSet(OutputState.STATE);
38     }
39
40     @Override
41     public byte getControlCommand() {
42         return controlCommand;
43     }
44
45     @Override
46     public ObjectType getObjectType() {
47         return ObjectType.OUTPUT;
48     }
49
50     @Override
51     public BitSet getControlledStates() {
52         return stateBits;
53     }
54 }