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.
Dependents: BLE_Thermometer MAXWSNENV_demo
att_defs.h
00001 /*************************************************************************************************/ 00002 /*! 00003 * \file att_defs.h 00004 * 00005 * \brief Attribute protocol constants and definitions from the Bluetooth specification. 00006 * 00007 * $Date: 2012-09-11 16:18:57 -0700 (Tue, 11 Sep 2012) $ 00008 * $Revision: 349 $ 00009 * 00010 * Copyright (c) 2009-2016 ARM Limited. All rights reserved. 00011 * 00012 * SPDX-License-Identifier: LicenseRef-PBL 00013 * 00014 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use 00015 * this file except in compliance with the License. You may obtain a copy of the License at 00016 * 00017 * https://www.mbed.com/licenses/PBL-1.0 00018 * 00019 * See the License for the specific language governing permissions and limitations under the License. 00020 */ 00021 /*************************************************************************************************/ 00022 #ifndef ATT_DEFS_H 00023 #define ATT_DEFS_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 /************************************************************************************************** 00030 Macros 00031 **************************************************************************************************/ 00032 00033 /*! Attribute PDU format */ 00034 #define ATT_HDR_LEN 1 /*! Attribute PDU header length */ 00035 #define ATT_AUTH_SIG_LEN 12 /*! Authentication signature length */ 00036 #define ATT_DEFAULT_MTU 23 /*! Default value of ATT_MTU */ 00037 #define ATT_MAX_MTU 517 /*! Maximum value of ATT_MTU */ 00038 #define ATT_DEFAULT_PAYLOAD_LEN 20 /*! Default maximum payload length for most PDUs */ 00039 00040 /*! Attribute value parameters */ 00041 #define ATT_VALUE_MAX_LEN 512 /*! Maximum attribute value length */ 00042 #define ATT_VALUE_MAX_OFFSET 511 /*! Maximum attribute value offset */ 00043 00044 /*! Transaction timeout */ 00045 #define ATT_MAX_TRANS_TIMEOUT 30 /*! Maximum transaction timeout in seconds */ 00046 00047 /*! Error codes */ 00048 #define ATT_SUCCESS 0x00 /*! Operation successful */ 00049 #define ATT_ERR_HANDLE 0x01 /*! Invalid handle */ 00050 #define ATT_ERR_READ 0x02 /*! Read not permitted */ 00051 #define ATT_ERR_WRITE 0x03 /*! Write not permitted */ 00052 #define ATT_ERR_INVALID_PDU 0x04 /*! Invalid pdu */ 00053 #define ATT_ERR_AUTH 0x05 /*! Insufficient authentication */ 00054 #define ATT_ERR_NOT_SUP 0x06 /*! Request not supported */ 00055 #define ATT_ERR_OFFSET 0x07 /*! Invalid offset */ 00056 #define ATT_ERR_AUTHOR 0x08 /*! Insufficient authorization */ 00057 #define ATT_ERR_QUEUE_FULL 0x09 /*! Prepare queue full */ 00058 #define ATT_ERR_NOT_FOUND 0x0A /*! Attribute not found */ 00059 #define ATT_ERR_NOT_LONG 0x0B /*! Attribute not long */ 00060 #define ATT_ERR_KEY_SIZE 0x0C /*! Insufficient encryption key size */ 00061 #define ATT_ERR_LENGTH 0x0D /*! Invalid attribute value length */ 00062 #define ATT_ERR_UNLIKELY 0x0E /*! Other unlikely error */ 00063 #define ATT_ERR_ENC 0x0F /*! Insufficient encryption */ 00064 #define ATT_ERR_GROUP_TYPE 0x10 /*! Unsupported group type */ 00065 #define ATT_ERR_RESOURCES 0x11 /*! Insufficient resources */ 00066 #define ATT_ERR_CCCD 0xFD /*! CCCD improperly configured */ 00067 #define ATT_ERR_IN_PROGRESS 0xFE /*! Procedure already in progress */ 00068 #define ATT_ERR_RANGE 0xFF /*! Value out of range */ 00069 00070 /*! Proprietary internal error codes */ 00071 #define ATT_ERR_MEMORY 0x70 /*! Out of memory */ 00072 #define ATT_ERR_TIMEOUT 0x71 /*! Transaction timeout */ 00073 #define ATT_ERR_OVERFLOW 0x72 /*! Transaction overflow */ 00074 #define ATT_ERR_INVALID_RSP 0x73 /*! Invalid response PDU */ 00075 #define ATT_ERR_CANCELLED 0x74 /*! Request cancelled */ 00076 #define ATT_ERR_UNDEFINED 0x75 /*! Other undefined error */ 00077 #define ATT_ERR_REQ_NOT_FOUND 0x76 /*! Required characteristic not found */ 00078 #define ATT_CONTINUING 0x77 /*! Procedure continuing */ 00079 00080 /*! Application error codes */ 00081 #define ATT_ERR_VALUE_RANGE 0x80 /*! Value out of range */ 00082 00083 /*! PDU types */ 00084 #define ATT_PDU_ERR_RSP 0x01 /*! Error response */ 00085 #define ATT_PDU_MTU_REQ 0x02 /*! Exchange mtu request */ 00086 #define ATT_PDU_MTU_RSP 0x03 /*! Exchange mtu response */ 00087 #define ATT_PDU_FIND_INFO_REQ 0x04 /*! Find information request */ 00088 #define ATT_PDU_FIND_INFO_RSP 0x05 /*! Find information response */ 00089 #define ATT_PDU_FIND_TYPE_REQ 0x06 /*! Find by type value request */ 00090 #define ATT_PDU_FIND_TYPE_RSP 0x07 /*! Find by type value response */ 00091 #define ATT_PDU_READ_TYPE_REQ 0x08 /*! Read by type request */ 00092 #define ATT_PDU_READ_TYPE_RSP 0x09 /*! Read by type response */ 00093 #define ATT_PDU_READ_REQ 0x0A /*! Read request */ 00094 #define ATT_PDU_READ_RSP 0x0B /*! Read response */ 00095 #define ATT_PDU_READ_BLOB_REQ 0x0C /*! Read blob request */ 00096 #define ATT_PDU_READ_BLOB_RSP 0x0D /*! Read blob response */ 00097 #define ATT_PDU_READ_MULT_REQ 0x0E /*! Read multiple request */ 00098 #define ATT_PDU_READ_MULT_RSP 0x0F /*! Read multiple response */ 00099 #define ATT_PDU_READ_GROUP_TYPE_REQ 0x10 /*! Read by group type request */ 00100 #define ATT_PDU_READ_GROUP_TYPE_RSP 0x11 /*! Read by group type response */ 00101 #define ATT_PDU_WRITE_REQ 0x12 /*! Write request */ 00102 #define ATT_PDU_WRITE_RSP 0x13 /*! Write response */ 00103 #define ATT_PDU_WRITE_CMD 0x52 /*! Write command */ 00104 #define ATT_PDU_SIGNED_WRITE_CMD 0xD2 /*! Signed write command */ 00105 #define ATT_PDU_PREP_WRITE_REQ 0x16 /*! Prepare write request */ 00106 #define ATT_PDU_PREP_WRITE_RSP 0x17 /*! Prepare write response */ 00107 #define ATT_PDU_EXEC_WRITE_REQ 0x18 /*! Execute write request */ 00108 #define ATT_PDU_EXEC_WRITE_RSP 0x19 /*! Execute write response */ 00109 #define ATT_PDU_VALUE_NTF 0x1B /*! Handle value notification */ 00110 #define ATT_PDU_VALUE_IND 0x1D /*! Handle value indication */ 00111 #define ATT_PDU_VALUE_CNF 0x1E /*! Handle value confirmation */ 00112 #define ATT_PDU_MAX 0x1F /*! PDU Maximum */ 00113 00114 /*! Length of PDU fixed length fields */ 00115 #define ATT_ERR_RSP_LEN 5 00116 #define ATT_MTU_REQ_LEN 3 00117 #define ATT_MTU_RSP_LEN 3 00118 #define ATT_FIND_INFO_REQ_LEN 5 00119 #define ATT_FIND_INFO_RSP_LEN 2 00120 #define ATT_FIND_TYPE_REQ_LEN 7 00121 #define ATT_FIND_TYPE_RSP_LEN 1 00122 #define ATT_READ_TYPE_REQ_LEN 5 00123 #define ATT_READ_TYPE_RSP_LEN 2 00124 #define ATT_READ_REQ_LEN 3 00125 #define ATT_READ_RSP_LEN 1 00126 #define ATT_READ_BLOB_REQ_LEN 5 00127 #define ATT_READ_BLOB_RSP_LEN 1 00128 #define ATT_READ_MULT_REQ_LEN 1 00129 #define ATT_READ_MULT_RSP_LEN 1 00130 #define ATT_READ_GROUP_TYPE_REQ_LEN 5 00131 #define ATT_READ_GROUP_TYPE_RSP_LEN 2 00132 #define ATT_WRITE_REQ_LEN 3 00133 #define ATT_WRITE_RSP_LEN 1 00134 #define ATT_WRITE_CMD_LEN 3 00135 #define ATT_SIGNED_WRITE_CMD_LEN (ATT_WRITE_CMD_LEN + ATT_AUTH_SIG_LEN) 00136 #define ATT_PREP_WRITE_REQ_LEN 5 00137 #define ATT_PREP_WRITE_RSP_LEN 5 00138 #define ATT_EXEC_WRITE_REQ_LEN 2 00139 #define ATT_EXEC_WRITE_RSP_LEN 1 00140 #define ATT_VALUE_NTF_LEN 3 00141 #define ATT_VALUE_IND_LEN 3 00142 #define ATT_VALUE_CNF_LEN 1 00143 00144 /*! Find information response format */ 00145 #define ATT_FIND_HANDLE_16_UUID 0x01 /*! Handle and 16 bit UUID */ 00146 #define ATT_FIND_HANDLE_128_UUID 0x02 /*! Handle and 128 bit UUID */ 00147 00148 /*! Execute write request flags */ 00149 #define ATT_EXEC_WRITE_CANCEL 0x00 /*! Cancel all prepared writes */ 00150 #define ATT_EXEC_WRITE_ALL 0x01 /*! Write all pending prepared writes */ 00151 00152 /*! PDU masks */ 00153 #define ATT_PDU_MASK_SERVER 0x01 /*! Server bit mask */ 00154 #define ATT_PDU_MASK_COMMAND 0x40 /*! Command bit mask */ 00155 #define ATT_PDU_MASK_SIGNED 0x80 /*! Auth signature bit mask */ 00156 00157 /*! Handles */ 00158 #define ATT_HANDLE_NONE 0x0000 00159 #define ATT_HANDLE_START 0x0001 00160 #define ATT_HANDLE_MAX 0xFFFF 00161 00162 /*! UUID lengths */ 00163 #define ATT_NO_UUID_LEN 0 /*! Length when no UUID is present ;-) */ 00164 #define ATT_16_UUID_LEN 2 /*! Length in bytes of a 16 bit UUID */ 00165 #define ATT_128_UUID_LEN 16 /*! Length in bytes of a 128 bit UUID */ 00166 00167 /*! GATT characteristic properties */ 00168 #define ATT_PROP_BROADCAST 0x01 /*! Permit broadcasts */ 00169 #define ATT_PROP_READ 0x02 /*! Permit reads */ 00170 #define ATT_PROP_WRITE_NO_RSP 0x04 /*! Permit writes without response */ 00171 #define ATT_PROP_WRITE 0x08 /*! Permit writes with response */ 00172 #define ATT_PROP_NOTIFY 0x10 /*! Permit notifications */ 00173 #define ATT_PROP_INDICATE 0x20 /*! Permit indications */ 00174 #define ATT_PROP_AUTHENTICATED 0x40 /*! Permit signed writes */ 00175 #define ATT_PROP_EXTENDED 0x80 /*! More properties defined in extended properties */ 00176 00177 /*! GATT characteristic extended properties */ 00178 #define ATT_EXT_PROP_RELIABLE_WRITE 0x0001 /*! Permit reliable writes */ 00179 #define ATT_EXT_PROP_WRITEABLE_AUX 0x0002 /*! Permit write to characteristic descriptor */ 00180 00181 /*! GATT client characteristic configuration */ 00182 #define ATT_CLIENT_CFG_NOTIFY 0x0001 /*! Notify the value */ 00183 #define ATT_CLIENT_CFG_INDICATE 0x0002 /*! Indicate the value */ 00184 00185 /*! GATT server characteristic configuration */ 00186 #define ATT_SERVER_CFG_BROADCAST 0x0001 /*! Broadcast the value */ 00187 00188 /*! GATT characteristic format */ 00189 #define ATT_FORMAT_BOOLEAN 0x01 /*! Boolean */ 00190 #define ATT_FORMAT_2BIT 0x02 /*! Unsigned 2 bit integer */ 00191 #define ATT_FORMAT_NIBBLE 0x03 /*! Unsigned 4 bit integer */ 00192 #define ATT_FORMAT_UINT8 0x04 /*! Unsigned 8 bit integer */ 00193 #define ATT_FORMAT_UINT12 0x05 /*! Unsigned 12 bit integer */ 00194 #define ATT_FORMAT_UINT16 0x06 /*! Unsigned 16 bit integer */ 00195 #define ATT_FORMAT_UINT24 0x07 /*! Unsigned 24 bit integer */ 00196 #define ATT_FORMAT_UINT32 0x08 /*! Unsigned 32 bit integer */ 00197 #define ATT_FORMAT_UINT48 0x09 /*! Unsigned 48 bit integer */ 00198 #define ATT_FORMAT_UINT64 0x0A /*! Unsigned 64 bit integer */ 00199 #define ATT_FORMAT_UINT128 0x0B /*! Unsigned 128 bit integer */ 00200 #define ATT_FORMAT_SINT8 0x0C /*! Signed 8 bit integer */ 00201 #define ATT_FORMAT_SINT12 0x0D /*! Signed 12 bit integer */ 00202 #define ATT_FORMAT_SINT16 0x0E /*! Signed 16 bit integer */ 00203 #define ATT_FORMAT_SINT24 0x0F /*! Signed 24 bit integer */ 00204 #define ATT_FORMAT_SINT32 0x10 /*! Signed 32 bit integer */ 00205 #define ATT_FORMAT_SINT48 0x11 /*! Signed 48 bit integer */ 00206 #define ATT_FORMAT_SINT64 0x12 /*! Signed 64 bit integer */ 00207 #define ATT_FORMAT_SINT128 0x13 /*! Signed 128 bit integer */ 00208 #define ATT_FORMAT_FLOAT32 0x14 /*! IEEE-754 32 bit floating point */ 00209 #define ATT_FORMAT_FLOAT64 0x15 /*! IEEE-754 64 bit floating point */ 00210 #define ATT_FORMAT_SFLOAT 0x16 /*! IEEE-11073 16 bit SFLOAT */ 00211 #define ATT_FORMAT_FLOAT 0x17 /*! IEEE-11073 32 bit FLOAT */ 00212 #define ATT_FORMAT_DUINT16 0x18 /*! IEEE-20601 format */ 00213 #define ATT_FORMAT_UTF8 0x19 /*! UTF-8 string */ 00214 #define ATT_FORMAT_UTF16 0x1A /*! UTF-16 string */ 00215 #define ATT_FORMAT_STRUCT 0x1B /*! Opaque structure */ 00216 00217 #ifdef __cplusplus 00218 }; 00219 #endif 00220 00221 #endif /* ATT_DEFS_H */
Generated on Tue Jul 12 2022 19:59:22 by
1.7.2