Mistake on this page?
Report an issue in GitHub or email us
eatt_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Enhanced attribute protocol client and server API.
6  *
7  * Copyright (c) 2019-2020 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 #ifndef EATT_API_H
25 #define EATT_API_H
26 
27 #include "wsf_timer.h"
28 #include "att_defs.h"
29 #include "att_uuid.h"
30 #include "dm_api.h"
31 #include "l2c_api.h"
32 #include "cfg_stack.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /**************************************************************************************************
39  Macros
40 **************************************************************************************************/
41 
42 /*! \addtogroup STACK_ATT_API
43  * \{ */
44 /** \name EATT Role
45  * EATT role can be initiator or acceptor.
46  */
47 /**@{*/
48 #define EATT_ROLE_INITIATOR L2C_COC_ROLE_INITIATOR
49 #define EATT_ROLE_ACCEPTOR L2C_COC_ROLE_ACCEPTOR
50 /**@}*/
51 /*! \} */ /* STACK_ATT_API */
52 
53 /**************************************************************************************************
54  Data Types
55 **************************************************************************************************/
56 
57 /*! \addtogroup STACK_ATT_API
58  * \{ */
59 /**
60  * \name EATT Data Types
61  *
62  */
63 /**@{*/
64 /*! \brief EATT multiple notify tuple structure */
65 typedef struct
66 {
67  uint16_t handle; /*!< Attribute handle */
68  uint16_t len; /*!< Length of pValue in bytes. */
69  uint8_t *pValue; /*!< Attribute value */
70 } eattTuple_t;
71 /**@}*/
72 /*! \} */ /* STACK_ATT_API */
73 
74 /*! \addtogroup STACK_ATTS_API
75  * \{ */
76 /** \name EATT Server Functions
77  *
78  */
79 /**@{*/
80 /*************************************************************************************************/
81 /*!
82  * \brief Send multiple attribute protocol Handle Value Notification.
83  *
84  * \param connId DM connection ID.
85  * \param priority Operation priority.
86  * \param valueLen Length of value data.
87  * \param pValue Pointer to value data.
88  *
89  * \return None.
90  */
91 /*************************************************************************************************/
92 void EattsMultiValueNtf(dmConnId_t connId, uint8_t priority, uint16_t numTuples, eattTuple_t *pTupleList);
93 
94 /*************************************************************************************************/
95 /*!
96  * \brief Send an attribute protocol Handle Value Indication.
97  *
98  * \param connId DM connection ID.
99  * \param priority Operation priority.
100  * \param handle Attribute handle.
101  * \param valueLen Length of value data.
102  * \param pValue Pointer to value data.
103  *
104  * \return None.
105  */
106 /*************************************************************************************************/
107 void EattsHandleValueInd(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen,
108  uint8_t *pValue);
109 
110 /*************************************************************************************************/
111 /*!
112  * \brief Send an attribute protocol Handle Value Notification.
113  *
114  * \param connId DM connection ID.
115  * \param priority Operation priority.
116  * \param handle Attribute handle.
117  * \param valueLen Length of value data.
118  * \param pValue Pointer to value data.
119  *
120  * \return None.
121  */
122 /*************************************************************************************************/
123 void EattsHandleValueNtf(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen,
124  uint8_t *pValue);
125 
126 /*************************************************************************************************/
127 /*!
128  * \brief Send an attribute protocol Handle Value Indication without copying the attribute
129  * value data.
130  *
131  * Note: attribute value buffer 'pValue' must be allocated with AttMsgAlloc().
132  *
133  * \param connId DM connection ID.
134  * \param priority Operation priority.
135  * \param handle Attribute handle.
136  * \param valueLen Length of value data.
137  * \param pValue Pointer to value data.
138  *
139  * \return None.
140  */
141 /*************************************************************************************************/
142 void EattsHandleValueIndZeroCpy(dmConnId_t connId, uint8_t priority, uint16_t handle,
143  uint16_t valueLen, uint8_t *pValue);
144 
145 /*************************************************************************************************/
146 /*!
147  * \brief Send an attribute protocol Handle Value Notification without copying the attribute
148  * value data.
149  *
150  * Note: attribute value buffer 'pValue' must be allocated with AttMsgAlloc().
151  *
152  * \param connId DM connection ID.
153  * \param priority Operation priority.
154  * \param handle Attribute handle.
155  * \param valueLen Length of value data.
156  * \param pValue Pointer to value data.
157  *
158  * \return None.
159  */
160 /*************************************************************************************************/
161 void EattsHandleValueNtfZeroCpy(dmConnId_t connId, uint8_t priority, uint16_t handle,
162  uint16_t valueLen, uint8_t *pValue);
163 
164 /*************************************************************************************************/
165 /*!
166  * \brief Initialize the Enhanced ATT Server.
167  *
168  * \return None
169  */
170  /*************************************************************************************************/
171 void EattsInit();
172 /**@}*/
173 /*! \} */ /* STACK_ATTS_API */
174 
175 /*! \addtogroup STACK_ATTC_API
176  * \{ */
177 /** \name EATT Client Functions
178  *
179  */
180 /**@{*/
181 /*************************************************************************************************/
182 /*!
183  * \brief Initiate an attribute protocol Find Information Request.
184  *
185  * \param connId DM connection ID.
186  * \param priority Operation priority.
187  * \param startHandle Attribute start handle.
188  * \param endHandle Attribute end handle.
189  * \param continuing TRUE if ATTC continues sending requests until complete.
190  *
191  * \return None.
192  */
193 /*************************************************************************************************/
194 void EattcFindInfoReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle,
195  bool_t continuing);
196 
197 /*************************************************************************************************/
198 /*!
199  * \brief Initiate an attribute protocol Find By Type Value Request.
200  *
201  * \param connId DM connection ID.
202  * \param priority Operation priority.
203  * \param startHandle Attribute start handle.
204  * \param endHandle Attribute end handle.
205  * \param uuid16 16-bit UUID to find.
206  * \param valueLen Length of value data.
207  * \param pValue Pointer to value data.
208  * \param continuing TRUE if ATTC continues sending requests until complete.
209  *
210  * \return None.
211  */
212 /*************************************************************************************************/
213 void EattcFindByTypeValueReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle,
214  uint16_t uuid16, uint16_t valueLen, uint8_t *pValue, bool_t continuing);
215 
216 /*************************************************************************************************/
217 /*!
218  * \brief Initiate an attribute protocol Read By Type Request.
219  *
220  * \param connId DM connection ID.
221  * \param priority Operation priority.
222  * \param startHandle Attribute start handle.
223  * \param endHandle Attribute end handle.
224  * \param uuidLen Length of UUID (2 or 16).
225  * \param pUuid Pointer to UUID data.
226  * \param continuing TRUE if ATTC continues sending requests until complete.
227  *
228  * \return None.
229  */
230 /*************************************************************************************************/
231 void EattcReadByTypeReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle,
232  uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
233 
234 /*************************************************************************************************/
235 /*!
236  * \brief Initiate an attribute protocol Read Request.
237  *
238  * \param connId DM connection ID.
239  * \param priority Operation priority.
240  * \param handle Attribute handle.
241  *
242  * \return None.
243  */
244 /*************************************************************************************************/
245 void EattcReadReq(dmConnId_t connId, uint8_t priority, uint16_t handle);
246 
247 /*************************************************************************************************/
248 /*!
249  * \brief Initiate an attribute protocol Read Request.
250  *
251  * \param connId DM connection ID.
252  * \param priority Operation priority.
253  * \param handle Attribute handle.
254  * \param offset Read attribute data starting at this offset.
255  * \param continuing TRUE if ATTC continues sending requests until complete.
256  *
257  * \return None.
258  */
259 /*************************************************************************************************/
260 void EattcReadLongReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t offset, bool_t continuing);
261 
262 /*************************************************************************************************/
263 /*!
264  * \brief Initiate an attribute protocol Read Multiple Request.
265  *
266  * \param connId DM connection ID.
267  * \param priority Operation priority.
268  * \param numHandles Number of handles in attribute handle list.
269  * \param pHandles List of attribute handles.
270  *
271  * \return None.
272  */
273 /*************************************************************************************************/
274 void EattcReadMultipleReq(dmConnId_t connId, uint8_t priority, uint8_t numHandles, uint16_t *pHandles);
275 
276 /*************************************************************************************************/
277 /*!
278  * \brief Initiate an attribute protocol Read By Group Type Request.
279  *
280  * \param connId DM connection ID.
281  * \param priority Operation priority.
282  * \param startHandle Attribute start handle.
283  * \param endHandle Attribute end handle.
284  * \param uuidLen Length of UUID (2 or 16).
285  * \param pUuid Pointer to UUID data.
286  * \param continuing TRUE if ATTC continues sending requests until complete.
287  *
288  * \return None.
289  */
290 /*************************************************************************************************/
291 void EattcReadByGroupTypeReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle,
292  uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
293 
294 /*************************************************************************************************/
295 /*!
296  * \brief Initiate an attribute protocol Write Request.
297  *
298  * \param connId DM connection ID.
299  * \param priority Operation priority.
300  * \param handle Attribute handle.
301  * \param valueLen Length of value data.
302  * \param pValue Pointer to value data.
303  *
304  * \return None.
305  */
306 /*************************************************************************************************/
307 void EattcWriteReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen,
308  uint8_t *pValue);
309 
310 /*************************************************************************************************/
311 /*!
312  * \brief Cancel an attribute protocol request in progress.
313  *
314  * \param connId DM connection ID.
315  * \param priority Operation priority.
316  *
317  * \return None.
318  */
319 /*************************************************************************************************/
320 void EattcCancelReq(dmConnId_t connId, uint8_t priority);
321 
322 /*************************************************************************************************/
323 /*!
324  * \brief Send an attribute protocol indication confirmation.
325  *
326  * \param connId DM connection ID.
327  * \param cid L2Cap channel ID.
328  *
329  * \return None.
330  */
331 /*************************************************************************************************/
332 void EattcIndConfirm(dmConnId_t connId, uint16_t cid);
333 
334 /*************************************************************************************************/
335 /*!
336  * \brief Initiate an attribute protocol Write Command.
337  *
338  * \param connId DM connection ID.
339  * \param priority Operation priority.
340  * \param handle Attribute handle.
341  * \param valueLen Length of value data.
342  * \param pValue Pointer to value data.
343  *
344  * \return None.
345  */
346 /*************************************************************************************************/
347 void EattcWriteCmd(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen,
348  uint8_t *pValue);
349 
350 /*************************************************************************************************/
351 /*!
352  * \brief Initiate an attribute protocol Prepare Write Request.
353  *
354  * \param connId DM connection ID.
355  * \param priority Operation priority.
356  * \param handle Attribute handle.
357  * \param offset Write attribute data starting at this offset.
358  * \param valueLen Length of value data.
359  * \param pValue Pointer to value data.
360  * \param valueByRef TRUE if pValue data is accessed by reference rather than copied.
361  * \param continuing TRUE if ATTC continues sending requests until complete.
362  *
363  * \return None.
364  */
365 /*************************************************************************************************/
366 void EattcPrepareWriteReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t offset,
367  uint16_t valueLen, uint8_t *pValue, bool_t valueByRef, bool_t continuing);
368 
369 /*************************************************************************************************/
370 /*!
371  * \brief Initiate an attribute protocol Execute Write Request.
372  *
373  * \param connId DM connection ID.
374  * \param priority Operation priority.
375  * \param writeAll TRUE to write all queued writes, FALSE to cancel all queued writes.
376  *
377  * \return None.
378  */
379 /*************************************************************************************************/
380 void EattcExecuteWriteReq(dmConnId_t connId, uint8_t priority, bool_t writeAll);
381 
382 /*************************************************************************************************/
383 /*!
384  * \brief Initiate an attribute protocol Read Multiple Variable Length Request.
385  *
386  * \param connId DM connection ID.
387  * \param priority Operation priority.
388  * \param numHandles The number of handles in pHandles.
389  * \param pHandles List of attribute handles to read.
390  *
391  * \return None.
392  */
393 /*************************************************************************************************/
394 void EattcReadMultVarLenReq(dmConnId_t connId, uint8_t priority, uint8_t numHandles, uint16_t *pHandles);
395 
396 /*************************************************************************************************/
397 /*!
398  * \brief Initialize the Enhanced ATT Client.
399  *
400  * \return None
401  */
402  /*************************************************************************************************/
403 void EattcInit();
404 /**@}*/
405 /*! \} */ /* STACK_ATTC_API */
406 
407 /*! \addtogroup STACK_ATT_API
408  * \{ */
409 /** \name EATT Functions
410  *
411  */
412 /**@{*/
413 /*************************************************************************************************/
414 /*!
415  * \brief Begin requesting EATT L2CAP coc channels.
416  *
417  * \note When pEattCfg->initiateEatt is TRUE, EattEstablishChannels is called automatically
418  * on DM_CONN_OPEN_IND. If pEattCfg->initiateEatt is FALSE, EattEstablishChannels can be
419  * called by the application after DM_CONN_OPEN_IND to begin creating EATT channels.
420  *
421  * \param connId DM connection identifier.
422  *
423  * \return None.
424  */
425 /*************************************************************************************************/
426 void EattEstablishChannels(dmConnId_t connId);
427 
428 /*************************************************************************************************/
429 /*!
430  * \brief Returns the number of open EATT channels on a given connection.
431  *
432  * \param connId DM connection identifier.
433  *
434  * \return Number of open EATT channels.
435  */
436 /*************************************************************************************************/
437 uint8_t EattGetNumChannelsInUse(dmConnId_t connId);
438 
439 /*************************************************************************************************/
440 /*!
441  * \brief Initialize the Enhanced ATT subsystem.
442  *
443  * \return None
444  */
445  /*************************************************************************************************/
446 void EattInit(uint8_t roleBits);
447 /**@}*/
448 /*! \} */ /* STACK_ATT_API */
449 
450 #ifdef __cplusplus
451 };
452 #endif
453 
454 #endif /* EATT_API_H */
void EattcReadMultVarLenReq(dmConnId_t connId, uint8_t priority, uint8_t numHandles, uint16_t *pHandles)
Initiate an attribute protocol Read Multiple Variable Length Request.
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:588
void EattcReadByGroupTypeReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
Initiate an attribute protocol Read By Group Type Request.
void EattcInit()
Initialize the Enhanced ATT Client.
void EattcFindByTypeValueReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle, uint16_t uuid16, uint16_t valueLen, uint8_t *pValue, bool_t continuing)
Initiate an attribute protocol Find By Type Value Request.
void EattsInit()
Initialize the Enhanced ATT Server.
void EattcWriteReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Initiate an attribute protocol Write Request.
void EattcExecuteWriteReq(dmConnId_t connId, uint8_t priority, bool_t writeAll)
Initiate an attribute protocol Execute Write Request.
void EattInit(uint8_t roleBits)
Initialize the Enhanced ATT subsystem.
void EattsHandleValueNtf(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Notification.
uint8_t EattGetNumChannelsInUse(dmConnId_t connId)
Returns the number of open EATT channels on a given connection.
void EattcReadReq(dmConnId_t connId, uint8_t priority, uint16_t handle)
Initiate an attribute protocol Read Request.
void EattcReadMultipleReq(dmConnId_t connId, uint8_t priority, uint8_t numHandles, uint16_t *pHandles)
Initiate an attribute protocol Read Multiple Request.
void EattcFindInfoReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle, bool_t continuing)
Initiate an attribute protocol Find Information Request.
void EattsHandleValueIndZeroCpy(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Indication without copying the attribute value data...
void EattcReadLongReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t offset, bool_t continuing)
Initiate an attribute protocol Read Request.
uint16_t len
Definition: eatt_api.h:68
void EattsMultiValueNtf(dmConnId_t connId, uint8_t priority, uint16_t numTuples, eattTuple_t *pTupleList)
Send multiple attribute protocol Handle Value Notification.
void EattcCancelReq(dmConnId_t connId, uint8_t priority)
Cancel an attribute protocol request in progress.
Device Manager subsystem API.
void EattcWriteCmd(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Initiate an attribute protocol Write Command.
EATT multiple notify tuple structure.
Definition: eatt_api.h:65
void EattcReadByTypeReq(dmConnId_t connId, uint8_t priority, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
Initiate an attribute protocol Read By Type Request.
void EattsHandleValueNtfZeroCpy(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Notification without copying the attribute value data...
uint8_t * pValue
Definition: eatt_api.h:69
void EattcIndConfirm(dmConnId_t connId, uint16_t cid)
Send an attribute protocol indication confirmation.
Timer service.
Attribute protocol constants and definitions from the Bluetooth specification.
Attribute protocol UUIDs from the Bluetooth specification.
void EattsHandleValueInd(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Indication.
uint16_t handle
Definition: eatt_api.h:67
void EattEstablishChannels(dmConnId_t connId)
Begin requesting EATT L2CAP coc channels.
L2CAP subsystem API.
void EattcPrepareWriteReq(dmConnId_t connId, uint8_t priority, uint16_t handle, uint16_t offset, uint16_t valueLen, uint8_t *pValue, bool_t valueByRef, bool_t continuing)
Initiate an attribute protocol Prepare Write Request.
Stack configuration.
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.