mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Child:
128:9bcdf88f62b0
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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