1 /*
2  * Copyright (C) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HCI_ERROR_H
17 #define HCI_ERROR_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 // BLUETOOTH SPECIFICATION Version 5.0 | Vol 2, Part D
24 // 1.3 LIST OF ERROR CODES
25 
26 #define HCI_SUCCESS 0x00
27 #define HCI_UNKNOWN_HCI_COMMAND 0x01
28 #define HCI_UNKNOWN_CONNECTION_IDENTIFIER 0x02
29 #define HCI_HARDWARE_FAILURE 0x03
30 #define HCI_PAGE_TIMEOUT 0x04
31 #define HCI_AUTHENTICATION_FAILURE 0x05
32 #define HCI_PIN_OR_KEY_MISSING 0x06
33 #define HCI_MEMORY_CAPACITY_EXCEEDED 0x07
34 #define HCI_CONNECTION_TIMEOUT 0x08
35 #define HCI_CONNECTION_LIMIT_EXCEEDED 0x09
36 #define HCI_SYNCHRONOUS_CONNECTION_LIMIT_TO_A_DEVICE_EXCEEDED 0x0A
37 #define HCI_CONNECTION_ALREADY_EXISTS 0x0B
38 #define HCI_COMMAND_DISALLOWED 0x0C
39 #define HCI_CONNECTION_REJECTED_DUE_TO_LIMITED_RESOURCES 0x0D
40 #define HCI_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0E
41 #define HCI_CONNECTION_REJECTED_DUE_TO_UNACCEPTABLE_BD_ADDR 0x0F
42 #define HCI_CONNECTION_ACCEPT_TIMEOUT_EXCEEDED 0x10
43 #define HCI_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE 0x11
44 #define HCI_INVALID_HCI_COMMAND_PARAMETERS 0x12
45 #define HCI_REMOTE_USER_TERMINATED_CONNECTION 0x13
46 #define HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x14
47 #define HCI_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_POWER_OFF 0x15
48 #define HCI_CONNECTION_TERMINATED_BY_LOCAL_HOST 0x16
49 #define HCI_REPEATED_ATTEMPTS 0x17
50 #define HCI_PAIRING_NOT_ALLOWED 0x18
51 #define HCI_UNKNOWN_LMP_PDU 0x19
52 #define HCI_UNSUPPORTED_REMOTE_FEATURE_OR_UNSUPPORTED_LMP_FEATURE 0x1A
53 #define HCI_SCO_OFFSET_REJECTED 0x1B
54 #define HCI_SCO_INTERVAL_REJECTED 0x1C
55 #define HCI_SCO_AIR_MODE_REJECTED 0x1D
56 #define HCI_INVALID_LMP_PARAMETERS_OR_INVALID_LL_PARAMETERS 0x1E
57 #define HCI_UNSPECIFIED_ERROR 0x1F
58 #define HCI_UNSUPPORTED_LMP_PARAMETER_VALUE_OR_UNSUPPORTED_LL_PARAMETER_VALUE 0x20
59 #define HCI_ROLE_CHANGE_NOT_ALLOWED 0x21
60 #define HCI_LMP_RESPONSE_TIMEOUT_OR_LL_RESPONSE_TIMEOUT 0x22
61 #define HCI_LMP_ERROR_TRANSACTION_COLLISION_OR_LL_PROCEDURE_COLLISION 0x23
62 #define HCI_LMP_PDU_NOT_ALLOWED 0x24
63 #define HCI_ENCRYPTION_MODE_NOT_ACCEPTABLE 0x25
64 #define HCI_LINK_KEY_CANNOT_BE_CHANGED 0x26
65 #define HCI_REQUESTED_QOS_NOT_SUPPORTED 0x27
66 #define HCI_INSTANT_PASSED 0x28
67 #define HCI_PAIRING_WITH_UNIT_KEY_NOT_SUPPORTED 0x29
68 #define HCI_DIFFERENT_TRANSACTION_COLLISION 0x2A
69 #define HCI_QOS_UNACCEPTABLE_PARAMETER 0x2C
70 #define HCI_QOS_REJECTED 0x2D
71 #define HCI_CHANNEL_CLASSIFICATION_NOT_SUPPORTED 0x2E
72 #define HCI_INSUFFICIENT_SECURITY 0x2F
73 #define HCI_PARAMETER_OUT_OF_MANDATORY_RANGE 0x30
74 #define HCI_ROLE_SWITCH_PENDING 0x32
75 #define HCI_RESERVED_SLOT_VIOLATION 0x34
76 #define HCI_ROLE_SWITCH_FAILED 0x35
77 #define HCI_EXTENDED_INQUIRY_RESPONSE_TOO_LARGE 0x36
78 #define HCI_SECURE_SIMPLE_PAIRING_NOT_SUPPORTED_BY_HOST 0x37
79 #define HCI_HOST_BUSY_PAIRING 0x38
80 #define HCI_CONNECTION_REJECTED_DUE_TO_NO_SUITABLE_CHANNEL_FOUND 0x39
81 #define HCI_CONTROLLER_BUSY 0x3A
82 #define HCI_UNACCEPTABLE_CONNECTION_PARAMETERS 0x3B
83 #define HCI_ADVERTISING_TIMEOUT 0x3C
84 #define HCI_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3D
85 #define HCI_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3E
86 #define HCI_MAC_CONNECTION_FAILED 0x3F
87 #define HCI_COARSE_CLOCK_ADJUSTMENT_REJECTED_BUT_WILL_TRY_TO_ADJUST_USING_CLOCK_DRAGGING 0x40
88 #define HCI_TYPE0_SUBMAP_NOT_DEFINED 0x41
89 #define HCI_UNKNOWN_ADVERTISING_IDENTIFIER 0x42
90 #define HCI_LIMIT_REACHED 0x43
91 #define HCI_OPERATION_CANCELLED_BY_HOST 0x44
92 
93 // Stack definition
94 #define HCI_TIMEOUT 0xE1
95 
96 #ifdef __cplusplus
97 }
98 #endif
99 
100 #endif