mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_API/include/ble_gatt.h@277:0dffe5d9e928, 2014-08-08 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Aug 08 14:30:08 2014 +0100
- Revision:
- 277:0dffe5d9e928
Synchronized with git revision 6e585609af67e04984b0c09093a5790a751c6ceb
Full URL: https://github.com/mbedmicro/mbed/commit/6e585609af67e04984b0c09093a5790a751c6ceb/
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 277:0dffe5d9e928 | 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. |
mbed_official | 277:0dffe5d9e928 | 2 | * |
mbed_official | 277:0dffe5d9e928 | 3 | * The information contained herein is confidential property of Nordic Semiconductor. The use, |
mbed_official | 277:0dffe5d9e928 | 4 | * copying, transfer or disclosure of such information is prohibited except by express written |
mbed_official | 277:0dffe5d9e928 | 5 | * agreement with Nordic Semiconductor. |
mbed_official | 277:0dffe5d9e928 | 6 | * |
mbed_official | 277:0dffe5d9e928 | 7 | */ |
mbed_official | 277:0dffe5d9e928 | 8 | /** |
mbed_official | 277:0dffe5d9e928 | 9 | @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common |
mbed_official | 277:0dffe5d9e928 | 10 | @{ |
mbed_official | 277:0dffe5d9e928 | 11 | @brief Common definitions and prototypes for the GATT interfaces. |
mbed_official | 277:0dffe5d9e928 | 12 | */ |
mbed_official | 277:0dffe5d9e928 | 13 | |
mbed_official | 277:0dffe5d9e928 | 14 | #ifndef BLE_GATT_H__ |
mbed_official | 277:0dffe5d9e928 | 15 | #define BLE_GATT_H__ |
mbed_official | 277:0dffe5d9e928 | 16 | |
mbed_official | 277:0dffe5d9e928 | 17 | #include "ble_types.h" |
mbed_official | 277:0dffe5d9e928 | 18 | #include "ble_ranges.h" |
mbed_official | 277:0dffe5d9e928 | 19 | |
mbed_official | 277:0dffe5d9e928 | 20 | |
mbed_official | 277:0dffe5d9e928 | 21 | /** @addtogroup BLE_GATT_DEFINES Defines |
mbed_official | 277:0dffe5d9e928 | 22 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 23 | |
mbed_official | 277:0dffe5d9e928 | 24 | /** @brief Default MTU size. */ |
mbed_official | 277:0dffe5d9e928 | 25 | #define GATT_MTU_SIZE_DEFAULT 23 |
mbed_official | 277:0dffe5d9e928 | 26 | |
mbed_official | 277:0dffe5d9e928 | 27 | /** @brief Only the default MTU size of 23 is currently supported. */ |
mbed_official | 277:0dffe5d9e928 | 28 | #define GATT_RX_MTU 23 |
mbed_official | 277:0dffe5d9e928 | 29 | |
mbed_official | 277:0dffe5d9e928 | 30 | |
mbed_official | 277:0dffe5d9e928 | 31 | /**@brief Invalid Attribute Handle. */ |
mbed_official | 277:0dffe5d9e928 | 32 | #define BLE_GATT_HANDLE_INVALID 0x0000 |
mbed_official | 277:0dffe5d9e928 | 33 | |
mbed_official | 277:0dffe5d9e928 | 34 | /** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources |
mbed_official | 277:0dffe5d9e928 | 35 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 36 | #define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ |
mbed_official | 277:0dffe5d9e928 | 37 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 38 | |
mbed_official | 277:0dffe5d9e928 | 39 | /** @defgroup BLE_GATT_WRITE_OPS GATT Write operations |
mbed_official | 277:0dffe5d9e928 | 40 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 41 | #define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */ |
mbed_official | 277:0dffe5d9e928 | 42 | #define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */ |
mbed_official | 277:0dffe5d9e928 | 43 | #define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */ |
mbed_official | 277:0dffe5d9e928 | 44 | #define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ |
mbed_official | 277:0dffe5d9e928 | 45 | #define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ |
mbed_official | 277:0dffe5d9e928 | 46 | #define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */ |
mbed_official | 277:0dffe5d9e928 | 47 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 48 | |
mbed_official | 277:0dffe5d9e928 | 49 | /** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags |
mbed_official | 277:0dffe5d9e928 | 50 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 51 | #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 |
mbed_official | 277:0dffe5d9e928 | 52 | #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 |
mbed_official | 277:0dffe5d9e928 | 53 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 54 | |
mbed_official | 277:0dffe5d9e928 | 55 | /** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations |
mbed_official | 277:0dffe5d9e928 | 56 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 57 | #define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */ |
mbed_official | 277:0dffe5d9e928 | 58 | #define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */ |
mbed_official | 277:0dffe5d9e928 | 59 | #define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */ |
mbed_official | 277:0dffe5d9e928 | 60 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 61 | |
mbed_official | 277:0dffe5d9e928 | 62 | /** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes |
mbed_official | 277:0dffe5d9e928 | 63 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 64 | #define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */ |
mbed_official | 277:0dffe5d9e928 | 65 | #define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */ |
mbed_official | 277:0dffe5d9e928 | 66 | #define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */ |
mbed_official | 277:0dffe5d9e928 | 67 | #define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */ |
mbed_official | 277:0dffe5d9e928 | 68 | #define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */ |
mbed_official | 277:0dffe5d9e928 | 69 | #define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */ |
mbed_official | 277:0dffe5d9e928 | 70 | #define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */ |
mbed_official | 277:0dffe5d9e928 | 71 | #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */ |
mbed_official | 277:0dffe5d9e928 | 72 | #define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */ |
mbed_official | 277:0dffe5d9e928 | 73 | #define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */ |
mbed_official | 277:0dffe5d9e928 | 74 | #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */ |
mbed_official | 277:0dffe5d9e928 | 75 | #define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */ |
mbed_official | 277:0dffe5d9e928 | 76 | #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */ |
mbed_official | 277:0dffe5d9e928 | 77 | #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ |
mbed_official | 277:0dffe5d9e928 | 78 | #define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */ |
mbed_official | 277:0dffe5d9e928 | 79 | #define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */ |
mbed_official | 277:0dffe5d9e928 | 80 | #define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */ |
mbed_official | 277:0dffe5d9e928 | 81 | #define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */ |
mbed_official | 277:0dffe5d9e928 | 82 | #define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */ |
mbed_official | 277:0dffe5d9e928 | 83 | #define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */ |
mbed_official | 277:0dffe5d9e928 | 84 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */ |
mbed_official | 277:0dffe5d9e928 | 85 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */ |
mbed_official | 277:0dffe5d9e928 | 86 | #define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */ |
mbed_official | 277:0dffe5d9e928 | 87 | #define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */ |
mbed_official | 277:0dffe5d9e928 | 88 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */ |
mbed_official | 277:0dffe5d9e928 | 89 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */ |
mbed_official | 277:0dffe5d9e928 | 90 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */ |
mbed_official | 277:0dffe5d9e928 | 91 | #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */ |
mbed_official | 277:0dffe5d9e928 | 92 | #define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */ |
mbed_official | 277:0dffe5d9e928 | 93 | #define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */ |
mbed_official | 277:0dffe5d9e928 | 94 | #define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */ |
mbed_official | 277:0dffe5d9e928 | 95 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 96 | |
mbed_official | 277:0dffe5d9e928 | 97 | |
mbed_official | 277:0dffe5d9e928 | 98 | /** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats |
mbed_official | 277:0dffe5d9e928 | 99 | * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml |
mbed_official | 277:0dffe5d9e928 | 100 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 101 | #define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */ |
mbed_official | 277:0dffe5d9e928 | 102 | #define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */ |
mbed_official | 277:0dffe5d9e928 | 103 | #define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 104 | #define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 105 | #define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 106 | #define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 107 | #define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 108 | #define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 109 | #define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 110 | #define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 111 | #define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 112 | #define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 113 | #define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 114 | #define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 115 | #define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 116 | #define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 117 | #define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 118 | #define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 119 | #define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 120 | #define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */ |
mbed_official | 277:0dffe5d9e928 | 121 | #define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */ |
mbed_official | 277:0dffe5d9e928 | 122 | #define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */ |
mbed_official | 277:0dffe5d9e928 | 123 | #define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */ |
mbed_official | 277:0dffe5d9e928 | 124 | #define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */ |
mbed_official | 277:0dffe5d9e928 | 125 | #define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */ |
mbed_official | 277:0dffe5d9e928 | 126 | #define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */ |
mbed_official | 277:0dffe5d9e928 | 127 | #define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */ |
mbed_official | 277:0dffe5d9e928 | 128 | #define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */ |
mbed_official | 277:0dffe5d9e928 | 129 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 130 | |
mbed_official | 277:0dffe5d9e928 | 131 | /** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces |
mbed_official | 277:0dffe5d9e928 | 132 | * @{ |
mbed_official | 277:0dffe5d9e928 | 133 | */ |
mbed_official | 277:0dffe5d9e928 | 134 | #define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 |
mbed_official | 277:0dffe5d9e928 | 135 | #define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 |
mbed_official | 277:0dffe5d9e928 | 136 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 137 | |
mbed_official | 277:0dffe5d9e928 | 138 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 139 | |
mbed_official | 277:0dffe5d9e928 | 140 | /** @addtogroup BLE_GATT_STRUCTURES Structures |
mbed_official | 277:0dffe5d9e928 | 141 | * @{ */ |
mbed_official | 277:0dffe5d9e928 | 142 | |
mbed_official | 277:0dffe5d9e928 | 143 | /**@brief GATT Characteristic Properties. */ |
mbed_official | 277:0dffe5d9e928 | 144 | typedef struct |
mbed_official | 277:0dffe5d9e928 | 145 | { |
mbed_official | 277:0dffe5d9e928 | 146 | /* Standard properties */ |
mbed_official | 277:0dffe5d9e928 | 147 | uint8_t broadcast :1; /**< Broadcasting of value permitted. */ |
mbed_official | 277:0dffe5d9e928 | 148 | uint8_t read :1; /**< Reading value permitted. */ |
mbed_official | 277:0dffe5d9e928 | 149 | uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */ |
mbed_official | 277:0dffe5d9e928 | 150 | uint8_t write :1; /**< Writing value with Write Request permitted. */ |
mbed_official | 277:0dffe5d9e928 | 151 | uint8_t notify :1; /**< Notications of value permitted. */ |
mbed_official | 277:0dffe5d9e928 | 152 | uint8_t indicate :1; /**< Indications of value permitted. */ |
mbed_official | 277:0dffe5d9e928 | 153 | uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command permitted. */ |
mbed_official | 277:0dffe5d9e928 | 154 | } ble_gatt_char_props_t; |
mbed_official | 277:0dffe5d9e928 | 155 | |
mbed_official | 277:0dffe5d9e928 | 156 | /**@brief GATT Characteristic Extended Properties. */ |
mbed_official | 277:0dffe5d9e928 | 157 | typedef struct |
mbed_official | 277:0dffe5d9e928 | 158 | { |
mbed_official | 277:0dffe5d9e928 | 159 | /* Extended properties */ |
mbed_official | 277:0dffe5d9e928 | 160 | uint8_t reliable_wr :1; /**< Writing value with Queued Write Request permitted. */ |
mbed_official | 277:0dffe5d9e928 | 161 | uint8_t wr_aux :1; /**< Writing the Characteristic User Description permitted. */ |
mbed_official | 277:0dffe5d9e928 | 162 | } ble_gatt_char_ext_props_t; |
mbed_official | 277:0dffe5d9e928 | 163 | |
mbed_official | 277:0dffe5d9e928 | 164 | #endif // BLE_GATT_H__ |
mbed_official | 277:0dffe5d9e928 | 165 | |
mbed_official | 277:0dffe5d9e928 | 166 | /** @} */ |
mbed_official | 277:0dffe5d9e928 | 167 | |
mbed_official | 277:0dffe5d9e928 | 168 | /** |
mbed_official | 277:0dffe5d9e928 | 169 | @} |
mbed_official | 277:0dffe5d9e928 | 170 | @} |
mbed_official | 277:0dffe5d9e928 | 171 | */ |