2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.bluetooth.bluegiga.internal.enumeration;
15 import java.util.HashMap;
19 * Class to implement the BlueGiga Enumeration <b>GapConnectableMode</b>.
21 * GAP connectable modes
23 * Note that this code is autogenerated. Manual changes may be overwritten.
25 * @author Chris Jackson - Initial contribution of Java code generator
27 public enum GapConnectableMode {
29 * Default unknown value
36 GAP_NON_CONNECTABLE(0x0000),
39 * [1] Directed Connectable
41 GAP_DIRECTED_CONNECTABLE(0x0001),
44 * [2] Undirected connectable
46 GAP_UNDIRECTED_CONNECTABLE(0x0002),
49 * [3] Same as non-connectable, but also supports ADV_SCAN_IND packets. Device accepts scan
50 * requests (active scanning) but is not connectable.
52 GAP_SCANNABLE_NON_CONNECTABLE(0x0003);
55 * A mapping between the integer code and its corresponding type to
56 * facilitate lookup by code.
58 private static Map<Integer, GapConnectableMode> codeMapping;
62 private GapConnectableMode(int key) {
66 private static void initMapping() {
67 codeMapping = new HashMap<>();
68 for (GapConnectableMode s : values()) {
69 codeMapping.put(s.key, s);
74 * Lookup function based on the type code. Returns null if the code does not exist.
76 * @param gapConnectableMode
78 * @return enumeration value.
80 public static GapConnectableMode getGapConnectableMode(int gapConnectableMode) {
81 if (codeMapping == null) {
85 if (codeMapping.get(gapConnectableMode) == null) {
89 return codeMapping.get(gapConnectableMode);
93 * Returns the BlueGiga protocol defined value for this enum
95 * @return the BGAPI enumeration key