Maxim Integrated Bluetooth LE Library

Dependents:   BLE_Thermometer MAXWSNENV_demo

Committer:
enginerd
Date:
Thu Mar 03 14:13:21 2016 +0000
Revision:
0:b562096246b3
Initial commit of Maxim Integrated Bluetooth LE Library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
enginerd 0:b562096246b3 1 /*************************************************************************************************/
enginerd 0:b562096246b3 2 /*!
enginerd 0:b562096246b3 3 * \file att_api.h
enginerd 0:b562096246b3 4 *
enginerd 0:b562096246b3 5 * \brief Attribute protocol client and server API.
enginerd 0:b562096246b3 6 *
enginerd 0:b562096246b3 7 * $Date: 2012-05-07 19:54:28 -0700 (Mon, 07 May 2012) $
enginerd 0:b562096246b3 8 * $Revision: 315 $
enginerd 0:b562096246b3 9 *
enginerd 0:b562096246b3 10 * Copyright (c) 2009-2016 ARM Limited. All rights reserved.
enginerd 0:b562096246b3 11 *
enginerd 0:b562096246b3 12 * SPDX-License-Identifier: LicenseRef-PBL
enginerd 0:b562096246b3 13 *
enginerd 0:b562096246b3 14 * Licensed under the Permissive Binary License, Version 1.0 (the "License"); you may not use
enginerd 0:b562096246b3 15 * this file except in compliance with the License. You may obtain a copy of the License at
enginerd 0:b562096246b3 16 *
enginerd 0:b562096246b3 17 * https://www.mbed.com/licenses/PBL-1.0
enginerd 0:b562096246b3 18 *
enginerd 0:b562096246b3 19 * See the License for the specific language governing permissions and limitations under the License.
enginerd 0:b562096246b3 20 */
enginerd 0:b562096246b3 21 /*************************************************************************************************/
enginerd 0:b562096246b3 22 #ifndef ATT_API_H
enginerd 0:b562096246b3 23 #define ATT_API_H
enginerd 0:b562096246b3 24
enginerd 0:b562096246b3 25 #include "wsf_timer.h"
enginerd 0:b562096246b3 26 #include "att_defs.h"
enginerd 0:b562096246b3 27 #include "att_uuid.h"
enginerd 0:b562096246b3 28 #include "dm_api.h"
enginerd 0:b562096246b3 29 #include "cfg_stack.h"
enginerd 0:b562096246b3 30
enginerd 0:b562096246b3 31 #ifdef __cplusplus
enginerd 0:b562096246b3 32 extern "C" {
enginerd 0:b562096246b3 33 #endif
enginerd 0:b562096246b3 34
enginerd 0:b562096246b3 35 /**************************************************************************************************
enginerd 0:b562096246b3 36 Macros
enginerd 0:b562096246b3 37 **************************************************************************************************/
enginerd 0:b562096246b3 38
enginerd 0:b562096246b3 39 /*! ATT server attribute settings */
enginerd 0:b562096246b3 40 #define ATTS_SET_UUID_128 0x01 /*! Set if the UUID is 128 bits in length */
enginerd 0:b562096246b3 41 #define ATTS_SET_WRITE_CBACK 0x02 /*! Set if the group callback is executed when
enginerd 0:b562096246b3 42 this attribute is written by a client device */
enginerd 0:b562096246b3 43 #define ATTS_SET_READ_CBACK 0x04 /*! Set if the group callback is executed when
enginerd 0:b562096246b3 44 this attribute is read by a client device */
enginerd 0:b562096246b3 45 #define ATTS_SET_VARIABLE_LEN 0x08 /*! Set if the attribute has a variable length */
enginerd 0:b562096246b3 46 #define ATTS_SET_ALLOW_OFFSET 0x10 /*! Set if writes are allowed with an offset */
enginerd 0:b562096246b3 47 #define ATTS_SET_CCC 0x20 /*! Set if the attribute is a client characteristic
enginerd 0:b562096246b3 48 configuration descriptor */
enginerd 0:b562096246b3 49 #define ATTS_SET_ALLOW_SIGNED 0x40 /*! Set if signed writes are allowed */
enginerd 0:b562096246b3 50 #define ATTS_SET_REQ_SIGNED 0x80 /*! Set if signed writes are required if link
enginerd 0:b562096246b3 51 is not encrypted */
enginerd 0:b562096246b3 52
enginerd 0:b562096246b3 53 /*! ATT server attribute permissions */
enginerd 0:b562096246b3 54 #define ATTS_PERMIT_READ 0x01 /*! Set if attribute can be read */
enginerd 0:b562096246b3 55 #define ATTS_PERMIT_READ_AUTH 0x02 /*! Set if attribute read requires authentication */
enginerd 0:b562096246b3 56 #define ATTS_PERMIT_READ_AUTHORIZ 0x04 /*! Set if attribute read requires authorization */
enginerd 0:b562096246b3 57 #define ATTS_PERMIT_READ_ENC 0x08 /*! Set if attribute read requires encryption */
enginerd 0:b562096246b3 58 #define ATTS_PERMIT_WRITE 0x10 /*! Set if attribute can be written */
enginerd 0:b562096246b3 59 #define ATTS_PERMIT_WRITE_AUTH 0x20 /*! Set if attribute write requires authentication */
enginerd 0:b562096246b3 60 #define ATTS_PERMIT_WRITE_AUTHORIZ 0x40 /*! Set if attribute write requires authorization */
enginerd 0:b562096246b3 61 #define ATTS_PERMIT_WRITE_ENC 0x80 /*! Set if attribute write requires encryption */
enginerd 0:b562096246b3 62
enginerd 0:b562096246b3 63 /*! ATT client characteristic discovery and configuration settings */
enginerd 0:b562096246b3 64 #define ATTC_SET_UUID_128 0x01 /*! Set if the UUID is 128 bits in length */
enginerd 0:b562096246b3 65 #define ATTC_SET_REQUIRED 0x02 /*! Set if characteristic must be discovered */
enginerd 0:b562096246b3 66 #define ATTC_SET_DESCRIPTOR 0x04 /*! Set if this is a characteristic descriptor */
enginerd 0:b562096246b3 67
enginerd 0:b562096246b3 68 /*! ATT callback events */
enginerd 0:b562096246b3 69 #define ATT_CBACK_START 0x02 /*! ATT callback event starting value */
enginerd 0:b562096246b3 70 enum /*! Internal note: event values match method values */
enginerd 0:b562096246b3 71 {
enginerd 0:b562096246b3 72 /*! ATT client callback events */
enginerd 0:b562096246b3 73 ATTC_FIND_INFO_RSP = ATT_CBACK_START, /*! Find information response */
enginerd 0:b562096246b3 74 ATTC_FIND_BY_TYPE_VALUE_RSP, /*! Find by type value response */
enginerd 0:b562096246b3 75 ATTC_READ_BY_TYPE_RSP, /*! Read by type value response */
enginerd 0:b562096246b3 76 ATTC_READ_RSP, /*! Read response */
enginerd 0:b562096246b3 77 ATTC_READ_LONG_RSP, /*! Read long response */
enginerd 0:b562096246b3 78 ATTC_READ_MULTIPLE_RSP, /*! Read multiple response */
enginerd 0:b562096246b3 79 ATTC_READ_BY_GROUP_TYPE_RSP, /*! Read group type response */
enginerd 0:b562096246b3 80 ATTC_WRITE_RSP, /*! Write response */
enginerd 0:b562096246b3 81 ATTC_WRITE_CMD_RSP, /*! Write command response */
enginerd 0:b562096246b3 82 ATTC_PREPARE_WRITE_RSP, /*! Prepare write response */
enginerd 0:b562096246b3 83 ATTC_EXECUTE_WRITE_RSP, /*! Execute write response */
enginerd 0:b562096246b3 84 ATTC_HANDLE_VALUE_NTF, /*! Handle value notification */
enginerd 0:b562096246b3 85 ATTC_HANDLE_VALUE_IND, /*! Handle value indication */
enginerd 0:b562096246b3 86 /*! ATT server callback events */
enginerd 0:b562096246b3 87 ATTS_HANDLE_VALUE_CNF, /*! Handle value confirmation */
enginerd 0:b562096246b3 88 ATTS_CCC_STATE_IND /*! Client chracteristic configuration state change */
enginerd 0:b562096246b3 89 };
enginerd 0:b562096246b3 90
enginerd 0:b562096246b3 91 /*! ATT callback events */
enginerd 0:b562096246b3 92 #define ATT_CBACK_END ATTS_CCC_STATE_IND /*! ATT callback event ending value */
enginerd 0:b562096246b3 93
enginerd 0:b562096246b3 94 /*! Base value for HCI error status values passed through ATT */
enginerd 0:b562096246b3 95 #define ATT_HCI_ERR_BASE 0x20
enginerd 0:b562096246b3 96
enginerd 0:b562096246b3 97 /**************************************************************************************************
enginerd 0:b562096246b3 98 Data Types
enginerd 0:b562096246b3 99 **************************************************************************************************/
enginerd 0:b562096246b3 100
enginerd 0:b562096246b3 101 /*! Configurable parameters */
enginerd 0:b562096246b3 102 typedef struct
enginerd 0:b562096246b3 103 {
enginerd 0:b562096246b3 104 wsfTimerTicks_t discIdleTimeout; /*! ATT server service discovery connection idle timeout in seconds */
enginerd 0:b562096246b3 105 uint16_t mtu; /*! desired ATT MTU */
enginerd 0:b562096246b3 106 uint8_t transTimeout; /*! transcation timeout in seconds */
enginerd 0:b562096246b3 107 uint8_t numPrepWrites; /*! number of queued prepare writes supported by server */
enginerd 0:b562096246b3 108 } attCfg_t;
enginerd 0:b562096246b3 109
enginerd 0:b562096246b3 110 /*!
enginerd 0:b562096246b3 111 * Attribute server data types
enginerd 0:b562096246b3 112 */
enginerd 0:b562096246b3 113
enginerd 0:b562096246b3 114 /*! Attribute structure */
enginerd 0:b562096246b3 115 typedef struct
enginerd 0:b562096246b3 116 {
enginerd 0:b562096246b3 117 uint8_t const *pUuid; /*! Pointer to the attribute’s UUID */
enginerd 0:b562096246b3 118 uint8_t *pValue; /*! Pointer to the attribute’s value */
enginerd 0:b562096246b3 119 uint16_t *pLen; /*! Pointer to the length of the attribute’s value */
enginerd 0:b562096246b3 120 uint16_t maxLen; /*! Maximum length of attribute’s value */
enginerd 0:b562096246b3 121 uint8_t settings; /*! Attribute settings */
enginerd 0:b562096246b3 122 uint8_t permissions; /*! Attribute permissions */
enginerd 0:b562096246b3 123 } attsAttr_t;
enginerd 0:b562096246b3 124
enginerd 0:b562096246b3 125 /*! Attribute group read callback */
enginerd 0:b562096246b3 126 typedef uint8_t (*attsReadCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation,
enginerd 0:b562096246b3 127 uint16_t offset, attsAttr_t *pAttr);
enginerd 0:b562096246b3 128
enginerd 0:b562096246b3 129 /*! Attribute group write callback */
enginerd 0:b562096246b3 130 typedef uint8_t (*attsWriteCback_t)(dmConnId_t connId, uint16_t handle, uint8_t operation,
enginerd 0:b562096246b3 131 uint16_t offset, uint16_t len, uint8_t *pValue,
enginerd 0:b562096246b3 132 attsAttr_t *pAttr);
enginerd 0:b562096246b3 133
enginerd 0:b562096246b3 134 /*! Attribute group */
enginerd 0:b562096246b3 135 typedef struct attsGroup_tag
enginerd 0:b562096246b3 136 {
enginerd 0:b562096246b3 137 struct attsGroup_tag *pNext; /*! For internal use only */
enginerd 0:b562096246b3 138 attsAttr_t *pAttr; /*! Pointer to attribute list for this group */
enginerd 0:b562096246b3 139 attsReadCback_t readCback; /*! Read callback function */
enginerd 0:b562096246b3 140 attsWriteCback_t writeCback; /*! Write callback function */
enginerd 0:b562096246b3 141 uint16_t startHandle; /*! The handle of the first attribute in this group */
enginerd 0:b562096246b3 142 uint16_t endHandle; /*! The handle of the last attribute in this group */
enginerd 0:b562096246b3 143 } attsGroup_t;
enginerd 0:b562096246b3 144
enginerd 0:b562096246b3 145 /*! Client characteristc configuration settings */
enginerd 0:b562096246b3 146 typedef struct
enginerd 0:b562096246b3 147 {
enginerd 0:b562096246b3 148 uint16_t handle; /*! Client characteristc configuration descriptor handle */
enginerd 0:b562096246b3 149 uint16_t valueRange; /*! Acceptable value range of the descriptor value */
enginerd 0:b562096246b3 150 uint8_t secLevel; /*! Security level of characteristic value */
enginerd 0:b562096246b3 151 } attsCccSet_t;
enginerd 0:b562096246b3 152
enginerd 0:b562096246b3 153 /*! ATT client structure for characteristic and descriptor discovery */
enginerd 0:b562096246b3 154 typedef struct attcDiscChar_tag
enginerd 0:b562096246b3 155 {
enginerd 0:b562096246b3 156 uint8_t const *pUuid; /*! Pointer to UUID */
enginerd 0:b562096246b3 157 uint8_t settings; /*! Characteristic discovery settings */
enginerd 0:b562096246b3 158 } attcDiscChar_t;
enginerd 0:b562096246b3 159
enginerd 0:b562096246b3 160 /*! ATT client structure for characteristic and descriptor configuration */
enginerd 0:b562096246b3 161 typedef struct
enginerd 0:b562096246b3 162 {
enginerd 0:b562096246b3 163 uint8_t const *pValue; /*! Pointer to default value or NULL */
enginerd 0:b562096246b3 164 uint8_t valueLen; /*! Default value length */
enginerd 0:b562096246b3 165 uint8_t hdlIdx; /*! Index of its handle in handle list */
enginerd 0:b562096246b3 166 } attcDiscCfg_t;
enginerd 0:b562096246b3 167
enginerd 0:b562096246b3 168 /*! ATT client discovery control block */
enginerd 0:b562096246b3 169 typedef struct
enginerd 0:b562096246b3 170 {
enginerd 0:b562096246b3 171 attcDiscChar_t **pCharList; /*! Characterisic list for discovery */
enginerd 0:b562096246b3 172 uint16_t *pHdlList; /*! Characteristic handle list */
enginerd 0:b562096246b3 173 attcDiscCfg_t *pCfgList; /*! Characterisic list for configuration */
enginerd 0:b562096246b3 174 uint8_t charListLen; /*! Characteristic and handle list length */
enginerd 0:b562096246b3 175 uint8_t cfgListLen; /*! Configuration list length */
enginerd 0:b562096246b3 176
enginerd 0:b562096246b3 177 /* the following are for internal use only */
enginerd 0:b562096246b3 178 uint16_t svcStartHdl;
enginerd 0:b562096246b3 179 uint16_t svcEndHdl;
enginerd 0:b562096246b3 180 uint8_t charListIdx;
enginerd 0:b562096246b3 181 uint8_t endHdlIdx;
enginerd 0:b562096246b3 182 } attcDiscCb_t;
enginerd 0:b562096246b3 183
enginerd 0:b562096246b3 184 /*!
enginerd 0:b562096246b3 185 * ATT callback parameters:
enginerd 0:b562096246b3 186 *
enginerd 0:b562096246b3 187 * \param hdr.event Callback event
enginerd 0:b562096246b3 188 * \param hdr.param DM connection ID
enginerd 0:b562096246b3 189 * \param hdr.status Event status: ATT_SUCCESS or error status
enginerd 0:b562096246b3 190 * \param pValue Pointer to value data, valid if valueLen > 0
enginerd 0:b562096246b3 191 * \param valueLen Length of value data
enginerd 0:b562096246b3 192 * \param handle Attribute handle
enginerd 0:b562096246b3 193 */
enginerd 0:b562096246b3 194 typedef struct
enginerd 0:b562096246b3 195 {
enginerd 0:b562096246b3 196 wsfMsgHdr_t hdr; /*! Header structure */
enginerd 0:b562096246b3 197 uint8_t *pValue; /*! Value */
enginerd 0:b562096246b3 198 uint16_t valueLen; /*! Value length */
enginerd 0:b562096246b3 199 uint16_t handle; /*! Attribute handle */
enginerd 0:b562096246b3 200 bool_t continuing; /*! TRUE if more response packets expected */
enginerd 0:b562096246b3 201 } attEvt_t;
enginerd 0:b562096246b3 202
enginerd 0:b562096246b3 203 /*! ATTS client characteristic configuration callback structure */
enginerd 0:b562096246b3 204 typedef struct
enginerd 0:b562096246b3 205 {
enginerd 0:b562096246b3 206 wsfMsgHdr_t hdr; /*! Header structure */
enginerd 0:b562096246b3 207 uint16_t handle; /*! CCCD handle */
enginerd 0:b562096246b3 208 uint16_t value; /*! CCCD value */
enginerd 0:b562096246b3 209 uint8_t idx; /*! CCCD settings index */
enginerd 0:b562096246b3 210 } attsCccEvt_t;
enginerd 0:b562096246b3 211
enginerd 0:b562096246b3 212 /*! ATT callback type */
enginerd 0:b562096246b3 213 typedef void (*attCback_t)(attEvt_t *pEvt);
enginerd 0:b562096246b3 214
enginerd 0:b562096246b3 215 /*! ATTS authorization callback type */
enginerd 0:b562096246b3 216 typedef uint8_t (*attsAuthorCback_t)(dmConnId_t connId, uint8_t permit, uint16_t handle);
enginerd 0:b562096246b3 217
enginerd 0:b562096246b3 218 /*! ATTS client characteristic configuration callback */
enginerd 0:b562096246b3 219 typedef void (*attsCccCback_t)(attsCccEvt_t *pEvt);
enginerd 0:b562096246b3 220
enginerd 0:b562096246b3 221 /**************************************************************************************************
enginerd 0:b562096246b3 222 Global Variables
enginerd 0:b562096246b3 223 **************************************************************************************************/
enginerd 0:b562096246b3 224
enginerd 0:b562096246b3 225 /*! Configuration pointer */
enginerd 0:b562096246b3 226 extern attCfg_t *pAttCfg;
enginerd 0:b562096246b3 227
enginerd 0:b562096246b3 228 /**************************************************************************************************
enginerd 0:b562096246b3 229 Function Declarations
enginerd 0:b562096246b3 230 **************************************************************************************************/
enginerd 0:b562096246b3 231
enginerd 0:b562096246b3 232 /*************************************************************************************************/
enginerd 0:b562096246b3 233 /*!
enginerd 0:b562096246b3 234 * \fn AttRegister
enginerd 0:b562096246b3 235 *
enginerd 0:b562096246b3 236 * \brief Register a callback with ATT.
enginerd 0:b562096246b3 237 *
enginerd 0:b562096246b3 238 * \param cback Client callback function.
enginerd 0:b562096246b3 239 *
enginerd 0:b562096246b3 240 * \return None.
enginerd 0:b562096246b3 241 */
enginerd 0:b562096246b3 242 /*************************************************************************************************/
enginerd 0:b562096246b3 243 void AttRegister(attCback_t cback);
enginerd 0:b562096246b3 244
enginerd 0:b562096246b3 245 /*************************************************************************************************/
enginerd 0:b562096246b3 246 /*!
enginerd 0:b562096246b3 247 * \fn AttConnRegister
enginerd 0:b562096246b3 248 *
enginerd 0:b562096246b3 249 * \brief Register a connection callback with ATT. The callback is typically used to
enginerd 0:b562096246b3 250 * manage the attribute server database.
enginerd 0:b562096246b3 251 *
enginerd 0:b562096246b3 252 * \param cback Client callback function.
enginerd 0:b562096246b3 253 *
enginerd 0:b562096246b3 254 * \return None.
enginerd 0:b562096246b3 255 */
enginerd 0:b562096246b3 256 /*************************************************************************************************/
enginerd 0:b562096246b3 257 void AttConnRegister(dmCback_t cback);
enginerd 0:b562096246b3 258
enginerd 0:b562096246b3 259
enginerd 0:b562096246b3 260 /*************************************************************************************************/
enginerd 0:b562096246b3 261 /*!
enginerd 0:b562096246b3 262 * \fn AttGetMtu
enginerd 0:b562096246b3 263 *
enginerd 0:b562096246b3 264 * \brief Get the attribute protocol MTU of a connection.
enginerd 0:b562096246b3 265 *
enginerd 0:b562096246b3 266 * \param connId DM connection ID.
enginerd 0:b562096246b3 267 *
enginerd 0:b562096246b3 268 * \return MTU of the connection.
enginerd 0:b562096246b3 269 */
enginerd 0:b562096246b3 270 /*************************************************************************************************/
enginerd 0:b562096246b3 271 uint16_t AttGetMtu(dmConnId_t connId);
enginerd 0:b562096246b3 272
enginerd 0:b562096246b3 273 /*************************************************************************************************/
enginerd 0:b562096246b3 274 /*!
enginerd 0:b562096246b3 275 * \fn AttsInit
enginerd 0:b562096246b3 276 *
enginerd 0:b562096246b3 277 * \brief Initialize ATT server.
enginerd 0:b562096246b3 278 *
enginerd 0:b562096246b3 279 * \return None.
enginerd 0:b562096246b3 280 */
enginerd 0:b562096246b3 281 /*************************************************************************************************/
enginerd 0:b562096246b3 282 void AttsInit(void);
enginerd 0:b562096246b3 283
enginerd 0:b562096246b3 284 /*************************************************************************************************/
enginerd 0:b562096246b3 285 /*!
enginerd 0:b562096246b3 286 * \fn AttsIndInit
enginerd 0:b562096246b3 287 *
enginerd 0:b562096246b3 288 * \brief Initialize ATT server for indications/notifications.
enginerd 0:b562096246b3 289 *
enginerd 0:b562096246b3 290 * \return None.
enginerd 0:b562096246b3 291 */
enginerd 0:b562096246b3 292 /*************************************************************************************************/
enginerd 0:b562096246b3 293 void AttsIndInit(void);
enginerd 0:b562096246b3 294
enginerd 0:b562096246b3 295 /*************************************************************************************************/
enginerd 0:b562096246b3 296 /*!
enginerd 0:b562096246b3 297 * \fn AttsSignInit
enginerd 0:b562096246b3 298 *
enginerd 0:b562096246b3 299 * \brief Initialize ATT server for data signing.
enginerd 0:b562096246b3 300 *
enginerd 0:b562096246b3 301 * \return None.
enginerd 0:b562096246b3 302 */
enginerd 0:b562096246b3 303 /*************************************************************************************************/
enginerd 0:b562096246b3 304 void AttsSignInit(void);
enginerd 0:b562096246b3 305
enginerd 0:b562096246b3 306 /*************************************************************************************************/
enginerd 0:b562096246b3 307 /*!
enginerd 0:b562096246b3 308 * \fn AttsAuthorRegister
enginerd 0:b562096246b3 309 *
enginerd 0:b562096246b3 310 * \brief Register an authorization callback with the attribute server.
enginerd 0:b562096246b3 311 *
enginerd 0:b562096246b3 312 * \param cback Client callback function.
enginerd 0:b562096246b3 313 *
enginerd 0:b562096246b3 314 * \return None.
enginerd 0:b562096246b3 315 */
enginerd 0:b562096246b3 316 /*************************************************************************************************/
enginerd 0:b562096246b3 317 void AttsAuthorRegister(attsAuthorCback_t cback);
enginerd 0:b562096246b3 318
enginerd 0:b562096246b3 319 /*************************************************************************************************/
enginerd 0:b562096246b3 320 /*!
enginerd 0:b562096246b3 321 * \fn AttsAddGroup
enginerd 0:b562096246b3 322 *
enginerd 0:b562096246b3 323 * \brief Add an attribute group to the attribute server.
enginerd 0:b562096246b3 324 *
enginerd 0:b562096246b3 325 * \param pGroup Pointer to an attribute group structure.
enginerd 0:b562096246b3 326 *
enginerd 0:b562096246b3 327 * \return None.
enginerd 0:b562096246b3 328 */
enginerd 0:b562096246b3 329 /*************************************************************************************************/
enginerd 0:b562096246b3 330 void AttsAddGroup(attsGroup_t *pGroup);
enginerd 0:b562096246b3 331
enginerd 0:b562096246b3 332 /*************************************************************************************************/
enginerd 0:b562096246b3 333 /*!
enginerd 0:b562096246b3 334 * \fn AttsRemoveGroup
enginerd 0:b562096246b3 335 *
enginerd 0:b562096246b3 336 * \brief Remove an attribute group from the attribute server.
enginerd 0:b562096246b3 337 *
enginerd 0:b562096246b3 338 * \param startHandle Start handle of attribute group to be removed.
enginerd 0:b562096246b3 339 *
enginerd 0:b562096246b3 340 * \return None.
enginerd 0:b562096246b3 341 */
enginerd 0:b562096246b3 342 /*************************************************************************************************/
enginerd 0:b562096246b3 343 void AttsRemoveGroup(uint16_t startHandle);
enginerd 0:b562096246b3 344
enginerd 0:b562096246b3 345 /*************************************************************************************************/
enginerd 0:b562096246b3 346 /*!
enginerd 0:b562096246b3 347 * \fn AttsSetAttr
enginerd 0:b562096246b3 348 *
enginerd 0:b562096246b3 349 * \brief Set an attribute value in the attribute server.
enginerd 0:b562096246b3 350 *
enginerd 0:b562096246b3 351 * \param handle Attribute handle.
enginerd 0:b562096246b3 352 * \param valueLen Attribute length.
enginerd 0:b562096246b3 353 * \param pValue Attribute value.
enginerd 0:b562096246b3 354 *
enginerd 0:b562096246b3 355 * \return ATT_SUCCESS if successful otherwise error.
enginerd 0:b562096246b3 356 */
enginerd 0:b562096246b3 357 /*************************************************************************************************/
enginerd 0:b562096246b3 358 uint8_t AttsSetAttr(uint16_t handle, uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 359
enginerd 0:b562096246b3 360 /*************************************************************************************************/
enginerd 0:b562096246b3 361 /*!
enginerd 0:b562096246b3 362 * \fn AttsGetAttr
enginerd 0:b562096246b3 363 *
enginerd 0:b562096246b3 364 * \brief Get an attribute value in the attribute server.
enginerd 0:b562096246b3 365 *
enginerd 0:b562096246b3 366 * \param handle Attribute handle.
enginerd 0:b562096246b3 367 * \param pLen Returned attribute length pointer.
enginerd 0:b562096246b3 368 * \param pValue Returned attribute value pointer.
enginerd 0:b562096246b3 369 *
enginerd 0:b562096246b3 370 * \return ATT_SUCCESS if successful otherwise error.
enginerd 0:b562096246b3 371 * \return This function returns the attribute length in pLen and a pointer to the attribute
enginerd 0:b562096246b3 372 * value in pValue.
enginerd 0:b562096246b3 373 */
enginerd 0:b562096246b3 374 /*************************************************************************************************/
enginerd 0:b562096246b3 375 uint8_t AttsGetAttr(uint16_t handle, uint16_t *pLen, uint8_t **pValue);
enginerd 0:b562096246b3 376
enginerd 0:b562096246b3 377 /*************************************************************************************************/
enginerd 0:b562096246b3 378 /*!
enginerd 0:b562096246b3 379 * \fn AttsHandleValueInd
enginerd 0:b562096246b3 380 *
enginerd 0:b562096246b3 381 * \brief Send an attribute protocol Handle Value Indication.
enginerd 0:b562096246b3 382 *
enginerd 0:b562096246b3 383 * \param connId DM connection ID.
enginerd 0:b562096246b3 384 * \param handle Attribute handle.
enginerd 0:b562096246b3 385 * \param valueLen Length of value data.
enginerd 0:b562096246b3 386 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 387 *
enginerd 0:b562096246b3 388 * \return None.
enginerd 0:b562096246b3 389 */
enginerd 0:b562096246b3 390 /*************************************************************************************************/
enginerd 0:b562096246b3 391 void AttsHandleValueInd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 392
enginerd 0:b562096246b3 393 /*************************************************************************************************/
enginerd 0:b562096246b3 394 /*!
enginerd 0:b562096246b3 395 * \fn AttsHandleValueNtf
enginerd 0:b562096246b3 396 *
enginerd 0:b562096246b3 397 * \brief Send an attribute protocol Handle Value Notification.
enginerd 0:b562096246b3 398 *
enginerd 0:b562096246b3 399 * \param connId DM connection ID.
enginerd 0:b562096246b3 400 * \param handle Attribute handle.
enginerd 0:b562096246b3 401 * \param valueLen Length of value data.
enginerd 0:b562096246b3 402 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 403 *
enginerd 0:b562096246b3 404 * \return None.
enginerd 0:b562096246b3 405 */
enginerd 0:b562096246b3 406 /*************************************************************************************************/
enginerd 0:b562096246b3 407 void AttsHandleValueNtf(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 408
enginerd 0:b562096246b3 409 /*************************************************************************************************/
enginerd 0:b562096246b3 410 /*!
enginerd 0:b562096246b3 411 * \fn AttsCccRegister
enginerd 0:b562096246b3 412 *
enginerd 0:b562096246b3 413 * \brief Register the utility service for managing client characteristic
enginerd 0:b562096246b3 414 * configuration descriptors. This function is typically called once on
enginerd 0:b562096246b3 415 * system initialization.
enginerd 0:b562096246b3 416 *
enginerd 0:b562096246b3 417 * \param setLen Length of settings array.
enginerd 0:b562096246b3 418 * \param pSet Array of CCC descriptor settings.
enginerd 0:b562096246b3 419 * \param cback Client callback function.
enginerd 0:b562096246b3 420 *
enginerd 0:b562096246b3 421 * \return None.
enginerd 0:b562096246b3 422 */
enginerd 0:b562096246b3 423 /*************************************************************************************************/
enginerd 0:b562096246b3 424 void AttsCccRegister(uint8_t setLen, attsCccSet_t *pSet, attsCccCback_t cback);
enginerd 0:b562096246b3 425
enginerd 0:b562096246b3 426 /*************************************************************************************************/
enginerd 0:b562096246b3 427 /*!
enginerd 0:b562096246b3 428 * \fn AttsCccInitTable
enginerd 0:b562096246b3 429 *
enginerd 0:b562096246b3 430 * \brief Initialize the client characteristic configuration descriptor value table for a
enginerd 0:b562096246b3 431 * connection. The table is initialized with the values from pCccTbl. If pCccTbl
enginerd 0:b562096246b3 432 * is NULL the table will be initialized to zero.
enginerd 0:b562096246b3 433 *
enginerd 0:b562096246b3 434 * This function must be called when a connection is established or when a
enginerd 0:b562096246b3 435 * device is bonded.
enginerd 0:b562096246b3 436 *
enginerd 0:b562096246b3 437 * \param connId DM connection ID.
enginerd 0:b562096246b3 438 * \param pCccTbl Pointer to the descriptor value array. The length of the array
enginerd 0:b562096246b3 439 * must equal the value of setLen passed to AttsCccRegister().
enginerd 0:b562096246b3 440 *
enginerd 0:b562096246b3 441 * \return None.
enginerd 0:b562096246b3 442 */
enginerd 0:b562096246b3 443 /*************************************************************************************************/
enginerd 0:b562096246b3 444 void AttsCccInitTable(dmConnId_t connId, uint16_t *pCccTbl);
enginerd 0:b562096246b3 445
enginerd 0:b562096246b3 446 /*************************************************************************************************/
enginerd 0:b562096246b3 447 /*!
enginerd 0:b562096246b3 448 * \fn AttsCccClearTable
enginerd 0:b562096246b3 449 *
enginerd 0:b562096246b3 450 * \brief Clear and deallocate the client characteristic configuration descriptor value
enginerd 0:b562096246b3 451 * table for a connection. This function must be called when a connection is closed.
enginerd 0:b562096246b3 452 *
enginerd 0:b562096246b3 453 * \param connId DM connection ID.
enginerd 0:b562096246b3 454 *
enginerd 0:b562096246b3 455 * \return None.
enginerd 0:b562096246b3 456 */
enginerd 0:b562096246b3 457 /*************************************************************************************************/
enginerd 0:b562096246b3 458 void AttsCccClearTable(dmConnId_t connId);
enginerd 0:b562096246b3 459
enginerd 0:b562096246b3 460 /*************************************************************************************************/
enginerd 0:b562096246b3 461 /*!
enginerd 0:b562096246b3 462 * \fn AttsCccGet
enginerd 0:b562096246b3 463 *
enginerd 0:b562096246b3 464 * \brief Get the value of a client characteristic configuration descriptor by its index.
enginerd 0:b562096246b3 465 * If not found, return zero.
enginerd 0:b562096246b3 466 *
enginerd 0:b562096246b3 467 * \param connId DM connection ID.
enginerd 0:b562096246b3 468 * \param idx Index of descriptor in CCC descriptor handle table.
enginerd 0:b562096246b3 469 *
enginerd 0:b562096246b3 470 * \return Value of the descriptor.
enginerd 0:b562096246b3 471 */
enginerd 0:b562096246b3 472 /*************************************************************************************************/
enginerd 0:b562096246b3 473 uint16_t AttsCccGet(dmConnId_t connId, uint8_t idx);
enginerd 0:b562096246b3 474
enginerd 0:b562096246b3 475 /*************************************************************************************************/
enginerd 0:b562096246b3 476 /*!
enginerd 0:b562096246b3 477 * \fn AttsCccSet
enginerd 0:b562096246b3 478 *
enginerd 0:b562096246b3 479 * \brief Set the value of a client characteristic configuration descriptor by its index.
enginerd 0:b562096246b3 480 *
enginerd 0:b562096246b3 481 * \param connId DM connection ID.
enginerd 0:b562096246b3 482 * \param idx Index of descriptor in CCC descriptor handle table.
enginerd 0:b562096246b3 483 * \param value Value of the descriptor.
enginerd 0:b562096246b3 484 *
enginerd 0:b562096246b3 485 * \return None.
enginerd 0:b562096246b3 486 */
enginerd 0:b562096246b3 487 /*************************************************************************************************/
enginerd 0:b562096246b3 488 void AttsCccSet(dmConnId_t connId, uint8_t idx, uint16_t value);
enginerd 0:b562096246b3 489
enginerd 0:b562096246b3 490 /*************************************************************************************************/
enginerd 0:b562096246b3 491 /*!
enginerd 0:b562096246b3 492 * \fn AttsCccEnabled
enginerd 0:b562096246b3 493 *
enginerd 0:b562096246b3 494 * \brief Check if a client characteristic configuration descriptor is enabled and if
enginerd 0:b562096246b3 495 * the characteristic's security level has been met.
enginerd 0:b562096246b3 496 *
enginerd 0:b562096246b3 497 * \param connId DM connection ID.
enginerd 0:b562096246b3 498 * \param idx Index of descriptor in CCC descriptor handle table.
enginerd 0:b562096246b3 499 *
enginerd 0:b562096246b3 500 * \return Value of the descriptor if security level is met, otherwise zero.
enginerd 0:b562096246b3 501 */
enginerd 0:b562096246b3 502 /*************************************************************************************************/
enginerd 0:b562096246b3 503 uint16_t AttsCccEnabled(dmConnId_t connId, uint8_t idx);
enginerd 0:b562096246b3 504
enginerd 0:b562096246b3 505 /*************************************************************************************************/
enginerd 0:b562096246b3 506 /*!
enginerd 0:b562096246b3 507 * \fn AttsSetCsrk
enginerd 0:b562096246b3 508 *
enginerd 0:b562096246b3 509 * \brief Set the peer's data signing key on this connection. This function
enginerd 0:b562096246b3 510 * is typically called from the ATT connection callback when the connection is
enginerd 0:b562096246b3 511 * established. The caller is responsible for maintaining the memory that
enginerd 0:b562096246b3 512 * contains the key.
enginerd 0:b562096246b3 513 *
enginerd 0:b562096246b3 514 * \param connId DM connection ID.
enginerd 0:b562096246b3 515 * \param pCsrk Pointer to data signing key (CSRK).
enginerd 0:b562096246b3 516 *
enginerd 0:b562096246b3 517 * \return None.
enginerd 0:b562096246b3 518 */
enginerd 0:b562096246b3 519 /*************************************************************************************************/
enginerd 0:b562096246b3 520 void AttsSetCsrk(dmConnId_t connId, uint8_t *pCsrk);
enginerd 0:b562096246b3 521
enginerd 0:b562096246b3 522 /*************************************************************************************************/
enginerd 0:b562096246b3 523 /*!
enginerd 0:b562096246b3 524 * \fn AttsSetSignCounter
enginerd 0:b562096246b3 525 *
enginerd 0:b562096246b3 526 * \brief Set the peer's sign counter on this connection. This function
enginerd 0:b562096246b3 527 * is typically called from the ATT connection callback when the connection is
enginerd 0:b562096246b3 528 * established. ATT maintains the value of the sign counter internally and
enginerd 0:b562096246b3 529 * sets the value when a signed packet is successfully received.
enginerd 0:b562096246b3 530 *
enginerd 0:b562096246b3 531 * \param connId DM connection ID.
enginerd 0:b562096246b3 532 * \param signCounter Sign counter.
enginerd 0:b562096246b3 533 *
enginerd 0:b562096246b3 534 * \return None.
enginerd 0:b562096246b3 535 */
enginerd 0:b562096246b3 536 /*************************************************************************************************/
enginerd 0:b562096246b3 537 void AttsSetSignCounter(dmConnId_t connId, uint32_t signCounter);
enginerd 0:b562096246b3 538
enginerd 0:b562096246b3 539 /*************************************************************************************************/
enginerd 0:b562096246b3 540 /*!
enginerd 0:b562096246b3 541 * \fn AttsGetSignCounter
enginerd 0:b562096246b3 542 *
enginerd 0:b562096246b3 543 * \brief Get the current value peer's sign counter on this connection. This function
enginerd 0:b562096246b3 544 * is typically called from the ATT connection callback when the connection is
enginerd 0:b562096246b3 545 * closed so the application can store the sign counter for use on future
enginerd 0:b562096246b3 546 * connections.
enginerd 0:b562096246b3 547 *
enginerd 0:b562096246b3 548 * \param connId DM connection ID.
enginerd 0:b562096246b3 549 *
enginerd 0:b562096246b3 550 * \return Sign counter.
enginerd 0:b562096246b3 551 */
enginerd 0:b562096246b3 552 /*************************************************************************************************/
enginerd 0:b562096246b3 553 uint32_t AttsGetSignCounter(dmConnId_t connId);
enginerd 0:b562096246b3 554
enginerd 0:b562096246b3 555 /*************************************************************************************************/
enginerd 0:b562096246b3 556 /*!
enginerd 0:b562096246b3 557 * \fn AttcInit
enginerd 0:b562096246b3 558 *
enginerd 0:b562096246b3 559 * \brief Initialize ATT client.
enginerd 0:b562096246b3 560 *
enginerd 0:b562096246b3 561 * \return None.
enginerd 0:b562096246b3 562 */
enginerd 0:b562096246b3 563 /*************************************************************************************************/
enginerd 0:b562096246b3 564 void AttcInit(void);
enginerd 0:b562096246b3 565
enginerd 0:b562096246b3 566 /*************************************************************************************************/
enginerd 0:b562096246b3 567 /*!
enginerd 0:b562096246b3 568 * \fn AttcSignInit
enginerd 0:b562096246b3 569 *
enginerd 0:b562096246b3 570 * \brief Initialize ATT client for data signing.
enginerd 0:b562096246b3 571 *
enginerd 0:b562096246b3 572 * \return None.
enginerd 0:b562096246b3 573 */
enginerd 0:b562096246b3 574 /*************************************************************************************************/
enginerd 0:b562096246b3 575 void AttcSignInit(void);
enginerd 0:b562096246b3 576
enginerd 0:b562096246b3 577 /*************************************************************************************************/
enginerd 0:b562096246b3 578 /*!
enginerd 0:b562096246b3 579 * \fn AttcFindInfoReq
enginerd 0:b562096246b3 580 *
enginerd 0:b562096246b3 581 * \brief Initiate an attribute protocol Find Information Request.
enginerd 0:b562096246b3 582 *
enginerd 0:b562096246b3 583 * \param connId DM connection ID.
enginerd 0:b562096246b3 584 * \param startHandle Attribute start handle.
enginerd 0:b562096246b3 585 * \param endHandle Attribute end handle.
enginerd 0:b562096246b3 586 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 587 *
enginerd 0:b562096246b3 588 * \return None.
enginerd 0:b562096246b3 589 */
enginerd 0:b562096246b3 590 /*************************************************************************************************/
enginerd 0:b562096246b3 591 void AttcFindInfoReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle, bool_t continuing);
enginerd 0:b562096246b3 592
enginerd 0:b562096246b3 593 /*************************************************************************************************/
enginerd 0:b562096246b3 594 /*!
enginerd 0:b562096246b3 595 * \fn AttcFindByTypeValueReq
enginerd 0:b562096246b3 596 *
enginerd 0:b562096246b3 597 * \brief Initiate an attribute protocol Find By Type Value Request.
enginerd 0:b562096246b3 598 *
enginerd 0:b562096246b3 599 * \param connId DM connection ID.
enginerd 0:b562096246b3 600 * \param startHandle Attribute start handle.
enginerd 0:b562096246b3 601 * \param endHandle Attribute end handle.
enginerd 0:b562096246b3 602 * \param uuid16 16-bit UUID to find.
enginerd 0:b562096246b3 603 * \param valueLen Length of value data.
enginerd 0:b562096246b3 604 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 605 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 606 *
enginerd 0:b562096246b3 607 * \return None.
enginerd 0:b562096246b3 608 */
enginerd 0:b562096246b3 609 /*************************************************************************************************/
enginerd 0:b562096246b3 610 void AttcFindByTypeValueReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
enginerd 0:b562096246b3 611 uint16_t uuid16, uint16_t valueLen, uint8_t *pValue, bool_t continuing);
enginerd 0:b562096246b3 612
enginerd 0:b562096246b3 613 /*************************************************************************************************/
enginerd 0:b562096246b3 614 /*!
enginerd 0:b562096246b3 615 * \fn AttcReadByTypeReq
enginerd 0:b562096246b3 616 *
enginerd 0:b562096246b3 617 * \brief Initiate an attribute protocol Read By Type Request.
enginerd 0:b562096246b3 618 *
enginerd 0:b562096246b3 619 * \param connId DM connection ID.
enginerd 0:b562096246b3 620 * \param startHandle Attribute start handle.
enginerd 0:b562096246b3 621 * \param endHandle Attribute end handle.
enginerd 0:b562096246b3 622 * \param uuidLen Length of UUID (2 or 16).
enginerd 0:b562096246b3 623 * \param pUuid Pointer to UUID data.
enginerd 0:b562096246b3 624 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 625 *
enginerd 0:b562096246b3 626 * \return None.
enginerd 0:b562096246b3 627 */
enginerd 0:b562096246b3 628 /*************************************************************************************************/
enginerd 0:b562096246b3 629 void AttcReadByTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
enginerd 0:b562096246b3 630 uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
enginerd 0:b562096246b3 631
enginerd 0:b562096246b3 632 /*************************************************************************************************/
enginerd 0:b562096246b3 633 /*!
enginerd 0:b562096246b3 634 * \fn AttcReadReq
enginerd 0:b562096246b3 635 *
enginerd 0:b562096246b3 636 * \brief Initiate an attribute protocol Read Request.
enginerd 0:b562096246b3 637 *
enginerd 0:b562096246b3 638 * \param connId DM connection ID.
enginerd 0:b562096246b3 639 * \param handle Attribute handle.
enginerd 0:b562096246b3 640 *
enginerd 0:b562096246b3 641 * \return None.
enginerd 0:b562096246b3 642 */
enginerd 0:b562096246b3 643 /*************************************************************************************************/
enginerd 0:b562096246b3 644 void AttcReadReq(dmConnId_t connId, uint16_t handle);
enginerd 0:b562096246b3 645
enginerd 0:b562096246b3 646 /*************************************************************************************************/
enginerd 0:b562096246b3 647 /*!
enginerd 0:b562096246b3 648 * \fn AttcReadLongReq
enginerd 0:b562096246b3 649 *
enginerd 0:b562096246b3 650 * \brief Initiate an attribute protocol Read Long Request.
enginerd 0:b562096246b3 651 *
enginerd 0:b562096246b3 652 * \param connId DM connection ID.
enginerd 0:b562096246b3 653 * \param handle Attribute handle.
enginerd 0:b562096246b3 654 * \param offset Read attribute data starting at this offset.
enginerd 0:b562096246b3 655 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 656 *
enginerd 0:b562096246b3 657 * \return None.
enginerd 0:b562096246b3 658 */
enginerd 0:b562096246b3 659 /*************************************************************************************************/
enginerd 0:b562096246b3 660 void AttcReadLongReq(dmConnId_t connId, uint16_t handle, uint16_t offset, bool_t continuing);
enginerd 0:b562096246b3 661
enginerd 0:b562096246b3 662 /*************************************************************************************************/
enginerd 0:b562096246b3 663 /*!
enginerd 0:b562096246b3 664 * \fn AttcReadMultipleReq
enginerd 0:b562096246b3 665 *
enginerd 0:b562096246b3 666 * \brief Initiate an attribute protocol Read Multiple Request.
enginerd 0:b562096246b3 667 *
enginerd 0:b562096246b3 668 * \param connId DM connection ID.
enginerd 0:b562096246b3 669 * \param numHandles Number of handles in attribute handle list.
enginerd 0:b562096246b3 670 * \param pHandles List of attribute handles.
enginerd 0:b562096246b3 671 *
enginerd 0:b562096246b3 672 * \return None.
enginerd 0:b562096246b3 673 */
enginerd 0:b562096246b3 674 /*************************************************************************************************/
enginerd 0:b562096246b3 675 void AttcReadMultipleReq(dmConnId_t connId, uint8_t numHandles, uint16_t *pHandles);
enginerd 0:b562096246b3 676
enginerd 0:b562096246b3 677 /*************************************************************************************************/
enginerd 0:b562096246b3 678 /*!
enginerd 0:b562096246b3 679 * \fn AttcReadByGroupTypeReq
enginerd 0:b562096246b3 680 *
enginerd 0:b562096246b3 681 * \brief Initiate an attribute protocol Read By Group Type Request.
enginerd 0:b562096246b3 682 *
enginerd 0:b562096246b3 683 * \param connId DM connection ID.
enginerd 0:b562096246b3 684 * \param startHandle Attribute start handle.
enginerd 0:b562096246b3 685 * \param endHandle Attribute end handle.
enginerd 0:b562096246b3 686 * \param uuidLen Length of UUID (2 or 16).
enginerd 0:b562096246b3 687 * \param pUuid Pointer to UUID data.
enginerd 0:b562096246b3 688 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 689 *
enginerd 0:b562096246b3 690 * \return None.
enginerd 0:b562096246b3 691 */
enginerd 0:b562096246b3 692 /*************************************************************************************************/
enginerd 0:b562096246b3 693 void AttcReadByGroupTypeReq(dmConnId_t connId, uint16_t startHandle, uint16_t endHandle,
enginerd 0:b562096246b3 694 uint8_t uuidLen, uint8_t *pUuid, bool_t continuing);
enginerd 0:b562096246b3 695
enginerd 0:b562096246b3 696 /*************************************************************************************************/
enginerd 0:b562096246b3 697 /*!
enginerd 0:b562096246b3 698 * \fn AttcWriteReq
enginerd 0:b562096246b3 699 *
enginerd 0:b562096246b3 700 * \brief Initiate an attribute protocol Write Request.
enginerd 0:b562096246b3 701 *
enginerd 0:b562096246b3 702 * \param connId DM connection ID.
enginerd 0:b562096246b3 703 * \param handle Attribute handle.
enginerd 0:b562096246b3 704 * \param valueLen Length of value data.
enginerd 0:b562096246b3 705 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 706 *
enginerd 0:b562096246b3 707 * \return None.
enginerd 0:b562096246b3 708 */
enginerd 0:b562096246b3 709 /*************************************************************************************************/
enginerd 0:b562096246b3 710 void AttcWriteReq(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 711
enginerd 0:b562096246b3 712 /*************************************************************************************************/
enginerd 0:b562096246b3 713 /*!
enginerd 0:b562096246b3 714 * \fn AttcWriteCmd
enginerd 0:b562096246b3 715 *
enginerd 0:b562096246b3 716 * \brief Initiate an attribute protocol Write Command.
enginerd 0:b562096246b3 717 *
enginerd 0:b562096246b3 718 * \param connId DM connection ID.
enginerd 0:b562096246b3 719 * \param handle Attribute handle.
enginerd 0:b562096246b3 720 * \param valueLen Length of value data.
enginerd 0:b562096246b3 721 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 722 *
enginerd 0:b562096246b3 723 * \return None.
enginerd 0:b562096246b3 724 */
enginerd 0:b562096246b3 725 /*************************************************************************************************/
enginerd 0:b562096246b3 726 void AttcWriteCmd(dmConnId_t connId, uint16_t handle, uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 727
enginerd 0:b562096246b3 728 /*************************************************************************************************/
enginerd 0:b562096246b3 729 /*!
enginerd 0:b562096246b3 730 * \fn AttcSignedWriteCmd
enginerd 0:b562096246b3 731 *
enginerd 0:b562096246b3 732 * \brief Initiate an attribute protocol signed Write Command.
enginerd 0:b562096246b3 733 *
enginerd 0:b562096246b3 734 * \param connId DM connection ID.
enginerd 0:b562096246b3 735 * \param handle Attribute handle.
enginerd 0:b562096246b3 736 * \param signCounter Value of the sign counter.
enginerd 0:b562096246b3 737 * \param valueLen Length of value data.
enginerd 0:b562096246b3 738 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 739 *
enginerd 0:b562096246b3 740 * \return None.
enginerd 0:b562096246b3 741 */
enginerd 0:b562096246b3 742 /*************************************************************************************************/
enginerd 0:b562096246b3 743 void AttcSignedWriteCmd(dmConnId_t connId, uint16_t handle, uint32_t signCounter,
enginerd 0:b562096246b3 744 uint16_t valueLen, uint8_t *pValue);
enginerd 0:b562096246b3 745
enginerd 0:b562096246b3 746 /*************************************************************************************************/
enginerd 0:b562096246b3 747 /*!
enginerd 0:b562096246b3 748 * \fn AttcPrepareWriteReq
enginerd 0:b562096246b3 749 *
enginerd 0:b562096246b3 750 * \brief Initiate an attribute protocol Prepare Write Request.
enginerd 0:b562096246b3 751 *
enginerd 0:b562096246b3 752 * \param connId DM connection ID.
enginerd 0:b562096246b3 753 * \param handle Attribute handle.
enginerd 0:b562096246b3 754 * \param offset Write attribute data starting at this offset.
enginerd 0:b562096246b3 755 * \param valueLen Length of value data.
enginerd 0:b562096246b3 756 * \param pValue Pointer to value data.
enginerd 0:b562096246b3 757 * \param valueByRef TRUE if pValue data is accessed by reference rather than copied.
enginerd 0:b562096246b3 758 * \param continuing TRUE if ATTC continues sending requests until complete.
enginerd 0:b562096246b3 759 *
enginerd 0:b562096246b3 760 * \return None.
enginerd 0:b562096246b3 761 */
enginerd 0:b562096246b3 762 /*************************************************************************************************/
enginerd 0:b562096246b3 763 void AttcPrepareWriteReq(dmConnId_t connId, uint16_t handle, uint16_t offset, uint16_t valueLen,
enginerd 0:b562096246b3 764 uint8_t *pValue, bool_t valueByRef, bool_t continuing);
enginerd 0:b562096246b3 765
enginerd 0:b562096246b3 766 /*************************************************************************************************/
enginerd 0:b562096246b3 767 /*!
enginerd 0:b562096246b3 768 * \fn AttcExecuteWriteReq
enginerd 0:b562096246b3 769 *
enginerd 0:b562096246b3 770 * \brief Initiate an attribute protocol Execute Write Request.
enginerd 0:b562096246b3 771 *
enginerd 0:b562096246b3 772 * \param connId DM connection ID.
enginerd 0:b562096246b3 773 * \param writeAll TRUE to write all queued writes, FALSE to cancel all queued writes.
enginerd 0:b562096246b3 774 *
enginerd 0:b562096246b3 775 * \return None.
enginerd 0:b562096246b3 776 */
enginerd 0:b562096246b3 777 /*************************************************************************************************/
enginerd 0:b562096246b3 778 void AttcExecuteWriteReq(dmConnId_t connId, bool_t writeAll);
enginerd 0:b562096246b3 779
enginerd 0:b562096246b3 780 /*************************************************************************************************/
enginerd 0:b562096246b3 781 /*!
enginerd 0:b562096246b3 782 * \fn AttcCancelReq
enginerd 0:b562096246b3 783 *
enginerd 0:b562096246b3 784 * \brief Cancel an attribute protocol request in progress.
enginerd 0:b562096246b3 785 *
enginerd 0:b562096246b3 786 * \param connId DM connection ID.
enginerd 0:b562096246b3 787 *
enginerd 0:b562096246b3 788 * \return None.
enginerd 0:b562096246b3 789 */
enginerd 0:b562096246b3 790 /*************************************************************************************************/
enginerd 0:b562096246b3 791 void AttcCancelReq(dmConnId_t connId);
enginerd 0:b562096246b3 792
enginerd 0:b562096246b3 793 /*************************************************************************************************/
enginerd 0:b562096246b3 794 /*!
enginerd 0:b562096246b3 795 * \fn AttcDiscService
enginerd 0:b562096246b3 796 *
enginerd 0:b562096246b3 797 * \brief This utility function discovers the given service on a peer device. Function
enginerd 0:b562096246b3 798 * AttcFindByTypeValueReq() is called to initiate the discovery procedure.
enginerd 0:b562096246b3 799 *
enginerd 0:b562096246b3 800 * \param connId DM connection ID.
enginerd 0:b562096246b3 801 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 802 * \param uuidLen Length of service UUID (2 or 16).
enginerd 0:b562096246b3 803 * \param pUuid Pointer to service UUID.
enginerd 0:b562096246b3 804 *
enginerd 0:b562096246b3 805 * \return None.
enginerd 0:b562096246b3 806 */
enginerd 0:b562096246b3 807 /*************************************************************************************************/
enginerd 0:b562096246b3 808 void AttcDiscService(dmConnId_t connId, attcDiscCb_t *pCb, uint8_t uuidLen, uint8_t *pUuid);
enginerd 0:b562096246b3 809
enginerd 0:b562096246b3 810 /*************************************************************************************************/
enginerd 0:b562096246b3 811 /*!
enginerd 0:b562096246b3 812 * \fn AttcDiscServiceCmpl
enginerd 0:b562096246b3 813 *
enginerd 0:b562096246b3 814 * \brief This utility function processes a service discovery result. It should be called
enginerd 0:b562096246b3 815 * when an ATTC_FIND_BY_TYPE_VALUE_RSP callback event is received after service
enginerd 0:b562096246b3 816 * discovery is initiated by calling AttcDiscService().
enginerd 0:b562096246b3 817 *
enginerd 0:b562096246b3 818 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 819 * \param pMsg ATT callback event message.
enginerd 0:b562096246b3 820 *
enginerd 0:b562096246b3 821 * \return ATT_SUCCESS if successful otherwise error.
enginerd 0:b562096246b3 822 */
enginerd 0:b562096246b3 823 /*************************************************************************************************/
enginerd 0:b562096246b3 824 uint8_t AttcDiscServiceCmpl(attcDiscCb_t *pCb, attEvt_t *pMsg);
enginerd 0:b562096246b3 825
enginerd 0:b562096246b3 826 /*************************************************************************************************/
enginerd 0:b562096246b3 827 /*!
enginerd 0:b562096246b3 828 * \fn AttcDiscCharStart
enginerd 0:b562096246b3 829 *
enginerd 0:b562096246b3 830 * \brief This utility function starts characteristic and characteristic descriptor
enginerd 0:b562096246b3 831 * discovery for a service on a peer device. The service must have been previously
enginerd 0:b562096246b3 832 * discovered by calling AttcDiscService() and AttcDiscServiceCmpl().
enginerd 0:b562096246b3 833 *
enginerd 0:b562096246b3 834 * \param connId DM connection ID.
enginerd 0:b562096246b3 835 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 836 *
enginerd 0:b562096246b3 837 * \return None.
enginerd 0:b562096246b3 838 */
enginerd 0:b562096246b3 839 /*************************************************************************************************/
enginerd 0:b562096246b3 840 void AttcDiscCharStart(dmConnId_t connId, attcDiscCb_t *pCb);
enginerd 0:b562096246b3 841
enginerd 0:b562096246b3 842 /*************************************************************************************************/
enginerd 0:b562096246b3 843 /*!
enginerd 0:b562096246b3 844 * \fn AttcDiscCharCmpl
enginerd 0:b562096246b3 845 *
enginerd 0:b562096246b3 846 * \brief This utility function processes a characteristic discovery result. It should be
enginerd 0:b562096246b3 847 * called when an ATTC_READ_BY_TYPE_RSP or ATTC_FIND_INFO_RSP callback event is
enginerd 0:b562096246b3 848 * received after characteristic discovery is initiated by calling AttcDiscCharStart().
enginerd 0:b562096246b3 849 *
enginerd 0:b562096246b3 850 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 851 * \param pMsg ATT callback event message.
enginerd 0:b562096246b3 852 *
enginerd 0:b562096246b3 853 * \return ATT_CONTINUING if successful and the discovery procedure is continuing.
enginerd 0:b562096246b3 854 * ATT_SUCCESS if the discovery procedure completed successfully.
enginerd 0:b562096246b3 855 * Otherwise the discovery procedure failed.
enginerd 0:b562096246b3 856 */
enginerd 0:b562096246b3 857 /*************************************************************************************************/
enginerd 0:b562096246b3 858 uint8_t AttcDiscCharCmpl(attcDiscCb_t *pCb, attEvt_t *pMsg);
enginerd 0:b562096246b3 859
enginerd 0:b562096246b3 860 /*************************************************************************************************/
enginerd 0:b562096246b3 861 /*!
enginerd 0:b562096246b3 862 * \fn AttcDiscConfigStart
enginerd 0:b562096246b3 863 *
enginerd 0:b562096246b3 864 * \brief This utility function starts characteristic configuration for characteristics on a
enginerd 0:b562096246b3 865 * peer device. The characteristics must have been previously discovered by calling
enginerd 0:b562096246b3 866 * AttcDiscCharStart() and AttcDiscCharCmpl().
enginerd 0:b562096246b3 867 *
enginerd 0:b562096246b3 868 * \param connId DM connection ID.
enginerd 0:b562096246b3 869 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 870 *
enginerd 0:b562096246b3 871 * \return ATT_CONTINUING if successful and configuration procedure is continuing.
enginerd 0:b562096246b3 872 * ATT_SUCCESS if nothing to configure.
enginerd 0:b562096246b3 873 */
enginerd 0:b562096246b3 874 /*************************************************************************************************/
enginerd 0:b562096246b3 875 uint8_t AttcDiscConfigStart(dmConnId_t connId, attcDiscCb_t *pCb);
enginerd 0:b562096246b3 876
enginerd 0:b562096246b3 877 /*************************************************************************************************/
enginerd 0:b562096246b3 878 /*!
enginerd 0:b562096246b3 879 * \fn AttcDiscConfigCmpl
enginerd 0:b562096246b3 880 *
enginerd 0:b562096246b3 881 * \brief This utility function initiates the next characteristic configuration procedure.
enginerd 0:b562096246b3 882 * It should be called when an ATTC_READ_RSP or ATTC_WRITE_RSP callback event is received
enginerd 0:b562096246b3 883 * after characteristic configuration is initiated by calling AttcDiscConfigStart().
enginerd 0:b562096246b3 884 *
enginerd 0:b562096246b3 885 * \param connId DM connection ID.
enginerd 0:b562096246b3 886 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 887 *
enginerd 0:b562096246b3 888 * \return ATT_CONTINUING if successful and configuration procedure is continuing.
enginerd 0:b562096246b3 889 * ATT_SUCCESS if configuration procedure completed successfully.
enginerd 0:b562096246b3 890 */
enginerd 0:b562096246b3 891 /*************************************************************************************************/
enginerd 0:b562096246b3 892 uint8_t AttcDiscConfigCmpl(dmConnId_t connId, attcDiscCb_t *pCb);
enginerd 0:b562096246b3 893
enginerd 0:b562096246b3 894 /*************************************************************************************************/
enginerd 0:b562096246b3 895 /*!
enginerd 0:b562096246b3 896 * \fn AttcDiscConfigResume
enginerd 0:b562096246b3 897 *
enginerd 0:b562096246b3 898 * \brief This utility function resumes the characteristic configuration procedure. It can
enginerd 0:b562096246b3 899 * be called when an ATTC_READ_RSP or ATTC_WRITE_RSP callback event is received
enginerd 0:b562096246b3 900 * with failure status to attempt the read or write procedure again.
enginerd 0:b562096246b3 901 *
enginerd 0:b562096246b3 902 * \param connId DM connection ID.
enginerd 0:b562096246b3 903 * \param pCb Pointer to discovery control block.
enginerd 0:b562096246b3 904 *
enginerd 0:b562096246b3 905 * \return ATT_CONTINUING if successful and configuration procedure is continuing.
enginerd 0:b562096246b3 906 * ATT_SUCCESS if configuration procedure completed successfully.
enginerd 0:b562096246b3 907 */
enginerd 0:b562096246b3 908 /*************************************************************************************************/
enginerd 0:b562096246b3 909 uint8_t AttcDiscConfigResume(dmConnId_t connId, attcDiscCb_t *pCb);
enginerd 0:b562096246b3 910
enginerd 0:b562096246b3 911 /*************************************************************************************************/
enginerd 0:b562096246b3 912 /*!
enginerd 0:b562096246b3 913 * \fn AttcMtuReq
enginerd 0:b562096246b3 914 *
enginerd 0:b562096246b3 915 * \brief For internal use only.
enginerd 0:b562096246b3 916 *
enginerd 0:b562096246b3 917 * \param connId DM connection ID.
enginerd 0:b562096246b3 918 * \param mtu Attribute protocol MTU.
enginerd 0:b562096246b3 919 *
enginerd 0:b562096246b3 920 * \return None.
enginerd 0:b562096246b3 921 */
enginerd 0:b562096246b3 922 /*************************************************************************************************/
enginerd 0:b562096246b3 923 void AttcMtuReq(dmConnId_t connId, uint16_t mtu);
enginerd 0:b562096246b3 924
enginerd 0:b562096246b3 925 /*************************************************************************************************/
enginerd 0:b562096246b3 926 /*!
enginerd 0:b562096246b3 927 * \fn AttsErrorTest
enginerd 0:b562096246b3 928 *
enginerd 0:b562096246b3 929 * \brief For testing purposes only.
enginerd 0:b562096246b3 930 *
enginerd 0:b562096246b3 931 * \param status ATT status
enginerd 0:b562096246b3 932 *
enginerd 0:b562096246b3 933 * \return None.
enginerd 0:b562096246b3 934 */
enginerd 0:b562096246b3 935 /*************************************************************************************************/
enginerd 0:b562096246b3 936 void AttsErrorTest(uint8_t status);
enginerd 0:b562096246b3 937
enginerd 0:b562096246b3 938 #ifdef __cplusplus
enginerd 0:b562096246b3 939 };
enginerd 0:b562096246b3 940 #endif
enginerd 0:b562096246b3 941
enginerd 0:b562096246b3 942 #endif /* ATT_API_H */