ble_error.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file ble_error.h
5 *
6 * @brief File that contains error codes.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 *****************************************************************************************
36 */
37
38 /**
39 * @addtogroup BLE
40 * @{
41 */
42
43 /**
44 @addtogroup BLE_ERROR Error Codes
45 @{
46 @brief File that contains error codes.
47 */
48
49 #ifndef _BLE_SDK_ERROR_H_
50 #define _BLE_SDK_ERROR_H_
51
52 #include <stdint.h>
53
54 /**@addtogroup BLE_ERROR_CODES Defines
55 * @{
56 */
57
58 /**@defgroup SDK_ERROR_CODES SDK Specific Error Codes
59 * @{
60 */
61 #define SDK_SUCCESS 0x0000 /**< Successful. */
62 #define SDK_ERR_INVALID_PARAM 0x0001 /**< Invalid parameter supplied. */
63 #define SDK_ERR_POINTER_NULL 0x0002 /**< Invalid pointer supplied. */
64 #define SDK_ERR_INVALID_CONN_IDX 0x0003 /**< Invalid connection index supplied. */
65 #define SDK_ERR_INVALID_HANDLE 0x0004 /**< Invalid handle supplied. */
66 #define SDK_ERR_PROFILE_COUNT 0x0005 /**< Maximum SDK profile count exceeded. */
67 #define SDK_ERR_BUSY 0x0006 /**< SDK is busy internally. */
68 #define SDK_ERR_TIMER_INSUFFICIENT 0x0007 /**< Timer is insufficient. */
69 #define SDK_ERR_NVDS_NOT_INIT 0x0008 /**< NVDS is not initiated. */
70 #define SDK_ERR_LIST_ITEM_NOT_FOUND 0x0009 /**< Item not found in list. */
71 #define SDK_ERR_LIST_ITEM_ALREADY_EXISTED 0x000a /**< Item already exists in list. */
72 #define SDK_ERR_LIST_FULL 0x000b /**< List is full. */
73 #define SDK_ERR_SDK_INTERNAL 0x000c /**< Internal SDK error. */
74 #define SDK_ERR_INVALID_BUFF_LENGTH 0x000d /**< The buffer's length is not enough. */
75 #define SDK_ERR_INVALID_DATA_LENGTH 0x000e /**< Invalid data length supplied. */
76 #define SDK_ERR_DISALLOWED 0x000f /**< Operation is disallowed. */
77 #define SDK_ERR_NO_RESOURCES 0x0010 /**< Not enough resources for operation. */
78 #define SDK_ERR_REQ_NOT_SUPPORTED 0x0011 /**< Request not supported. */
79 #define SDK_ERR_INVALID_OFFSET 0x0012 /**< Offset exceeds the current attribute value length. */
80 #define SDK_ERR_INVALID_ATT_VAL_LEN 0x0013 /**< Invalid length of the attribute value. */
81 #define SDK_ERR_INVALID_PERM 0x0014 /**< Permission set in service/attribute is invalid. */
82 #define SDK_ERR_INVALID_ADV_IDX 0x0015 /**< Invalid advertising index supplied. */
83 #define SDK_ERR_INVALID_ADV_DATA_TYPE 0x0016 /**< Invalid advertising data type supplied. */
84 #define SDK_ERR_INVALID_PSM_NUM 0x0017 /**< Invalid PSM number. */
85 #define SDK_ERR_INVALID_PSM_ALREADY_REGISTERED 0x0018 /**< The PSM number has been registered. */
86 #define SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM 0x0019 /**< The maximum PSM number limit is exceeded. */
87 #define SDK_ERR_NTF_DISABLED 0x001A /**< Notification is NOT enabled. */
88 #define SDK_ERR_IND_DISABLED 0x001B /**< Indication is NOT enabled. */
89 #define SDK_ERR_DISCONNECTED 0x001C /**< Disconnection occurs. */
90 #define SDK_ERR_INVALID_ADDRESS 0x001D /**< Invalid address supplied. */
91 #define SDK_ERR_INVALID_ADV_INTERVAL 0x001F /**< Invalid advertising interval supplied. */
92 #define SDK_ERR_INVALID_DISVCOVERY_MODE 0x0020 /**< Invalid discovery mode supplied. */
93 #define SDK_ERR_INVALID_ADV_PARAM 0x0021 /**< Invalid advertising parameters supplied. */
94 #define SDK_ERR_INVALID_ADV_PEER_ADDR 0x0022 /**< Invalid peer address supplied. */
95 #define SDK_ERR_ADV_DATA_NOT_SET 0x0023 /**< Legacy advertising data not set. */
96 #define SDK_ERR_PER_ADV_DATA_NOT_SET 0x0024 /**< Periodic advertising data not set. */
97 #define SDK_ERR_EXT_SCAN_RSP_DATA_NOT_SET 0x0025 /**< Extended scan response data not set. */
98 #define SDK_ERR_INVALID_DURATION_PARAM 0x0026 /**< Invalid duration parameter supplied. */
99 #define SDK_ERR_INVALID_PER_SYNC_IDX 0x0027 /**< Invalid periodic synchronization index supplied. */
100 #define SDK_ERR_INVALID_CID 0x0028 /**< Invalid CID supplied. */
101 #define SDK_ERR_INVALID_CHL_NUM 0x0029 /**< Invalid channel number supplied. */
102 #define SDK_ERR_NOT_ENOUGH_CREDITS 0x002A /**< Not enough credits. */
103
104 #define SDK_ERR_APP_ERROR 0x0080 /**< Application error. */
105 /**@} */
106
107 /**@defgroup BLE_STACK_ERROR_CODES BLE Stack specific error codes
108 * @{
109 */
110
111 #define BLE_SUCCESS 0x00 /**< Operation is Successful. */
112 /**@brief ATT Specific Error. */
113 #define BLE_ATT_ERR_INVALID_HANDLE 0x01 /**< The given attribute handle was not valid on this server. */
114 #define BLE_ATT_ERR_READ_NOT_PERMITTED 0x02 /**< The attribute cannot be read. */
115 #define BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x03 /**< The attribute cannot be written. */
116 #define BLE_ATT_ERR_INVALID_PDU 0x04 /**< The attribute PDU was invalid. */
117 #define BLE_ATT_ERR_INSUFF_AUTHEN 0x05 /**< The attribute requires authentication before it can be read or written. */
118 #define BLE_ATT_ERR_REQUEST_NOT_SUPPORTED 0x06 /**< Attribute server does not support the request received from the client. */
119 #define BLE_ATT_ERR_INVALID_OFFSET 0x07 /**< Offset specified was past the end of the attribute. */
120 #define BLE_ATT_ERR_INSUFF_AUTHOR 0x08 /**< The attribute requires authorization before it can be read or written. */
121 #define BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x09 /**< Too many prepare writes have been queued. */
122 #define BLE_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0A /**< No attribute found within the given attribute handle range. */
123 #define BLE_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0B /**< The attribute cannot be read using the Read Blob Request. */
124 #define BLE_ATT_ERR_INSUFF_ENC_KEY_SIZE 0x0C /**< The Encryption Key Size used for encrypting this link is insufficient. */
125 #define BLE_ATT_ERR_INVALID_ATTRIBUTE_VAL_LEN 0x0D /**< The attribute value length is invalid for the operation. */
126 #define BLE_ATT_ERR_UNLIKELY_ERR 0x0E /**< The attribute request has encountered an unlikely error, so the request could not be completed as requested. */
127 #define BLE_ATT_ERR_INSUFF_ENC 0x0F /**< The attribute requires encryption before it can be read or written. */
128 #define BLE_ATT_ERR_UNSUPP_GRP_TYPE 0x10 /**< The attribute type is not a supported grouping attribute as defined by a higher layer specification. */
129 #define BLE_ATT_ERR_INSUFF_RESOURCE 0x11 /**< Insufficient resources to complete the request. */
130
131 /**@brief L2CAP Specific Error. */
132 #define BLE_L2C_ERR_CONNECTION_LOST 0x30 /**< Message cannot be sent because connection is lost (disconnected). */
133 #define BLE_L2C_ERR_INVALID_MTU_EXCEED 0x31 /**< Invalid PDU length exceeds MTU. */
134 #define BLE_L2C_ERR_INVALID_MPS_EXCEED 0x32 /**< Invalid PDU length exceeds MPS. */
135 #define BLE_L2C_ERR_INVALID_CID 0x33 /**< Invalid Channel ID. */
136 #define BLE_L2C_ERR_INVALID_PDU 0x34 /**< Invalid PDU. */
137 #define BLE_L2C_ERR_NO_RES_AVAIL 0x35 /**< Connection refused because no resources are available. */
138 #define BLE_L2C_ERR_INSUFF_AUTHEN 0x36 /**< Connection refused because of insufficient authentication. */
139 #define BLE_L2C_ERR_INSUFF_AUTHOR 0x37 /**< Connection refused because of insufficient authorization. */
140 #define BLE_L2C_ERR_INSUFF_ENC_KEY_SIZE 0x38 /**< Connection refused because of insufficient encryption key size. */
141 #define BLE_L2C_ERR_INSUFF_ENC 0x39 /**< Connection refused because of insufficient encryption. */
142 #define BLE_L2C_ERR_LEPSM_NOT_SUPP 0x3A /**< Connection refused because LE_PSM is not supported. */
143 #define BLE_L2C_ERR_INSUFF_CREDIT 0x3B /**< No more credit. */
144 #define BLE_L2C_ERR_NOT_UNDERSTOOD 0x3C /**< Command not understood by peer device. */
145 #define BLE_L2C_ERR_CREDIT_ERROR 0x3D /**< Credit error: invalid number of credit received. */
146 #define BLE_L2C_ERR_CID_ALREADY_ALLOC 0x3E /**< Channel identifier already allocated. */
147
148 /**@brief GAP Specific Error. */
149 #define BLE_GAP_ERR_INVALID_PARAM 0x40 /**< Invalid parameters set. */
150 #define BLE_GAP_ERR_PROTOCOL_PROBLEM 0x41 /**< Problem with protocol exchange, resulting in unexpected responses. */
151 #define BLE_GAP_ERR_NOT_SUPPORTED 0x42 /**< Request not supported by software configuration. */
152 #define BLE_GAP_ERR_COMMAND_DISALLOWED 0x43 /**< Request not allowed in current state. */
153 #define BLE_GAP_ERR_CANCELED 0x44 /**< Requested operation canceled. */
154 #define BLE_GAP_ERR_TIMEOUT 0x45 /**< Requested operation timeout. */
155 #define BLE_GAP_ERR_DISCONNECTED 0x46 /**< Link connection is lost during operation. */
156 #define BLE_GAP_ERR_NOT_FOUND 0x47 /**< Search algorithm finished, but no result found. */
157 #define BLE_GAP_ERR_REJECTED 0x48 /**< Request rejected by peer device. */
158 #define BLE_GAP_ERR_PRIVACY_CFG_PB 0x49 /**< Problem with privacy configuration. */
159 #define BLE_GAP_ERR_ADV_DATA_INVALID 0x4A /**< Duplicate or invalid advertising data. */
160 #define BLE_GAP_ERR_INSUFF_RESOURCES 0x4B /**< Insufficient resources. */
161 #define BLE_GAP_ERR_UNEXPECTED 0x4C /**< Unexpected error. */
162 #define BLE_GAP_ERR_MISMATCH 0x4D /**< Feature mismatch. */
163
164 /**@brief GATT Specific Error. */
165 #define BLE_GATT_ERR_INVALID_ATT_LEN 0x50 /**< Problem with ATTC protocol response. */
166 #define BLE_GATT_ERR_INVALID_TYPE_IN_SVC_SEARCH 0x51 /**< Error in service search. */
167 #define BLE_GATT_ERR_WRITE 0x52 /**< Invalid write data. */
168 #define BLE_GATT_ERR_SIGNED_WRITE 0x53 /**< Signed write error. */
169 #define BLE_GATT_ERR_ATTRIBUTE_CLIENT_MISSING 0x54 /**< No attribute client defined. */
170 #define BLE_GATT_ERR_ATTRIBUTE_SERVER_MISSING 0x55 /**< No attribute server defined. */
171 #define BLE_GATT_ERR_INVALID_PERM 0x56 /**< Permission set in service/attribute is invalid. */
172 #define BLE_GATT_ERR_BROWSE_NO_ANY_MORE 0x57 /**< GATT browses no any more contents. */
173
174
175 /**@brief LL Specific Error. */
176 #define BLE_LL_ERR_UNKNOWN_HCI_COMMAND 0x91 /**< Unknown HCI Command. */
177 #define BLE_LL_ERR_UNKNOWN_CONNECTION_ID 0x92 /**< Unknown Connection Identifier. */
178 #define BLE_LL_ERR_HARDWARE_FAILURE 0x93 /**< Hardware Failure. */
179 #define BLE_LL_ERR_PAGE_TIMEOUT 0x94 /**< BT Page Timeout. */
180 #define BLE_LL_ERR_AUTH_FAILURE 0x95 /**< Authentication failure. */
181 #define BLE_LL_ERR_PIN_MISSING 0x96 /**< Pin code missing. */
182 #define BLE_LL_ERR_MEMORY_CAPA_EXCEED 0x97 /**< Memory capacity exceeded. */
183 #define BLE_LL_ERR_CON_TIMEOUT 0x98 /**< Connection Timeout. */
184 #define BLE_LL_ERR_CON_LIMIT_EXCEED 0x99 /**< Connection limit Exceed. */
185 #define BLE_LL_ERR_SYNC_CON_LIMIT_DEV_EXCEED 0x9A /**< Synchronous Connection limit exceeded. */
186 #define BLE_LL_ERR_ACL_CON_EXISTS 0x9B /**< ACL Connection exits. */
187 #define BLE_LL_ERR_COMMAND_DISALLOWED 0x9C /**< Command Disallowed. */
188 #define BLE_LL_ERR_CONN_REJ_LIMITED_RESOURCES 0x9D /**< Connection rejected due to limited resources. */
189 #define BLE_LL_ERR_CONN_REJ_SECURITY_REASONS 0x9E /**< Connection rejected due to insecurity issues. */
190 #define BLE_LL_ERR_CONN_REJ_UNACCEPTABLE_BDADDR 0x9F /**< Connection rejected due to unacceptable BD Addr. */
191 #define BLE_LL_ERR_CONN_ACCEPT_TIMEOUT_EXCEED 0xA0 /**< Connection rejected due to Accept connection timeout. */
192 #define BLE_LL_ERR_UNSUPPORTED 0xA1 /**< Not Supported. */
193 #define BLE_LL_ERR_INVALID_HCI_PARAM 0xA2 /**< Invalid parameters. */
194 #define BLE_LL_ERR_REMOTE_USER_TERM_CON 0xA3 /**< Remote user terminates connection. */
195 #define BLE_LL_ERR_REMOTE_DEV_TERM_LOW_RESOURCES 0xA4 /**< Remote device loses connection due to low resources. */
196 #define BLE_LL_ERR_REMOTE_DEV_POWER_OFF 0xA5 /**< Remote device loses connection due to power failure. */
197 #define BLE_LL_ERR_CON_TERM_BY_LOCAL_HOST 0xA6 /**< Connection terminated by local host. */
198 #define BLE_LL_ERR_REPEATED_ATTEMPTS 0xA7 /**< Repeated attempts. */
199 #define BLE_LL_ERR_PAIRING_NOT_ALLOWED 0xA8 /**< Pairing not allowed. */
200 #define BLE_LL_ERR_UNKNOWN_LMP_PDU 0xA9 /**< Unknown PDU Error. */
201 #define BLE_LL_ERR_UNSUPPORTED_REMOTE_FEATURE 0xAA /**< Unsupported remote feature. */
202 #define BLE_LL_ERR_SCO_OFFSET_REJECTED 0xAB /**< SCO Offset rejected. */
203 #define BLE_LL_ERR_SCO_INTERVAL_REJECTED 0xAC /**< SCO Interval Rejected. */
204 #define BLE_LL_ERR_SCO_AIR_MODE_REJECTED 0xAD /**< SCO air mode Rejected. */
205 #define BLE_LL_ERR_INVALID_LMP_PARAM 0xAE /**< Invalid LMP parameters. */
206 #define BLE_LL_ERR_UNSPECIFIED_ERROR 0xAF /**< Unspecified error. */
207 #define BLE_LL_ERR_UNSUPPORTED_LMP_PARAM_VALUE 0xB0 /**< Unsupported LMP Parameter value. */
208 #define BLE_LL_ERR_ROLE_CHANGE_NOT_ALLOWED 0xB1 /**< Role Change not allowed. */
209 #define BLE_LL_ERR_LMP_RSP_TIMEOUT 0xB2 /**< LMP Response timeout. */
210 #define BLE_LL_ERR_LMP_COLLISION 0xB3 /**< LMP Collision. */
211 #define BLE_LL_ERR_LMP_PDU_NOT_ALLOWED 0xB4 /**< LMP PDU not allowed. */
212 #define BLE_LL_ERR_ENC_MODE_NOT_ACCEPT 0xB5 /**< Encryption mode not accepted. */
213 #define BLE_LL_ERR_LINK_KEY_CANT_CHANGE 0xB6 /**< Link Key cannot be changed. */
214 #define BLE_LL_ERR_QOS_NOT_SUPPORTED 0xB7 /**< Quality of Service not supported. */
215 #define BLE_LL_ERR_INSTANT_PASSED 0xB8 /**< Error, instant passed. */
216 #define BLE_LL_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUP 0xB9 /**< Pairing with unit key not supported. */
217 #define BLE_LL_ERR_DIFF_TRANSACTION_COLLISION 0xBA /**< Transaction collision. */
218 #define BLE_LL_ERR_QOS_UNACCEPTABLE_PARAM 0xBC /**< Quality of Service not supported. */
219 #define BLE_LL_ERR_QOS_REJECTED 0xBD /**< Quality of Service rejected. */
220 #define BLE_LL_ERR_CHANNEL_CLASS_NOT_SUP 0xBE /**< Channel class not supported. */
221 #define BLE_LL_ERR_INSUFFICIENT_SECURITY 0xBF /**< Insufficient security. */
222 #define BLE_LL_ERR_PARAM_OUT_OF_MAND_RANGE 0xC0 /**< Parameters out of mandatory range. */
223 #define BLE_LL_ERR_ROLE_SWITCH_PEND 0xC2 /**< Role switch pending. */
224 #define BLE_LL_ERR_RESERVED_SLOT_VIOLATION 0xC4 /**< Reserved slot violation. */
225 #define BLE_LL_ERR_ROLE_SWITCH_FAIL 0xC5 /**< Role Switch failed. */
226 #define BLE_LL_ERR_EIR_TOO_LARGE 0xC6 /**< Error: EIR too large. */
227 #define BLE_LL_ERR_SP_NOT_SUPPORTED_HOST 0xC7 /**< Simple pairing not supported by host. */
228 #define BLE_LL_ERR_HOST_BUSY_PAIRING 0xC8 /**< Host pairing is busy. */
229 #define BLE_LL_ERR_CONTROLLER_BUSY 0xCA /**< Controller is busy. */
230 #define BLE_LL_ERR_UNACCEPTABLE_CONN_INT 0xCB /**< Unacceptable connection initialization. */
231 #define BLE_LL_ERR_ADV_TO 0xCC /**< Advertising Timeout. */
232 #define BLE_LL_ERR_TERMINATED_MIC_FAILURE 0xCD /**< Connection Terminated due to a MIC failure. */
233 #define BLE_LL_ERR_CONN_FAILED_TO_BE_EST 0xCE /**< Connection failed to be established. */
234 /**@} */
235
236 /**
237 * @defgroup BLE_ERROR_TYPEDEF Typedefs
238 * @{
239 */
240 /**@brief Callback function error parameter type. */
241 typedef uint8_t ble_err_t;
242 /**@brief SDK API result type. */
243 typedef uint16_t sdk_err_t;
244 /**@} */
245 /**@} */
246
247
248 #endif
249 /** @} */
250 /** @} */
251
252
ble_err_t
uint8_t ble_err_t
Callback function error parameter type.
Definition: ble_error.h:241
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243