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>AttributeValueType</b>.
21 * These enumerations are in the Attribute Client class
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 AttributeValueType {
29 * Default unknown value
36 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_READ(0x0000),
39 * [1] Value was notified
41 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_NOTIFY(0x0001),
44 * [2] Value was indicated
46 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_INDICATE(0x0002),
51 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_READ_BY_TYPE(0x0003),
54 * [4] Value was part of a long attribute
56 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_READ_BLOB(0x0004),
59 * [5] Value was indicated and the remote device is waiting for a confirmation. Indicate
60 * Confirm command can be used to send a confirmation.
62 ATTCLIENT_ATTRIBUTE_VALUE_TYPE_INDICATE_RSP_REQ(0x0005);
65 * A mapping between the integer code and its corresponding type to
66 * facilitate lookup by code.
68 private static Map<Integer, AttributeValueType> codeMapping;
72 private AttributeValueType(int key) {
76 private static void initMapping() {
77 codeMapping = new HashMap<>();
78 for (AttributeValueType s : values()) {
79 codeMapping.put(s.key, s);
84 * Lookup function based on the type code. Returns null if the code does not exist.
86 * @param attributeValueType
88 * @return enumeration value.
90 public static AttributeValueType getAttributeValueType(int attributeValueType) {
91 if (codeMapping == null) {
95 if (codeMapping.get(attributeValueType) == null) {
99 return codeMapping.get(attributeValueType);
103 * Returns the BlueGiga protocol defined value for this enum
105 * @return the BGAPI enumeration key
107 public int getKey() {