2 * Copyright (c) 2010-2022 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>BluetoothAddressType</b>.
21 * Bluetooth address types
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 BluetoothAddressType {
29 * Default unknown value
36 GAP_ADDRESS_TYPE_PUBLIC(0x0000),
41 GAP_ADDRESS_TYPE_RANDOM(0x0001);
44 * A mapping between the integer code and its corresponding type to
45 * facilitate lookup by code.
47 private static Map<Integer, BluetoothAddressType> codeMapping;
51 private BluetoothAddressType(int key) {
55 private static void initMapping() {
56 codeMapping = new HashMap<>();
57 for (BluetoothAddressType s : values()) {
58 codeMapping.put(s.key, s);
63 * Lookup function based on the type code. Returns null if the code does not exist.
65 * @param bluetoothAddressType
67 * @return enumeration value.
69 public static BluetoothAddressType getBluetoothAddressType(int bluetoothAddressType) {
70 if (codeMapping == null) {
74 if (codeMapping.get(bluetoothAddressType) == null) {
78 return codeMapping.get(bluetoothAddressType);
82 * Returns the BlueGiga protocol defined value for this enum
84 * @return the BGAPI enumeration key