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>BgApiResponse</b>.
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 BgApiResponse {
29 * Default unknown value
34 * [0] Completed successfully.
39 * [257] Invalid GATT connection handle.
41 INVALID_CONN_HANDLE(0x0101),
44 * [258] Waiting response from GATT server to previous procedure.
46 WAITING_RESPONSE(0x0102),
49 * [384] Command contained invalid parameter
51 INVALID_PARAM(0x0180),
54 * [385] Device is in wrong state to receive command
59 * [386] Device has run out of memory
61 OUT_OF_MEMORY(0x0182),
64 * [387] Feature is not implemented
66 NOT_IMPLEMENTED(0x0183),
69 * [388] Command was not recognized
71 INVALID_COMMAND(0x0184),
74 * [389] Command or Procedure failed due to timeout
79 * [390] Connection handle passed is to command is not a valid handle
81 NOT_CONNECTED(0x0186),
84 * [391] Command would cause either underflow or overflow error
89 * [392] User attribute was accessed through API which is not supported
91 USER_ATTRIBUTE(0x0188),
94 * [393] No valid license key found
96 INVALID_LICENSE_KEY(0x0189),
99 * [394] Command maximum length exceeded
101 COMMAND_TOO_LONG(0x018A),
104 * [395] Bonding procedure can't be started because device has no space left for bond.
106 OUT_OF_BONDS(0x018B),
109 * [396] Unspecified error
114 * [397] Hardware failure
119 * [398] Command not accepted, because internal buffers are full
121 BUFFERS_FULL(0x018E),
124 * [399] Command or Procedure failed due to disconnection
126 DISCONNECTED(0x018F),
129 * [400] Too many Simultaneous Requests
131 TOO_MANY_REQUESTS(0x0190),
134 * [401] Feature is not supported in this firmware build
136 NOT_SUPPORTED(0x0191),
139 * [402] The bonding does not exist.
144 * [403] Error using crypto functions
149 * [514] A command was sent from the Host that should identify a connection, but that connection
152 UNKNOWN_CONNECTION_IDENTIFIER(0x0202),
155 * [520] Link supervision timeout has expired.
157 CONNECTION_TIMEOUT(0x0208),
160 * [521] Controller is at limit of connections it can support.
162 CONNECTION_LIMIT_EXCEEDED(0x0209),
167 SYNCHRONOUS_CONNECTIONTION_LIMIT_EXCEEDED(0x020A),
170 * [523] The ACL Connection Already Exists error code indicates that an attempt to create a new
171 * ACL Connection to a device when there is already a connection to this device.
173 ACL_CONNECTION_ALREADY_EXISTS(0x020B),
176 * [524] Command requested cannot be executed because the Controller is in a state where it
177 * cannot process this command at this time.
179 COMMAND_DISALLOWED(0x020C),
182 * [525] The Connection Rejected Due To Limited Resources error code indicates that an
183 * incoming connection was rejected due to limited resources.
185 CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES(0x020D),
188 * [526] The Connection Rejected Due To Security Reasons error code indicates that a
189 * connection was rejected due to security requirements not being fulfilled, like
190 * authentication or pairing.
192 CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS(0x020E),
195 * [527] The Connection was rejected because this device does not accept the BD_ADDR. This may
196 * be because the device will only accept connections from specific BD_ADDRs.
198 CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR(0x020F),
201 * [528] The Connection Accept Timeout has been exceeded for this connection attempt.
203 CONNECTION_ACCEPT_TIMEOUT_EXCEEDED(0x0210),
206 * [529] A feature or parameter value in the HCI command is not supported.
208 UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE(0x0211),
211 * [530] Command contained invalid parameters.
213 INVALID_COMMAND_PARAMETERS(0x0212),
216 * [531] User on the remote device terminated the connection.
218 REMOTE_USER_TERMINATED(0x0213),
221 * [532] The remote device terminated the connection because of low resources
223 REMOTE_DEVICE_TERMINATED_CONNECTION_LOW_RESOURCES(0x0214),
226 * [533] Remote Device Terminated Connection due to Power Off
228 REMOTE_POWERING_OFF(0x0215),
231 * [534] Local device terminated the connection.
233 CONNECTION_TERMINATED_BY_LOCAL_HOST(0x0216),
236 * [535] The Controller is disallowing an authentication or pairing procedure because too
237 * little time has elapsed since the last authentication or pairing attempt failed.
239 REPEATED_ATTEMPTS(0x0217),
242 * [536] The device does not allow pairing. This can be for example, when a device only allows
243 * pairing during a certain time window after some user input allows pairing
245 PAIRING_NOT_ALLOWED(0x0218),
248 * [537] The Controller has received an unknown LMP OpCode.
250 UNKNOWN_LMP_PDU(0x0219),
253 * [538] The remote device does not support the feature associated with the issued command or
256 UNSUPPORTED_REMOTE_FEATURE(0x021A),
259 * [560] A parameter value requested is outside the mandatory range of parameters for the given
260 * HCI command or LMP PDU.
262 PARAMETER_OUT_OF_MANDATORY_RANGE(0x0230),
265 * [569] The Controller could not calculate an appropriate value for the Channel selection
268 CONNECTION_REJECTED_NO_SUITABLE_CHANNEL(0x0239),
271 * [570] Operation was rejected because the controller is busy and unable to process the
274 CONTROLLER_BUSY(0x023A),
277 * [571] Remote device terminated the connection because of an unacceptable connection
280 UNACCEPTABLE_CONNECTION_INTERVAL(0x023B),
283 * [573] Connection was terminated because the Message Integrity Check (MIC) failed on a
286 CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE(0x023D),
289 * [574] LL initiated a connection but the connection has failed to be established. Controller
290 * did not receive any packets from remote end.
292 CONNECTION_FAILED_TO_BE_ESTABLISHED(0x023E),
295 * [575] The MAC of the 802.11 AMP was requested to connect to a peer, but the connection failed.
297 MAC_CONNECTION_FAILED(0x023F),
300 * [576] The master, at this time, is unable to make a coarse adjustment to the piconet clock,
301 * using the supplied parameters. Instead the master will attempt to move the clock using clock
304 COARSE_CLOCK_ADJUSTMENT_REJECTED(0x0240),
307 * [769] The user input of passkey failed, for example, the user cancelled the operation
309 PASSKEY_ENTRY_FAILED(0x0301),
312 * [1025] The attribute handle given was not valid on this server
314 INVALID_HANDLE(0x0401),
317 * [1026] The attribute cannot be read
319 READ_NOT_PERMITTED(0x0402),
322 * [1027] The attribute cannot be written
324 WRITE_NOT_PERMITTED(0x0403),
327 * [1028] The attribute PDU was invalid
332 * [1029] The attribute requires authentication before it can be read or written.
334 INSUFFICIENT_AUTHENTICATION(0x0405),
337 * [1030] Attribute Server does not support the request received from the client.
339 REQUEST_NOT_SUPPORTED(0x0406),
342 * [1031] Offset specified was past the end of the attribute
344 INVALID_OFFSET(0x0407),
347 * [1032] The attribute requires authorization before it can be read or written.
349 INSUFFICIENT_AUTHORIZATION(0x0408),
352 * [1033] Too many prepare writes have been queueud
354 PREPARE_QUEUE_FULL(0x0409),
357 * [1034] No attribute found within the given attribute handle range.
359 ATT_NOT_FOUND(0x040A),
362 * [1035] The attribute cannot be read or written using the Read Blob Request
364 ATT_NOT_LONG(0x040B),
367 * [1037] The attribute value length is invalid for the operation
369 INVALID_ATT_LENGTH(0x040D),
372 * [1040] The attribute type is not a supported grouping attribute as defined by a higher layer
375 UNSUPPORTED_GROUP_TYPE(0x0410),
378 * [1041] Insufficient Resources to complete the request
380 INSUFFICIENT_RESOURCES(0x0411),
383 * [1152] Application error code defined by a higher layer specification.
388 * [1537] Service Record not found
390 RECORD_NOT_FOUND(0x0601),
393 * [1538] Service Record with this handle already exist
395 RECORD_ALREADY_EXIST(0x0602),
398 * [2305] File not found.
400 FILE_NOT_FOUND(0x0901),
403 * [2561] File open failed.
405 FILE_OPEN_FAILED(0x0A01),
408 * [2562] XML parsing failed.
410 XML_PARSE_FAILED(0x0A02),
413 * [2563] Device connection failed.
415 DEVICE_CONNECTION_FAILED(0x0A03),
418 * [2817] Device firmware signature verification failed.
420 IMAGE_SIGNATURE_VERIFICATION_FAILED(0x0B01),
423 * [2818] File signature verification failed.
425 FILE_SIGNATURE_VERIFICATION_FAILED(0x0B02),
428 * [2819] Device firmware checksum is not valid.
430 IMAGE_CHECKSUM_ERROR(0x0B03);
433 * A mapping between the integer code and its corresponding type to
434 * facilitate lookup by code.
436 private static Map<Integer, BgApiResponse> codeMapping;
440 private BgApiResponse(int key) {
444 private static void initMapping() {
445 codeMapping = new HashMap<>();
446 for (BgApiResponse s : values()) {
447 codeMapping.put(s.key, s);
452 * Lookup function based on the type code. Returns null if the code does not exist.
454 * @param bgApiResponse
456 * @return enumeration value.
458 public static BgApiResponse getBgApiResponse(int bgApiResponse) {
459 if (codeMapping == null) {
463 if (codeMapping.get(bgApiResponse) == null) {
467 return codeMapping.get(bgApiResponse);
471 * Returns the BlueGiga protocol defined value for this enum
473 * @return the BGAPI enumeration key
475 public int getKey() {