Initial commit
mbed-dev-master/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/ublox-odin-w2-drivers/cb_gatt_server.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 | * Copyright (c) 2016, u-blox Malmö, All Rights Reserved |
lypinator | 0:bb348c97df44 | 3 | * SPDX-License-Identifier: LicenseRef-PBL |
lypinator | 0:bb348c97df44 | 4 | * |
lypinator | 0:bb348c97df44 | 5 | * This file and the related binary are licensed under the |
lypinator | 0:bb348c97df44 | 6 | * Permissive Binary License, Version 1.0 (the "License"); |
lypinator | 0:bb348c97df44 | 7 | * you may not use these files except in compliance with the License. |
lypinator | 0:bb348c97df44 | 8 | * |
lypinator | 0:bb348c97df44 | 9 | * You may obtain a copy of the License here: |
lypinator | 0:bb348c97df44 | 10 | * LICENSE-permissive-binary-license-1.0.txt and at |
lypinator | 0:bb348c97df44 | 11 | * https://www.mbed.com/licenses/PBL-1.0 |
lypinator | 0:bb348c97df44 | 12 | * |
lypinator | 0:bb348c97df44 | 13 | * See the License for the specific language governing permissions and |
lypinator | 0:bb348c97df44 | 14 | * limitations under the License. |
lypinator | 0:bb348c97df44 | 15 | *------------------------------------------------------------------------------ |
lypinator | 0:bb348c97df44 | 16 | * Component: GATT |
lypinator | 0:bb348c97df44 | 17 | * File : cb_gatt_server.h |
lypinator | 0:bb348c97df44 | 18 | * |
lypinator | 0:bb348c97df44 | 19 | * Description: |
lypinator | 0:bb348c97df44 | 20 | * GATT server functionality |
lypinator | 0:bb348c97df44 | 21 | *------------------------------------------------------------------------------ |
lypinator | 0:bb348c97df44 | 22 | */ |
lypinator | 0:bb348c97df44 | 23 | |
lypinator | 0:bb348c97df44 | 24 | /** |
lypinator | 0:bb348c97df44 | 25 | * @file cb_gatt_server.h |
lypinator | 0:bb348c97df44 | 26 | * |
lypinator | 0:bb348c97df44 | 27 | * @brief GATT server functionality |
lypinator | 0:bb348c97df44 | 28 | */ |
lypinator | 0:bb348c97df44 | 29 | |
lypinator | 0:bb348c97df44 | 30 | #ifndef _CB_GATT_SERVER_H_ |
lypinator | 0:bb348c97df44 | 31 | #define _CB_GATT_SERVER_H_ |
lypinator | 0:bb348c97df44 | 32 | |
lypinator | 0:bb348c97df44 | 33 | #include "bt_types.h" |
lypinator | 0:bb348c97df44 | 34 | #include "cb_gatt.h" |
lypinator | 0:bb348c97df44 | 35 | |
lypinator | 0:bb348c97df44 | 36 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 37 | extern "C" { |
lypinator | 0:bb348c97df44 | 38 | #endif |
lypinator | 0:bb348c97df44 | 39 | |
lypinator | 0:bb348c97df44 | 40 | /*============================================================================== |
lypinator | 0:bb348c97df44 | 41 | * CONSTANTS |
lypinator | 0:bb348c97df44 | 42 | *============================================================================== |
lypinator | 0:bb348c97df44 | 43 | */ |
lypinator | 0:bb348c97df44 | 44 | |
lypinator | 0:bb348c97df44 | 45 | #define cbGATT_RD_SEC_NONE 0x01 |
lypinator | 0:bb348c97df44 | 46 | #define cbGATT_RD_SEC_UNAUTH 0x02 |
lypinator | 0:bb348c97df44 | 47 | #define cbGATT_RD_SEC_AUTH 0x04 |
lypinator | 0:bb348c97df44 | 48 | #define cbGATT_WR_SEC_NONE 0x10 |
lypinator | 0:bb348c97df44 | 49 | #define cbGATT_WR_SEC_UNAUTH 0x20 |
lypinator | 0:bb348c97df44 | 50 | #define cbGATT_WR_SEC_AUTH 0x40 |
lypinator | 0:bb348c97df44 | 51 | |
lypinator | 0:bb348c97df44 | 52 | #define cbGATT_NBR_OF_ATTR_OF_SERVICE(x) (sizeof(x)/sizeof(cbGATT_Attribute)) |
lypinator | 0:bb348c97df44 | 53 | |
lypinator | 0:bb348c97df44 | 54 | #define cbGATT_APP_START_SERVICE_HANDLE 1024 |
lypinator | 0:bb348c97df44 | 55 | |
lypinator | 0:bb348c97df44 | 56 | /*============================================================================== |
lypinator | 0:bb348c97df44 | 57 | * TYPES |
lypinator | 0:bb348c97df44 | 58 | *============================================================================== |
lypinator | 0:bb348c97df44 | 59 | */ |
lypinator | 0:bb348c97df44 | 60 | |
lypinator | 0:bb348c97df44 | 61 | /** |
lypinator | 0:bb348c97df44 | 62 | * Attribute database entry |
lypinator | 0:bb348c97df44 | 63 | * @param pUuid 16 or 128-bits UUID |
lypinator | 0:bb348c97df44 | 64 | * @param uuidFormat Format of the pUuid |
lypinator | 0:bb348c97df44 | 65 | * @param properties Properties see cbGATT_PROP_* in cb_gatt.h |
lypinator | 0:bb348c97df44 | 66 | * @param security Read/write security properties for this characteristic see cbGATT_WR_SEC_* and cbGATT_RD_SEC_* |
lypinator | 0:bb348c97df44 | 67 | * @param pvValue1 Depends on pUuid, see below |
lypinator | 0:bb348c97df44 | 68 | * cbGATT_CHAR_EXT_PROP - properties as cb_uint32 |
lypinator | 0:bb348c97df44 | 69 | * cbGATT_CLIENT_CHAR_CONFIG - callback that is called when remote device reads the client config, cbGATT_ServerReadClientConfig |
lypinator | 0:bb348c97df44 | 70 | * cbGATT_SERVER_CHAR_CONFIG - callback that is called when remote device reads the server config, cbGATT_ServerReadServerConfig |
lypinator | 0:bb348c97df44 | 71 | * cbGATT_CHAR_FORMAT - Pointer to cbGATT_CharFormat |
lypinator | 0:bb348c97df44 | 72 | * cbGATT_CHAR_USER_DESC and all other CHARACTERISTICS value - cbGATT_ServerReadAttr callback |
lypinator | 0:bb348c97df44 | 73 | * cbGATT_INCLUDE_DECL - Pointer to inlcuded service cbGATT_Attribute |
lypinator | 0:bb348c97df44 | 74 | * @param pvValue2 Depends on pUuid, see below |
lypinator | 0:bb348c97df44 | 75 | * cbGATT_CLIENT_CHAR_CONFIG - callback that is called when remote device writes the client config cbGATT_ServerWriteClientConfig |
lypinator | 0:bb348c97df44 | 76 | * cbGATT_CLIENT_CHAR_CONFIG - callback that is called when remote device writes the client config cbGATT_ServerWriteClientConfig |
lypinator | 0:bb348c97df44 | 77 | * cbGATT_SERVER_CHAR_CONFIG - callback that is called when remote device writes the server config cbGATT_ServerWriteServerConfig |
lypinator | 0:bb348c97df44 | 78 | * cbGATT_CHAR_USER_DESC and all other CHARACTERISTICS value - cbGATT_ServerWriteAttr callback |
lypinator | 0:bb348c97df44 | 79 | * @param pAttrHandle Pointer where to write the attribute handle in case it's needed by the app. |
lypinator | 0:bb348c97df44 | 80 | * If not needed, pass NULL. Will be written after the service has been added. |
lypinator | 0:bb348c97df44 | 81 | */ |
lypinator | 0:bb348c97df44 | 82 | typedef struct |
lypinator | 0:bb348c97df44 | 83 | { |
lypinator | 0:bb348c97df44 | 84 | void* pUuid; |
lypinator | 0:bb348c97df44 | 85 | cbGATT_UuidFormat uuidFormat; |
lypinator | 0:bb348c97df44 | 86 | cb_uint8 properties; |
lypinator | 0:bb348c97df44 | 87 | cb_uint8 security; |
lypinator | 0:bb348c97df44 | 88 | void* pvValue1; |
lypinator | 0:bb348c97df44 | 89 | void* pvValue2; |
lypinator | 0:bb348c97df44 | 90 | cb_uint16* pAttrHandle; |
lypinator | 0:bb348c97df44 | 91 | } cbGATT_Attribute; |
lypinator | 0:bb348c97df44 | 92 | |
lypinator | 0:bb348c97df44 | 93 | /** |
lypinator | 0:bb348c97df44 | 94 | * Callback is called when the indication has been confirmed. |
lypinator | 0:bb348c97df44 | 95 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 96 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 97 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 98 | */ |
lypinator | 0:bb348c97df44 | 99 | typedef void (*cbGATT_CharacteristicValueIndicationCnf)( |
lypinator | 0:bb348c97df44 | 100 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 101 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 102 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 103 | |
lypinator | 0:bb348c97df44 | 104 | /** |
lypinator | 0:bb348c97df44 | 105 | * Callback is called when the notification has been sent. |
lypinator | 0:bb348c97df44 | 106 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 107 | * @param errorCode cbGATT_ERROR_CODE_OK when succeeded |
lypinator | 0:bb348c97df44 | 108 | */ |
lypinator | 0:bb348c97df44 | 109 | typedef void (*cbGATT_CharacteristicValueNotificationCnf)( |
lypinator | 0:bb348c97df44 | 110 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 111 | cbGATT_ErrorCode errorCode); |
lypinator | 0:bb348c97df44 | 112 | |
lypinator | 0:bb348c97df44 | 113 | /** |
lypinator | 0:bb348c97df44 | 114 | * Callback is called when the GATT client has commited a write long |
lypinator | 0:bb348c97df44 | 115 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 116 | * @param commit TRUE = commit, FALSE = cancel |
lypinator | 0:bb348c97df44 | 117 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 118 | */ |
lypinator | 0:bb348c97df44 | 119 | typedef cbGATT_ErrorCode (*cbGATT_CharacteristicWriteLongCommitEvt)( |
lypinator | 0:bb348c97df44 | 120 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 121 | cb_boolean commit); |
lypinator | 0:bb348c97df44 | 122 | |
lypinator | 0:bb348c97df44 | 123 | // Callbacks to use in server table |
lypinator | 0:bb348c97df44 | 124 | |
lypinator | 0:bb348c97df44 | 125 | /** |
lypinator | 0:bb348c97df44 | 126 | * Callback is called when the client is reading an attribute |
lypinator | 0:bb348c97df44 | 127 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 128 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 129 | * @param pAttr Pointer to attribute record |
lypinator | 0:bb348c97df44 | 130 | * @param pAttrValue Pointer where to put the read data |
lypinator | 0:bb348c97df44 | 131 | * @param pLength Pointer where to put the read length. |
lypinator | 0:bb348c97df44 | 132 | * @param maxLength Max number of bytes that is allowed for pAttrValue |
lypinator | 0:bb348c97df44 | 133 | * @param offset The offset of the read data |
lypinator | 0:bb348c97df44 | 134 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 135 | */ |
lypinator | 0:bb348c97df44 | 136 | typedef cbGATT_ErrorCode (*cbGATT_ServerReadAttr)( |
lypinator | 0:bb348c97df44 | 137 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 138 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 139 | cbGATT_Attribute* pAttr, |
lypinator | 0:bb348c97df44 | 140 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 141 | cb_uint16* pLength, |
lypinator | 0:bb348c97df44 | 142 | cb_uint16 maxLength, |
lypinator | 0:bb348c97df44 | 143 | cb_uint16 offset); |
lypinator | 0:bb348c97df44 | 144 | |
lypinator | 0:bb348c97df44 | 145 | /** |
lypinator | 0:bb348c97df44 | 146 | * Callback is called when the client is writing an attribute. |
lypinator | 0:bb348c97df44 | 147 | * If the application wants to send the response later it can |
lypinator | 0:bb348c97df44 | 148 | * return the cbGATT_ERROR_CODE_DELAYED_RSP error code and call cbGATT_writeRsp |
lypinator | 0:bb348c97df44 | 149 | * when ready. |
lypinator | 0:bb348c97df44 | 150 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 151 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 152 | * @param pAttr Pointer to attribute record |
lypinator | 0:bb348c97df44 | 153 | * @param pAttrValue Pointer where to get the data |
lypinator | 0:bb348c97df44 | 154 | * @param length The length. |
lypinator | 0:bb348c97df44 | 155 | * @param writeMethod Which write method the client is using. |
lypinator | 0:bb348c97df44 | 156 | * This depends on the properties in the attribute table. |
lypinator | 0:bb348c97df44 | 157 | * @param offset The offset of the written data |
lypinator | 0:bb348c97df44 | 158 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 159 | */ |
lypinator | 0:bb348c97df44 | 160 | typedef cbGATT_ErrorCode (*cbGATT_ServerWriteAttr)( |
lypinator | 0:bb348c97df44 | 161 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 162 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 163 | cbGATT_Attribute* pAttr, |
lypinator | 0:bb348c97df44 | 164 | cb_uint8* pAttrValue, |
lypinator | 0:bb348c97df44 | 165 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 166 | cbGATT_WriteMethod writeMethod, |
lypinator | 0:bb348c97df44 | 167 | cb_uint16 offset); |
lypinator | 0:bb348c97df44 | 168 | |
lypinator | 0:bb348c97df44 | 169 | /** |
lypinator | 0:bb348c97df44 | 170 | * Callback is called when the client is reading the client config |
lypinator | 0:bb348c97df44 | 171 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 172 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 173 | * @param pConfig Pointer where to write the config |
lypinator | 0:bb348c97df44 | 174 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 175 | */ |
lypinator | 0:bb348c97df44 | 176 | typedef cbGATT_ErrorCode (*cbGATT_ServerReadClientConfig)( |
lypinator | 0:bb348c97df44 | 177 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 178 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 179 | cb_uint16* pConfig); |
lypinator | 0:bb348c97df44 | 180 | |
lypinator | 0:bb348c97df44 | 181 | /** |
lypinator | 0:bb348c97df44 | 182 | * Callback is called when the client is writing the client config |
lypinator | 0:bb348c97df44 | 183 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 184 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 185 | * @param config The config to be stored |
lypinator | 0:bb348c97df44 | 186 | * @param writeMethod Which write method the client is using. |
lypinator | 0:bb348c97df44 | 187 | * This depends on the properties in the attribute table. |
lypinator | 0:bb348c97df44 | 188 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 189 | */ |
lypinator | 0:bb348c97df44 | 190 | typedef cbGATT_ErrorCode (*cbGATT_ServerWriteClientConfig)( |
lypinator | 0:bb348c97df44 | 191 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 192 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 193 | cb_uint16 config, |
lypinator | 0:bb348c97df44 | 194 | cbGATT_WriteMethod writeMethod); |
lypinator | 0:bb348c97df44 | 195 | |
lypinator | 0:bb348c97df44 | 196 | /** |
lypinator | 0:bb348c97df44 | 197 | * Callback is called when the client is reading the server config |
lypinator | 0:bb348c97df44 | 198 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 199 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 200 | * @param pConfig Pointer where to write the config |
lypinator | 0:bb348c97df44 | 201 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 202 | */ |
lypinator | 0:bb348c97df44 | 203 | typedef cbGATT_ErrorCode (*cbGATT_ServerReadServerConfig)( |
lypinator | 0:bb348c97df44 | 204 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 205 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 206 | cb_uint16* pConfig); |
lypinator | 0:bb348c97df44 | 207 | |
lypinator | 0:bb348c97df44 | 208 | /** |
lypinator | 0:bb348c97df44 | 209 | * Callback is called when the client is writing the server config |
lypinator | 0:bb348c97df44 | 210 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 211 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 212 | * @param config The config to be stored |
lypinator | 0:bb348c97df44 | 213 | * @param writeMethod Which write method the client is using. |
lypinator | 0:bb348c97df44 | 214 | * This depends on the properties in the attribute table. |
lypinator | 0:bb348c97df44 | 215 | * @return cbGATT_ERROR_CODE_OK if accepted or some cbGATT_ERROR_CODE_* code when failed. |
lypinator | 0:bb348c97df44 | 216 | */ |
lypinator | 0:bb348c97df44 | 217 | typedef cbGATT_ErrorCode (*cbGATT_ServerWriteServerConfig)( |
lypinator | 0:bb348c97df44 | 218 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 219 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 220 | cb_uint16 config, |
lypinator | 0:bb348c97df44 | 221 | cbGATT_WriteMethod writeMethod); |
lypinator | 0:bb348c97df44 | 222 | |
lypinator | 0:bb348c97df44 | 223 | typedef struct |
lypinator | 0:bb348c97df44 | 224 | { |
lypinator | 0:bb348c97df44 | 225 | cbGATT_ConnComplEvt connComplEvt; |
lypinator | 0:bb348c97df44 | 226 | cbGATT_DisconnectEvt disconnectEvt; |
lypinator | 0:bb348c97df44 | 227 | cbGATT_CharacteristicValueIndicationCnf characteristicValueIndicationCnf; |
lypinator | 0:bb348c97df44 | 228 | cbGATT_CharacteristicValueNotificationCnf characteristicValueNotificationCnf; |
lypinator | 0:bb348c97df44 | 229 | cbGATT_CharacteristicWriteLongCommitEvt characteristicWriteLongCommitEvt; |
lypinator | 0:bb348c97df44 | 230 | } cbGATT_ServerCallBack; |
lypinator | 0:bb348c97df44 | 231 | |
lypinator | 0:bb348c97df44 | 232 | |
lypinator | 0:bb348c97df44 | 233 | /*============================================================================= |
lypinator | 0:bb348c97df44 | 234 | * EXPORTED FUNCTIONS |
lypinator | 0:bb348c97df44 | 235 | *============================================================================= |
lypinator | 0:bb348c97df44 | 236 | */ |
lypinator | 0:bb348c97df44 | 237 | |
lypinator | 0:bb348c97df44 | 238 | /** |
lypinator | 0:bb348c97df44 | 239 | * Register server callbacks |
lypinator | 0:bb348c97df44 | 240 | * @param pCallBack Server callback |
lypinator | 0:bb348c97df44 | 241 | * @param pAppHandle Where to store app handle |
lypinator | 0:bb348c97df44 | 242 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 243 | */ |
lypinator | 0:bb348c97df44 | 244 | cb_int32 cbGATT_registerServer( |
lypinator | 0:bb348c97df44 | 245 | const cbGATT_ServerCallBack* pCallBack, |
lypinator | 0:bb348c97df44 | 246 | cb_uint8* pAppHandle); |
lypinator | 0:bb348c97df44 | 247 | |
lypinator | 0:bb348c97df44 | 248 | /** |
lypinator | 0:bb348c97df44 | 249 | * Deregister all server callbacks |
lypinator | 0:bb348c97df44 | 250 | * @return cbGATT_OK if succeeded or cbGATT_ERROR when failed. |
lypinator | 0:bb348c97df44 | 251 | */ |
lypinator | 0:bb348c97df44 | 252 | cb_int32 cbGATT_deregisterAllServers(void); |
lypinator | 0:bb348c97df44 | 253 | |
lypinator | 0:bb348c97df44 | 254 | /** |
lypinator | 0:bb348c97df44 | 255 | * Send notification to GATT client. The characteristicValueNotificationCnf |
lypinator | 0:bb348c97df44 | 256 | * callback will be called when finished and a new notification can be sent. |
lypinator | 0:bb348c97df44 | 257 | * The client config notification must have been enabled by the GATT client |
lypinator | 0:bb348c97df44 | 258 | * before an notification can be sent. |
lypinator | 0:bb348c97df44 | 259 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 260 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 261 | * @param pData Pointer to data to send |
lypinator | 0:bb348c97df44 | 262 | * @param length Length of pData |
lypinator | 0:bb348c97df44 | 263 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 264 | * @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed. |
lypinator | 0:bb348c97df44 | 265 | */ |
lypinator | 0:bb348c97df44 | 266 | cb_int32 cbGATT_notification( |
lypinator | 0:bb348c97df44 | 267 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 268 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 269 | cb_uint8* pData, |
lypinator | 0:bb348c97df44 | 270 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 271 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 272 | |
lypinator | 0:bb348c97df44 | 273 | /** |
lypinator | 0:bb348c97df44 | 274 | * Send indication to GATT client. The characteristicValueIndicationCnf |
lypinator | 0:bb348c97df44 | 275 | * callback will be called when finished and a new indication can be sent. |
lypinator | 0:bb348c97df44 | 276 | * The client config indication must have been enabled by the GATT client |
lypinator | 0:bb348c97df44 | 277 | * before an indication can be sent. |
lypinator | 0:bb348c97df44 | 278 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 279 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 280 | * @param pData Pointer to data to send |
lypinator | 0:bb348c97df44 | 281 | * @param length Length of pData |
lypinator | 0:bb348c97df44 | 282 | * @param appHandle App handle |
lypinator | 0:bb348c97df44 | 283 | * @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed. |
lypinator | 0:bb348c97df44 | 284 | */ |
lypinator | 0:bb348c97df44 | 285 | cb_int32 cbGATT_indication( |
lypinator | 0:bb348c97df44 | 286 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 287 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 288 | cb_uint8* pData, |
lypinator | 0:bb348c97df44 | 289 | cb_uint16 length, |
lypinator | 0:bb348c97df44 | 290 | cb_uint8 appHandle); |
lypinator | 0:bb348c97df44 | 291 | |
lypinator | 0:bb348c97df44 | 292 | /** |
lypinator | 0:bb348c97df44 | 293 | * Delay write respone to client, see cbGATT_ServerWriteAttr |
lypinator | 0:bb348c97df44 | 294 | * @param connHandle Connection handle |
lypinator | 0:bb348c97df44 | 295 | * @param attrHandle Handle of the attribute value |
lypinator | 0:bb348c97df44 | 296 | * @param errorCode Error code, use cbGATT_ERROR_CODE_OK if OK otherwise some cbGATT_ERROR_CODE_* |
lypinator | 0:bb348c97df44 | 297 | * @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed. |
lypinator | 0:bb348c97df44 | 298 | */ |
lypinator | 0:bb348c97df44 | 299 | cb_int32 cbGATT_writeRsp( |
lypinator | 0:bb348c97df44 | 300 | TConnHandle connHandle, |
lypinator | 0:bb348c97df44 | 301 | cb_uint16 attrHandle, |
lypinator | 0:bb348c97df44 | 302 | cb_uint8 errorCode); // For delayed write responses |
lypinator | 0:bb348c97df44 | 303 | |
lypinator | 0:bb348c97df44 | 304 | /** |
lypinator | 0:bb348c97df44 | 305 | * Add service list to attribute database |
lypinator | 0:bb348c97df44 | 306 | * @param pAttrList Attribute list |
lypinator | 0:bb348c97df44 | 307 | * @param attrListSize Size of the attribute list |
lypinator | 0:bb348c97df44 | 308 | * @param startHandle Start handle. Note that startHandle for the application |
lypinator | 0:bb348c97df44 | 309 | * should start at lowest 1024, cbGATT_APP_START_SERVICE_HANDLE. |
lypinator | 0:bb348c97df44 | 310 | * 1-1023 is reserved for GATT/GAP and other u-blox services. |
lypinator | 0:bb348c97df44 | 311 | * @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed. |
lypinator | 0:bb348c97df44 | 312 | */ |
lypinator | 0:bb348c97df44 | 313 | cb_int32 cbGATT_addService( |
lypinator | 0:bb348c97df44 | 314 | const cbGATT_Attribute* pAttrList, |
lypinator | 0:bb348c97df44 | 315 | cb_uint16 attrListSize, |
lypinator | 0:bb348c97df44 | 316 | cb_uint16 startHandle); |
lypinator | 0:bb348c97df44 | 317 | |
lypinator | 0:bb348c97df44 | 318 | /** |
lypinator | 0:bb348c97df44 | 319 | * NOTE: Only for tests |
lypinator | 0:bb348c97df44 | 320 | * Free all services. Use with care since this will also remove GATT and GAP services. |
lypinator | 0:bb348c97df44 | 321 | * @return cbGATT_OK if succeeded or some cbGATT_ERROR* when failed. |
lypinator | 0:bb348c97df44 | 322 | */ |
lypinator | 0:bb348c97df44 | 323 | cb_int32 cbGATT_freeServices(void); |
lypinator | 0:bb348c97df44 | 324 | |
lypinator | 0:bb348c97df44 | 325 | #ifdef __cplusplus |
lypinator | 0:bb348c97df44 | 326 | } |
lypinator | 0:bb348c97df44 | 327 | #endif |
lypinator | 0:bb348c97df44 | 328 | |
lypinator | 0:bb348c97df44 | 329 | #endif |