]> git.basschouten.com Git - openhab-addons.git/blob
752c161e4bda85cc599f0a5a0c61653fe74f889e
[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.onewire.internal.owserver;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * The {@link OwserverControlFlag} provides the owserver protocol control flag
19  *
20  * @author Jan N. Klug - Initial contribution
21  */
22
23 @NonNullByDefault
24 public enum OwserverControlFlag {
25     UNCACHED(0x00000020),
26     SAFEMODE(0x00000010),
27     ALIAS(0x00000008),
28     PERSISTENCE(0x00000004),
29     BUS_RET(0x00000002),
30     DEVICE_DISPLAY(0x00000000),
31     OWNET(0x00000100);
32
33     private final int controlFlag;
34
35     OwserverControlFlag(int controlFlag) {
36         this.controlFlag = controlFlag;
37     }
38
39     /**
40      * get the this flag's numeric representation
41      *
42      * @return integer value of this flag
43      */
44     public int getValue() {
45         return controlFlag;
46     }
47
48     /**
49      * check if a this flag is set in the parameter
50      *
51      * @param controlFlags full control flag
52      * @return true if this flag is set in the parameter
53      */
54     public boolean isSet(int controlFlags) {
55         return (this.getValue() & controlFlags) == this.getValue();
56     }
57 }