WallbotBLE default code

Dependencies:   mbed

Fork of BLE_WallbotBLE_Challenge by Wallbot BLE Developer

Committer:
jksoft
Date:
Wed Nov 12 02:40:34 2014 +0000
Revision:
0:76dfa9657d9d
????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:76dfa9657d9d 1 /**************************************************************************/
jksoft 0:76dfa9657d9d 2 /*!
jksoft 0:76dfa9657d9d 3 @file ble_error.h
jksoft 0:76dfa9657d9d 4 @author hathach (tinyusb.org)
jksoft 0:76dfa9657d9d 5
jksoft 0:76dfa9657d9d 6 @section LICENSE
jksoft 0:76dfa9657d9d 7
jksoft 0:76dfa9657d9d 8 Software License Agreement (BSD License)
jksoft 0:76dfa9657d9d 9
jksoft 0:76dfa9657d9d 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
jksoft 0:76dfa9657d9d 11 All rights reserved.
jksoft 0:76dfa9657d9d 12
jksoft 0:76dfa9657d9d 13 Redistribution and use in source and binary forms, with or without
jksoft 0:76dfa9657d9d 14 modification, are permitted provided that the following conditions are met:
jksoft 0:76dfa9657d9d 15 1. Redistributions of source code must retain the above copyright
jksoft 0:76dfa9657d9d 16 notice, this list of conditions and the following disclaimer.
jksoft 0:76dfa9657d9d 17 2. Redistributions in binary form must reproduce the above copyright
jksoft 0:76dfa9657d9d 18 notice, this list of conditions and the following disclaimer in the
jksoft 0:76dfa9657d9d 19 documentation and/or other materials provided with the distribution.
jksoft 0:76dfa9657d9d 20 3. Neither the name of the copyright holders nor the
jksoft 0:76dfa9657d9d 21 names of its contributors may be used to endorse or promote products
jksoft 0:76dfa9657d9d 22 derived from this software without specific prior written permission.
jksoft 0:76dfa9657d9d 23
jksoft 0:76dfa9657d9d 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
jksoft 0:76dfa9657d9d 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
jksoft 0:76dfa9657d9d 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
jksoft 0:76dfa9657d9d 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
jksoft 0:76dfa9657d9d 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
jksoft 0:76dfa9657d9d 29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
jksoft 0:76dfa9657d9d 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
jksoft 0:76dfa9657d9d 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
jksoft 0:76dfa9657d9d 32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
jksoft 0:76dfa9657d9d 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
jksoft 0:76dfa9657d9d 34 */
jksoft 0:76dfa9657d9d 35 /**************************************************************************/
jksoft 0:76dfa9657d9d 36
jksoft 0:76dfa9657d9d 37 /** \file
jksoft 0:76dfa9657d9d 38 * \brief Error Header
jksoft 0:76dfa9657d9d 39 *
jksoft 0:76dfa9657d9d 40 * \note TBD
jksoft 0:76dfa9657d9d 41 */
jksoft 0:76dfa9657d9d 42
jksoft 0:76dfa9657d9d 43 /** \ingroup Group_Common
jksoft 0:76dfa9657d9d 44 * \defgroup Group_Error Error Codes
jksoft 0:76dfa9657d9d 45 * @{
jksoft 0:76dfa9657d9d 46 */
jksoft 0:76dfa9657d9d 47
jksoft 0:76dfa9657d9d 48 #ifndef _BLE_ERROR_H_
jksoft 0:76dfa9657d9d 49 #define _BLE_ERROR_H_
jksoft 0:76dfa9657d9d 50
jksoft 0:76dfa9657d9d 51 #include "projectconfig.h"
jksoft 0:76dfa9657d9d 52
jksoft 0:76dfa9657d9d 53 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 54 extern "C" {
jksoft 0:76dfa9657d9d 55 #endif
jksoft 0:76dfa9657d9d 56
jksoft 0:76dfa9657d9d 57 typedef enum
jksoft 0:76dfa9657d9d 58 {
jksoft 0:76dfa9657d9d 59 /*=======================================================================
jksoft 0:76dfa9657d9d 60 NORDIC GLOBAL ERRORS 0x0000 .. 0x00FF
jksoft 0:76dfa9657d9d 61 -----------------------------------------------------------------------
jksoft 0:76dfa9657d9d 62 Errors mapped from nrf_error.h
jksoft 0:76dfa9657d9d 63 -----------------------------------------------------------------------*/
jksoft 0:76dfa9657d9d 64 ERROR_NONE = 0x0000 , ///< Successful command
jksoft 0:76dfa9657d9d 65 ERROR_SVC_HANDLER_MISSING = 0x0001 , ///< SVC handler is missing
jksoft 0:76dfa9657d9d 66 ERROR_SOFTDEVICE_NOT_ENABLED = 0x0002 , ///< SoftDevice has not been enabled
jksoft 0:76dfa9657d9d 67 ERROR_INTERNAL = 0x0003 , ///< Internal Error
jksoft 0:76dfa9657d9d 68 ERROR_NO_MEM = 0x0004 , ///< No Memory for operation
jksoft 0:76dfa9657d9d 69 ERROR_NOT_FOUND = 0x0005 , ///< Not found
jksoft 0:76dfa9657d9d 70 ERROR_NOT_SUPPORTED = 0x0006 , ///< Not supported
jksoft 0:76dfa9657d9d 71 ERROR_INVALID_PARAM = 0x0007 , ///< Invalid Parameter
jksoft 0:76dfa9657d9d 72 ERROR_INVALID_STATE = 0x0008 , ///< Invalid state, operation disallowed in this state
jksoft 0:76dfa9657d9d 73 ERROR_INVALID_LENGTH = 0x0009 , ///< Invalid Length
jksoft 0:76dfa9657d9d 74 ERROR_INVALID_FLAGS = 0x000A , ///< Invalid Flags
jksoft 0:76dfa9657d9d 75 ERROR_INVALID_DATA = 0x000B , ///< Invalid Data
jksoft 0:76dfa9657d9d 76 ERROR_DATA_SIZE = 0x000C , ///< Data size exceeds limit
jksoft 0:76dfa9657d9d 77 ERROR_TIMEOUT = 0x000D , ///< Operation timed out
jksoft 0:76dfa9657d9d 78 ERROR_NULL = 0x000E , ///< Null Pointer
jksoft 0:76dfa9657d9d 79 ERROR_FORBIDDEN = 0x000F , ///< Forbidden Operation
jksoft 0:76dfa9657d9d 80 ERROR_INVALID_ADDR = 0x0010 , ///< Bad Memory Address
jksoft 0:76dfa9657d9d 81 ERROR_BUSY = 0x0011 , ///< Busy
jksoft 0:76dfa9657d9d 82 /*=======================================================================*/
jksoft 0:76dfa9657d9d 83
jksoft 0:76dfa9657d9d 84 ERROR_INVALIDPARAMETER = 0x0100 , /**< An invalid parameter value was provided */
jksoft 0:76dfa9657d9d 85 ERROR_I2C_XFER_FAILED = 0x0101 , /**< an failed attempt to make I2C transfer */
jksoft 0:76dfa9657d9d 86
jksoft 0:76dfa9657d9d 87 /*=======================================================================
jksoft 0:76dfa9657d9d 88 SIMPLE BINARY PROTOCOL ERRORS 0x0120 .. 0x013F
jksoft 0:76dfa9657d9d 89 -----------------------------------------------------------------------
jksoft 0:76dfa9657d9d 90 Errors relating to the simple binary protocol (/src//protocol)
jksoft 0:76dfa9657d9d 91 -----------------------------------------------------------------------*/
jksoft 0:76dfa9657d9d 92 ERROR_PROT_INVALIDMSGTYPE = 0x121, /**< Unexpected msg type encountered */
jksoft 0:76dfa9657d9d 93 ERROR_PROT_INVALIDCOMMANDID = 0x122, /**< Unknown or out of range command ID */
jksoft 0:76dfa9657d9d 94 ERROR_PROT_INVALIDPAYLOAD = 0x123, /**< Message payload has a problem (invalid len, etc.) */
jksoft 0:76dfa9657d9d 95 /*=======================================================================*/
jksoft 0:76dfa9657d9d 96
jksoft 0:76dfa9657d9d 97 //------------- based on Nordic SDM nrf_error_sdm.h -------------//
jksoft 0:76dfa9657d9d 98 ERROR_SDM_LFCLK_SOURCE_UNKNOWN = 0x1000 , ///< Unknown lfclk source
jksoft 0:76dfa9657d9d 99 ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION = 0x1001 , ///< Incorrect interrupt configuration (can be caused by using illegal priority levels, or having enabled SoftDevice interrupts)
jksoft 0:76dfa9657d9d 100 ERROR_SDM_INCORRECT_CLENR0 = 0x1002 , ///< Incorrect CLENR0 (can be caused by erronous SoftDevice flashing)
jksoft 0:76dfa9657d9d 101
jksoft 0:76dfa9657d9d 102 //------------- based on Nordic SOC nrf_error_soc.h -------------//
jksoft 0:76dfa9657d9d 103 /* Mutex Errors */
jksoft 0:76dfa9657d9d 104 ERROR_SOC_MUTEX_ALREADY_TAKEN = 0x2000 , ///< Mutex already taken
jksoft 0:76dfa9657d9d 105
jksoft 0:76dfa9657d9d 106 /* NVIC errors */
jksoft 0:76dfa9657d9d 107 ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE = 0x2001 , ///< NVIC interrupt not available
jksoft 0:76dfa9657d9d 108 ERROR_SOC_NVIC_INTERRUPT_PRIORITY_NOT_ALLOWED = 0x2002 , ///< NVIC interrupt priority not allowed
jksoft 0:76dfa9657d9d 109 ERROR_SOC_NVIC_SHOULD_NOT_RETURN = 0x2003 , ///< NVIC should not return
jksoft 0:76dfa9657d9d 110
jksoft 0:76dfa9657d9d 111 /* Power errors */
jksoft 0:76dfa9657d9d 112 ERROR_SOC_POWER_MODE_UNKNOWN = 0x2004 , ///< Power mode unknown
jksoft 0:76dfa9657d9d 113 ERROR_SOC_POWER_POF_THRESHOLD_UNKNOWN = 0x2005 , ///< Power POF threshold unknown
jksoft 0:76dfa9657d9d 114 ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN = 0x2006 , ///< Power off should not return
jksoft 0:76dfa9657d9d 115
jksoft 0:76dfa9657d9d 116 /* Rand errors */
jksoft 0:76dfa9657d9d 117 ERROR_SOC_RAND_NOT_ENOUGH_VALUES = 0x2007 , ///< RAND not enough values
jksoft 0:76dfa9657d9d 118
jksoft 0:76dfa9657d9d 119 /* PPI errors */
jksoft 0:76dfa9657d9d 120 ERROR_SOC_PPI_INVALID_CHANNEL = 0x2008 , ///< Invalid PPI Channel
jksoft 0:76dfa9657d9d 121 ERROR_SOC_PPI_INVALID_GROUP = 0x2009 , ///< Invalid PPI Group
jksoft 0:76dfa9657d9d 122
jksoft 0:76dfa9657d9d 123 //------------- based on Nordic STK (ble) ble_err.h -------------//
jksoft 0:76dfa9657d9d 124 ERROR_BLE_INVALID_CONN_HANDLE = 0x3001 , /**< Invalid connection handle. */
jksoft 0:76dfa9657d9d 125 ERROR_BLE_INVALID_ATTR_HANDLE = 0x3002 , /**< Invalid attribute handle. */
jksoft 0:76dfa9657d9d 126 ERROR_BLE_NO_TX_BUFFERS = 0x3003 , /**< Buffer capacity exceeded. */
jksoft 0:76dfa9657d9d 127
jksoft 0:76dfa9657d9d 128 // L2CAP
jksoft 0:76dfa9657d9d 129 ERROR_BLE_L2CAP_CID_IN_USE = 0x3100 , /**< CID already in use. */
jksoft 0:76dfa9657d9d 130
jksoft 0:76dfa9657d9d 131 // GAP
jksoft 0:76dfa9657d9d 132 ERROR_BLE_GAP_UUID_LIST_MISMATCH = 0x3200 , /**< UUID list does not contain an integral number of UUIDs. */
jksoft 0:76dfa9657d9d 133 ERROR_BLE_GAP_DISCOVERABLE_WITH_WHITELIST = 0x3201 , /**< Use of Whitelist not permitted with discoverable advertising. */
jksoft 0:76dfa9657d9d 134 ERROR_BLE_GAP_INVALID_BLE_ADDR = 0x3202 , /**< The upper two bits of the address do not correspond to the specified address type. */
jksoft 0:76dfa9657d9d 135
jksoft 0:76dfa9657d9d 136 // GATTC
jksoft 0:76dfa9657d9d 137 ERROR_BLE_GATTC_PROC_NOT_PERMITTED = 0x3300 ,
jksoft 0:76dfa9657d9d 138
jksoft 0:76dfa9657d9d 139 // GATTS
jksoft 0:76dfa9657d9d 140 ERROR_BLEGATTS_INVALID_ATTR_TYPE = 0x3400 , /**< Invalid attribute type. */
jksoft 0:76dfa9657d9d 141 ERROR_BLEGATTS_SYS_ATTR_MISSING = 0x3401 , /**< System Attributes missing. */
jksoft 0:76dfa9657d9d 142
jksoft 0:76dfa9657d9d 143 }error_t;
jksoft 0:76dfa9657d9d 144
jksoft 0:76dfa9657d9d 145 #ifdef __cplusplus
jksoft 0:76dfa9657d9d 146 }
jksoft 0:76dfa9657d9d 147 #endif
jksoft 0:76dfa9657d9d 148
jksoft 0:76dfa9657d9d 149 #endif /* _BLE_ERROR_H_ */
jksoft 0:76dfa9657d9d 150
jksoft 0:76dfa9657d9d 151 /** @} */