library for BLE_GAP_backpack

Dependencies:   nrf51-sdk

Fork of nRF51822 by Nordic Semiconductor

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ble_error.h Source File

ble_error.h

Go to the documentation of this file.
00001 /**************************************************************************/
00002 /*!
00003     @file     ble_error.h
00004     @author   hathach (tinyusb.org)
00005 
00006     @section LICENSE
00007 
00008     Software License Agreement (BSD License)
00009 
00010     Copyright (c) 2013, K. Townsend (microBuilder.eu)
00011     All rights reserved.
00012 
00013     Redistribution and use in source and binary forms, with or without
00014     modification, are permitted provided that the following conditions are met:
00015     1. Redistributions of source code must retain the above copyright
00016     notice, this list of conditions and the following disclaimer.
00017     2. Redistributions in binary form must reproduce the above copyright
00018     notice, this list of conditions and the following disclaimer in the
00019     documentation and/or other materials provided with the distribution.
00020     3. Neither the name of the copyright holders nor the
00021     names of its contributors may be used to endorse or promote products
00022     derived from this software without specific prior written permission.
00023 
00024     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
00025     EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00026     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
00028     DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00029     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00031     ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00032     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00033     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 */
00035 /**************************************************************************/
00036 
00037 /** \file
00038  *  \brief Error Header
00039  *
00040  *  \note TBD
00041  */
00042 
00043 /** \ingroup Group_Common
00044  *  \defgroup Group_Error Error Codes
00045  *  @{
00046  */
00047 
00048 #ifndef _BLE_ERROR_H_
00049 #define _BLE_ERROR_H_
00050 
00051 #include "projectconfig.h"
00052 
00053 #ifdef __cplusplus
00054  extern "C" {
00055 #endif
00056 
00057 typedef enum 
00058 {
00059   /*=======================================================================
00060     NORDIC GLOBAL ERRORS                                   0x0000 .. 0x00FF
00061     -----------------------------------------------------------------------
00062     Errors mapped from nrf_error.h
00063     -----------------------------------------------------------------------*/
00064     ERROR_NONE                                    = 0x0000 , ///< Successful command
00065     ERROR_SVC_HANDLER_MISSING                     = 0x0001 , ///< SVC handler is missing
00066     ERROR_SOFTDEVICE_NOT_ENABLED                  = 0x0002 , ///< SoftDevice has not been enabled
00067     ERROR_INTERNAL                                = 0x0003 , ///< Internal Error
00068     ERROR_NO_MEM                                  = 0x0004 , ///< No Memory for operation
00069     ERROR_NOT_FOUND                               = 0x0005 , ///< Not found
00070     ERROR_NOT_SUPPORTED                           = 0x0006 , ///< Not supported
00071     ERROR_INVALID_PARAM                           = 0x0007 , ///< Invalid Parameter
00072     ERROR_INVALID_STATE                           = 0x0008 , ///< Invalid state, operation disallowed in this state
00073     ERROR_INVALID_LENGTH                          = 0x0009 , ///< Invalid Length
00074     ERROR_INVALID_FLAGS                           = 0x000A , ///< Invalid Flags
00075     ERROR_INVALID_DATA                            = 0x000B , ///< Invalid Data
00076     ERROR_DATA_SIZE                               = 0x000C , ///< Data size exceeds limit
00077     ERROR_TIMEOUT                                 = 0x000D , ///< Operation timed out
00078     ERROR_NULL                                    = 0x000E , ///< Null Pointer
00079     ERROR_FORBIDDEN                               = 0x000F , ///< Forbidden Operation
00080     ERROR_INVALID_ADDR                            = 0x0010 , ///< Bad Memory Address
00081     ERROR_BUSY                                    = 0x0011 , ///< Busy
00082   /*=======================================================================*/
00083 
00084   ERROR_INVALIDPARAMETER                        = 0x0100 , /**< An invalid parameter value was provided */
00085   ERROR_I2C_XFER_FAILED                         = 0x0101 , /**< an failed attempt to make I2C transfer */
00086 
00087   /*=======================================================================
00088     SIMPLE BINARY PROTOCOL ERRORS                          0x0120 .. 0x013F
00089     -----------------------------------------------------------------------
00090     Errors relating to the simple binary protocol (/src//protocol)
00091     -----------------------------------------------------------------------*/
00092     ERROR_PROT_INVALIDMSGTYPE                   = 0x121,  /**< Unexpected msg type encountered */
00093     ERROR_PROT_INVALIDCOMMANDID                 = 0x122,  /**< Unknown or out of range command ID */
00094     ERROR_PROT_INVALIDPAYLOAD                   = 0x123,  /**< Message payload has a problem (invalid len, etc.) */
00095   /*=======================================================================*/
00096 
00097   //------------- based on Nordic SDM nrf_error_sdm.h -------------//
00098   ERROR_SDM_LFCLK_SOURCE_UNKNOWN                = 0x1000 , ///< Unknown lfclk source
00099   ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION   = 0x1001 , ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts)
00100   ERROR_SDM_INCORRECT_CLENR0                    = 0x1002 , ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing)
00101 
00102   //------------- based on Nordic SOC nrf_error_soc.h -------------//
00103   /* Mutex Errors */
00104   ERROR_SOC_MUTEX_ALREADY_TAKEN                 = 0x2000 ,  ///< Mutex already taken
00105 
00106   /* NVIC errors */
00107   ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE        = 0x2001 ,  ///< NVIC interrupt not available
00108   ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002 ,  ///< NVIC interrupt priority not allowed
00109   ERROR_SOC_NVIC_SHOULD_NOT_RETURN              = 0x2003 ,  ///< NVIC should not return
00110 
00111   /* Power errors */
00112   ERROR_SOC_POWER_MODE_UNKNOWN                  = 0x2004 ,  ///< Power mode unknown
00113   ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN         = 0x2005 ,  ///< Power POF threshold unknown
00114   ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN         = 0x2006 ,  ///< Power off should not return
00115 
00116   /* Rand errors */
00117   ERROR_SOC_RAND_NOT_ENOUGH_VALUES              = 0x2007 ,  ///< RAND not enough values
00118 
00119   /* PPI errors */
00120   ERROR_SOC_PPI_INVALID_CHANNEL                 = 0x2008 ,  ///< Invalid PPI Channel
00121   ERROR_SOC_PPI_INVALID_GROUP                   = 0x2009 ,  ///< Invalid PPI Group
00122 
00123   //------------- based on Nordic STK (ble) ble_err.h -------------//
00124   ERROR_BLE_INVALID_CONN_HANDLE                 = 0x3001 , /**< Invalid connection handle. */
00125   ERROR_BLE_INVALID_ATTR_HANDLE                 = 0x3002 , /**< Invalid attribute handle. */
00126   ERROR_BLE_NO_TX_BUFFERS                       = 0x3003 , /**< Buffer capacity exceeded. */
00127 
00128   // L2CAP
00129   ERROR_BLE_L2CAP_CID_IN_USE                    = 0x3100 , /**< CID already in use. */
00130 
00131   // GAP
00132   ERROR_BLE_GAP_UUID_LIST_MISMATCH              = 0x3200 , /**< UUID list does not contain an integral number of UUIDs. */
00133   ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST     = 0x3201 , /**< Use of Whitelist not permitted with discoverable advertising. */
00134   ERROR_BLE_GAP_INVALID_BLE_ADDR                = 0x3202 , /**< The upper two bits of the address do not correspond to the specified address type. */
00135 
00136   // GATTC
00137   ERROR_BLE_GATTC_PROC_NOT_PERMITTED            = 0x3300 ,
00138 
00139   // GATTS
00140   ERROR_BLEGATTS_INVALID_ATTR_TYPE              = 0x3400 , /**< Invalid attribute type. */
00141   ERROR_BLEGATTS_SYS_ATTR_MISSING               = 0x3401 , /**< System Attributes missing. */
00142 
00143 }error_t;
00144 
00145 #ifdef __cplusplus
00146  }
00147 #endif
00148 
00149 #endif /* _BLE_ERROR_H_ */
00150 
00151  /**  @} */