Cordio Stack and Cordio Profiles  r2p3-02rel0
att_api.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Attribute protocol client and server API.
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_API_H
20 #define ATT_API_H
21 
22 #include "wsf_timer.h"
23 #include "att_defs.h"
24 #include "att_uuid.h"
25 #include "dm_api.h"
26 #include "cfg_stack.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 
33 
34 /**************************************************************************************************
35  Macros
36 **************************************************************************************************/
37 /*! \addtogroup STACK_ATTS_API
38  * \{ */
39 
40 /** \name ATT Server Attribute Settings
41  * Settings that may be set on each attribute.
42  */
43 /**@{*/
44 #define ATTS_SET_UUID_128 0x01 /*!< \brief Set if the UUID is 128 bits in length */
45 #define ATTS_SET_WRITE_CBACK 0x02 /*!< \brief Set if the group callback is executed when
46  this attribute is written by a client device */
47 #define ATTS_SET_READ_CBACK 0x04 /*!< \brief Set if the group callback is executed when
48  this attribute is read by a client device */
49 #define ATTS_SET_VARIABLE_LEN 0x08 /*!< \brief Set if the attribute has a variable length */
50 #define ATTS_SET_ALLOW_OFFSET 0x10 /*!< \brief Set if writes are allowed with an offset */
51 #define ATTS_SET_CCC 0x20 /*!< \brief Set if the attribute is a client characteristic
52  configuration descriptor */
53 #define ATTS_SET_ALLOW_SIGNED 0x40 /*!< \brief Set if signed writes are allowed */
54 #define ATTS_SET_REQ_SIGNED 0x80 /*!< \brief Set if signed writes are required if link
55  is not encrypted */
56 /**@}*/
57 
58 /** \name ATT Server Attribute Permissions
59  * Permissions used to describe a attribute's security setting.
60  * These values can be set in any combination.
61  */
62 /**@{*/
63 #define ATTS_PERMIT_READ 0x01 /*!< \brief Set if attribute can be read */
64 #define ATTS_PERMIT_READ_AUTH 0x02 /*!< \brief Set if attribute read requires authentication */
65 #define ATTS_PERMIT_READ_AUTHORIZ 0x04 /*!< \brief Set if attribute read requires authorization */
66 #define ATTS_PERMIT_READ_ENC 0x08 /*!< \brief Set if attribute read requires encryption */
67 #define ATTS_PERMIT_WRITE 0x10 /*!< \brief Set if attribute can be written */
68 #define ATTS_PERMIT_WRITE_AUTH 0x20 /*!< \brief Set if attribute write requires authentication */
69 #define ATTS_PERMIT_WRITE_AUTHORIZ 0x40 /*!< \brief Set if attribute write requires authorization */
70 #define ATTS_PERMIT_WRITE_ENC 0x80 /*!< \brief Set if attribute write requires encryption */
71 /**@}*/
72 
73 /*! \} */ /* STACK_ATTS_API */
74 
75 /*! \addtogroup STACK_ATTC_API
76  * \{ */
77 
78 /** \name ATT Client Discovery and Configuration Settings
79  * Settings used to configurate ATT Discovery procedure for ATT Clients.
80  */
81 /**@{*/
82 #define ATTC_SET_UUID_128 0x01 /*!< \brief Set if the UUID is 128 bits in length */
83 #define ATTC_SET_REQUIRED 0x02 /*!< \brief Set if characteristic must be discovered */
84 #define ATTC_SET_DESCRIPTOR 0x04 /*!< \brief Set if this is a characteristic descriptor */
85 /**@}*/
86 
87 /*! \} */ /* STACK_ATTC_API */
88 
89 /*! \addtogroup STACK_ATT_API
90  * \{ */
91 
92 /** \name ATT Callback Events
93  * Events related to ATT transactions.
94  */
95 /**@{*/
96 #define ATT_CBACK_START 0x02 /*!< \brief ATT callback event starting value */
97 
98 /*! \brief ATT client callback events */
99 enum /*!< \brief Internal note: event values match method values */
100 {
101  ATTC_FIND_INFO_RSP = ATT_CBACK_START, /*!< \brief Find information response */
102  ATTC_FIND_BY_TYPE_VALUE_RSP, /*!< \brief Find by type value response */
103  ATTC_READ_BY_TYPE_RSP, /*!< \brief Read by type value response */
104  ATTC_READ_RSP, /*!< \brief Read response */
105  ATTC_READ_LONG_RSP, /*!< \brief Read long response */
106  ATTC_READ_MULTIPLE_RSP, /*!< \brief Read multiple response */
107  ATTC_READ_BY_GROUP_TYPE_RSP, /*!< \brief Read group type response */
108  ATTC_WRITE_RSP, /*!< \brief Write response */
109  ATTC_WRITE_CMD_RSP, /*!< \brief Write command response */
110  ATTC_PREPARE_WRITE_RSP, /*!< \brief Prepare write response */
111  ATTC_EXECUTE_WRITE_RSP, /*!< \brief Execute write response */
112  ATTC_HANDLE_VALUE_NTF, /*!< \brief Handle value notification */
113  ATTC_HANDLE_VALUE_IND, /*!< \brief Handle value indication */
114  /* ATT server callback events */
115  ATTS_HANDLE_VALUE_CNF, /*!< \brief Handle value confirmation */
116  ATTS_CCC_STATE_IND, /*!< \brief Client chracteristic configuration state change */
117  /* ATT common callback events */
118  ATT_MTU_UPDATE_IND /*!< \brief Negotiated MTU value */
119 };
121 /*! \brief ATT callback events */
122 #define ATT_CBACK_END ATT_MTU_UPDATE_IND /*!< \brief ATT callback event ending value */
123 /**@}*/
124 
125 /**************************************************************************************************
126  Data Types
127 **************************************************************************************************/
128 
129 /*! \brief ATT run-time configurable parameters */
130 typedef struct
131 {
132  wsfTimerTicks_t discIdleTimeout; /*!< \brief ATT server service discovery connection idle timeout in seconds */
133  uint16_t mtu; /*!< \brief desired ATT MTU */
134  uint8_t transTimeout; /*!< \brief transcation timeout in seconds */
135  uint8_t numPrepWrites; /*!< \brief number of queued prepare writes supported by server */
138 /*!
139  * \brief ATT callback event
140  *
141  * \param hdr.event Callback event
142  * \param hdr.param DM connection ID
143  * \param hdr.status Event status: ATT_SUCCESS or error status
144  * \param pValue Pointer to value data, valid if valueLen > 0
145  * \param valueLen Length of value data
146  * \param handle Attribute handle
147  * \param continuing TRUE if more response packets expected
148  * \param mtu Negotiated MTU value
149  */
150 typedef struct
151 {
152  wsfMsgHdr_t hdr; /*!< \brief Header structure */
153  uint8_t *pValue; /*!< \brief Value */
154  uint16_t valueLen; /*!< \brief Value length */
155  uint16_t handle; /*!< \brief Attribute handle */
156  bool_t continuing; /*!< \brief TRUE if more response packets expected */
157  uint16_t mtu; /*!< \brief Negotiated MTU value */
160 /*! \brief ATT event callback type.
161  *
162  * This callback function sends ATT events to the client application. A
163  * single callback function is used for both ATTS and ATTC.
164  *
165  * \param pEvt Pointer to ATT event structure.
166  *
167  * \return None.
168  */
169 typedef void (*attCback_t)(attEvt_t *pEvt);
170 
171 /*! \} */ /* STACK_ATT_API */
172 
173 /*! \addtogroup STACK_ATTS_API
174  * \{ */
175 
176 /**
177  * \name Attribute Server Data Types
178  *
179  */
180 /**@{*/
181 /*! \brief Attribute structure */
182 typedef struct
183 {
184  uint8_t const *pUuid; /*!< \brief Pointer to the attribute's UUID */
185  uint8_t *pValue; /*!< \brief Pointer to the attribute's value */
186  uint16_t *pLen; /*!< \brief Pointer to the length of the attribute's value */
187  uint16_t maxLen; /*!< \brief Maximum length of attribute's value */
188  uint8_t settings; /*!< \brief Attribute settings */
189  uint8_t permissions; /*!< \brief Attribute permissions */
191 /**@}*/
193 /** \name ATT Server Callbacks
194  *
195  */
196 /**@{*/
197 /*! \brief Attribute group read callback
198  *
199  * This is the attribute server read callback. It is executed on an attribute
200  * read operation if bitmask ATTS_SET_READ_CBACK is set in the settings field
201  * of the attribute structure.
202  * For a read operation, if the operation is successful the function must set
203  * pAttr->pValue to the data to be read. In addition, if the attribute is
204  * variable length then pAttr->pLen must be set as well.
205  *
206  * \param connId DM connection ID.
207  * \param handle Attribute handle.
208  * \param operation Operation type.
209  * \param offset Read data offset.
210  * \param pAttr Pointer to attribute structure.
211  *
212  * \return status of the operation. \ref ATT_SUCCESS if successful.
213  */
214 typedef uint8_t (*attsReadCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation,
215  uint16_t offset, attsAttr_t *pAttr);
216 
217 /*! \brief Attribute group write callback
218  *
219  * This is the attribute server write callback. It is executed on an
220  * attribute write operation if bitmask ATTS_SET_WRITE_CBACK is set
221  * in the settings field of the attribute structure.
222  *
223  * \param connId DM connection ID.
224  * \param handle Attribute handle.
225  * \param operation Operation type.
226  * \param offset Write data offset.
227  * \param len Length of data to write.
228  * \param pValue Pointer to data to write.
229  * \param pAttr Pointer to attribute structure.
230  *
231  * \return status of operation. \ref ATT_SUCCESS if successful.
232  */
233 typedef uint8_t (*attsWriteCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation,
234  uint16_t offset, uint16_t len, uint8_t *pValue,
235  attsAttr_t *pAttr);
236 
237 /*! \brief ATTS authorization callback type
238  *
239  * This callback function is executed when a read or write operation occurs
240  * and the security field of an attribute structure is set to
241  * \ref ATTS_PERMIT_READ_AUTHORIZ or \ref ATTS_PERMIT_WRITE_AUTHORIZ respectively.
242  *
243  * \param connId DM Connection ID.
244  * \param permit Set to \ref ATTS_PERMIT_WRITE for a writre operation or
245  * \ref ATTS_PERMIT_READ for a read operation.
246  * \param handle Attribute handle.
247  *
248  * \return status of the operation. \ref ATT_SUCCESS if successful, else if failure
249  * the \ref ATT_ERR_AUTH is typically returned.
250  */
251 typedef uint8_t (*attsAuthorCback_t)(dmConnId_t connId, uint8_t permit, uint16_t handle);
252 /**@}*/
253 
254 /**
255  * \name Attribute Server Data Types
256  *
257  */
258 /**@{*/
259 /*! \brief Attribute group */
260 typedef struct attsGroup_tag
261 {
262  struct attsGroup_tag *pNext; /*!< \brief For internal use only */
263  attsAttr_t *pAttr; /*!< \brief Pointer to attribute list for this group */
264  attsReadCback_t readCback; /*!< \brief Read callback function */
265  attsWriteCback_t writeCback; /*!< \brief Write callback function */
266  uint16_t startHandle; /*!< \brief The handle of the first attribute in this group */
267  uint16_t endHandle; /*!< \brief The handle of the last attribute in this group */
270 /*! \brief Client characteristc configuration settings */
271 typedef struct
272 {
273  uint16_t handle; /*!< \brief Client characteristc configuration descriptor handle */
274  uint16_t valueRange; /*!< \brief Acceptable value range of the descriptor value */
275  uint8_t secLevel; /*!< \brief Security level of characteristic value */
276 } attsCccSet_t;
278 /*! \brief ATTS client characteristic configuration callback structure */
279 typedef struct
280 {
281  wsfMsgHdr_t hdr; /*!< \brief Header structure */
282  uint16_t handle; /*!< \brief CCCD handle */
283  uint16_t value; /*!< \brief CCCD value */
284  uint8_t idx; /*!< \brief CCCD settings index */
286 /**@}*/
288 /*! \} */ /* STACK_ATTS_API */
289 
290 /*! \addtogroup STACK_ATTC_API
291  * \{ */
292 
293 /**
294  * \name ATT Client Data Types
295  */
296 /**@{*/
297 /*! \brief ATT client structure for characteristic and descriptor discovery */
298 typedef struct attcDiscChar_tag
299 {
300  uint8_t const *pUuid; /*!< \brief Pointer to UUID */
301  uint8_t settings; /*!< \brief Characteristic discovery settings */
303 
304 /*! \brief ATT client structure for characteristic and descriptor configuration */
305 typedef struct
306 {
307  uint8_t const *pValue; /*!< \brief Pointer to default value or NULL */
308  uint8_t valueLen; /*!< \brief Default value length */
309  uint8_t hdlIdx; /*!< \brief Index of its handle in handle list */
310 } attcDiscCfg_t;
312 /*! \brief ATT client discovery control block */
313 typedef struct
314 {
315  attcDiscChar_t **pCharList; /*!< \brief Characterisic list for discovery */
316  uint16_t *pHdlList; /*!< \brief Characteristic handle list */
317  attcDiscCfg_t *pCfgList; /*!< \brief Characterisic list for configuration */
318  uint8_t charListLen; /*!< \brief Characteristic and handle list length */
319  uint8_t cfgListLen; /*!< \brief Configuration list length */
321  uint16_t svcStartHdl; /*!< \brief Internal use only */
322  uint16_t svcEndHdl; /*!< \brief Internal use only */
323  uint8_t charListIdx; /*!< \brief Internal use only */
324  uint8_t endHdlIdx; /*!< \brief Internal use only */
326 /**@}*/
328 /*! \} */ /* STACK_ATTC_API */
329 
330 /*! \addtogroup STACK_ATTS_API
331  * \{ */
332 
333 /** \name ATT Server Callbacks
334  *
335  */
336 /**@{*/
337 /*! \brief ATTS client characteristic configuration callback
338  *
339  * Client characteristic configuration callback. This function is executed
340  * when a CCCD value changes. This happens when a peer device writes a new
341  * value to the CCCD or when a CCCD table is initialized by calling \ref AttsCccInitTable.
342  *
343  * \param pEvt Pointer to callback structure.
344  *
345  * \return None.
346  */
347 typedef void (*attsCccCback_t)(attsCccEvt_t *pEvt);
348 /**@}*/
349 
350 /*! \} */ /* STACK_ATTS_API */
352 /**************************************************************************************************
353  Global Variables
354 **************************************************************************************************/
355 
356 /*! \addtogroup STACK_INIT
357  * \{ */
358 
359 /** \name ATT Configuration Structure
360  * Pointer to structure containing initialization details of the ATT Subsystem. To be configured
361  * by Application.
362  */
363 /**@{*/
364 /*! \brief Configuration pointer */
365 extern attCfg_t *pAttCfg;
366 /**@}*/
367 
368 /*! \} */ /* STACK_INIT */
369 
370 /**************************************************************************************************
371  Function Declarations
372 **************************************************************************************************/
373 
374 /*! \addtogroup STACK_ATT_API
375  * \{ */
376 
377 /** \name ATT Setup Functions
378  *
379  */
380 /**@{*/
381 
382 /*************************************************************************************************/
383 /*!
384  * \brief Register a callback with ATT. This callback will be used for messages from both ATTC
385  * and ATTS.
386  *
387  * \param cback Client callback function.
388  *
389  * \return None.
390  */
391 /*************************************************************************************************/
392 void AttRegister(attCback_t cback);
393 
394 /*************************************************************************************************/
395 /*!
396  * \brief Register a connection callback with ATT. The callback is typically used to
397  * manage the attribute server database.
398  *
399  * \param cback Client callback function.
400  *
401  * \return None.
402  */
403 /*************************************************************************************************/
404 void AttConnRegister(dmCback_t cback);
405 
406 /**@}*/
407 
408 /** \name ATT Parameter Functions
409  * Functions specific to a connection between 2 devices. Functions may be called by either
410  * Client or server.
411  */
412 /**@{*/
413 
414 /*************************************************************************************************/
415 /*!
416  * \brief Get the attribute protocol MTU of a connection.
417  *
418  * \param connId DM connection ID.
419  *
420  * \return MTU of the connection.
421  */
422 /*************************************************************************************************/
424 
425 /**@}*/
426 
427 /** \name ATT Message Passing Functions
428  *
429  */
430 /**@{*/
431 
432 /*************************************************************************************************/
433 /*!
434  * \brief Allocate an ATT message buffer to be sent with the ATT attribute protocol
435  * zero-copy APIs.
436  *
437  * \param len Message length in bytes.
438  * \param opcode Opcode for ATT message.
439  *
440  * \return Pointer to message buffer or NULL if allocation failed.
441  */
442 /*************************************************************************************************/
443 void *AttMsgAlloc(uint16_t len, uint8_t opcode);
444 
445 /*************************************************************************************************/
446 /*!
447  * \brief Free an ATT message buffer allocated with AttMsgAlloc().
448  *
449  * \param pMsg Pointer to message buffer.
450  * \param opcode Opcode for ATT message.
451  *
452  * \return None.
453  */
454 /*************************************************************************************************/
455 void AttMsgFree(void *pMsg, uint8_t opcode);
456 
457 /**@}*/
458 /*! \} */ /* STACK_ATT_API */
459 
460 /*! \addtogroup STACK_ATTS_API
461  * \{ */
462 
463 /** \name ATT Server Functions
464  *
465  */
466 /**@{*/
467 
468 /*************************************************************************************************/
469 /*!
470  * \brief Initialize ATT server.
471  *
472  * \return None.
473  */
474 /*************************************************************************************************/
475 void AttsInit(void);
476 
477 /*************************************************************************************************/
478 /*!
479  * \brief Initialize ATT server for indications/notifications.
480  *
481  * \return None.
482  */
483 /*************************************************************************************************/
484 void AttsIndInit(void);
485 
486 /*************************************************************************************************/
487 /*!
488  * \brief Initialize ATT server for data signing.
489  *
490  * \return None.
491  */
492 /*************************************************************************************************/
493 void AttsSignInit(void);
494 
495 /*************************************************************************************************/
496 /*!
497  * \brief Register an authorization callback with the attribute server.
498  *
499  * \param cback Client callback function.
500  *
501  * \return None.
502  */
503 /*************************************************************************************************/
505 
506 /*************************************************************************************************/
507 /*!
508  * \brief Add an attribute group to the attribute server.
509  *
510  * \param pGroup Pointer to an attribute group structure.
511  *
512  * \return None.
513  */
514 /*************************************************************************************************/
515 void AttsAddGroup(attsGroup_t *pGroup);
516 
517 /*************************************************************************************************/
518 /*!
519  * \brief Remove an attribute group from the attribute server.
520  *
521  * \param startHandle Start handle of attribute group to be removed.
522  *
523  * \return None.
524  */
525 /*************************************************************************************************/
526 void AttsRemoveGroup(uint16_t startHandle);
527 
528 /*************************************************************************************************/
529 /*!
530  * \brief Set an attribute value in the attribute server.
531  *
532  * \param handle Attribute handle.
533  * \param valueLen Attribute length.
534  * \param pValue Attribute value.
535  *
536  * \return ATT_SUCCESS if successful otherwise error.
537  */
538 /*************************************************************************************************/
539 uint8_t AttsSetAttr(uint16_t handle, uint16_t valueLen, uint8_t *pValue);
540 
541 /*************************************************************************************************/
542 /*!
543  * \brief Get an attribute value in the attribute server.
544  *
545  * \param handle Attribute handle.
546  * \param pLen Returned attribute length pointer.
547  * \param pValue Returned attribute value pointer.
548  *
549  * \return ATT_SUCCESS if successful otherwise error.
550  * \return This function returns the attribute length in pLen and a pointer to the attribute
551  * value in pValue.
552  */
553 /*************************************************************************************************/
554 uint8_t AttsGetAttr(uint16_t handle, uint16_t *pLen, uint8_t **pValue);
555 
556 /*************************************************************************************************/
557 /*!
558  * \brief Send an attribute protocol Handle Value Indication.
559  *
560  * \param connId DM connection ID.
561  * \param handle Attribute handle.
562  * \param valueLen Length of value data.
563  * \param pValue Pointer to value data.
564  *
565  * \return None.
566  */
567 /*************************************************************************************************/
568 void AttsHandleValueInd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
569 
570 /*************************************************************************************************/
571 /*!
572  * \brief Send an attribute protocol Handle Value Notification.
573  *
574  * \param connId DM connection ID.
575  * \param handle Attribute handle.
576  * \param valueLen Length of value data.
577  * \param pValue Pointer to value data.
578  *
579  * \return None.
580  */
581 /*************************************************************************************************/
582 void AttsHandleValueNtf(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
583 
584 /*************************************************************************************************/
585 /*!
586  * \brief Send an attribute protocol Handle Value Indication without copying the attribute
587  * value data.
588  *
589  * Note: attribute value buffer 'pValue' must be allocated with AttMsgAlloc().
590  *
591  * \param connId DM connection ID.
592  * \param handle Attribute handle.
593  * \param valueLen Length of value data.
594  * \param pValue Pointer to value data.
595  *
596  * \return None.
597  */
598 /*************************************************************************************************/
599 void AttsHandleValueIndZeroCpy(dmConnId_t connId, uint16_t handle, uint16_t valueLen,
600  uint8_t *pValue);
601 
602 /*************************************************************************************************/
603 /*!
604  * \brief Send an attribute protocol Handle Value Notification without copying the attribute
605  * value data.
606  *
607  * Note: attribute value buffer 'pValue' must be allocated with AttMsgAlloc().
608  *
609  * \param connId DM connection ID.
610  * \param handle Attribute handle.
611  * \param valueLen Length of value data.
612  * \param pValue Pointer to value data.
613  *
614  * \return None.
615  */
616 /*************************************************************************************************/
617 void AttsHandleValueNtfZeroCpy(dmConnId_t connId, uint16_t handle, uint16_t valueLen,
618  uint8_t *pValue);
619 
620 /*************************************************************************************************/
621 /*!
622  * \brief Register the utility service for managing client characteristic
623  * configuration descriptors. This function is typically called once on
624  * system initialization.
625  *
626  * \param setLen Length of settings array.
627  * \param pSet Array of CCC descriptor settings.
628  * \param cback Client callback function.
629  *
630  * \return None.
631  */
632 /*************************************************************************************************/
633 void AttsCccRegister(uint8_t setLen, attsCccSet_t *pSet, attsCccCback_t cback);
634 
635 /*************************************************************************************************/
636 /*!
637  * \brief Initialize the client characteristic configuration descriptor value table for a
638  * connection. The table is initialized with the values from pCccTbl. If pCccTbl
639  * is NULL the table will be initialized to zero.
640  *
641  * This function must be called when a connection is established or when a
642  * device is bonded.
643  *
644  * \param connId DM connection ID.
645  * \param pCccTbl Pointer to the descriptor value array. The length of the array
646  * must equal the value of setLen passed to AttsCccRegister().
647  *
648  * \return None.
649  */
650 /*************************************************************************************************/
651 void AttsCccInitTable(dmConnId_t connId, uint16_t *pCccTbl);
652 
653 /*************************************************************************************************/
654 /*!
655  * \brief Clear and deallocate the client characteristic configuration descriptor value
656  * table for a connection. This function must be called when a connection is closed.
657  *
658  * \param connId DM connection ID.
659  *
660  * \return None.
661  */
662 /*************************************************************************************************/
663 void AttsCccClearTable(dmConnId_t connId);
664 
665 /*************************************************************************************************/
666 /*!
667  * \brief Get the value of a client characteristic configuration descriptor by its index.
668  * If not found, return zero.
669  *
670  * \param connId DM connection ID.
671  * \param idx Index of descriptor in CCC descriptor handle table.
672  *
673  * \return Value of the descriptor.
674  */
675 /*************************************************************************************************/
677 
678 /*************************************************************************************************/
679 /*!
680  * \brief Set the value of a client characteristic configuration descriptor by its index.
681  *
682  * \param connId DM connection ID.
683  * \param idx Index of descriptor in CCC descriptor handle table.
684  * \param value Value of the descriptor.
685  *
686  * \return None.
687  */
688 /*************************************************************************************************/
689 void AttsCccSet(dmConnId_t connId, uint8_t idx, uint16_t value);
690 
691 /*************************************************************************************************/
692 /*!
693  * \brief Check if a client characteristic configuration descriptor is enabled and if
694  * the characteristic's security level has been met.
695  *
696  * \param connId DM connection ID.
697  * \param idx Index of descriptor in CCC descriptor handle table.
698  *
699  * \return Value of the descriptor if security level is met, otherwise zero.
700  */
701 /*************************************************************************************************/
703 
704 /*************************************************************************************************/
705 /*!
706  * \brief Get number of CCC entries in table.
707  *
708  * \return Number of CCC entries in table.
709  */
710 /*************************************************************************************************/
712 
713 /*************************************************************************************************/
714 /*!
715  * \brief Set the peer's data signing key on this connection. This function
716  * is typically called from the ATT connection callback when the connection is
717  * established. The caller is responsible for maintaining the memory that
718  * contains the key.
719  *
720  * \param connId DM connection ID.
721  * \param pCsrk Pointer to data signing key (CSRK).
722  *
723  * \return None.
724  */
725 /*************************************************************************************************/
726 void AttsSetCsrk(dmConnId_t connId, uint8_t *pCsrk);
727 
728 /*************************************************************************************************/
729 /*!
730  * \brief Set the peer's sign counter on this connection. This function
731  * is typically called from the ATT connection callback when the connection is
732  * established. ATT maintains the value of the sign counter internally and
733  * sets the value when a signed packet is successfully received.
734  *
735  * \param connId DM connection ID.
736  * \param signCounter Sign counter.
737  *
738  * \return None.
739  */
740 /*************************************************************************************************/
741 void AttsSetSignCounter(dmConnId_t connId, uint32_t signCounter);
742 
743 /*************************************************************************************************/
744 /*!
745  * \brief Get the current value peer's sign counter on this connection. This function
746  * is typically called from the ATT connection callback when the connection is
747  * closed so the application can store the sign counter for use on future
748  * connections.
749  *
750  * \param connId DM connection ID.
751  *
752  * \return Sign counter.
753  */
754 /*************************************************************************************************/
756 
757 /**@}*/
758 
759 
760 /** \name ATT Server Dynamic Service Subsystem Functions
761  *
762  */
763 /**@{*/
764 
765 /*************************************************************************************************/
766 /*!
767  * \brief Initialize the Dynamic ATT Service subsystem.
768  *
769  * \return None.
770  */
771 /*************************************************************************************************/
772 void AttsDynInit(void);
773 
774 /*************************************************************************************************/
775 /*!
776  * \brief Dynamically create an ATT Service at runtime.
777  *
778  * \param startHandle Starting attribute handle in the service
779  * \param endHandle Last attribute handle in the service
780  *
781  * \return Service Handle.
782  */
783 /*************************************************************************************************/
784 void *AttsDynCreateGroup(uint16_t startHandle, uint16_t endHandle);
785 
786 /*************************************************************************************************/
787 /*!
788  * \brief Dynamically delete an ATT Service at runtime.
789  *
790  * \param pSvcHandle Service handle returned by \ref AttsDynCreateGroup
791  *
792  * \return None.
793  */
794 /*************************************************************************************************/
795 void AttsDynDeleteGroup(void *pSvcHandle);
796 
797 /*************************************************************************************************/
798 /*!
799  * \brief Register callback functions for a dynamic ATT Service at runtime.
800  *
801  * \param pSvcHandle Service handle returned by \ref AttsDynCreateGroup
802  * \param readCback Read callback function
803  * \param writeCback Write callback function
804  *
805  * \return None.
806  */
807 /*************************************************************************************************/
808 void AttsDynRegister(void *pSvcHandle, attsReadCback_t readCback, attsWriteCback_t writeCback);
809 
810 /*************************************************************************************************/
811 /*!
812  * \brief Dynamically add an attribute to a dynamic ATT Services at runtime.
813  *
814  * \param pSvcHandle Service handle returned by \ref AttsDynCreateGroup
815  * \param pUuid Constant UUID
816  * \param pValue Initial value of attribute (copied into attribute memory)
817  * \param len Length of pValue in bytes
818  * \param maxLen Maximum length of the attribute in bytes
819  * \param settings Attribute settings
820  * \param permissions Attribute permissions
821  *
822  * \return None.
823  */
824 /*************************************************************************************************/
825 void AttsDynAddAttr(void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue, uint16_t len,
826  const uint16_t maxLen, uint8_t settings, uint8_t permissions);
827 
828 /*************************************************************************************************/
829 /*!
830  * \brief Dynamically add an attribute with a constant value to a dynamic ATT Services at runtime.
831  *
832  * \param pSvcHandle Service handle returned by \ref AttsDynCreateGroup
833  * \param pUuid Constant UUID
834  * \param pValue Pointer to constant attribute memory
835  * \param len Length of pValue in bytes
836  * \param settings Attribute settings
837  * \param permissions Attribute permissions
838  *
839  * \return None.
840  */
841 /*************************************************************************************************/
842 void AttsDynAddAttrConst(void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue,
843  const uint16_t len, uint8_t settings, uint8_t permissions);
844 
845 /**@}*/
846 
847 /** \name ATT Server Testing
848  *
849  */
850 /**@{*/
851 
852 /*************************************************************************************************/
853 /*!
854  * \brief For testing purposes only.
855  *
856  * \param status ATT status
857  *
858  * \return None.
859  */
860 /*************************************************************************************************/
861 void AttsErrorTest(uint8_t status);
862 
863 /**@}*/
864 
865 /*! \} */ /* STACK_ATTS_API */
866 
867 /*! \addtogroup STACK_ATTC_API
868  * \{ */
869 
870 /** \name ATT Client Functions
871  *
872  */
873 /**@{*/
874 
875 /*************************************************************************************************/
876 /*!
877  * \brief Initialize ATT client.
878  *
879  * \return None.
880  */
881 /*************************************************************************************************/
882 void AttcInit(void);
883 
884 /*************************************************************************************************/
885 /*!
886  * \brief Initialize ATT client for data signing.
887  *
888  * \return None.
889  */
890 /*************************************************************************************************/
891 void AttcSignInit(void);
892 
893 /*************************************************************************************************/
894 /*!
895  * \brief Initiate an attribute protocol Find Information Request.
896  *
897  * \param connId DM connection ID.
898  * \param startHandle Attribute start handle.
899  * \param endHandle Attribute end handle.
900  * \param continuing TRUE if ATTC continues sending requests until complete.
901  *
902  * \return None.
903  */
904 /*************************************************************************************************/
905 void AttcFindInfoReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, bool_t continuing);
906 
907 /*************************************************************************************************/
908 /*!
909  * \brief Initiate an attribute protocol Find By Type Value Request.
910  *
911  * \param connId DM connection ID.
912  * \param startHandle Attribute start handle.
913  * \param endHandle Attribute end handle.
914  * \param uuid16 16-bit UUID to find.
915  * \param valueLen Length of value data.
916  * \param pValue Pointer to value data.
917  * \param continuing TRUE if ATTC continues sending requests until complete.
918  *
919  * \return None.
920  */
921 /*************************************************************************************************/
922 void AttcFindByTypeValueReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
923  uint16_t uuid16, uint16_t valueLen, uint8_t *pValue, bool_t continuing);
924 
925 /*************************************************************************************************/
926 /*!
927  * \brief Initiate an attribute protocol Read By Type Request.
928  *
929  * \param connId DM connection ID.
930  * \param startHandle Attribute start handle.
931  * \param endHandle Attribute end handle.
932  * \param uuidLen Length of UUID (2 or 16).
933  * \param pUuid Pointer to UUID data.
934  * \param continuing TRUE if ATTC continues sending requests until complete.
935  *
936  * \return None.
937  */
938 /*************************************************************************************************/
939 void AttcReadByTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
940  uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
941 
942 /*************************************************************************************************/
943 /*!
944  * \brief Initiate an attribute protocol Read Request.
945  *
946  * \param connId DM connection ID.
947  * \param handle Attribute handle.
948  *
949  * \return None.
950  */
951 /*************************************************************************************************/
952 void AttcReadReq(dmConnId_t connId, uint16_t handle);
953 
954 /*************************************************************************************************/
955 /*!
956  * \brief Initiate an attribute protocol Read Long Request.
957  *
958  * \param connId DM connection ID.
959  * \param handle Attribute handle.
960  * \param offset Read attribute data starting at this offset.
961  * \param continuing TRUE if ATTC continues sending requests until complete.
962  *
963  * \return None.
964  */
965 /*************************************************************************************************/
966 void AttcReadLongReq(dmConnId_t connId, uint16_t handle, uint16_t offset, bool_t continuing);
967 
968 /*************************************************************************************************/
969 /*!
970  * \brief Initiate an attribute protocol Read Multiple Request.
971  *
972  * \param connId DM connection ID.
973  * \param numHandles Number of handles in attribute handle list.
974  * \param pHandles List of attribute handles.
975  *
976  * \return None.
977  */
978 /*************************************************************************************************/
979 void AttcReadMultipleReq(dmConnId_t connId, uint8_t numHandles, uint16_t *pHandles);
980 
981 /*************************************************************************************************/
982 /*!
983  * \brief Initiate an attribute protocol Read By Group Type Request.
984  *
985  * \param connId DM connection ID.
986  * \param startHandle Attribute start handle.
987  * \param endHandle Attribute end handle.
988  * \param uuidLen Length of UUID (2 or 16).
989  * \param pUuid Pointer to UUID data.
990  * \param continuing TRUE if ATTC continues sending requests until complete.
991  *
992  * \return None.
993  */
994 /*************************************************************************************************/
995 void AttcReadByGroupTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
996  uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
997 
998 /*************************************************************************************************/
999 /*!
1000  * \brief Initiate an attribute protocol Write Request.
1001  *
1002  * \param connId DM connection ID.
1003  * \param handle Attribute handle.
1004  * \param valueLen Length of value data.
1005  * \param pValue Pointer to value data.
1006  *
1007  * \return None.
1008  */
1009 /*************************************************************************************************/
1010 void AttcWriteReq(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
1011 
1012 /*************************************************************************************************/
1013 /*!
1014  * \brief Initiate an attribute protocol Write Command.
1015  *
1016  * \param connId DM connection ID.
1017  * \param handle Attribute handle.
1018  * \param valueLen Length of value data.
1019  * \param pValue Pointer to value data.
1020  *
1021  * \return None.
1022  */
1023 /*************************************************************************************************/
1024 void AttcWriteCmd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
1025 
1026 /*************************************************************************************************/
1027 /*!
1028  * \brief Initiate an attribute protocol signed Write Command.
1029  *
1030  * \param connId DM connection ID.
1031  * \param handle Attribute handle.
1032  * \param signCounter Value of the sign counter.
1033  * \param valueLen Length of value data.
1034  * \param pValue Pointer to value data.
1035  *
1036  * \return None.
1037  */
1038 /*************************************************************************************************/
1039 void AttcSignedWriteCmd(dmConnId_t connId, uint16_t handle, uint32_t signCounter,
1040  uint16_t valueLen, uint8_t *pValue);
1041 
1042 /*************************************************************************************************/
1043 /*!
1044  * \brief Initiate an attribute protocol Prepare Write Request.
1045  *
1046  * \param connId DM connection ID.
1047  * \param handle Attribute handle.
1048  * \param offset Write attribute data starting at this offset.
1049  * \param valueLen Length of value data.
1050  * \param pValue Pointer to value data.
1051  * \param valueByRef TRUE if pValue data is accessed by reference rather than copied.
1052  * \param continuing TRUE if ATTC continues sending requests until complete.
1053  *
1054  * \return None.
1055  */
1056 /*************************************************************************************************/
1057 void AttcPrepareWriteReq(dmConnId_t connId, uint16_t handle, uint16_t offset, uint16_t valueLen,
1058  uint8_t *pValue, bool_t valueByRef, bool_t continuing);
1059 
1060 /*************************************************************************************************/
1061 /*!
1062  * \brief Initiate an attribute protocol Execute Write Request.
1063  *
1064  * \param connId DM connection ID.
1065  * \param writeAll TRUE to write all queued writes, FALSE to cancel all queued writes.
1066  *
1067  * \return None.
1068  */
1069 /*************************************************************************************************/
1070 void AttcExecuteWriteReq(dmConnId_t connId, bool_t writeAll);
1071 
1072 /*************************************************************************************************/
1073 /*!
1074  * \brief Cancel an attribute protocol request in progress.
1075  *
1076  * \param connId DM connection ID.
1077  *
1078  * \return None.
1079  */
1080 /*************************************************************************************************/
1081 void AttcCancelReq(dmConnId_t connId);
1082 
1083 /*************************************************************************************************/
1084 /*!
1085  * \brief This utility function discovers the given service on a peer device. Function
1086  * AttcFindByTypeValueReq() is called to initiate the discovery procedure.
1087  *
1088  * \param connId DM connection ID.
1089  * \param pCb Pointer to discovery control block.
1090  * \param uuidLen Length of service UUID (2 or 16).
1091  * \param pUuid Pointer to service UUID.
1092  *
1093  * \return None.
1094  */
1095 /*************************************************************************************************/
1096 void AttcDiscService(dmConnId_t connId, attcDiscCb_t *pCb, uint8_t uuidLen, uint8_t *pUuid);
1097 
1098 /*************************************************************************************************/
1099 /*!
1100  * \brief This utility function processes a service discovery result. It should be called
1101  * when an \ref ATTC_FIND_BY_TYPE_VALUE_RSP callback event is received after service
1102  * discovery is initiated by calling AttcDiscService().
1103  *
1104  * \param pCb Pointer to discovery control block.
1105  * \param pMsg ATT callback event message.
1106  *
1107  * \return ATT_SUCCESS if successful otherwise error.
1108  */
1109 /*************************************************************************************************/
1111 
1112 /*************************************************************************************************/
1113 /*!
1114  * \brief This utility function starts characteristic and characteristic descriptor
1115  * discovery for a service on a peer device. The service must have been previously
1116  * discovered by calling AttcDiscService() and AttcDiscServiceCmpl().
1117  *
1118  * \param connId DM connection ID.
1119  * \param pCb Pointer to discovery control block.
1120  *
1121  * \return None.
1122  */
1123 /*************************************************************************************************/
1124 void AttcDiscCharStart(dmConnId_t connId, attcDiscCb_t *pCb);
1125 
1126 /*************************************************************************************************/
1127 /*!
1128  * \brief This utility function processes a characteristic discovery result. It should be
1129  * called when an \ref ATTC_READ_BY_TYPE_RSP or \ref ATTC_FIND_INFO_RSP callback event is
1130  * received after characteristic discovery is initiated by calling AttcDiscCharStart().
1131  *
1132  * \param pCb Pointer to discovery control block.
1133  * \param pMsg ATT callback event message.
1134  *
1135  * \return ATT_CONTINUING if successful and the discovery procedure is continuing.
1136  * ATT_SUCCESS if the discovery procedure completed successfully.
1137  * Otherwise the discovery procedure failed.
1138  */
1139 /*************************************************************************************************/
1141 
1142 /*************************************************************************************************/
1143 /*!
1144  * \brief This utility function starts characteristic configuration for characteristics on a
1145  * peer device. The characteristics must have been previously discovered by calling
1146  * AttcDiscCharStart() and AttcDiscCharCmpl().
1147  *
1148  * \param connId DM connection ID.
1149  * \param pCb Pointer to discovery control block.
1150  *
1151  * \return ATT_CONTINUING if successful and configuration procedure is continuing.
1152  * ATT_SUCCESS if nothing to configure.
1153  */
1154 /*************************************************************************************************/
1156 
1157 /*************************************************************************************************/
1158 /*!
1159  * \brief This utility function initiates the next characteristic configuration procedure.
1160  * It should be called when an \ref ATTC_READ_RSP or \ref ATTC_WRITE_RSP callback event
1161  * is received after characteristic configuration is initiated by calling
1162  * AttcDiscConfigStart().
1163  *
1164  * \param connId DM connection ID.
1165  * \param pCb Pointer to discovery control block.
1166  *
1167  * \return ATT_CONTINUING if successful and configuration procedure is continuing.
1168  * ATT_SUCCESS if configuration procedure completed successfully.
1169  */
1170 /*************************************************************************************************/
1172 
1173 /*************************************************************************************************/
1174 /*!
1175  * \brief This utility function resumes the characteristic configuration procedure. It can
1176  * be called when an \ref ATTC_READ_RSP or \ref ATTC_WRITE_RSP callback event is received
1177  * with failure status to attempt the read or write procedure again.
1178  *
1179  * \param connId DM connection ID.
1180  * \param pCb Pointer to discovery control block.
1181  *
1182  * \return ATT_CONTINUING if successful and configuration procedure is continuing.
1183  * ATT_SUCCESS if configuration procedure completed successfully.
1184  */
1185 /*************************************************************************************************/
1187 
1188 /*************************************************************************************************/
1189 /*!
1190  * \brief For internal use only.
1191  *
1192  * \param connId DM connection ID.
1193  * \param mtu Attribute protocol MTU.
1194  *
1195  * \return None.
1196  */
1197 /*************************************************************************************************/
1198 void AttcMtuReq(dmConnId_t connId, uint16_t mtu);
1199 
1200 /**@}*/
1201 
1202 /*! \} */ /* STACK_ATTC_API */
1203 
1204 
1205 #ifdef __cplusplus
1206 };
1207 #endif
1208 
1209 #endif /* ATT_API_H */
uint16_t AttsCccGet(dmConnId_t connId, uint8_t idx)
Get the value of a client characteristic configuration descriptor by its index. If not found...
#define ATT_CBACK_START
ATT callback event starting value.
Definition: att_api.h:100
void AttcReadLongReq(dmConnId_t connId, uint16_t handle, uint16_t offset, bool_t continuing)
Initiate an attribute protocol Read Long Request.
void AttcReadMultipleReq(dmConnId_t connId, uint8_t numHandles, uint16_t *pHandles)
Initiate an attribute protocol Read Multiple Request.
uint8_t dmConnId_t
Connection identifier.
Definition: dm_api.h:501
Read group type response.
Definition: att_api.h:111
ATT callback event.
Definition: att_api.h:154
void AttsDynDeleteGroup(void *pSvcHandle)
Dynamically delete an ATT Service at runtime.
void AttcReadByGroupTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
Initiate an attribute protocol Read By Group Type Request.
uint8_t AttcDiscServiceCmpl(attcDiscCb_t *pCb, attEvt_t *pMsg)
This utility function processes a service discovery result. It should be called when an ATTC_FIND_BY_...
void AttcDiscCharStart(dmConnId_t connId, attcDiscCb_t *pCb)
This utility function starts characteristic and characteristic descriptor discovery for a service on ...
void AttsRemoveGroup(uint16_t startHandle)
Remove an attribute group from the attribute server.
uint32_t AttsGetSignCounter(dmConnId_t connId)
Get the current value peer&#39;s sign counter on this connection. This function is typically called from ...
void AttsAuthorRegister(attsAuthorCback_t cback)
Register an authorization callback with the attribute server.
uint8_t bool_t
Boolean data type.
Definition: wsf_types.h:78
void AttRegister(attCback_t cback)
Register a callback with ATT. This callback will be used for messages from both ATTC and ATTS...
void AttsSetSignCounter(dmConnId_t connId, uint32_t signCounter)
Set the peer&#39;s sign counter on this connection. This function is typically called from the ATT connec...
uint8_t(* attsWriteCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, uint16_t len, uint8_t *pValue, attsAttr_t *pAttr)
Attribute group write callback.
Definition: att_api.h:237
void AttsCccRegister(uint8_t setLen, attsCccSet_t *pSet, attsCccCback_t cback)
Register the utility service for managing client characteristic configuration descriptors. This function is typically called once on system initialization.
uint8_t AttcDiscConfigStart(dmConnId_t connId, attcDiscCb_t *pCb)
This utility function starts characteristic configuration for characteristics on a peer device...
void AttsDynAddAttr(void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue, uint16_t len, const uint16_t maxLen, uint8_t settings, uint8_t permissions)
Dynamically add an attribute to a dynamic ATT Services at runtime.
ATT client structure for characteristic and descriptor discovery.
Definition: att_api.h:302
void AttcSignedWriteCmd(dmConnId_t connId, uint16_t handle, uint32_t signCounter, uint16_t valueLen, uint8_t *pValue)
Initiate an attribute protocol signed Write Command.
void AttsCccClearTable(dmConnId_t connId)
Clear and deallocate the client characteristic configuration descriptor value table for a connection...
attCfg_t * pAttCfg
Configuration pointer.
ATT run-time configurable parameters.
Definition: att_api.h:134
void AttsDynInit(void)
Initialize the Dynamic ATT Service subsystem.
void(* attCback_t)(attEvt_t *pEvt)
ATT event callback type.
Definition: att_api.h:173
void AttcFindByTypeValueReq(dmConnId_t connId, 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 AttcExecuteWriteReq(dmConnId_t connId, bool_t writeAll)
Initiate an attribute protocol Execute Write Request.
Handle value notification.
Definition: att_api.h:116
void AttsAddGroup(attsGroup_t *pGroup)
Add an attribute group to the attribute server.
void AttcInit(void)
Initialize ATT client.
void AttcWriteCmd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Initiate an attribute protocol Write Command.
Attribute group.
Definition: att_api.h:264
void(* attsCccCback_t)(attsCccEvt_t *pEvt)
ATTS client characteristic configuration callback.
Definition: att_api.h:351
void AttsSignInit(void)
Initialize ATT server for data signing.
void AttsInit(void)
Initialize ATT server.
void AttsHandleValueNtf(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Notification.
uint8_t AttcDiscCharCmpl(attcDiscCb_t *pCb, attEvt_t *pMsg)
This utility function processes a characteristic discovery result. It should be called when an ATTC_R...
Read response.
Definition: att_api.h:108
uint8_t(* attsAuthorCback_t)(dmConnId_t connId, uint8_t permit, uint16_t handle)
ATTS authorization callback type.
Definition: att_api.h:255
Read long response.
Definition: att_api.h:109
void AttcSignInit(void)
Initialize ATT client for data signing.
Handle value confirmation.
Definition: att_api.h:119
void AttMsgFree(void *pMsg, uint8_t opcode)
Free an ATT message buffer allocated with AttMsgAlloc().
void AttcCancelReq(dmConnId_t connId)
Cancel an attribute protocol request in progress.
unsigned long uint32_t
Unsigned 32-bit value.
Definition: wsf_types.h:71
void AttcFindInfoReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, bool_t continuing)
Initiate an attribute protocol Find Information Request.
uint8_t AttcDiscConfigCmpl(dmConnId_t connId, attcDiscCb_t *pCb)
This utility function initiates the next characteristic configuration procedure. It should be called ...
uint16_t AttsCccEnabled(dmConnId_t connId, uint8_t idx)
Check if a client characteristic configuration descriptor is enabled and if the characteristic&#39;s secu...
uint8_t AttsGetAttr(uint16_t handle, uint16_t *pLen, uint8_t **pValue)
Get an attribute value in the attribute server.
ATTS client characteristic configuration callback structure.
Definition: att_api.h:283
void AttsHandleValueInd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Indication.
void(* dmCback_t)(dmEvt_t *pDmEvt)
Callback type.
Definition: dm_api.h:728
Negotiated MTU value.
Definition: att_api.h:122
Execute write response.
Definition: att_api.h:115
void AttsDynAddAttrConst(void *pSvcHandle, const uint8_t *pUuid, const uint8_t *pValue, const uint16_t len, uint8_t settings, uint8_t permissions)
Dynamically add an attribute with a constant value to a dynamic ATT Services at runtime.
Client characteristc configuration settings.
Definition: att_api.h:275
Find by type value response.
Definition: att_api.h:106
void * AttsDynCreateGroup(uint16_t startHandle, uint16_t endHandle)
Dynamically create an ATT Service at runtime.
Write response.
Definition: att_api.h:112
ATT client discovery control block.
Definition: att_api.h:317
Attribute structure.
Definition: att_api.h:186
void AttcWriteReq(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Initiate an attribute protocol Write Request.
Device Manager subsystem API.
void AttsHandleValueIndZeroCpy(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Indication without copying the attribute value data...
void AttcMtuReq(dmConnId_t connId, uint16_t mtu)
For internal use only.
uint16_t AttGetMtu(dmConnId_t connId)
Get the attribute protocol MTU of a connection.
Handle value indication.
Definition: att_api.h:117
Client chracteristic configuration state change.
Definition: att_api.h:120
unsigned short uint16_t
Unsigned 16-bit value.
Definition: wsf_types.h:67
void AttsIndInit(void)
Initialize ATT server for indications/notifications.
uint8_t(* attsReadCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation, uint16_t offset, attsAttr_t *pAttr)
Attribute group read callback.
Definition: att_api.h:218
Write command response.
Definition: att_api.h:113
void * AttMsgAlloc(uint16_t len, uint8_t opcode)
Allocate an ATT message buffer to be sent with the ATT attribute protocol zero-copy APIs...
Prepare write response.
Definition: att_api.h:114
void AttcReadByTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, uint8_t uuidLen, uint8_t *pUuid, bool_t continuing)
Initiate an attribute protocol Read By Type Request.
uint8_t AttcDiscConfigResume(dmConnId_t connId, attcDiscCb_t *pCb)
This utility function resumes the characteristic configuration procedure. It can be called when an AT...
uint8_t AttsSetAttr(uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Set an attribute value in the attribute server.
void AttcPrepareWriteReq(dmConnId_t connId, 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.
uint8_t AttsGetCccTableLen(void)
Get number of CCC entries in table.
Read multiple response.
Definition: att_api.h:110
Timer service.
void AttsDynRegister(void *pSvcHandle, attsReadCback_t readCback, attsWriteCback_t writeCback)
Register callback functions for a dynamic ATT Service at runtime.
Attribute protocol constants and definitions from the Bluetooth specification.
Attribute protocol UUIDs from the Bluetooth specification.
void AttsSetCsrk(dmConnId_t connId, uint8_t *pCsrk)
Set the peer&#39;s data signing key on this connection. This function is typically called from the ATT co...
uint32_t wsfTimerTicks_t
Timer ticks data type.
Definition: wsf_timer.h:45
Read by type value response.
Definition: att_api.h:107
ATT client structure for characteristic and descriptor configuration.
Definition: att_api.h:309
Common message structure passed to event handler.
Definition: wsf_os.h:97
void AttsCccSet(dmConnId_t connId, uint8_t idx, uint16_t value)
Set the value of a client characteristic configuration descriptor by its index.
void AttcReadReq(dmConnId_t connId, uint16_t handle)
Initiate an attribute protocol Read Request.
unsigned char uint8_t
Unsigned 8-bit value.
Definition: wsf_types.h:63
void AttConnRegister(dmCback_t cback)
Register a connection callback with ATT. The callback is typically used to manage the attribute serve...
void AttsHandleValueNtfZeroCpy(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue)
Send an attribute protocol Handle Value Notification without copying the attribute value data...
Stack configuration.
void AttsErrorTest(uint8_t status)
For testing purposes only.
Find information response.
Definition: att_api.h:105
void AttcDiscService(dmConnId_t connId, attcDiscCb_t *pCb, uint8_t uuidLen, uint8_t *pUuid)
This utility function discovers the given service on a peer device. Function AttcFindByTypeValueReq()...
void AttsCccInitTable(dmConnId_t connId, uint16_t *pCccTbl)
Initialize the client characteristic configuration descriptor value table for a connection. The table is initialized with the values from pCccTbl. If pCccTbl is NULL the table will be initialized to zero.