Maxim Integrated Bluetooth LE Library

Dependents:   BLE_Thermometer MAXWSNENV_demo

Committer:
enginerd
Date:
Thu Oct 06 22:02:31 2016 +0000
Revision:
5:5b87f64ce81e
Parent:
0:b562096246b3
Added new required method.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enginerd 0:b562096246b3 1 /*************************************************************************************************/
enginerd 0:b562096246b3 2 /*!
enginerd 0:b562096246b3 3 * \file att_defs.h
enginerd 0:b562096246b3 4 *
enginerd 0:b562096246b3 5 * \brief Attribute protocol constants and definitions from the Bluetooth specification.
enginerd 0:b562096246b3 6 *
enginerd 0:b562096246b3 7 * $Date: 2012-09-11 16:18:57 -0700 (Tue, 11 Sep 2012) $
enginerd 0:b562096246b3 8 * $Revision: 349 $
enginerd 0:b562096246b3 9 *
enginerd 0:b562096246b3 10 * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
enginerd 0:b562096246b3 11 *
enginerd 0:b562096246b3 12 * SPDX-License-Identifier: LicenseRef-PBL
enginerd 0:b562096246b3 13 *
enginerd 0:b562096246b3 14 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
enginerd 0:b562096246b3 15 * this file except in compliance with the License. You may obtain a copy of the License at
enginerd 0:b562096246b3 16 *
enginerd 0:b562096246b3 17 * https://www.mbed.com/licenses/PBL-1.0
enginerd 0:b562096246b3 18 *
enginerd 0:b562096246b3 19 * See the License for the specific language governing permissions and limitations under the License.
enginerd 0:b562096246b3 20 */
enginerd 0:b562096246b3 21 /*************************************************************************************************/
enginerd 0:b562096246b3 22 #ifndef ATT_DEFS_H
enginerd 0:b562096246b3 23 #define ATT_DEFS_H
enginerd 0:b562096246b3 24
enginerd 0:b562096246b3 25 #ifdef __cplusplus
enginerd 0:b562096246b3 26 extern "C" {
enginerd 0:b562096246b3 27 #endif
enginerd 0:b562096246b3 28
enginerd 0:b562096246b3 29 /**************************************************************************************************
enginerd 0:b562096246b3 30 Macros
enginerd 0:b562096246b3 31 **************************************************************************************************/
enginerd 0:b562096246b3 32
enginerd 0:b562096246b3 33 /*! Attribute PDU format */
enginerd 0:b562096246b3 34 #define ATT_HDR_LEN 1 /*! Attribute PDU header length */
enginerd 0:b562096246b3 35 #define ATT_AUTH_SIG_LEN 12 /*! Authentication signature length */
enginerd 0:b562096246b3 36 #define ATT_DEFAULT_MTU 23 /*! Default value of ATT_MTU */
enginerd 0:b562096246b3 37 #define ATT_MAX_MTU 517 /*! Maximum value of ATT_MTU */
enginerd 0:b562096246b3 38 #define ATT_DEFAULT_PAYLOAD_LEN 20 /*! Default maximum payload length for most PDUs */
enginerd 0:b562096246b3 39
enginerd 0:b562096246b3 40 /*! Attribute value parameters */
enginerd 0:b562096246b3 41 #define ATT_VALUE_MAX_LEN 512 /*! Maximum attribute value length */
enginerd 0:b562096246b3 42 #define ATT_VALUE_MAX_OFFSET 511 /*! Maximum attribute value offset */
enginerd 0:b562096246b3 43
enginerd 0:b562096246b3 44 /*! Transaction timeout */
enginerd 0:b562096246b3 45 #define ATT_MAX_TRANS_TIMEOUT 30 /*! Maximum transaction timeout in seconds */
enginerd 0:b562096246b3 46
enginerd 0:b562096246b3 47 /*! Error codes */
enginerd 0:b562096246b3 48 #define ATT_SUCCESS 0x00 /*! Operation successful */
enginerd 0:b562096246b3 49 #define ATT_ERR_HANDLE 0x01 /*! Invalid handle */
enginerd 0:b562096246b3 50 #define ATT_ERR_READ 0x02 /*! Read not permitted */
enginerd 0:b562096246b3 51 #define ATT_ERR_WRITE 0x03 /*! Write not permitted */
enginerd 0:b562096246b3 52 #define ATT_ERR_INVALID_PDU 0x04 /*! Invalid pdu */
enginerd 0:b562096246b3 53 #define ATT_ERR_AUTH 0x05 /*! Insufficient authentication */
enginerd 0:b562096246b3 54 #define ATT_ERR_NOT_SUP 0x06 /*! Request not supported */
enginerd 0:b562096246b3 55 #define ATT_ERR_OFFSET 0x07 /*! Invalid offset */
enginerd 0:b562096246b3 56 #define ATT_ERR_AUTHOR 0x08 /*! Insufficient authorization */
enginerd 0:b562096246b3 57 #define ATT_ERR_QUEUE_FULL 0x09 /*! Prepare queue full */
enginerd 0:b562096246b3 58 #define ATT_ERR_NOT_FOUND 0x0A /*! Attribute not found */
enginerd 0:b562096246b3 59 #define ATT_ERR_NOT_LONG 0x0B /*! Attribute not long */
enginerd 0:b562096246b3 60 #define ATT_ERR_KEY_SIZE 0x0C /*! Insufficient encryption key size */
enginerd 0:b562096246b3 61 #define ATT_ERR_LENGTH 0x0D /*! Invalid attribute value length */
enginerd 0:b562096246b3 62 #define ATT_ERR_UNLIKELY 0x0E /*! Other unlikely error */
enginerd 0:b562096246b3 63 #define ATT_ERR_ENC 0x0F /*! Insufficient encryption */
enginerd 0:b562096246b3 64 #define ATT_ERR_GROUP_TYPE 0x10 /*! Unsupported group type */
enginerd 0:b562096246b3 65 #define ATT_ERR_RESOURCES 0x11 /*! Insufficient resources */
enginerd 0:b562096246b3 66 #define ATT_ERR_CCCD 0xFD /*! CCCD improperly configured */
enginerd 0:b562096246b3 67 #define ATT_ERR_IN_PROGRESS 0xFE /*! Procedure already in progress */
enginerd 0:b562096246b3 68 #define ATT_ERR_RANGE 0xFF /*! Value out of range */
enginerd 0:b562096246b3 69
enginerd 0:b562096246b3 70 /*! Proprietary internal error codes */
enginerd 0:b562096246b3 71 #define ATT_ERR_MEMORY 0x70 /*! Out of memory */
enginerd 0:b562096246b3 72 #define ATT_ERR_TIMEOUT 0x71 /*! Transaction timeout */
enginerd 0:b562096246b3 73 #define ATT_ERR_OVERFLOW 0x72 /*! Transaction overflow */
enginerd 0:b562096246b3 74 #define ATT_ERR_INVALID_RSP 0x73 /*! Invalid response PDU */
enginerd 0:b562096246b3 75 #define ATT_ERR_CANCELLED 0x74 /*! Request cancelled */
enginerd 0:b562096246b3 76 #define ATT_ERR_UNDEFINED 0x75 /*! Other undefined error */
enginerd 0:b562096246b3 77 #define ATT_ERR_REQ_NOT_FOUND 0x76 /*! Required characteristic not found */
enginerd 0:b562096246b3 78 #define ATT_CONTINUING 0x77 /*! Procedure continuing */
enginerd 0:b562096246b3 79
enginerd 0:b562096246b3 80 /*! Application error codes */
enginerd 0:b562096246b3 81 #define ATT_ERR_VALUE_RANGE 0x80 /*! Value out of range */
enginerd 0:b562096246b3 82
enginerd 0:b562096246b3 83 /*! PDU types */
enginerd 0:b562096246b3 84 #define ATT_PDU_ERR_RSP 0x01 /*! Error response */
enginerd 0:b562096246b3 85 #define ATT_PDU_MTU_REQ 0x02 /*! Exchange mtu request */
enginerd 0:b562096246b3 86 #define ATT_PDU_MTU_RSP 0x03 /*! Exchange mtu response */
enginerd 0:b562096246b3 87 #define ATT_PDU_FIND_INFO_REQ 0x04 /*! Find information request */
enginerd 0:b562096246b3 88 #define ATT_PDU_FIND_INFO_RSP 0x05 /*! Find information response */
enginerd 0:b562096246b3 89 #define ATT_PDU_FIND_TYPE_REQ 0x06 /*! Find by type value request */
enginerd 0:b562096246b3 90 #define ATT_PDU_FIND_TYPE_RSP 0x07 /*! Find by type value response */
enginerd 0:b562096246b3 91 #define ATT_PDU_READ_TYPE_REQ 0x08 /*! Read by type request */
enginerd 0:b562096246b3 92 #define ATT_PDU_READ_TYPE_RSP 0x09 /*! Read by type response */
enginerd 0:b562096246b3 93 #define ATT_PDU_READ_REQ 0x0A /*! Read request */
enginerd 0:b562096246b3 94 #define ATT_PDU_READ_RSP 0x0B /*! Read response */
enginerd 0:b562096246b3 95 #define ATT_PDU_READ_BLOB_REQ 0x0C /*! Read blob request */
enginerd 0:b562096246b3 96 #define ATT_PDU_READ_BLOB_RSP 0x0D /*! Read blob response */
enginerd 0:b562096246b3 97 #define ATT_PDU_READ_MULT_REQ 0x0E /*! Read multiple request */
enginerd 0:b562096246b3 98 #define ATT_PDU_READ_MULT_RSP 0x0F /*! Read multiple response */
enginerd 0:b562096246b3 99 #define ATT_PDU_READ_GROUP_TYPE_REQ 0x10 /*! Read by group type request */
enginerd 0:b562096246b3 100 #define ATT_PDU_READ_GROUP_TYPE_RSP 0x11 /*! Read by group type response */
enginerd 0:b562096246b3 101 #define ATT_PDU_WRITE_REQ 0x12 /*! Write request */
enginerd 0:b562096246b3 102 #define ATT_PDU_WRITE_RSP 0x13 /*! Write response */
enginerd 0:b562096246b3 103 #define ATT_PDU_WRITE_CMD 0x52 /*! Write command */
enginerd 0:b562096246b3 104 #define ATT_PDU_SIGNED_WRITE_CMD 0xD2 /*! Signed write command */
enginerd 0:b562096246b3 105 #define ATT_PDU_PREP_WRITE_REQ 0x16 /*! Prepare write request */
enginerd 0:b562096246b3 106 #define ATT_PDU_PREP_WRITE_RSP 0x17 /*! Prepare write response */
enginerd 0:b562096246b3 107 #define ATT_PDU_EXEC_WRITE_REQ 0x18 /*! Execute write request */
enginerd 0:b562096246b3 108 #define ATT_PDU_EXEC_WRITE_RSP 0x19 /*! Execute write response */
enginerd 0:b562096246b3 109 #define ATT_PDU_VALUE_NTF 0x1B /*! Handle value notification */
enginerd 0:b562096246b3 110 #define ATT_PDU_VALUE_IND 0x1D /*! Handle value indication */
enginerd 0:b562096246b3 111 #define ATT_PDU_VALUE_CNF 0x1E /*! Handle value confirmation */
enginerd 0:b562096246b3 112 #define ATT_PDU_MAX 0x1F /*! PDU Maximum */
enginerd 0:b562096246b3 113
enginerd 0:b562096246b3 114 /*! Length of PDU fixed length fields */
enginerd 0:b562096246b3 115 #define ATT_ERR_RSP_LEN 5
enginerd 0:b562096246b3 116 #define ATT_MTU_REQ_LEN 3
enginerd 0:b562096246b3 117 #define ATT_MTU_RSP_LEN 3
enginerd 0:b562096246b3 118 #define ATT_FIND_INFO_REQ_LEN 5
enginerd 0:b562096246b3 119 #define ATT_FIND_INFO_RSP_LEN 2
enginerd 0:b562096246b3 120 #define ATT_FIND_TYPE_REQ_LEN 7
enginerd 0:b562096246b3 121 #define ATT_FIND_TYPE_RSP_LEN 1
enginerd 0:b562096246b3 122 #define ATT_READ_TYPE_REQ_LEN 5
enginerd 0:b562096246b3 123 #define ATT_READ_TYPE_RSP_LEN 2
enginerd 0:b562096246b3 124 #define ATT_READ_REQ_LEN 3
enginerd 0:b562096246b3 125 #define ATT_READ_RSP_LEN 1
enginerd 0:b562096246b3 126 #define ATT_READ_BLOB_REQ_LEN 5
enginerd 0:b562096246b3 127 #define ATT_READ_BLOB_RSP_LEN 1
enginerd 0:b562096246b3 128 #define ATT_READ_MULT_REQ_LEN 1
enginerd 0:b562096246b3 129 #define ATT_READ_MULT_RSP_LEN 1
enginerd 0:b562096246b3 130 #define ATT_READ_GROUP_TYPE_REQ_LEN 5
enginerd 0:b562096246b3 131 #define ATT_READ_GROUP_TYPE_RSP_LEN 2
enginerd 0:b562096246b3 132 #define ATT_WRITE_REQ_LEN 3
enginerd 0:b562096246b3 133 #define ATT_WRITE_RSP_LEN 1
enginerd 0:b562096246b3 134 #define ATT_WRITE_CMD_LEN 3
enginerd 0:b562096246b3 135 #define ATT_SIGNED_WRITE_CMD_LEN (ATT_WRITE_CMD_LEN + ATT_AUTH_SIG_LEN)
enginerd 0:b562096246b3 136 #define ATT_PREP_WRITE_REQ_LEN 5
enginerd 0:b562096246b3 137 #define ATT_PREP_WRITE_RSP_LEN 5
enginerd 0:b562096246b3 138 #define ATT_EXEC_WRITE_REQ_LEN 2
enginerd 0:b562096246b3 139 #define ATT_EXEC_WRITE_RSP_LEN 1
enginerd 0:b562096246b3 140 #define ATT_VALUE_NTF_LEN 3
enginerd 0:b562096246b3 141 #define ATT_VALUE_IND_LEN 3
enginerd 0:b562096246b3 142 #define ATT_VALUE_CNF_LEN 1
enginerd 0:b562096246b3 143
enginerd 0:b562096246b3 144 /*! Find information response format */
enginerd 0:b562096246b3 145 #define ATT_FIND_HANDLE_16_UUID 0x01 /*! Handle and 16 bit UUID */
enginerd 0:b562096246b3 146 #define ATT_FIND_HANDLE_128_UUID 0x02 /*! Handle and 128 bit UUID */
enginerd 0:b562096246b3 147
enginerd 0:b562096246b3 148 /*! Execute write request flags */
enginerd 0:b562096246b3 149 #define ATT_EXEC_WRITE_CANCEL 0x00 /*! Cancel all prepared writes */
enginerd 0:b562096246b3 150 #define ATT_EXEC_WRITE_ALL 0x01 /*! Write all pending prepared writes */
enginerd 0:b562096246b3 151
enginerd 0:b562096246b3 152 /*! PDU masks */
enginerd 0:b562096246b3 153 #define ATT_PDU_MASK_SERVER 0x01 /*! Server bit mask */
enginerd 0:b562096246b3 154 #define ATT_PDU_MASK_COMMAND 0x40 /*! Command bit mask */
enginerd 0:b562096246b3 155 #define ATT_PDU_MASK_SIGNED 0x80 /*! Auth signature bit mask */
enginerd 0:b562096246b3 156
enginerd 0:b562096246b3 157 /*! Handles */
enginerd 0:b562096246b3 158 #define ATT_HANDLE_NONE 0x0000
enginerd 0:b562096246b3 159 #define ATT_HANDLE_START 0x0001
enginerd 0:b562096246b3 160 #define ATT_HANDLE_MAX 0xFFFF
enginerd 0:b562096246b3 161
enginerd 0:b562096246b3 162 /*! UUID lengths */
enginerd 0:b562096246b3 163 #define ATT_NO_UUID_LEN 0 /*! Length when no UUID is present ;-) */
enginerd 0:b562096246b3 164 #define ATT_16_UUID_LEN 2 /*! Length in bytes of a 16 bit UUID */
enginerd 0:b562096246b3 165 #define ATT_128_UUID_LEN 16 /*! Length in bytes of a 128 bit UUID */
enginerd 0:b562096246b3 166
enginerd 0:b562096246b3 167 /*! GATT characteristic properties */
enginerd 0:b562096246b3 168 #define ATT_PROP_BROADCAST 0x01 /*! Permit broadcasts */
enginerd 0:b562096246b3 169 #define ATT_PROP_READ 0x02 /*! Permit reads */
enginerd 0:b562096246b3 170 #define ATT_PROP_WRITE_NO_RSP 0x04 /*! Permit writes without response */
enginerd 0:b562096246b3 171 #define ATT_PROP_WRITE 0x08 /*! Permit writes with response */
enginerd 0:b562096246b3 172 #define ATT_PROP_NOTIFY 0x10 /*! Permit notifications */
enginerd 0:b562096246b3 173 #define ATT_PROP_INDICATE 0x20 /*! Permit indications */
enginerd 0:b562096246b3 174 #define ATT_PROP_AUTHENTICATED 0x40 /*! Permit signed writes */
enginerd 0:b562096246b3 175 #define ATT_PROP_EXTENDED 0x80 /*! More properties defined in extended properties */
enginerd 0:b562096246b3 176
enginerd 0:b562096246b3 177 /*! GATT characteristic extended properties */
enginerd 0:b562096246b3 178 #define ATT_EXT_PROP_RELIABLE_WRITE 0x0001 /*! Permit reliable writes */
enginerd 0:b562096246b3 179 #define ATT_EXT_PROP_WRITEABLE_AUX 0x0002 /*! Permit write to characteristic descriptor */
enginerd 0:b562096246b3 180
enginerd 0:b562096246b3 181 /*! GATT client characteristic configuration */
enginerd 0:b562096246b3 182 #define ATT_CLIENT_CFG_NOTIFY 0x0001 /*! Notify the value */
enginerd 0:b562096246b3 183 #define ATT_CLIENT_CFG_INDICATE 0x0002 /*! Indicate the value */
enginerd 0:b562096246b3 184
enginerd 0:b562096246b3 185 /*! GATT server characteristic configuration */
enginerd 0:b562096246b3 186 #define ATT_SERVER_CFG_BROADCAST 0x0001 /*! Broadcast the value */
enginerd 0:b562096246b3 187
enginerd 0:b562096246b3 188 /*! GATT characteristic format */
enginerd 0:b562096246b3 189 #define ATT_FORMAT_BOOLEAN 0x01 /*! Boolean */
enginerd 0:b562096246b3 190 #define ATT_FORMAT_2BIT 0x02 /*! Unsigned 2 bit integer */
enginerd 0:b562096246b3 191 #define ATT_FORMAT_NIBBLE 0x03 /*! Unsigned 4 bit integer */
enginerd 0:b562096246b3 192 #define ATT_FORMAT_UINT8 0x04 /*! Unsigned 8 bit integer */
enginerd 0:b562096246b3 193 #define ATT_FORMAT_UINT12 0x05 /*! Unsigned 12 bit integer */
enginerd 0:b562096246b3 194 #define ATT_FORMAT_UINT16 0x06 /*! Unsigned 16 bit integer */
enginerd 0:b562096246b3 195 #define ATT_FORMAT_UINT24 0x07 /*! Unsigned 24 bit integer */
enginerd 0:b562096246b3 196 #define ATT_FORMAT_UINT32 0x08 /*! Unsigned 32 bit integer */
enginerd 0:b562096246b3 197 #define ATT_FORMAT_UINT48 0x09 /*! Unsigned 48 bit integer */
enginerd 0:b562096246b3 198 #define ATT_FORMAT_UINT64 0x0A /*! Unsigned 64 bit integer */
enginerd 0:b562096246b3 199 #define ATT_FORMAT_UINT128 0x0B /*! Unsigned 128 bit integer */
enginerd 0:b562096246b3 200 #define ATT_FORMAT_SINT8 0x0C /*! Signed 8 bit integer */
enginerd 0:b562096246b3 201 #define ATT_FORMAT_SINT12 0x0D /*! Signed 12 bit integer */
enginerd 0:b562096246b3 202 #define ATT_FORMAT_SINT16 0x0E /*! Signed 16 bit integer */
enginerd 0:b562096246b3 203 #define ATT_FORMAT_SINT24 0x0F /*! Signed 24 bit integer */
enginerd 0:b562096246b3 204 #define ATT_FORMAT_SINT32 0x10 /*! Signed 32 bit integer */
enginerd 0:b562096246b3 205 #define ATT_FORMAT_SINT48 0x11 /*! Signed 48 bit integer */
enginerd 0:b562096246b3 206 #define ATT_FORMAT_SINT64 0x12 /*! Signed 64 bit integer */
enginerd 0:b562096246b3 207 #define ATT_FORMAT_SINT128 0x13 /*! Signed 128 bit integer */
enginerd 0:b562096246b3 208 #define ATT_FORMAT_FLOAT32 0x14 /*! IEEE-754 32 bit floating point */
enginerd 0:b562096246b3 209 #define ATT_FORMAT_FLOAT64 0x15 /*! IEEE-754 64 bit floating point */
enginerd 0:b562096246b3 210 #define ATT_FORMAT_SFLOAT 0x16 /*! IEEE-11073 16 bit SFLOAT */
enginerd 0:b562096246b3 211 #define ATT_FORMAT_FLOAT 0x17 /*! IEEE-11073 32 bit FLOAT */
enginerd 0:b562096246b3 212 #define ATT_FORMAT_DUINT16 0x18 /*! IEEE-20601 format */
enginerd 0:b562096246b3 213 #define ATT_FORMAT_UTF8 0x19 /*! UTF-8 string */
enginerd 0:b562096246b3 214 #define ATT_FORMAT_UTF16 0x1A /*! UTF-16 string */
enginerd 0:b562096246b3 215 #define ATT_FORMAT_STRUCT 0x1B /*! Opaque structure */
enginerd 0:b562096246b3 216
enginerd 0:b562096246b3 217 #ifdef __cplusplus
enginerd 0:b562096246b3 218 };
enginerd 0:b562096246b3 219 #endif
enginerd 0:b562096246b3 220
enginerd 0:b562096246b3 221 #endif /* ATT_DEFS_H */