Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_gatt_client.h@0:bb348c97df44, 2020-09-16 (annotated)
- Committer:
- lypinator
- Date:
- Wed Sep 16 01:11:49 2020 +0000
- Revision:
- 0:bb348c97df44
Added PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lypinator | 0:bb348c97df44 | 1 | /* |
lypinator | 0:bb348c97df44 | 2 | *--------------------------------------------------------------------------- |
lypinator | 0:bb348c97df44 | 3 | * Copyright (c) 2016, u-blox Malmö, All Rights Reserved |
lypinator | 0:bb348c97df44 | 4 | * SPDX-License-Identifier: LicenseRef-PBL |
lypinator | 0:bb348c97df44 | 5 | * |
lypinator | 0:bb348c97df44 | 6 | * This file and the related binary are licensed under the |
lypinator | 0:bb348c97df44 | 7 | * Permissive Binary License, Version 1.0 (the "License"); |
lypinator | 0:bb348c97df44 | 8 | * you may not use these files except in compliance with the License. |
lypinator | 0:bb348c97df44 | 9 | * |
lypinator | 0:bb348c97df44 | 10 | * You may obtain a copy of the License here: |
lypinator | 0:bb348c97df44 | 11 | * LICENSE-permissive-binary-license-1.0.txt and at |
lypinator | 0:bb348c97df44 | 12 | * https://www.mbed.com/licenses/PBL-1.0 |
lypinator | 0:bb348c97df44 | 13 | * |
lypinator | 0:bb348c97df44 | 14 | * See the License for the specific language governing permissions and |
lypinator | 0:bb348c97df44 | 15 | * limitations under the License. |
lypinator | 0:bb348c97df44 | 16 | * |
lypinator | 0:bb348c97df44 | 17 | * Component GATT |
lypinator | 0:bb348c97df44 | 18 | * File cb_gatt_client.h |
lypinator | 0:bb348c97df44 | 19 | * |
lypinator | 0:bb348c97df44 | 20 | * Description Definitions and types for GATT client functionality |
lypinator | 0:bb348c97df44 | 21 | * |
lypinator | 0:bb348c97df44 | 22 | */ |
lypinator | 0:bb348c97df44 | 23 | |
lypinator | 0:bb348c97df44 | 24 | /** |
lypinator | 0:bb348c97df44 | 25 | * @file cb_gatt_client.h |
lypinator | 0:bb348c97df44 | 26 | * |
lypinator | 0:bb348c97df44 | 27 | * This file contains all GATT client functionality. There are some restrictions |
lypinator | 0:bb348c97df44 | 28 | * on how this API is used. |
lypinator | 0:bb348c97df44 | 29 | * - Pointer data in callbacks are only valid in the context of the callback |
lypinator | 0:bb348c97df44 | 30 | * - Only one request at a time should be done from each app(app handle). The |
lypinator | 0:bb348c97df44 | 31 | * app must wait until all responses from an outstanding request have been |
lypinator | 0:bb348c97df44 | 32 | * received. |
lypinator | 0:bb348c97df44 | 33 | * - In the callback of the request another request can not be done except when |
lypinator | 0:bb348c97df44 | 34 | * the request is interrupted by setting the return value to FALSE |
lypinator | 0:bb348c97df44 | 35 | * or when in the last callback which contains an error code. |
lypinator | 0:bb348c97df44 | 36 | * - Most of the GATT requests can be interrupted by returning FALSE in the |
lypinator | 0:bb348c97df44 | 37 | * callback. |
lypinator | 0:bb348c97df44 | 38 | * |
lypinator | 0:bb348c97df44 | 39 | * See Bluetooth 4.0 specification for more info on GATT and ATT chapters: |
lypinator | 0:bb348c97df44 | 40 | * https://www.bluetooth.org/en-us/specification/adopted-specifications |
lypinator | 0:bb348c97df44 | 41 | * |
lypinator | 0:bb348c97df44 | 42 | */ |
lypinator | 0:bb348c97df44 | 43 | |
lypinator | 0:bb348c97df44 | 44 | #ifndef _CB_GATT_CLIENT_H_ |
lypinator | 0:bb348c97df44 | 45 | #define _CB_GATT_CLIENT_H_ |
lypinator | 0:bb348c97df44 | 46 | |
lypinator | 0:bb348c97df44 | 47 | #include "bt_types.h" |
lypinator | 0:bb348c97df44 | 48 | #include "cb_gatt.h" |
lypinator | 0:bb348c97df44 | 49 | |
lypinator | 0:bb348c97df44 | 50 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 51 | extern "C" { |
lypinator | 0:bb348c97df44 | 52 | #endif |
lypinator | 0:bb348c97df44 | 53 | |
lypinator | 0:bb348c97df44 | 54 | /*============================================================================== |
lypinator | 0:bb348c97df44 | 55 | * TYPES |
lypinator | 0:bb348c97df44 | 56 | *============================================================================== |
lypinator | 0:bb348c97df44 | 57 | */ |
lypinator | 0:bb348c97df44 | 58 | |
lypinator | 0:bb348c97df44 | 59 | /** |
lypinator | 0:bb348c97df44 | 60 | * Callback for discover all primary services. This callback will be called |
lypinator | 0:bb348c97df44 | 61 | * for each primary service found. |
lypinator | 0:bb348c97df44 | 62 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 63 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 64 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 65 | * when search is finished. |
lypinator | 0:bb348c97df44 | 66 | * cbGATT_ERROR_CODE_ on failure |
lypinator | 0:bb348c97df44 | 67 | * @param startGroupHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 68 | * @param endGroupHandle End handle of the service |
lypinator | 0:bb348c97df44 | 69 | * @param pUuid Pointer to UUID of the service |
lypinator | 0:bb348c97df44 | 70 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 71 | */ |
lypinator | 0:bb348c97df44 | 72 | typedef cb_boolean (*cbGATT_DiscoverAllPrimaryServicesCnf)( |
lypinator | 0:bb348c97df44 | 73 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 74 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 75 | cb_uint16 startGroupHandle, |
lypinator | 0:bb348c97df44 | 76 | cb_uint16 endGroupHandle, |
lypinator | 0:bb348c97df44 | 77 | cbGATT_Uuid* pUuid); |
lypinator | 0:bb348c97df44 | 78 | |
lypinator | 0:bb348c97df44 | 79 | /** |
lypinator | 0:bb348c97df44 | 80 | * Callback for discover all secondary services. This callback will be called |
lypinator | 0:bb348c97df44 | 81 | * for each secondary service found. |
lypinator | 0:bb348c97df44 | 82 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 83 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 84 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 85 | * when search is finished. |
lypinator | 0:bb348c97df44 | 86 | * cbGATT_ERROR_CODE on failure |
lypinator | 0:bb348c97df44 | 87 | * @param startGroupHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 88 | * @param endGroupHandle End handle of the service |
lypinator | 0:bb348c97df44 | 89 | * @param pUuid Pointer to UUID of the service |
lypinator | 0:bb348c97df44 | 90 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 91 | */ |
lypinator | 0:bb348c97df44 | 92 | typedef cb_boolean (*cbGATT_DiscoverAllSecondaryServicesCnf)( |
lypinator | 0:bb348c97df44 | 93 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 94 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 95 | cb_uint16 startGroupHandle, |
lypinator | 0:bb348c97df44 | 96 | cb_uint16 endGroupHandle, |
lypinator | 0:bb348c97df44 | 97 | cbGATT_Uuid* pUuid); |
lypinator | 0:bb348c97df44 | 98 | |
lypinator | 0:bb348c97df44 | 99 | /** |
lypinator | 0:bb348c97df44 | 100 | * Callback for discover all primary services by UUID. This callback will be |
lypinator | 0:bb348c97df44 | 101 | * called for each primary service found. |
lypinator | 0:bb348c97df44 | 102 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 103 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 104 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 105 | * when search is finished. |
lypinator | 0:bb348c97df44 | 106 | * cbGATT_ERROR_CODE_* on failure |
lypinator | 0:bb348c97df44 | 107 | * @param startGroupHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 108 | * @param endGroupHandle End handle of the service |
lypinator | 0:bb348c97df44 | 109 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 110 | */ |
lypinator | 0:bb348c97df44 | 111 | typedef cb_boolean (*cbGATT_DiscoverPrimaryServiceByUuidCnf)( |
lypinator | 0:bb348c97df44 | 112 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 113 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 114 | cb_uint16 startHandle, |
lypinator | 0:bb348c97df44 | 115 | cb_uint16 endHandle); |
lypinator | 0:bb348c97df44 | 116 | |
lypinator | 0:bb348c97df44 | 117 | /** |
lypinator | 0:bb348c97df44 | 118 | * Callback for find included services. This callback will be called |
lypinator | 0:bb348c97df44 | 119 | * for each service found. |
lypinator | 0:bb348c97df44 | 120 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 121 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 122 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 123 | * when search is finished. |
lypinator | 0:bb348c97df44 | 124 | * cbGATT_ERROR_CODE_* on failure |
lypinator | 0:bb348c97df44 | 125 | * @param startGroupHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 126 | * @param endGroupHandle End handle of the service |
lypinator | 0:bb348c97df44 | 127 | * @param pUuid Pointer to UUID of the service |
lypinator | 0:bb348c97df44 | 128 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 129 | */ |
lypinator | 0:bb348c97df44 | 130 | typedef cb_boolean (*cbGATT_FindIncludedServicesCnf)( |
lypinator | 0:bb348c97df44 | 131 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 132 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 133 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 134 | cb_uint16 startGroupHandle, |
lypinator | 0:bb348c97df44 | 135 | cb_uint16 endGroupHandle, |
lypinator | 0:bb348c97df44 | 136 | cbGATT_Uuid* pUuid); |
lypinator | 0:bb348c97df44 | 137 | |
lypinator | 0:bb348c97df44 | 138 | /** |
lypinator | 0:bb348c97df44 | 139 | * Callback for discover all characteristics of service. This callback will |
lypinator | 0:bb348c97df44 | 140 | * be called for each characteristic found. |
lypinator | 0:bb348c97df44 | 141 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 142 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 143 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 144 | * when search is finished. |
lypinator | 0:bb348c97df44 | 145 | * cbGATT_ERROR_CODE_* on failure |
lypinator | 0:bb348c97df44 | 146 | * @param attrHandle Attribute handle of the characteristic |
lypinator | 0:bb348c97df44 | 147 | * @param properties Bitmap of properties of the characteristic. |
lypinator | 0:bb348c97df44 | 148 | * See cbGATT_PROP_*. |
lypinator | 0:bb348c97df44 | 149 | * @param valueHandle Attribute handle of the characteristic value. |
lypinator | 0:bb348c97df44 | 150 | * This is where the actual data is located. |
lypinator | 0:bb348c97df44 | 151 | * @param pUuid Pointer to UUID of the characteristic |
lypinator | 0:bb348c97df44 | 152 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 153 | */ |
lypinator | 0:bb348c97df44 | 154 | typedef cb_boolean (*cbGATT_DiscoverAllCharacteristicsOfServiceCnf)( |
lypinator | 0:bb348c97df44 | 155 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 156 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 157 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 158 | cb_uint8 properties, |
lypinator | 0:bb348c97df44 | 159 | cb_uint16 valueHandle, |
lypinator | 0:bb348c97df44 | 160 | cbGATT_Uuid* pUuid); |
lypinator | 0:bb348c97df44 | 161 | |
lypinator | 0:bb348c97df44 | 162 | /** |
lypinator | 0:bb348c97df44 | 163 | * Callback for discover all descriptors of a characteristic. This callback |
lypinator | 0:bb348c97df44 | 164 | * will be called for each descriptor found. |
lypinator | 0:bb348c97df44 | 165 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 166 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 167 | * cbGATT_ERROR_CODE_ATTRIBUTE_NOT_FOUND as last callback |
lypinator | 0:bb348c97df44 | 168 | * when search is finished. |
lypinator | 0:bb348c97df44 | 169 | * cbGATT_ERROR_CODE_* on failure |
lypinator | 0:bb348c97df44 | 170 | * @param charAttrHandle Attribute handle of the characteristic |
lypinator | 0:bb348c97df44 | 171 | * @param attrHandle Attribute handle of the characteristic descriptor. |
lypinator | 0:bb348c97df44 | 172 | * @param pUuid Pointer to UUID of the descriptor |
lypinator | 0:bb348c97df44 | 173 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 174 | */ |
lypinator | 0:bb348c97df44 | 175 | typedef cb_boolean (*cbGATT_DiscoverAllCharacteristicDescriptorsCnf)( |
lypinator | 0:bb348c97df44 | 176 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 177 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 178 | cb_uint16 charAttrHandle, |
lypinator | 0:bb348c97df44 | 179 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 180 | cbGATT_Uuid* pUuid); |
lypinator | 0:bb348c97df44 | 181 | |
lypinator | 0:bb348c97df44 | 182 | /** |
lypinator | 0:bb348c97df44 | 183 | * Callback for read characteristic. This callback will be called for each |
lypinator | 0:bb348c97df44 | 184 | * data chunk read. |
lypinator | 0:bb348c97df44 | 185 | * The last callback will contain either an error code or moreToRead = FALSE |
lypinator | 0:bb348c97df44 | 186 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 187 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 188 | * @param attrHandle Attribute handle of the characteristic |
lypinator | 0:bb348c97df44 | 189 | * @param pAttrValue Pointer to the read data chunk. |
lypinator | 0:bb348c97df44 | 190 | * @param length Length of the read data chunk |
lypinator | 0:bb348c97df44 | 191 | * @param moreToRead TRUE = more data to read from the characteristic |
lypinator | 0:bb348c97df44 | 192 | * FALSE = no more data to read |
lypinator | 0:bb348c97df44 | 193 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 194 | */ |
lypinator | 0:bb348c97df44 | 195 | typedef cb_boolean (*cbGATT_ReadCharacteristicCnf)( |
lypinator | 0:bb348c97df44 | 196 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 197 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 198 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 199 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 200 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 201 | cb_boolean moreToRead); |
lypinator | 0:bb348c97df44 | 202 | |
lypinator | 0:bb348c97df44 | 203 | /** |
lypinator | 0:bb348c97df44 | 204 | * Callback for read characteristic by UUID. This callback will be called |
lypinator | 0:bb348c97df44 | 205 | * for each data chunk read. |
lypinator | 0:bb348c97df44 | 206 | * The last callback will contain either an error code or moreToRead = FALSE |
lypinator | 0:bb348c97df44 | 207 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 208 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 209 | * @param attrHandle Attribute handle of the characteristic |
lypinator | 0:bb348c97df44 | 210 | * @param pAttrValue Pointer to the read data chunk. |
lypinator | 0:bb348c97df44 | 211 | * @param length Length of the read data chunk |
lypinator | 0:bb348c97df44 | 212 | * @param moreToRead TRUE = more data to read from the characteristic |
lypinator | 0:bb348c97df44 | 213 | * FALSE = no more data to read |
lypinator | 0:bb348c97df44 | 214 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 215 | */ |
lypinator | 0:bb348c97df44 | 216 | typedef cb_boolean (*cbGATT_ReadCharacteristicByUuidCnf)( |
lypinator | 0:bb348c97df44 | 217 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 218 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 219 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 220 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 221 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 222 | cb_boolean moreToRead); |
lypinator | 0:bb348c97df44 | 223 | |
lypinator | 0:bb348c97df44 | 224 | // TODO to have or not?? |
lypinator | 0:bb348c97df44 | 225 | typedef void (*cbGATT_ReadLongCharacteristicCnf)( |
lypinator | 0:bb348c97df44 | 226 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 227 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 228 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 229 | cb_uint16 length); |
lypinator | 0:bb348c97df44 | 230 | |
lypinator | 0:bb348c97df44 | 231 | /** |
lypinator | 0:bb348c97df44 | 232 | * Callback for read multiple characteristics. This callback will be called |
lypinator | 0:bb348c97df44 | 233 | * for each data chunk read. |
lypinator | 0:bb348c97df44 | 234 | * The last callback will contain either an error code or moreToRead = FALSE |
lypinator | 0:bb348c97df44 | 235 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 236 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 237 | * @param pAttrValues Pointer to the read data chunk. |
lypinator | 0:bb348c97df44 | 238 | * @param length Length of the read data chunk |
lypinator | 0:bb348c97df44 | 239 | * @param moreToRead TRUE = more data to read from the characteristic(s) |
lypinator | 0:bb348c97df44 | 240 | * FALSE = no more data to read |
lypinator | 0:bb348c97df44 | 241 | * @return TRUE to continue or FALSE to interrupt the search. |
lypinator | 0:bb348c97df44 | 242 | */ |
lypinator | 0:bb348c97df44 | 243 | typedef cb_boolean (*cbGATT_ReadMultipleCharacteristicCnf)( |
lypinator | 0:bb348c97df44 | 244 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 245 | cbGATT_ErrorCode errorCode, |
lypinator | 0:bb348c97df44 | 246 | cb_uint8* pAttrValues, |
lypinator | 0:bb348c97df44 | 247 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 248 | cb_boolean moreToRead); |
lypinator | 0:bb348c97df44 | 249 | |
lypinator | 0:bb348c97df44 | 250 | /** |
lypinator | 0:bb348c97df44 | 251 | * Callback for write characteristic with response from the remote side |
lypinator | 0:bb348c97df44 | 252 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 253 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 254 | */ |
lypinator | 0:bb348c97df44 | 255 | typedef void (*cbGATT_WriteCharacteristicCnf)( |
lypinator | 0:bb348c97df44 | 256 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 257 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 258 | |
lypinator | 0:bb348c97df44 | 259 | /** |
lypinator | 0:bb348c97df44 | 260 | * Callback for write characteristic with no response from the remote side |
lypinator | 0:bb348c97df44 | 261 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 262 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 263 | */ |
lypinator | 0:bb348c97df44 | 264 | typedef void (*cbGATT_WriteCharacteristicNoRspCnf)( |
lypinator | 0:bb348c97df44 | 265 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 266 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 267 | |
lypinator | 0:bb348c97df44 | 268 | /** |
lypinator | 0:bb348c97df44 | 269 | * Callback for write characteristic configuration with response from the |
lypinator | 0:bb348c97df44 | 270 | * remote side. |
lypinator | 0:bb348c97df44 | 271 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 272 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 273 | */ |
lypinator | 0:bb348c97df44 | 274 | typedef void (*cbGATT_WriteCharacteristicConfigCnf)( |
lypinator | 0:bb348c97df44 | 275 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 276 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 277 | |
lypinator | 0:bb348c97df44 | 278 | /** |
lypinator | 0:bb348c97df44 | 279 | * Callback for write long characteristic with response from the |
lypinator | 0:bb348c97df44 | 280 | * remote side. |
lypinator | 0:bb348c97df44 | 281 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 282 | * @param errorCode Error code, cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 283 | */ |
lypinator | 0:bb348c97df44 | 284 | typedef void (*cbGATT_WriteLongCharacteristicCnf)( |
lypinator | 0:bb348c97df44 | 285 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 286 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 287 | |
lypinator | 0:bb348c97df44 | 288 | /** |
lypinator | 0:bb348c97df44 | 289 | * Callback for receiving value indication. The client configuration |
lypinator | 0:bb348c97df44 | 290 | * notifications must have been enabled before this will be sent to the app. |
lypinator | 0:bb348c97df44 | 291 | * Note that the indication is replied by GATT when exiting the callback. |
lypinator | 0:bb348c97df44 | 292 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 293 | * @param attrHandle Attribute handle of the indicated value |
lypinator | 0:bb348c97df44 | 294 | * @param pAttrValue Pointer to the value data |
lypinator | 0:bb348c97df44 | 295 | * @param length Length of the value data |
lypinator | 0:bb348c97df44 | 296 | */ |
lypinator | 0:bb348c97df44 | 297 | typedef void (*cbGATT_CharacteristicValueIndication)( |
lypinator | 0:bb348c97df44 | 298 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 299 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 300 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 301 | cb_uint16 length); |
lypinator | 0:bb348c97df44 | 302 | |
lypinator | 0:bb348c97df44 | 303 | /** |
lypinator | 0:bb348c97df44 | 304 | * Callback for receiving value notification. The client configuration |
lypinator | 0:bb348c97df44 | 305 | * notifications must have been enabled before this will be sent to the app. |
lypinator | 0:bb348c97df44 | 306 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 307 | * @param attrHandle Attribute handle of the notified value |
lypinator | 0:bb348c97df44 | 308 | * @param pAttrValue Pointer to the value data |
lypinator | 0:bb348c97df44 | 309 | * @param length Length of the value data |
lypinator | 0:bb348c97df44 | 310 | */ |
lypinator | 0:bb348c97df44 | 311 | typedef void (*cbGATT_CharacteristicValueNotification)( |
lypinator | 0:bb348c97df44 | 312 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 313 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 314 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 315 | cb_uint16 length); |
lypinator | 0:bb348c97df44 | 316 | |
lypinator | 0:bb348c97df44 | 317 | typedef struct |
lypinator | 0:bb348c97df44 | 318 | { |
lypinator | 0:bb348c97df44 | 319 | cbGATT_ConnComplEvt connComplEvt; |
lypinator | 0:bb348c97df44 | 320 | cbGATT_DisconnectEvt disconnectEvt; |
lypinator | 0:bb348c97df44 | 321 | cbGATT_DiscoverAllPrimaryServicesCnf discoverAllPrimaryServicesCnf; |
lypinator | 0:bb348c97df44 | 322 | cbGATT_DiscoverAllSecondaryServicesCnf discoverAllSecondaryServicesCnf; |
lypinator | 0:bb348c97df44 | 323 | cbGATT_DiscoverPrimaryServiceByUuidCnf discoverPrimaryServiceByUuidCnf; |
lypinator | 0:bb348c97df44 | 324 | cbGATT_FindIncludedServicesCnf findIncludedServicesCnf; |
lypinator | 0:bb348c97df44 | 325 | cbGATT_DiscoverAllCharacteristicsOfServiceCnf discoverAllCharacteristicsOfServiceCnf; |
lypinator | 0:bb348c97df44 | 326 | cbGATT_DiscoverAllCharacteristicDescriptorsCnf discoverAllCharacteristicDescriptorsCnf; |
lypinator | 0:bb348c97df44 | 327 | cbGATT_ReadCharacteristicCnf readCharacteristicCnf; |
lypinator | 0:bb348c97df44 | 328 | cbGATT_ReadCharacteristicByUuidCnf readCharacteristicByUuidCnf; |
lypinator | 0:bb348c97df44 | 329 | cbGATT_ReadLongCharacteristicCnf readLongCharacteristicCnf; |
lypinator | 0:bb348c97df44 | 330 | cbGATT_ReadMultipleCharacteristicCnf readMultipleCharacteristicCnf; |
lypinator | 0:bb348c97df44 | 331 | cbGATT_WriteCharacteristicCnf writeCharacteristicCnf; |
lypinator | 0:bb348c97df44 | 332 | cbGATT_WriteCharacteristicNoRspCnf writeCharacteristicNoRspCnf; |
lypinator | 0:bb348c97df44 | 333 | cbGATT_WriteCharacteristicConfigCnf writeCharacteristicConfigCnf; |
lypinator | 0:bb348c97df44 | 334 | cbGATT_WriteLongCharacteristicCnf writeLongCharacteristicCnf; |
lypinator | 0:bb348c97df44 | 335 | } cbGATT_ClientCallBack; |
lypinator | 0:bb348c97df44 | 336 | |
lypinator | 0:bb348c97df44 | 337 | |
lypinator | 0:bb348c97df44 | 338 | typedef struct |
lypinator | 0:bb348c97df44 | 339 | { |
lypinator | 0:bb348c97df44 | 340 | cbGATT_CharacteristicValueIndication characteristicValueIndication; |
lypinator | 0:bb348c97df44 | 341 | cbGATT_CharacteristicValueNotification characteristicValueNotification; |
lypinator | 0:bb348c97df44 | 342 | } cbGATT_ClientNotIndCallBack; |
lypinator | 0:bb348c97df44 | 343 | |
lypinator | 0:bb348c97df44 | 344 | /*============================================================================= |
lypinator | 0:bb348c97df44 | 345 | * EXPORTED FUNCTIONS |
lypinator | 0:bb348c97df44 | 346 | *============================================================================= |
lypinator | 0:bb348c97df44 | 347 | */ |
lypinator | 0:bb348c97df44 | 348 | |
lypinator | 0:bb348c97df44 | 349 | /** |
lypinator | 0:bb348c97df44 | 350 | * Register a GATT client. This must be done before any GATT client |
lypinator | 0:bb348c97df44 | 351 | * functionality can be used. |
lypinator | 0:bb348c97df44 | 352 | * @param pCallBack Callback structure that should be provided by the app. Use |
lypinator | 0:bb348c97df44 | 353 | * NULL as pointer for callbacks that are not used. |
lypinator | 0:bb348c97df44 | 354 | * @param pAppHandle Pointer where to put created app handle |
lypinator | 0:bb348c97df44 | 355 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 356 | */ |
lypinator | 0:bb348c97df44 | 357 | cb_int32 cbGATT_registerClient( |
lypinator | 0:bb348c97df44 | 358 | const cbGATT_ClientCallBack* pCallBack, |
lypinator | 0:bb348c97df44 | 359 | cb_uint8* pAppHandle); |
lypinator | 0:bb348c97df44 | 360 | |
lypinator | 0:bb348c97df44 | 361 | /** |
lypinator | 0:bb348c97df44 | 362 | * Register a notification/indication handler for an attribute handle |
lypinator | 0:bb348c97df44 | 363 | * This is used when the application needs a specific handler for an |
lypinator | 0:bb348c97df44 | 364 | * attribute. This can be done first after connection setup. |
lypinator | 0:bb348c97df44 | 365 | * @param pCallBack Callback structure that should be provided by the app. Use |
lypinator | 0:bb348c97df44 | 366 | * NULL as pointer for callbacks that are not used. |
lypinator | 0:bb348c97df44 | 367 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 368 | * @param attrHandle Attribute handle for the notification/indication to |
lypinator | 0:bb348c97df44 | 369 | * subscribe on. |
lypinator | 0:bb348c97df44 | 370 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 371 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 372 | */ |
lypinator | 0:bb348c97df44 | 373 | cb_int32 cbGATT_registerNotIndHandler( |
lypinator | 0:bb348c97df44 | 374 | const cbGATT_ClientNotIndCallBack* pCallBack, |
lypinator | 0:bb348c97df44 | 375 | cb_uint8 appHandle, |
lypinator | 0:bb348c97df44 | 376 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 377 | TConnHandle connHandle); |
lypinator | 0:bb348c97df44 | 378 | |
lypinator | 0:bb348c97df44 | 379 | /** |
lypinator | 0:bb348c97df44 | 380 | * De-register a notification/indication handler. This is used when the |
lypinator | 0:bb348c97df44 | 381 | * app does not want to subscribe to the attribute handle any longer e.g. |
lypinator | 0:bb348c97df44 | 382 | * the client characteristic configuration has been disabled. The handler is |
lypinator | 0:bb348c97df44 | 383 | * automatically de-registered on disconnection. |
lypinator | 0:bb348c97df44 | 384 | * @param pCallBack Registered callback. |
lypinator | 0:bb348c97df44 | 385 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 386 | * @param attrHandle Attribute handle for the notification/indication to |
lypinator | 0:bb348c97df44 | 387 | * subscribe on. |
lypinator | 0:bb348c97df44 | 388 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 389 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 390 | */ |
lypinator | 0:bb348c97df44 | 391 | cb_int32 cbGATT_deregisterNotIndHandler( |
lypinator | 0:bb348c97df44 | 392 | const cbGATT_ClientNotIndCallBack* pCallBack, |
lypinator | 0:bb348c97df44 | 393 | cb_uint8 appHandle, |
lypinator | 0:bb348c97df44 | 394 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 395 | TConnHandle connHandle); |
lypinator | 0:bb348c97df44 | 396 | |
lypinator | 0:bb348c97df44 | 397 | /** |
lypinator | 0:bb348c97df44 | 398 | * Register a default notification/indication handler. This is used when the |
lypinator | 0:bb348c97df44 | 399 | * app wants to subscribe to all attribute handles notifications/indications |
lypinator | 0:bb348c97df44 | 400 | * for all connections. This can only be used by one app at a time. |
lypinator | 0:bb348c97df44 | 401 | * @param pCallBack Callback structure that should be provided by the app. Use |
lypinator | 0:bb348c97df44 | 402 | * NULL as pointer for callbacks that are not used. |
lypinator | 0:bb348c97df44 | 403 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 404 | */ |
lypinator | 0:bb348c97df44 | 405 | cb_int32 cbGATT_registerDefaultNotIndHandler( |
lypinator | 0:bb348c97df44 | 406 | const cbGATT_ClientNotIndCallBack* pCallBack); |
lypinator | 0:bb348c97df44 | 407 | |
lypinator | 0:bb348c97df44 | 408 | /** |
lypinator | 0:bb348c97df44 | 409 | * Discover all primary services. Results will be provided in the |
lypinator | 0:bb348c97df44 | 410 | * cbGATT_DiscoverAllPrimaryServicesCnf callback. |
lypinator | 0:bb348c97df44 | 411 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 412 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 413 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 414 | */ |
lypinator | 0:bb348c97df44 | 415 | cb_int32 cbGATT_discoverAllPrimaryServices( |
lypinator | 0:bb348c97df44 | 416 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 417 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 418 | |
lypinator | 0:bb348c97df44 | 419 | /** |
lypinator | 0:bb348c97df44 | 420 | * Discover all secondary services. Results will be provided in the |
lypinator | 0:bb348c97df44 | 421 | * cbGATT_DiscoverAllSecondaryServicesCnf callback. |
lypinator | 0:bb348c97df44 | 422 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 423 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 424 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 425 | */ |
lypinator | 0:bb348c97df44 | 426 | cb_int32 cbGATT_discoverAllSecondaryServices( |
lypinator | 0:bb348c97df44 | 427 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 428 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 429 | |
lypinator | 0:bb348c97df44 | 430 | /** |
lypinator | 0:bb348c97df44 | 431 | * Discover all primary services by UUID. This will filter out all results |
lypinator | 0:bb348c97df44 | 432 | * based on the UUID. Results will be provided in the |
lypinator | 0:bb348c97df44 | 433 | * cbGATT_DiscoverPrimaryServiceByUuidCnf callback. |
lypinator | 0:bb348c97df44 | 434 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 435 | * @param pUuid Pointer to the 16 or 128 bits UUID to search for |
lypinator | 0:bb348c97df44 | 436 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 437 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 438 | */ |
lypinator | 0:bb348c97df44 | 439 | cb_int32 cbGATT_discoverPrimaryServiceByUuid( |
lypinator | 0:bb348c97df44 | 440 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 441 | cbGATT_Uuid* pUuid, |
lypinator | 0:bb348c97df44 | 442 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 443 | |
lypinator | 0:bb348c97df44 | 444 | /** |
lypinator | 0:bb348c97df44 | 445 | * Discover all characteristics of a service. The handles can be |
lypinator | 0:bb348c97df44 | 446 | * retrieved by doing a discover primary/secondary services request. Results |
lypinator | 0:bb348c97df44 | 447 | * will be provided in the cbGATT_DiscoverAllCharacteristicsOfServiceCnf |
lypinator | 0:bb348c97df44 | 448 | * callback. |
lypinator | 0:bb348c97df44 | 449 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 450 | * @param startHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 451 | * @param endHandle End handle of the service |
lypinator | 0:bb348c97df44 | 452 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 453 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 454 | */ |
lypinator | 0:bb348c97df44 | 455 | cb_int32 cbGATT_discoverAllCharacteristicsOfService( |
lypinator | 0:bb348c97df44 | 456 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 457 | cb_uint16 startHandle, |
lypinator | 0:bb348c97df44 | 458 | cb_uint16 endHandle, |
lypinator | 0:bb348c97df44 | 459 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 460 | |
lypinator | 0:bb348c97df44 | 461 | /** |
lypinator | 0:bb348c97df44 | 462 | * Find included services of a given service. The handles can be |
lypinator | 0:bb348c97df44 | 463 | * retrieved by doing a discover primary/secondary services request. Results |
lypinator | 0:bb348c97df44 | 464 | * will be provided in the cbGATT_FindIncludedServicesCnf callback. |
lypinator | 0:bb348c97df44 | 465 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 466 | * @param startHandle Start handle of the service |
lypinator | 0:bb348c97df44 | 467 | * @param endHandle End handle of the service |
lypinator | 0:bb348c97df44 | 468 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 469 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 470 | */ |
lypinator | 0:bb348c97df44 | 471 | cb_int32 cbGATT_findIncludedServices( |
lypinator | 0:bb348c97df44 | 472 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 473 | cb_uint16 startHandle, |
lypinator | 0:bb348c97df44 | 474 | cb_uint16 endHandle, |
lypinator | 0:bb348c97df44 | 475 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 476 | |
lypinator | 0:bb348c97df44 | 477 | /** |
lypinator | 0:bb348c97df44 | 478 | * Discover all descriptors of a characteristic. The handles can be |
lypinator | 0:bb348c97df44 | 479 | * retrieved by doing a cbGATT_discoverAllCharacteristicsOfService. Results |
lypinator | 0:bb348c97df44 | 480 | * will be provided in the cbGATT_DiscoverAllCharacteristicDescriptorsCnf. |
lypinator | 0:bb348c97df44 | 481 | * callback. If the app wants to do a discover characteristics by UUID this |
lypinator | 0:bb348c97df44 | 482 | * function can be used and in the callback filter on UUID. |
lypinator | 0:bb348c97df44 | 483 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 484 | * @param valueHandle Handle of the characteristic value |
lypinator | 0:bb348c97df44 | 485 | * @param serviceEndHandle End handle of the service which the characteristic |
lypinator | 0:bb348c97df44 | 486 | * belongs to. |
lypinator | 0:bb348c97df44 | 487 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 488 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 489 | */ |
lypinator | 0:bb348c97df44 | 490 | cb_int32 cbGATT_discoverAllCharacteristicDescriptors( |
lypinator | 0:bb348c97df44 | 491 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 492 | cb_uint16 valueHandle, |
lypinator | 0:bb348c97df44 | 493 | cb_uint16 serviceEndHandle, |
lypinator | 0:bb348c97df44 | 494 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 495 | |
lypinator | 0:bb348c97df44 | 496 | /** |
lypinator | 0:bb348c97df44 | 497 | * Read characteristic/descriptor value. The handles can be retrieved by |
lypinator | 0:bb348c97df44 | 498 | * doing a cbGATT_discoverAllCharacteristicsOfService or |
lypinator | 0:bb348c97df44 | 499 | * cbGATT_discoverAllCharacteristicDescriptors. Results will be provided in |
lypinator | 0:bb348c97df44 | 500 | * the cbGATT_ReadCharacteristicCnf callback. |
lypinator | 0:bb348c97df44 | 501 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 502 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 503 | * @param offset Offset where to start read from |
lypinator | 0:bb348c97df44 | 504 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 505 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 506 | */ |
lypinator | 0:bb348c97df44 | 507 | cb_int32 cbGATT_readCharacteristic( |
lypinator | 0:bb348c97df44 | 508 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 509 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 510 | cb_uint16 offset, |
lypinator | 0:bb348c97df44 | 511 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 512 | |
lypinator | 0:bb348c97df44 | 513 | /** |
lypinator | 0:bb348c97df44 | 514 | * Read characteristic/descriptor value by UUID. The app can search the whole |
lypinator | 0:bb348c97df44 | 515 | * database by using cbGATT_MIN_ATTR_HANDLE and cbGATT_MAX_ATTR_HANDLE. |
lypinator | 0:bb348c97df44 | 516 | * Results will be provided in the cbGATT_ReadCharacteristicByUuidCnf |
lypinator | 0:bb348c97df44 | 517 | * callback. |
lypinator | 0:bb348c97df44 | 518 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 519 | * @param startHandle Handle, where to start looking for the UUID |
lypinator | 0:bb348c97df44 | 520 | * @param endHandle Handle, where to stop looking for the UUID |
lypinator | 0:bb348c97df44 | 521 | * @param pUuid Pointer to the 16 or 128 bits UUID |
lypinator | 0:bb348c97df44 | 522 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 523 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 524 | */ |
lypinator | 0:bb348c97df44 | 525 | cb_int32 cbGATT_readCharacteristicByUuid( |
lypinator | 0:bb348c97df44 | 526 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 527 | cb_uint16 startHandle, |
lypinator | 0:bb348c97df44 | 528 | cb_uint16 endHandle, |
lypinator | 0:bb348c97df44 | 529 | cbGATT_Uuid* pUuid, |
lypinator | 0:bb348c97df44 | 530 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 531 | |
lypinator | 0:bb348c97df44 | 532 | // Used for reading long characteristics value or descriptor |
lypinator | 0:bb348c97df44 | 533 | // TODO is this function necessary, because cbGATT_readCharacteristic will read long if needed |
lypinator | 0:bb348c97df44 | 534 | cb_int32 cbGATT_readLongCharacteristic( |
lypinator | 0:bb348c97df44 | 535 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 536 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 537 | cb_uint8* pDest, |
lypinator | 0:bb348c97df44 | 538 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 539 | |
lypinator | 0:bb348c97df44 | 540 | |
lypinator | 0:bb348c97df44 | 541 | /** |
lypinator | 0:bb348c97df44 | 542 | * Read multiple characteristics in a single read. The app must know the |
lypinator | 0:bb348c97df44 | 543 | * length of each data element in the returned list. Therefore only the last |
lypinator | 0:bb348c97df44 | 544 | * data element may have a variable length. |
lypinator | 0:bb348c97df44 | 545 | * Results will be provided in the cbGATT_ReadMultipleCharacteristicCnf |
lypinator | 0:bb348c97df44 | 546 | * callback. |
lypinator | 0:bb348c97df44 | 547 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 548 | * @param pAttrHandleList Pointer to a list of attribute handles |
lypinator | 0:bb348c97df44 | 549 | * @param nbrOfHandles Number of attribute handles in pAttrHandleList |
lypinator | 0:bb348c97df44 | 550 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 551 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 552 | */ |
lypinator | 0:bb348c97df44 | 553 | cb_int32 cbGATT_readMultipleCharacteristic( |
lypinator | 0:bb348c97df44 | 554 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 555 | cb_uint16* pAttrHandleList, |
lypinator | 0:bb348c97df44 | 556 | cb_uint16 nbrOfHandles, |
lypinator | 0:bb348c97df44 | 557 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 558 | |
lypinator | 0:bb348c97df44 | 559 | /** |
lypinator | 0:bb348c97df44 | 560 | * Write characteristic/descriptor and wait for response from remote side. |
lypinator | 0:bb348c97df44 | 561 | * Results will be provided in the cbGATT_WriteCharacteristicCnf |
lypinator | 0:bb348c97df44 | 562 | * callback. |
lypinator | 0:bb348c97df44 | 563 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 564 | * @param attrHandle Attribute handle of the value |
lypinator | 0:bb348c97df44 | 565 | * @param pData Pointer to the data byte sequence |
lypinator | 0:bb348c97df44 | 566 | * @param length Number of bytes to write |
lypinator | 0:bb348c97df44 | 567 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 568 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 569 | */ |
lypinator | 0:bb348c97df44 | 570 | cb_int32 cbGATT_writeCharacteristic( |
lypinator | 0:bb348c97df44 | 571 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 572 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 573 | cb_uint8* pData, |
lypinator | 0:bb348c97df44 | 574 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 575 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 576 | |
lypinator | 0:bb348c97df44 | 577 | /** |
lypinator | 0:bb348c97df44 | 578 | * Write client/server characteristic/descriptor configuration. |
lypinator | 0:bb348c97df44 | 579 | * cbGATT_writeCharacteristic can also be used instead of this function. |
lypinator | 0:bb348c97df44 | 580 | * Results will be provided in the cbGATT_WriteCharacteristicConfigCnf |
lypinator | 0:bb348c97df44 | 581 | * callback. |
lypinator | 0:bb348c97df44 | 582 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 583 | * @param attrHandle Attribute handle of the value |
lypinator | 0:bb348c97df44 | 584 | * @param config Configuration i.e. cbGATT_CLIENT_CFG_* or |
lypinator | 0:bb348c97df44 | 585 | * cbGATT_SERVER_CFG_* |
lypinator | 0:bb348c97df44 | 586 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 587 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 588 | */ |
lypinator | 0:bb348c97df44 | 589 | cb_int32 cbGATT_writeCharacteristicConfig( |
lypinator | 0:bb348c97df44 | 590 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 591 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 592 | cb_uint16 config, |
lypinator | 0:bb348c97df44 | 593 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 594 | |
lypinator | 0:bb348c97df44 | 595 | /** |
lypinator | 0:bb348c97df44 | 596 | * Write characteristic/descriptor with no response from remote side. |
lypinator | 0:bb348c97df44 | 597 | * Results will be provided in the cbGATT_WriteCharacteristicNoRspCnf |
lypinator | 0:bb348c97df44 | 598 | * callback. |
lypinator | 0:bb348c97df44 | 599 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 600 | * @param attrHandle Attribute handle of the value |
lypinator | 0:bb348c97df44 | 601 | * @param pData Pointer to the data byte sequence |
lypinator | 0:bb348c97df44 | 602 | * @param length Number of bytes to write |
lypinator | 0:bb348c97df44 | 603 | * @param pSignature Pointer to encrypted signature which is checked by the |
lypinator | 0:bb348c97df44 | 604 | * server. If the check fails the write is discarded. |
lypinator | 0:bb348c97df44 | 605 | * The devices must be bonded and CSRK exchanged. Use NULL |
lypinator | 0:bb348c97df44 | 606 | * when no signature is being used. |
lypinator | 0:bb348c97df44 | 607 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 608 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 609 | */ |
lypinator | 0:bb348c97df44 | 610 | cb_int32 cbGATT_writeCharacteristicNoRsp( |
lypinator | 0:bb348c97df44 | 611 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 612 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 613 | cb_uint8* pData, |
lypinator | 0:bb348c97df44 | 614 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 615 | cb_uint8* pSignature, |
lypinator | 0:bb348c97df44 | 616 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 617 | |
lypinator | 0:bb348c97df44 | 618 | /** |
lypinator | 0:bb348c97df44 | 619 | * Write long characteristic/descriptor and wait for response from remote |
lypinator | 0:bb348c97df44 | 620 | * side. Results will be provided in the cbGATT_WriteLongCharacteristicCnf |
lypinator | 0:bb348c97df44 | 621 | * callback. |
lypinator | 0:bb348c97df44 | 622 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 623 | * @param attrHandle Attribute handle of the value |
lypinator | 0:bb348c97df44 | 624 | * @param pData Pointer to the data byte sequence |
lypinator | 0:bb348c97df44 | 625 | * @param length Number of bytes to write |
lypinator | 0:bb348c97df44 | 626 | * @param reliable TRUE = the data will be sent back to client and |
lypinator | 0:bb348c97df44 | 627 | * checked by GATT. |
lypinator | 0:bb348c97df44 | 628 | * FALSE = no check of data |
lypinator | 0:bb348c97df44 | 629 | * @param flag Flag which is used when sending several packets |
lypinator | 0:bb348c97df44 | 630 | * or when data is canceled. If sending several packets all |
lypinator | 0:bb348c97df44 | 631 | * but the last packet should set the flag to more data. |
lypinator | 0:bb348c97df44 | 632 | * The last data packet should set the flag to final. |
lypinator | 0:bb348c97df44 | 633 | * @param offset Offset of the data to write. Is used when several packets |
lypinator | 0:bb348c97df44 | 634 | * need to be sent to write a complete data value. |
lypinator | 0:bb348c97df44 | 635 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 636 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 637 | */ |
lypinator | 0:bb348c97df44 | 638 | cb_int32 cbGATT_writeLongCharacteristic( |
lypinator | 0:bb348c97df44 | 639 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 640 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 641 | cb_uint8* pData, |
lypinator | 0:bb348c97df44 | 642 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 643 | cb_boolean reliable, |
lypinator | 0:bb348c97df44 | 644 | cbGATT_WriteLongCharFlag flag, |
lypinator | 0:bb348c97df44 | 645 | cb_uint16 offset, |
lypinator | 0:bb348c97df44 | 646 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 647 | |
lypinator | 0:bb348c97df44 | 648 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 649 | } |
lypinator | 0:bb348c97df44 | 650 | #endif |
lypinator | 0:bb348c97df44 | 651 | |
lypinator | 0:bb348c97df44 | 652 | #endif |