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