Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_WallbotBLE_Challenge by
ble_gatt.h
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is confidential property of Nordic Semiconductor. The use, 00004 * copying, transfer or disclosure of such information is prohibited except by express written 00005 * agreement with Nordic Semiconductor. 00006 * 00007 */ 00008 /** 00009 @addtogroup BLE_GATT Generic Attribute Profile (GATT) Common 00010 @{ 00011 @brief Common definitions and prototypes for the GATT interfaces. 00012 */ 00013 00014 #ifndef BLE_GATT_H__ 00015 #define BLE_GATT_H__ 00016 00017 #include "ble_types.h" 00018 #include "ble_ranges.h" 00019 00020 00021 /** @addtogroup BLE_GATT_DEFINES Defines 00022 * @{ */ 00023 00024 /** @brief Default MTU size. */ 00025 #define GATT_MTU_SIZE_DEFAULT 23 00026 00027 /** @brief Only the default MTU size of 23 is currently supported. */ 00028 #define GATT_RX_MTU 23 00029 00030 00031 /**@brief Invalid Attribute Handle. */ 00032 #define BLE_GATT_HANDLE_INVALID 0x0000 00033 00034 /** @defgroup BLE_GATT_TIMEOUT_SOURCES GATT Timeout sources 00035 * @{ */ 00036 #define BLE_GATT_TIMEOUT_SRC_PROTOCOL 0x00 /**< ATT Protocol timeout. */ 00037 /** @} */ 00038 00039 /** @defgroup BLE_GATT_WRITE_OPS GATT Write operations 00040 * @{ */ 00041 #define BLE_GATT_OP_INVALID 0x00 /**< Invalid Operation. */ 00042 #define BLE_GATT_OP_WRITE_REQ 0x01 /**< Write Request. */ 00043 #define BLE_GATT_OP_WRITE_CMD 0x02 /**< Write Command. */ 00044 #define BLE_GATT_OP_SIGN_WRITE_CMD 0x03 /**< Signed Write Command. */ 00045 #define BLE_GATT_OP_PREP_WRITE_REQ 0x04 /**< Prepare Write Request. */ 00046 #define BLE_GATT_OP_EXEC_WRITE_REQ 0x05 /**< Execute Write Request. */ 00047 /** @} */ 00048 00049 /** @defgroup BLE_GATT_EXEC_WRITE_FLAGS GATT Execute Write flags 00050 * @{ */ 00051 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_CANCEL 0x00 00052 #define BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE 0x01 00053 /** @} */ 00054 00055 /** @defgroup BLE_GATT_HVX_TYPES GATT Handle Value operations 00056 * @{ */ 00057 #define BLE_GATT_HVX_INVALID 0x00 /**< Invalid Operation. */ 00058 #define BLE_GATT_HVX_NOTIFICATION 0x01 /**< Handle Value Notification. */ 00059 #define BLE_GATT_HVX_INDICATION 0x02 /**< Handle Value Indication. */ 00060 /** @} */ 00061 00062 /** @defgroup BLE_GATT_STATUS_CODES GATT Status Codes 00063 * @{ */ 00064 #define BLE_GATT_STATUS_SUCCESS 0x0000 /**< Success. */ 00065 #define BLE_GATT_STATUS_UNKNOWN 0x0001 /**< Unknown or not applicable status. */ 00066 #define BLE_GATT_STATUS_ATTERR_INVALID 0x0100 /**< ATT Error: Invalid Error Code. */ 00067 #define BLE_GATT_STATUS_ATTERR_INVALID_HANDLE 0x0101 /**< ATT Error: Invalid Attribute Handle. */ 00068 #define BLE_GATT_STATUS_ATTERR_READ_NOT_PERMITTED 0x0102 /**< ATT Error: Read not permitted. */ 00069 #define BLE_GATT_STATUS_ATTERR_WRITE_NOT_PERMITTED 0x0103 /**< ATT Error: Write not permitted. */ 00070 #define BLE_GATT_STATUS_ATTERR_INVALID_PDU 0x0104 /**< ATT Error: Used in ATT as Invalid PDU. */ 00071 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION 0x0105 /**< ATT Error: Authenticated link required. */ 00072 #define BLE_GATT_STATUS_ATTERR_REQUEST_NOT_SUPPORTED 0x0106 /**< ATT Error: Used in ATT as Request Not Supported. */ 00073 #define BLE_GATT_STATUS_ATTERR_INVALID_OFFSET 0x0107 /**< ATT Error: Offset specified was past the end of the attribute. */ 00074 #define BLE_GATT_STATUS_ATTERR_INSUF_AUTHORIZATION 0x0108 /**< ATT Error: Used in ATT as Insufficient Authorisation. */ 00075 #define BLE_GATT_STATUS_ATTERR_PREPARE_QUEUE_FULL 0x0109 /**< ATT Error: Used in ATT as Prepare Queue Full. */ 00076 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_FOUND 0x010A /**< ATT Error: Used in ATT as Attribute not found. */ 00077 #define BLE_GATT_STATUS_ATTERR_ATTRIBUTE_NOT_LONG 0x010B /**< ATT Error: Attribute cannot be read or written using read/write blob requests. */ 00078 #define BLE_GATT_STATUS_ATTERR_INSUF_ENC_KEY_SIZE 0x010C /**< ATT Error: Encryption key size used is insufficient. */ 00079 #define BLE_GATT_STATUS_ATTERR_INVALID_ATT_VAL_LENGTH 0x010D /**< ATT Error: Invalid value size. */ 00080 #define BLE_GATT_STATUS_ATTERR_UNLIKELY_ERROR 0x010E /**< ATT Error: Very unlikely error. */ 00081 #define BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION 0x010F /**< ATT Error: Encrypted link required. */ 00082 #define BLE_GATT_STATUS_ATTERR_UNSUPPORTED_GROUP_TYPE 0x0110 /**< ATT Error: Attribute type is not a supported grouping attribute. */ 00083 #define BLE_GATT_STATUS_ATTERR_INSUF_RESOURCES 0x0111 /**< ATT Error: Encrypted link required. */ 00084 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_BEGIN 0x0112 /**< ATT Error: Reserved for Future Use range #1 begin. */ 00085 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE1_END 0x017F /**< ATT Error: Reserved for Future Use range #1 end. */ 00086 #define BLE_GATT_STATUS_ATTERR_APP_BEGIN 0x0180 /**< ATT Error: Application range begin. */ 00087 #define BLE_GATT_STATUS_ATTERR_APP_END 0x019F /**< ATT Error: Application range end. */ 00088 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_BEGIN 0x01A0 /**< ATT Error: Reserved for Future Use range #2 begin. */ 00089 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE2_END 0x01DF /**< ATT Error: Reserved for Future Use range #2 end. */ 00090 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_BEGIN 0x01E0 /**< ATT Error: Reserved for Future Use range #3 begin. */ 00091 #define BLE_GATT_STATUS_ATTERR_RFU_RANGE3_END 0x01FC /**< ATT Error: Reserved for Future Use range #3 end. */ 00092 #define BLE_GATT_STATUS_ATTERR_CPS_CCCD_CONFIG_ERROR 0x01FD /**< ATT Common Profile and Service Error: Client Characteristic Configuration Descriptor improperly configured. */ 00093 #define BLE_GATT_STATUS_ATTERR_CPS_PROC_ALR_IN_PROG 0x01FE /**< ATT Common Profile and Service Error: Procedure Already in Progress. */ 00094 #define BLE_GATT_STATUS_ATTERR_CPS_OUT_OF_RANGE 0x01FF /**< ATT Common Profile and Service Error: Out Of Range. */ 00095 /** @} */ 00096 00097 00098 /** @defgroup BLE_GATT_CPF_FORMATS Characteristic Presentation Formats 00099 * @note Found at http://developer.bluetooth.org/gatt/descriptors/Pages/DescriptorViewer.aspx?u=org.bluetooth.descriptor.gatt.characteristic_presentation_format.xml 00100 * @{ */ 00101 #define BLE_GATT_CPF_FORMAT_RFU 0x00 /**< Reserved For Future Use. */ 00102 #define BLE_GATT_CPF_FORMAT_BOOLEAN 0x01 /**< Boolean. */ 00103 #define BLE_GATT_CPF_FORMAT_2BIT 0x02 /**< Unsigned 2-bit integer. */ 00104 #define BLE_GATT_CPF_FORMAT_NIBBLE 0x03 /**< Unsigned 4-bit integer. */ 00105 #define BLE_GATT_CPF_FORMAT_UINT8 0x04 /**< Unsigned 8-bit integer. */ 00106 #define BLE_GATT_CPF_FORMAT_UINT12 0x05 /**< Unsigned 12-bit integer. */ 00107 #define BLE_GATT_CPF_FORMAT_UINT16 0x06 /**< Unsigned 16-bit integer. */ 00108 #define BLE_GATT_CPF_FORMAT_UINT24 0x07 /**< Unsigned 24-bit integer. */ 00109 #define BLE_GATT_CPF_FORMAT_UINT32 0x08 /**< Unsigned 32-bit integer. */ 00110 #define BLE_GATT_CPF_FORMAT_UINT48 0x09 /**< Unsigned 48-bit integer. */ 00111 #define BLE_GATT_CPF_FORMAT_UINT64 0x0A /**< Unsigned 64-bit integer. */ 00112 #define BLE_GATT_CPF_FORMAT_UINT128 0x0B /**< Unsigned 128-bit integer. */ 00113 #define BLE_GATT_CPF_FORMAT_SINT8 0x0C /**< Signed 2-bit integer. */ 00114 #define BLE_GATT_CPF_FORMAT_SINT12 0x0D /**< Signed 12-bit integer. */ 00115 #define BLE_GATT_CPF_FORMAT_SINT16 0x0E /**< Signed 16-bit integer. */ 00116 #define BLE_GATT_CPF_FORMAT_SINT24 0x0F /**< Signed 24-bit integer. */ 00117 #define BLE_GATT_CPF_FORMAT_SINT32 0x10 /**< Signed 32-bit integer. */ 00118 #define BLE_GATT_CPF_FORMAT_SINT48 0x11 /**< Signed 48-bit integer. */ 00119 #define BLE_GATT_CPF_FORMAT_SINT64 0x12 /**< Signed 64-bit integer. */ 00120 #define BLE_GATT_CPF_FORMAT_SINT128 0x13 /**< Signed 128-bit integer. */ 00121 #define BLE_GATT_CPF_FORMAT_FLOAT32 0x14 /**< IEEE-754 32-bit floating point. */ 00122 #define BLE_GATT_CPF_FORMAT_FLOAT64 0x15 /**< IEEE-754 64-bit floating point. */ 00123 #define BLE_GATT_CPF_FORMAT_SFLOAT 0x16 /**< IEEE-11073 16-bit SFLOAT. */ 00124 #define BLE_GATT_CPF_FORMAT_FLOAT 0x17 /**< IEEE-11073 32-bit FLOAT. */ 00125 #define BLE_GATT_CPF_FORMAT_DUINT16 0x18 /**< IEEE-20601 format. */ 00126 #define BLE_GATT_CPF_FORMAT_UTF8S 0x19 /**< UTF-8 string. */ 00127 #define BLE_GATT_CPF_FORMAT_UTF16S 0x1A /**< UTF-16 string. */ 00128 #define BLE_GATT_CPF_FORMAT_STRUCT 0x1B /**< Opaque Structure. */ 00129 /** @} */ 00130 00131 /** @defgroup BLE_GATT_CPF_NAMESPACES GATT Bluetooth Namespaces 00132 * @{ 00133 */ 00134 #define BLE_GATT_CPF_NAMESPACE_BTSIG 0x01 00135 #define BLE_GATT_CPF_NAMESPACE_DESCRIPTION_UNKNOWN 0x0000 00136 /** @} */ 00137 00138 /** @} */ 00139 00140 /** @addtogroup BLE_GATT_STRUCTURES Structures 00141 * @{ */ 00142 00143 /**@brief GATT Characteristic Properties. */ 00144 typedef struct 00145 { 00146 /* Standard properties */ 00147 uint8_t broadcast :1; /**< Broadcasting of value permitted. */ 00148 uint8_t read :1; /**< Reading value permitted. */ 00149 uint8_t write_wo_resp :1; /**< Writing value with Write Command permitted. */ 00150 uint8_t write :1; /**< Writing value with Write Request permitted. */ 00151 uint8_t notify :1; /**< Notications of value permitted. */ 00152 uint8_t indicate :1; /**< Indications of value permitted. */ 00153 uint8_t auth_signed_wr :1; /**< Writing value with Signed Write Command permitted. */ 00154 } ble_gatt_char_props_t; 00155 00156 /**@brief GATT Characteristic Extended Properties. */ 00157 typedef struct 00158 { 00159 /* Extended properties */ 00160 uint8_t reliable_wr :1; /**< Writing value with Queued Write Request permitted. */ 00161 uint8_t wr_aux :1; /**< Writing the Characteristic User Description permitted. */ 00162 } ble_gatt_char_ext_props_t; 00163 00164 #endif // BLE_GATT_H__ 00165 00166 /** @} */ 00167 00168 /** 00169 @} 00170 @} 00171 */
Generated on Tue Jul 12 2022 13:52:30 by
