Mistake on this page?
Report an issue in GitHub or email us
GattCallbackParamTypes.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2013 ARM Limited
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MBED_BLE_GATT_CALLBACK_PARAM_TYPES_H__
18 #define MBED_BLE_GATT_CALLBACK_PARAM_TYPES_H__
19 
20 /**
21  * @addtogroup ble
22  * @{
23  * @addtogroup gatt
24  * @{
25  */
26 
27 /**
28  * GATT Write event definition.
29  *
30  * Instances of this type are created and passed to user registered callbacks
31  * whether the GattServer has received a write request or a GattClient has
32  * received a write response.
33  *
34  * @attention The GattServer only populates the fields offset, len and data
35  * when it has received a write request. Callbacks attached to the GattClient
36  * do not use those fields.
37  *
38  * @attention The GattClient only populates the fields status and error_code
39  * when it has received a write response. Callbacks attached to the GattServer
40  * do not use those fields.
41  */
43  /**
44  * Enumeration of allowed write operations.
45  */
46  enum WriteOp_t {
47  /**
48  * Invalid operation.
49  */
50  OP_INVALID = 0x00,
51 
52  /**
53  * Write request.
54  */
55  OP_WRITE_REQ = 0x01,
56 
57  /**
58  * Write command.
59  */
60  OP_WRITE_CMD = 0x02,
61 
62  /**
63  * Signed write command.
64  */
66 
67  /**
68  * Prepare write request.
69  */
71 
72  /**
73  * Execute write request: cancel all prepared writes.
74  */
76 
77  /**
78  * Execute write request: immediately execute all prepared writes.
79  */
81  };
82 
83  /**
84  * Handle of the connection that triggered the event.
85  */
87 
88  /**
89  * Handle of the attribute to which the write operation applies.
90  */
92 
93  /**
94  * Type of the write operation.
95  */
97 
98  union {
99  /**
100  * Offset within the attribute value to be written.
101  *
102  * @attention Reserved for GattServer registered callbacks.
103  */
104  uint16_t offset;
105 
106  /**
107  * Status of the GattClient Write operation.
108  *
109  * @attention Reserved for GattClient registered callbacks.
110  */
112  };
113 
114  union {
115  /**
116  * Length (in bytes) of the data to write.
117  *
118  * @attention Reserved for GattServer registered callbacks.
119  */
120  uint16_t len;
121 
122  /**
123  * Error code of the GattClient Write operation.
124  *
125  * @attention Reserved for GattClient registered callbacks.
126  */
127  uint8_t error_code;
128  };
129 
130  /**
131  * Pointer to the data to write.
132  *
133  * @attention Data may not persist beyond the callback scope.
134  *
135  * @attention Reserved for GattServer registered callbacks.
136  */
137  const uint8_t *data;
138 };
139 
140 /**
141  * GATT Read event definition.
142  *
143  * Instances of this type are created and passed to user registered callbacks
144  * whether the GattServer has received a read request or a GattClient has
145  * received a read response.
146  *
147  * @attention The GattClient only populates the fields status and error_code
148  * when it has received a read response. Callbacks attached to the GattServer
149  * do not use those fields.
150  */
152  /**
153  * Handle of the connection that triggered the event.
154  */
156 
157  /**
158  * Attribute Handle to which the read operation applies.
159  */
161 
162  /**
163  * Offset within the attribute value read.
164  */
165  uint16_t offset;
166 
167  union {
168  /**
169  * Length in bytes of the data read.
170  */
171  uint16_t len;
172 
173  /**
174  * Error code of the GattClient read operation.
175  *
176  * @attention Reserved for GattClient registered callbacks.
177  *
178  * @attention set if status is not equal to BLE_ERROR_NONE; otherwise,
179  * this field is interpreted as len.
180  */
181  uint8_t error_code;
182  };
183 
184  /**
185  * Pointer to the data read.
186  *
187  * @attention Data may not persist beyond the callback scope.
188  */
189  const uint8_t *data;
190 
191  /**
192  * Status of the GattClient Read operation.
193  *
194  * @attention Reserved for GattClient registered callbacks.
195  */
197 };
198 
199 /**
200  * @addtogroup server
201  * @{
202  */
203 
204 /**
205  * Enumeration of allowed values returned by read or write authorization process.
206  */
208  /**
209  * Success.
210  */
212 
213  /**
214  * ATT Error: Invalid attribute handle.
215  */
217 
218  /**
219  * ATT Error: Read not permitted.
220  */
222 
223  /**
224  * ATT Error: Write not permitted.
225  */
227 
228  /**
229  * ATT Error: Authenticated link required.
230  */
232 
233  /**
234  * ATT Error: The specified offset was past the end of the attribute.
235  */
237 
238  /**
239  * ATT Error: Used in ATT as "insufficient authorization".
240  */
242 
243  /**
244  * ATT Error: Used in ATT as "prepare queue full".
245  */
247 
248  /**
249  * ATT Error: Used in ATT as "attribute not found".
250  */
252 
253  /**
254  * ATT Error: Attribute cannot be read or written using read/write blob
255  * requests.
256  */
258 
259  /**
260  * ATT Error: Invalid value size.
261  */
263 
264  /**
265  * ATT Error: Encrypted link required.
266  */
268 };
269 
270 /**
271  * GATT write authorization request event.
272  */
274  /**
275  * Handle of the connection that triggered the event.
276  */
278 
279  /**
280  * Attribute Handle to which the write operation applies.
281  */
283 
284  /**
285  * Offset for the write operation.
286  */
287  uint16_t offset;
288 
289  /**
290  * Length of the incoming data.
291  */
292  uint16_t len;
293 
294  /**
295  * Incoming data.
296  */
297  const uint8_t *data;
298 
299  /**
300  * Authorization result.
301  *
302  * The callback sets this parameter. If the value is set to
303  * AUTH_CALLBACK_REPLY_SUCCESS, then the write request is accepted;
304  * otherwise, an error code is returned to the peer client.
305  */
307 };
308 
309 /**
310  * GATT read authorization request event.
311  */
313  /**
314  * The handle of the connection that triggered the event.
315  */
317 
318  /**
319  * Attribute Handle to which the read operation applies.
320  */
322 
323  /**
324  * Offset for the read operation.
325  */
326  uint16_t offset;
327 
328  /**
329  * Optional: new length of the outgoing data.
330  */
331  uint16_t len;
332 
333  /**
334  * Optional: new outgoing data. Leave at NULL if data is unchanged.
335  */
336  uint8_t *data;
337 
338  /**
339  * Authorization result.
340  *
341  * The callback sets this parameter. If the value is set to
342  * AUTH_CALLBACK_REPLY_SUCCESS, then the read request is accepted;
343  * otherwise, an error code is returned to the peer client.
344  */
346 };
347 
348 /**
349  * Handle Value Notification/Indication event.
350  *
351  * The GattClient generates this type of event upon the reception of a
352  * Handle Value Notification or Indication.
353  *
354  * The event is passed to callbacks registered by GattClient::onHVX().
355  */
357  /**
358  * The handle of the connection that triggered the event.
359  */
361 
362  /**
363  * Attribute Handle to which the HVx operation applies.
364  */
366 
367  /**
368  * Indication or Notification, see HVXType_t.
369  */
371 
372  /**
373  * Attribute value length.
374  */
375  uint16_t len;
376 
377  /**
378  * Attribute value.
379  */
380  const uint8_t *data;
381 
382 };
383 
384 /**
385  * @}
386  * @}
387  * @}
388  */
389 
390 #endif /*MBED_BLE_GATT_CALLBACK_PARAM_TYPES_H__*/
Execute write request: immediately execute all prepared writes.
GattAttribute::Handle_t handle
Attribute Handle to which the write operation applies.
ATT Error: Encrypted link required.
GattAuthCallbackReply_t authorizationReply
Authorization result.
uint16_t offset
Offset within the attribute value read.
const uint8_t * data
Incoming data.
const uint8_t * data
Pointer to the data to write.
ble::connection_handle_t connHandle
Handle of the connection that triggered the event.
uint8_t error_code
Error code of the GattClient read operation.
uintptr_t connection_handle_t
Opaque reference to a connection.
Definition: BLETypes.h:86
uint8_t error_code
Error code of the GattClient Write operation.
GATT write authorization request event.
ATT Error: Authenticated link required.
Handle Value Notification/Indication event.
ATT Error: Invalid attribute handle.
Execute write request: cancel all prepared writes.
GATT read authorization request event.
GattAuthCallbackReply_t authorizationReply
Authorization result.
uint16_t offset
Offset within the attribute value to be written.
ATT Error: The specified offset was past the end of the attribute.
ble::connection_handle_t connHandle
Handle of the connection that triggered the event.
ATT Error: Attribute cannot be read or written using read/write blob requests.
ble::attribute_handle_t Handle_t
Representation of an attribute handle.
Definition: GattAttribute.h:67
ble::connection_handle_t connHandle
The handle of the connection that triggered the event.
uint16_t len
Optional: new length of the outgoing data.
ble_error_t status
Status of the GattClient Read operation.
GATT Write event definition.
uint16_t len
Length (in bytes) of the data to write.
GATT Read event definition.
uint8_t * data
Optional: new outgoing data.
uint16_t len
Length in bytes of the data read.
ATT Error: Used in ATT as "attribute not found".
ATT Error: Used in ATT as "prepare queue full".
const uint8_t * data
Attribute value.
HVXType_t
Handle Value Notification/Indication event.
Definition: blecommon.h:231
WriteOp_t writeOp
Type of the write operation.
uint16_t offset
Offset for the write operation.
uint16_t len
Length of the incoming data.
ble_error_t status
Status of the GattClient Write operation.
GattAttribute::Handle_t handle
Handle of the attribute to which the write operation applies.
GattAttribute::Handle_t handle
Attribute Handle to which the read operation applies.
ble::connection_handle_t connHandle
Handle of the connection that triggered the event.
uint16_t len
Attribute value length.
HVXType_t type
Indication or Notification, see HVXType_t.
GattAttribute::Handle_t handle
Attribute Handle to which the HVx operation applies.
const uint8_t * data
Pointer to the data read.
WriteOp_t
Enumeration of allowed write operations.
GattAuthCallbackReply_t
Enumeration of allowed values returned by read or write authorization process.
ATT Error: Used in ATT as "insufficient authorization".
GattAttribute::Handle_t handle
Attribute Handle to which the read operation applies.
uint16_t offset
Offset for the read operation.
ble_error_t
Error codes for the BLE API.
Definition: blecommon.h:147
ble::connection_handle_t connHandle
The handle of the connection that triggered the event.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.