Cordio Stack and Cordio Profiles
r2p3-02rel0
Main Page
Usage and Description
Reference
att_defs.h
Go to the documentation of this file.
1
/*************************************************************************************************/
2
/*!
3
* \file
4
*
5
* \brief Attribute protocol constants and definitions from the Bluetooth specification.
6
*
7
* Copyright (c) 2009-2018 Arm Ltd. All Rights Reserved.
8
* Arm Ltd. confidential and proprietary.
9
*
10
* IMPORTANT. Your use of this file is governed by a Software License Agreement
11
* ("Agreement") that must be accepted in order to download or otherwise receive a
12
* copy of this file. You may not use or copy this file for any purpose other than
13
* as described in the Agreement. If you do not agree to all of the terms of the
14
* Agreement do not use this file and delete all copies in your possession or control;
15
* if you do not have a copy of the Agreement, you must contact Arm Ltd. prior
16
* to any use, copying or further distribution of this software.
17
*/
18
/*************************************************************************************************/
19
#ifndef ATT_DEFS_H
20
#define ATT_DEFS_H
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/*! \addtogroup STACK_ATT_API
27
* \{ */
28
29
/**************************************************************************************************
30
Macros
31
**************************************************************************************************/
32
33
/** \name ATT PDU Format
34
* ATT PDU defaults and constants
35
*/
36
/**@{*/
37
#define ATT_HDR_LEN 1
/*!< \brief Attribute PDU header length */
38
#define ATT_AUTH_SIG_LEN 12
/*!< \brief Authentication signature length */
39
#define ATT_DEFAULT_MTU 23
/*!< \brief Default value of ATT_MTU */
40
#define ATT_MAX_MTU 517
/*!< \brief Maximum value of ATT_MTU */
41
#define ATT_DEFAULT_PAYLOAD_LEN 20
/*!< \brief Default maximum payload length for most PDUs */
42
/**@}*/
43
44
/** \name ATT Maximum Value Parameters
45
* maximum values for ATT attribute length and offset
46
*/
47
/**@{*/
48
#define ATT_VALUE_MAX_LEN 512
/*!< \brief Maximum attribute value length */
49
#define ATT_VALUE_MAX_OFFSET 511
/*!< \brief Maximum attribute value offset */
50
/**@}*/
51
52
/** \name ATT Transaction Timeout
53
* Maximum time allowed between transaction request and response.
54
*/
55
/**@{*/
56
#define ATT_MAX_TRANS_TIMEOUT 30
/*!< \brief Maximum transaction timeout in seconds */
57
/**@}*/
58
59
/** \name ATT Error Codes
60
* ATT Protocol operation status codes found in PDUs
61
*/
62
/**@{*/
63
#define ATT_SUCCESS 0x00
/*!< \brief Operation successful */
64
#define ATT_ERR_HANDLE 0x01
/*!< \brief Invalid handle */
65
#define ATT_ERR_READ 0x02
/*!< \brief Read not permitted */
66
#define ATT_ERR_WRITE 0x03
/*!< \brief Write not permitted */
67
#define ATT_ERR_INVALID_PDU 0x04
/*!< \brief Invalid pdu */
68
#define ATT_ERR_AUTH 0x05
/*!< \brief Insufficient authentication */
69
#define ATT_ERR_NOT_SUP 0x06
/*!< \brief Request not supported */
70
#define ATT_ERR_OFFSET 0x07
/*!< \brief Invalid offset */
71
#define ATT_ERR_AUTHOR 0x08
/*!< \brief Insufficient authorization */
72
#define ATT_ERR_QUEUE_FULL 0x09
/*!< \brief Prepare queue full */
73
#define ATT_ERR_NOT_FOUND 0x0A
/*!< \brief Attribute not found */
74
#define ATT_ERR_NOT_LONG 0x0B
/*!< \brief Attribute not long */
75
#define ATT_ERR_KEY_SIZE 0x0C
/*!< \brief Insufficient encryption key size */
76
#define ATT_ERR_LENGTH 0x0D
/*!< \brief Invalid attribute value length */
77
#define ATT_ERR_UNLIKELY 0x0E
/*!< \brief Other unlikely error */
78
#define ATT_ERR_ENC 0x0F
/*!< \brief Insufficient encryption */
79
#define ATT_ERR_GROUP_TYPE 0x10
/*!< \brief Unsupported group type */
80
#define ATT_ERR_RESOURCES 0x11
/*!< \brief Insufficient resources */
81
#define ATT_ERR_CCCD 0xFD
/*!< \brief CCCD improperly configured */
82
#define ATT_ERR_IN_PROGRESS 0xFE
/*!< \brief Procedure already in progress */
83
#define ATT_ERR_RANGE 0xFF
/*!< \brief Value out of range */
84
/**@}*/
85
86
/** \name Proprietary Internal Error Codes
87
* These codes may be sent to application but are not present in any ATT PDU.
88
*/
89
/**@{*/
90
#define ATT_ERR_MEMORY 0x70
/*!< \brief Out of memory */
91
#define ATT_ERR_TIMEOUT 0x71
/*!< \brief Transaction timeout */
92
#define ATT_ERR_OVERFLOW 0x72
/*!< \brief Transaction overflow */
93
#define ATT_ERR_INVALID_RSP 0x73
/*!< \brief Invalid response PDU */
94
#define ATT_ERR_CANCELLED 0x74
/*!< \brief Request cancelled */
95
#define ATT_ERR_UNDEFINED 0x75
/*!< \brief Other undefined error */
96
#define ATT_ERR_REQ_NOT_FOUND 0x76
/*!< \brief Required characteristic not found */
97
#define ATT_ERR_MTU_EXCEEDED 0x77
/*!< \brief Attribute PDU length exceeded MTU size */
98
#define ATT_CONTINUING 0x78
/*!< \brief Procedure continuing */
99
/**@}*/
100
101
/** \name ATT Application Error Codes
102
* These codes may be sent to application but are not present in any ATT PDU.
103
*/
104
/**@{*/
105
#define ATT_ERR_VALUE_RANGE 0x80
/*!< \brief Value out of range */
106
/**@}*/
107
108
/** \name ATT HCI Error Status
109
*
110
*/
111
/**@{*/
112
/*! \brief Base value for HCI error status values passed through ATT.
113
* Since the values of HCI and ATT error codes overlap, the constant
114
* \ref ATT_HCI_ERR_BASE is added to HCI error codes before being passed through ATT.
115
* See \ref HCI_SUCCESS for HCI error code values.
116
*/
117
#define ATT_HCI_ERR_BASE 0x20
118
/**@}*/
119
120
/** \name ATT PDU Types
121
* PDU Types for all possible over-the-air ATT operations.
122
*/
123
/**@{*/
124
#define ATT_PDU_ERR_RSP 0x01
/*!< \brief Error response */
125
#define ATT_PDU_MTU_REQ 0x02
/*!< \brief Exchange mtu request */
126
#define ATT_PDU_MTU_RSP 0x03
/*!< \brief Exchange mtu response */
127
#define ATT_PDU_FIND_INFO_REQ 0x04
/*!< \brief Find information request */
128
#define ATT_PDU_FIND_INFO_RSP 0x05
/*!< \brief Find information response */
129
#define ATT_PDU_FIND_TYPE_REQ 0x06
/*!< \brief Find by type value request */
130
#define ATT_PDU_FIND_TYPE_RSP 0x07
/*!< \brief Find by type value response */
131
#define ATT_PDU_READ_TYPE_REQ 0x08
/*!< \brief Read by type request */
132
#define ATT_PDU_READ_TYPE_RSP 0x09
/*!< \brief Read by type response */
133
#define ATT_PDU_READ_REQ 0x0A
/*!< \brief Read request */
134
#define ATT_PDU_READ_RSP 0x0B
/*!< \brief Read response */
135
#define ATT_PDU_READ_BLOB_REQ 0x0C
/*!< \brief Read blob request */
136
#define ATT_PDU_READ_BLOB_RSP 0x0D
/*!< \brief Read blob response */
137
#define ATT_PDU_READ_MULT_REQ 0x0E
/*!< \brief Read multiple request */
138
#define ATT_PDU_READ_MULT_RSP 0x0F
/*!< \brief Read multiple response */
139
#define ATT_PDU_READ_GROUP_TYPE_REQ 0x10
/*!< \brief Read by group type request */
140
#define ATT_PDU_READ_GROUP_TYPE_RSP 0x11
/*!< \brief Read by group type response */
141
#define ATT_PDU_WRITE_REQ 0x12
/*!< \brief Write request */
142
#define ATT_PDU_WRITE_RSP 0x13
/*!< \brief Write response */
143
#define ATT_PDU_WRITE_CMD 0x52
/*!< \brief Write command */
144
#define ATT_PDU_SIGNED_WRITE_CMD 0xD2
/*!< \brief Signed write command */
145
#define ATT_PDU_PREP_WRITE_REQ 0x16
/*!< \brief Prepare write request */
146
#define ATT_PDU_PREP_WRITE_RSP 0x17
/*!< \brief Prepare write response */
147
#define ATT_PDU_EXEC_WRITE_REQ 0x18
/*!< \brief Execute write request */
148
#define ATT_PDU_EXEC_WRITE_RSP 0x19
/*!< \brief Execute write response */
149
#define ATT_PDU_VALUE_NTF 0x1B
/*!< \brief Handle value notification */
150
#define ATT_PDU_VALUE_IND 0x1D
/*!< \brief Handle value indication */
151
#define ATT_PDU_VALUE_CNF 0x1E
/*!< \brief Handle value confirmation */
152
#define ATT_PDU_MAX 0x1F
/*!< \brief PDU Maximum */
153
/**@}*/
154
155
/** \name ATT PDU Length Fields
156
* Length constants of PDU fixed length fields
157
*/
158
/**@{*/
159
#define ATT_ERR_RSP_LEN 5
/*!< \brief Error response length. */
160
#define ATT_MTU_REQ_LEN 3
/*!< \brief MTU request length. */
161
#define ATT_MTU_RSP_LEN 3
/*!< \brief MTU response length. */
162
#define ATT_FIND_INFO_REQ_LEN 5
/*!< \brief Find information request length. */
163
#define ATT_FIND_INFO_RSP_LEN 2
/*!< \brief Find information response length. */
164
#define ATT_FIND_TYPE_REQ_LEN 7
/*!< \brief Find type request length. */
165
#define ATT_FIND_TYPE_RSP_LEN 1
/*!< \brief Find type response length. */
166
#define ATT_READ_TYPE_REQ_LEN 5
/*!< \brief Read type request length. */
167
#define ATT_READ_TYPE_RSP_LEN 2
/*!< \brief Read type response length. */
168
#define ATT_READ_REQ_LEN 3
/*!< \brief Read request length. */
169
#define ATT_READ_RSP_LEN 1
/*!< \brief Read response length. */
170
#define ATT_READ_BLOB_REQ_LEN 5
/*!< \brief Read blob request legnth. */
171
#define ATT_READ_BLOB_RSP_LEN 1
/*!< \brief Read blob response length. */
172
#define ATT_READ_MULT_REQ_LEN 1
/*!< \brief Read multiple request length. */
173
#define ATT_READ_MULT_RSP_LEN 1
/*!< \brief Read multiple response length. */
174
#define ATT_READ_GROUP_TYPE_REQ_LEN 5
/*!< \brief Read group type request length. */
175
#define ATT_READ_GROUP_TYPE_RSP_LEN 2
/*!< \brief Read group type response length. */
176
#define ATT_WRITE_REQ_LEN 3
/*!< \brief Write request length. */
177
#define ATT_WRITE_RSP_LEN 1
/*!< \brief Write response length. */
178
#define ATT_WRITE_CMD_LEN 3
/*!< \brief Write command length. */
179
#define ATT_SIGNED_WRITE_CMD_LEN (ATT_WRITE_CMD_LEN + ATT_AUTH_SIG_LEN)
/*!< \brief Signed write command length. */
180
#define ATT_PREP_WRITE_REQ_LEN 5
/*!< \brief Prepared write command length. */
181
#define ATT_PREP_WRITE_RSP_LEN 5
/*!< \brief Prepared write response length. */
182
#define ATT_EXEC_WRITE_REQ_LEN 2
/*!< \brief Execute write request length. */
183
#define ATT_EXEC_WRITE_RSP_LEN 1
/*!< \brief Execute write response length. */
184
#define ATT_VALUE_NTF_LEN 3
/*!< \brief Value notification length. */
185
#define ATT_VALUE_IND_LEN 3
/*!< \brief Value indication length. */
186
#define ATT_VALUE_CNF_LEN 1
/*!< \brief Value confirmation length. */
187
/**@}*/
188
189
/** \name ATT Find Information Response Format
190
*
191
*/
192
/**@{*/
193
#define ATT_FIND_HANDLE_16_UUID 0x01
/*!< \brief Handle and 16 bit UUID */
194
#define ATT_FIND_HANDLE_128_UUID 0x02
/*!< \brief Handle and 128 bit UUID */
195
/**@}*/
196
197
/** \name ATT Execute Write Request Flags
198
*
199
*/
200
/**@{*/
201
#define ATT_EXEC_WRITE_CANCEL 0x00
/*!< \brief Cancel all prepared writes */
202
#define ATT_EXEC_WRITE_ALL 0x01
/*!< \brief Write all pending prepared writes */
203
/**@}*/
204
205
/** \name ATT PDU Masks
206
*
207
*/
208
/**@{*/
209
#define ATT_PDU_MASK_SERVER 0x01
/*!< \brief Server bit mask */
210
#define ATT_PDU_MASK_COMMAND 0x40
/*!< \brief Command bit mask */
211
#define ATT_PDU_MASK_SIGNED 0x80
/*!< \brief Auth signature bit mask */
212
/**@}*/
213
214
/** \name ATT Handle Constants
215
* Invalid, minimum and maximum handle values.
216
*/
217
/**@{*/
218
#define ATT_HANDLE_NONE 0x0000
/*!< \brief Handle none. */
219
#define ATT_HANDLE_START 0x0001
/*!< \brief Handle start. */
220
#define ATT_HANDLE_MAX 0xFFFF
/*!< \brief Handle max. */
221
/**@}*/
222
223
/** \name ATT UUID Lengths
224
*
225
*/
226
/**@{*/
227
#define ATT_NO_UUID_LEN 0
/*!< \brief Length when no UUID is present ;-) */
228
#define ATT_16_UUID_LEN 2
/*!< \brief Length in bytes of a 16 bit UUID */
229
#define ATT_128_UUID_LEN 16
/*!< \brief Length in bytes of a 128 bit UUID */
230
/**@}*/
231
232
/** \name GATT Characteristic Properties
233
* Properties for how a characteristic may be interacted with through the ATT Protocol.
234
*/
235
/**@{*/
236
#define ATT_PROP_BROADCAST 0x01
/*!< \brief Permit broadcasts */
237
#define ATT_PROP_READ 0x02
/*!< \brief Permit reads */
238
#define ATT_PROP_WRITE_NO_RSP 0x04
/*!< \brief Permit writes without response */
239
#define ATT_PROP_WRITE 0x08
/*!< \brief Permit writes with response */
240
#define ATT_PROP_NOTIFY 0x10
/*!< \brief Permit notifications */
241
#define ATT_PROP_INDICATE 0x20
/*!< \brief Permit indications */
242
#define ATT_PROP_AUTHENTICATED 0x40
/*!< \brief Permit signed writes */
243
#define ATT_PROP_EXTENDED 0x80
/*!< \brief More properties defined in extended properties */
244
/**@}*/
245
246
/** \name GATT Characteristic Extended Properties
247
*
248
*/
249
/**@{*/
250
#define ATT_EXT_PROP_RELIABLE_WRITE 0x0001
/*!< \brief Permit reliable writes */
251
#define ATT_EXT_PROP_WRITEABLE_AUX 0x0002
/*!< \brief Permit write to characteristic descriptor */
252
/**@}*/
253
254
/** \name GATT Client Charactertic Configuration
255
* Configures a characteristic to send notifications or indications, if applicable.
256
*/
257
/**@{*/
258
#define ATT_CLIENT_CFG_NOTIFY 0x0001
/*!< \brief Notify the value */
259
#define ATT_CLIENT_CFG_INDICATE 0x0002
/*!< \brief Indicate the value */
260
/**@}*/
261
262
/** \name GATT Server Characteristic Configuration
263
*
264
*/
265
/**@{*/
266
#define ATT_SERVER_CFG_BROADCAST 0x0001
/*!< \brief Broadcast the value */
267
/**@}*/
268
269
/** \name GATT Characteristic Format
270
* GATT Format descriptor values
271
*/
272
/**@{*/
273
#define ATT_FORMAT_BOOLEAN 0x01
/*!< \brief Boolean */
274
#define ATT_FORMAT_2BIT 0x02
/*!< \brief Unsigned 2 bit integer */
275
#define ATT_FORMAT_NIBBLE 0x03
/*!< \brief Unsigned 4 bit integer */
276
#define ATT_FORMAT_UINT8 0x04
/*!< \brief Unsigned 8 bit integer */
277
#define ATT_FORMAT_UINT12 0x05
/*!< \brief Unsigned 12 bit integer */
278
#define ATT_FORMAT_UINT16 0x06
/*!< \brief Unsigned 16 bit integer */
279
#define ATT_FORMAT_UINT24 0x07
/*!< \brief Unsigned 24 bit integer */
280
#define ATT_FORMAT_UINT32 0x08
/*!< \brief Unsigned 32 bit integer */
281
#define ATT_FORMAT_UINT48 0x09
/*!< \brief Unsigned 48 bit integer */
282
#define ATT_FORMAT_UINT64 0x0A
/*!< \brief Unsigned 64 bit integer */
283
#define ATT_FORMAT_UINT128 0x0B
/*!< \brief Unsigned 128 bit integer */
284
#define ATT_FORMAT_SINT8 0x0C
/*!< \brief Signed 8 bit integer */
285
#define ATT_FORMAT_SINT12 0x0D
/*!< \brief Signed 12 bit integer */
286
#define ATT_FORMAT_SINT16 0x0E
/*!< \brief Signed 16 bit integer */
287
#define ATT_FORMAT_SINT24 0x0F
/*!< \brief Signed 24 bit integer */
288
#define ATT_FORMAT_SINT32 0x10
/*!< \brief Signed 32 bit integer */
289
#define ATT_FORMAT_SINT48 0x11
/*!< \brief Signed 48 bit integer */
290
#define ATT_FORMAT_SINT64 0x12
/*!< \brief Signed 64 bit integer */
291
#define ATT_FORMAT_SINT128 0x13
/*!< \brief Signed 128 bit integer */
292
#define ATT_FORMAT_FLOAT32 0x14
/*!< \brief IEEE-754 32 bit floating point */
293
#define ATT_FORMAT_FLOAT64 0x15
/*!< \brief IEEE-754 64 bit floating point */
294
#define ATT_FORMAT_SFLOAT 0x16
/*!< \brief IEEE-11073 16 bit SFLOAT */
295
#define ATT_FORMAT_FLOAT 0x17
/*!< \brief IEEE-11073 32 bit FLOAT */
296
#define ATT_FORMAT_DUINT16 0x18
/*!< \brief IEEE-20601 format */
297
#define ATT_FORMAT_UTF8 0x19
/*!< \brief UTF-8 string */
298
#define ATT_FORMAT_UTF16 0x1A
/*!< \brief UTF-16 string */
299
#define ATT_FORMAT_STRUCT 0x1B
/*!< \brief Opaque structure */
300
/**@}*/
301
302
/*! \} */
/* STACK_ATT_API */
303
304
#ifdef __cplusplus
305
};
306
#endif
307
308
#endif
/* ATT_DEFS_H */
Copyright © 2017-2018 Arm Ltd. All rights reserved.
Arm Confidential
Cordio Stack and Cordio Profiles