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;
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
22 * Class to implement the BlueGiga Enumeration <b>SmpIoCapabilities</b>.
24 * Security Manager I/O Capabilities
26 * Note that this code is autogenerated. Manual changes may be overwritten.
28 * @author Chris Jackson - Initial contribution of Java code generator
31 public enum SmpIoCapabilities {
33 * Default unknown value
40 SM_IO_CAPABILITY_DISPLAYONLY(0x0000),
43 * [1] Display with Yes/No-buttons
45 SM_IO_CAPABILITY_DISPLAYYESNO(0x0001),
50 SM_IO_CAPABILITY_KEYBOARDONLY(0x0002),
53 * [3] No Input and No Output
55 SM_IO_CAPABILITY_NOINPUTNOOUTPUT(0x0003),
58 * [4] Display with Keyboard
60 SM_IO_CAPABILITY_KEYBOARDDISPLAY(0x0004);
63 * A mapping between the integer code and its corresponding type to
64 * facilitate lookup by code.
66 private static @Nullable Map<Integer, SmpIoCapabilities> codeMapping;
70 private SmpIoCapabilities(int key) {
75 * Lookup function based on the type code. Returns {@link UNKNOWN} if the code does not exist.
77 * @param smpIoCapabilities
79 * @return enumeration value.
81 public static SmpIoCapabilities getSmpIoCapabilities(int smpIoCapabilities) {
82 Map<Integer, SmpIoCapabilities> localCodeMapping = codeMapping;
83 if (localCodeMapping == null) {
84 localCodeMapping = new HashMap<>();
85 for (SmpIoCapabilities s : values()) {
86 localCodeMapping.put(s.key, s);
88 codeMapping = localCodeMapping;
91 return localCodeMapping.getOrDefault(smpIoCapabilities, UNKNOWN);
95 * Returns the BlueGiga protocol defined value for this enum
97 * @return the BGAPI enumeration key