Includes library modifications to allow access to AIN_4 (AIN_0 / 5)

Committer:
bryantaylor
Date:
Tue Sep 20 21:26:12 2016 +0000
Revision:
0:eafc3fd41f75
hackathon

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bryantaylor 0:eafc3fd41f75 1 /* mbed Microcontroller Library
bryantaylor 0:eafc3fd41f75 2 * Copyright (c) 2006-2013 ARM Limited
bryantaylor 0:eafc3fd41f75 3 *
bryantaylor 0:eafc3fd41f75 4 * Licensed under the Apache License, Version 2.0 (the "License");
bryantaylor 0:eafc3fd41f75 5 * you may not use this file except in compliance with the License.
bryantaylor 0:eafc3fd41f75 6 * You may obtain a copy of the License at
bryantaylor 0:eafc3fd41f75 7 *
bryantaylor 0:eafc3fd41f75 8 * http://www.apache.org/licenses/LICENSE-2.0
bryantaylor 0:eafc3fd41f75 9 *
bryantaylor 0:eafc3fd41f75 10 * Unless required by applicable law or agreed to in writing, software
bryantaylor 0:eafc3fd41f75 11 * distributed under the License is distributed on an "AS IS" BASIS,
bryantaylor 0:eafc3fd41f75 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bryantaylor 0:eafc3fd41f75 13 * See the License for the specific language governing permissions and
bryantaylor 0:eafc3fd41f75 14 * limitations under the License.
bryantaylor 0:eafc3fd41f75 15 */
bryantaylor 0:eafc3fd41f75 16
bryantaylor 0:eafc3fd41f75 17 #ifndef __GATT_CLIENT_H__
bryantaylor 0:eafc3fd41f75 18 #define __GATT_CLIENT_H__
bryantaylor 0:eafc3fd41f75 19
bryantaylor 0:eafc3fd41f75 20 #include "Gap.h"
bryantaylor 0:eafc3fd41f75 21 #include "GattAttribute.h"
bryantaylor 0:eafc3fd41f75 22 #include "ServiceDiscovery.h"
bryantaylor 0:eafc3fd41f75 23 #include "CharacteristicDescriptorDiscovery.h"
bryantaylor 0:eafc3fd41f75 24
bryantaylor 0:eafc3fd41f75 25 #include "GattCallbackParamTypes.h"
bryantaylor 0:eafc3fd41f75 26
bryantaylor 0:eafc3fd41f75 27 #include "CallChainOfFunctionPointersWithContext.h"
bryantaylor 0:eafc3fd41f75 28
bryantaylor 0:eafc3fd41f75 29 class GattClient {
bryantaylor 0:eafc3fd41f75 30 public:
bryantaylor 0:eafc3fd41f75 31 /**
bryantaylor 0:eafc3fd41f75 32 * Type for the registered callbacks added to the data read callchain.
bryantaylor 0:eafc3fd41f75 33 * Refer to GattClient::onDataRead().
bryantaylor 0:eafc3fd41f75 34 */
bryantaylor 0:eafc3fd41f75 35 typedef FunctionPointerWithContext<const GattReadCallbackParams*> ReadCallback_t;
bryantaylor 0:eafc3fd41f75 36 /**
bryantaylor 0:eafc3fd41f75 37 * Type for the data read event callchain. Refer to GattClient::onDataRead().
bryantaylor 0:eafc3fd41f75 38 */
bryantaylor 0:eafc3fd41f75 39 typedef CallChainOfFunctionPointersWithContext<const GattReadCallbackParams*> ReadCallbackChain_t;
bryantaylor 0:eafc3fd41f75 40
bryantaylor 0:eafc3fd41f75 41 /**
bryantaylor 0:eafc3fd41f75 42 * Enumerator for write operations.
bryantaylor 0:eafc3fd41f75 43 */
bryantaylor 0:eafc3fd41f75 44 enum WriteOp_t {
bryantaylor 0:eafc3fd41f75 45 GATT_OP_WRITE_REQ = 0x01, /**< Write request. */
bryantaylor 0:eafc3fd41f75 46 GATT_OP_WRITE_CMD = 0x02, /**< Write command. */
bryantaylor 0:eafc3fd41f75 47 };
bryantaylor 0:eafc3fd41f75 48
bryantaylor 0:eafc3fd41f75 49 /**
bryantaylor 0:eafc3fd41f75 50 * Type for the registered callbacks added to the data write callchain.
bryantaylor 0:eafc3fd41f75 51 * Refer to GattClient::onDataWrite().
bryantaylor 0:eafc3fd41f75 52 */
bryantaylor 0:eafc3fd41f75 53 typedef FunctionPointerWithContext<const GattWriteCallbackParams*> WriteCallback_t;
bryantaylor 0:eafc3fd41f75 54 /**
bryantaylor 0:eafc3fd41f75 55 * Type for the data write event callchain. Refer to GattClient::onDataWrite().
bryantaylor 0:eafc3fd41f75 56 */
bryantaylor 0:eafc3fd41f75 57 typedef CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams*> WriteCallbackChain_t;
bryantaylor 0:eafc3fd41f75 58
bryantaylor 0:eafc3fd41f75 59 /**
bryantaylor 0:eafc3fd41f75 60 * Type for the registered callbacks added to the update event callchain.
bryantaylor 0:eafc3fd41f75 61 * Refer to GattClient::onHVX().
bryantaylor 0:eafc3fd41f75 62 */
bryantaylor 0:eafc3fd41f75 63 typedef FunctionPointerWithContext<const GattHVXCallbackParams*> HVXCallback_t;
bryantaylor 0:eafc3fd41f75 64 /**
bryantaylor 0:eafc3fd41f75 65 * Type for the update event callchain. Refer to GattClient::onHVX().
bryantaylor 0:eafc3fd41f75 66 */
bryantaylor 0:eafc3fd41f75 67 typedef CallChainOfFunctionPointersWithContext<const GattHVXCallbackParams*> HVXCallbackChain_t;
bryantaylor 0:eafc3fd41f75 68
bryantaylor 0:eafc3fd41f75 69 /**
bryantaylor 0:eafc3fd41f75 70 * Type for the registered callbacks added to the shutdown callchain.
bryantaylor 0:eafc3fd41f75 71 * Refer to GattClient::onShutdown().
bryantaylor 0:eafc3fd41f75 72 */
bryantaylor 0:eafc3fd41f75 73 typedef FunctionPointerWithContext<const GattClient *> GattClientShutdownCallback_t;
bryantaylor 0:eafc3fd41f75 74 /**
bryantaylor 0:eafc3fd41f75 75 * Type for the shutdown event callchain. Refer to GattClient::onShutown().
bryantaylor 0:eafc3fd41f75 76 */
bryantaylor 0:eafc3fd41f75 77 typedef CallChainOfFunctionPointersWithContext<const GattClient *> GattClientShutdownCallbackChain_t;
bryantaylor 0:eafc3fd41f75 78
bryantaylor 0:eafc3fd41f75 79 /*
bryantaylor 0:eafc3fd41f75 80 * The following functions are meant to be overridden in the platform-specific sub-class.
bryantaylor 0:eafc3fd41f75 81 */
bryantaylor 0:eafc3fd41f75 82 public:
bryantaylor 0:eafc3fd41f75 83 /**
bryantaylor 0:eafc3fd41f75 84 * Launch service discovery. Once launched, application callbacks will be
bryantaylor 0:eafc3fd41f75 85 * invoked for matching services or characteristics. isServiceDiscoveryActive()
bryantaylor 0:eafc3fd41f75 86 * can be used to determine status, and a termination callback (if one was set up)
bryantaylor 0:eafc3fd41f75 87 * will be invoked at the end. Service discovery can be terminated prematurely,
bryantaylor 0:eafc3fd41f75 88 * if needed, using terminateServiceDiscovery().
bryantaylor 0:eafc3fd41f75 89 *
bryantaylor 0:eafc3fd41f75 90 * @param[in] connectionHandle
bryantaylor 0:eafc3fd41f75 91 * Handle for the connection with the peer.
bryantaylor 0:eafc3fd41f75 92 * @param[in] sc
bryantaylor 0:eafc3fd41f75 93 * This is the application callback for a matching service. Taken as
bryantaylor 0:eafc3fd41f75 94 * NULL by default. Note: service discovery may still be active
bryantaylor 0:eafc3fd41f75 95 * when this callback is issued; calling asynchronous BLE-stack
bryantaylor 0:eafc3fd41f75 96 * APIs from within this application callback might cause the
bryantaylor 0:eafc3fd41f75 97 * stack to abort service discovery. If this becomes an issue, it
bryantaylor 0:eafc3fd41f75 98 * may be better to make a local copy of the discoveredService and
bryantaylor 0:eafc3fd41f75 99 * wait for service discovery to terminate before operating on the
bryantaylor 0:eafc3fd41f75 100 * service.
bryantaylor 0:eafc3fd41f75 101 * @param[in] cc
bryantaylor 0:eafc3fd41f75 102 * This is the application callback for a matching characteristic.
bryantaylor 0:eafc3fd41f75 103 * Taken as NULL by default. Note: service discovery may still be
bryantaylor 0:eafc3fd41f75 104 * active when this callback is issued; calling asynchronous
bryantaylor 0:eafc3fd41f75 105 * BLE-stack APIs from within this application callback might cause
bryantaylor 0:eafc3fd41f75 106 * the stack to abort service discovery. If this becomes an issue,
bryantaylor 0:eafc3fd41f75 107 * it may be better to make a local copy of the discoveredCharacteristic
bryantaylor 0:eafc3fd41f75 108 * and wait for service discovery to terminate before operating on the
bryantaylor 0:eafc3fd41f75 109 * characteristic.
bryantaylor 0:eafc3fd41f75 110 * @param[in] matchingServiceUUID
bryantaylor 0:eafc3fd41f75 111 * UUID-based filter for specifying a service in which the application is
bryantaylor 0:eafc3fd41f75 112 * interested. By default it is set as the wildcard UUID_UNKNOWN,
bryantaylor 0:eafc3fd41f75 113 * in which case it matches all services. If characteristic-UUID
bryantaylor 0:eafc3fd41f75 114 * filter (below) is set to the wildcard value, then a service
bryantaylor 0:eafc3fd41f75 115 * callback will be invoked for the matching service (or for every
bryantaylor 0:eafc3fd41f75 116 * service if the service filter is a wildcard).
bryantaylor 0:eafc3fd41f75 117 * @param[in] matchingCharacteristicUUIDIn
bryantaylor 0:eafc3fd41f75 118 * UUID-based filter for specifying characteristic in which the application
bryantaylor 0:eafc3fd41f75 119 * is interested. By default it is set as the wildcard UUID_UKNOWN
bryantaylor 0:eafc3fd41f75 120 * to match against any characteristic. If both service-UUID
bryantaylor 0:eafc3fd41f75 121 * filter and characteristic-UUID filter are used with non-wildcard
bryantaylor 0:eafc3fd41f75 122 * values, then only a single characteristic callback is
bryantaylor 0:eafc3fd41f75 123 * invoked for the matching characteristic.
bryantaylor 0:eafc3fd41f75 124 *
bryantaylor 0:eafc3fd41f75 125 * @note Using wildcard values for both service-UUID and characteristic-
bryantaylor 0:eafc3fd41f75 126 * UUID will result in complete service discovery: callbacks being
bryantaylor 0:eafc3fd41f75 127 * called for every service and characteristic.
bryantaylor 0:eafc3fd41f75 128 *
bryantaylor 0:eafc3fd41f75 129 * @note Providing NULL for the characteristic callback will result in
bryantaylor 0:eafc3fd41f75 130 * characteristic discovery being skipped for each matching
bryantaylor 0:eafc3fd41f75 131 * service. This allows for an inexpensive method to discover only
bryantaylor 0:eafc3fd41f75 132 * services.
bryantaylor 0:eafc3fd41f75 133 *
bryantaylor 0:eafc3fd41f75 134 * @return
bryantaylor 0:eafc3fd41f75 135 * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error.
bryantaylor 0:eafc3fd41f75 136 */
bryantaylor 0:eafc3fd41f75 137 virtual ble_error_t launchServiceDiscovery(Gap::Handle_t connectionHandle,
bryantaylor 0:eafc3fd41f75 138 ServiceDiscovery::ServiceCallback_t sc = NULL,
bryantaylor 0:eafc3fd41f75 139 ServiceDiscovery::CharacteristicCallback_t cc = NULL,
bryantaylor 0:eafc3fd41f75 140 const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN),
bryantaylor 0:eafc3fd41f75 141 const UUID &matchingCharacteristicUUIDIn = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) {
bryantaylor 0:eafc3fd41f75 142 /* Avoid compiler warnings about unused variables. */
bryantaylor 0:eafc3fd41f75 143 (void)connectionHandle;
bryantaylor 0:eafc3fd41f75 144 (void)sc;
bryantaylor 0:eafc3fd41f75 145 (void)cc;
bryantaylor 0:eafc3fd41f75 146 (void)matchingServiceUUID;
bryantaylor 0:eafc3fd41f75 147 (void)matchingCharacteristicUUIDIn;
bryantaylor 0:eafc3fd41f75 148
bryantaylor 0:eafc3fd41f75 149 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 150 }
bryantaylor 0:eafc3fd41f75 151
bryantaylor 0:eafc3fd41f75 152 /**
bryantaylor 0:eafc3fd41f75 153 * Launch service discovery for services. Once launched, service discovery will remain
bryantaylor 0:eafc3fd41f75 154 * active with service-callbacks being issued back into the application for matching
bryantaylor 0:eafc3fd41f75 155 * services. isServiceDiscoveryActive() can be used to
bryantaylor 0:eafc3fd41f75 156 * determine status, and a termination callback (if set up) will be invoked
bryantaylor 0:eafc3fd41f75 157 * at the end. Service discovery can be terminated prematurely, if needed,
bryantaylor 0:eafc3fd41f75 158 * using terminateServiceDiscovery().
bryantaylor 0:eafc3fd41f75 159 *
bryantaylor 0:eafc3fd41f75 160 * @param[in] connectionHandle
bryantaylor 0:eafc3fd41f75 161 * Handle for the connection with the peer.
bryantaylor 0:eafc3fd41f75 162 * @param[in] callback
bryantaylor 0:eafc3fd41f75 163 * This is the application callback for a matching service.
bryantaylor 0:eafc3fd41f75 164 * Note: service discovery may still be active
bryantaylor 0:eafc3fd41f75 165 * when this callback is issued; calling asynchronous BLE-stack
bryantaylor 0:eafc3fd41f75 166 * APIs from within this application callback might cause the
bryantaylor 0:eafc3fd41f75 167 * stack to abort service discovery. If this becomes an issue, it
bryantaylor 0:eafc3fd41f75 168 * may be better to make a local copy of the discoveredService and
bryantaylor 0:eafc3fd41f75 169 * wait for service discovery to terminate before operating on the
bryantaylor 0:eafc3fd41f75 170 * service.
bryantaylor 0:eafc3fd41f75 171 * @param[in] matchingServiceUUID
bryantaylor 0:eafc3fd41f75 172 * UUID-based filter for specifying a service in which the application is
bryantaylor 0:eafc3fd41f75 173 * interested. By default it is set as the wildcard UUID_UNKNOWN,
bryantaylor 0:eafc3fd41f75 174 * in which case it matches all services.
bryantaylor 0:eafc3fd41f75 175 *
bryantaylor 0:eafc3fd41f75 176 * @return
bryantaylor 0:eafc3fd41f75 177 * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error.
bryantaylor 0:eafc3fd41f75 178 */
bryantaylor 0:eafc3fd41f75 179 virtual ble_error_t discoverServices(Gap::Handle_t connectionHandle,
bryantaylor 0:eafc3fd41f75 180 ServiceDiscovery::ServiceCallback_t callback,
bryantaylor 0:eafc3fd41f75 181 const UUID &matchingServiceUUID = UUID::ShortUUIDBytes_t(BLE_UUID_UNKNOWN)) {
bryantaylor 0:eafc3fd41f75 182 return launchServiceDiscovery(connectionHandle, callback, NULL, matchingServiceUUID); /* We take advantage of the property
bryantaylor 0:eafc3fd41f75 183 * that providing NULL for the characteristic callback will result in
bryantaylor 0:eafc3fd41f75 184 * characteristic discovery being skipped for each matching
bryantaylor 0:eafc3fd41f75 185 * service. This allows for an inexpensive method to discover only
bryantaylor 0:eafc3fd41f75 186 * services. Porters are free to override this. */
bryantaylor 0:eafc3fd41f75 187 }
bryantaylor 0:eafc3fd41f75 188
bryantaylor 0:eafc3fd41f75 189 /**
bryantaylor 0:eafc3fd41f75 190 * Launch service discovery for services. Once launched, service discovery will remain
bryantaylor 0:eafc3fd41f75 191 * active with service-callbacks being issued back into the application for matching
bryantaylor 0:eafc3fd41f75 192 * services. isServiceDiscoveryActive() can be used to
bryantaylor 0:eafc3fd41f75 193 * determine status, and a termination callback (if set up) will be invoked
bryantaylor 0:eafc3fd41f75 194 * at the end. Service discovery can be terminated prematurely, if needed,
bryantaylor 0:eafc3fd41f75 195 * using terminateServiceDiscovery().
bryantaylor 0:eafc3fd41f75 196 *
bryantaylor 0:eafc3fd41f75 197 * @param[in] connectionHandle
bryantaylor 0:eafc3fd41f75 198 * Handle for the connection with the peer.
bryantaylor 0:eafc3fd41f75 199 * @param[in] callback
bryantaylor 0:eafc3fd41f75 200 * This is the application callback for a matching service.
bryantaylor 0:eafc3fd41f75 201 * Note: service discovery may still be active
bryantaylor 0:eafc3fd41f75 202 * when this callback is issued; calling asynchronous BLE-stack
bryantaylor 0:eafc3fd41f75 203 * APIs from within this application callback might cause the
bryantaylor 0:eafc3fd41f75 204 * stack to abort service discovery. If this becomes an issue, it
bryantaylor 0:eafc3fd41f75 205 * may be better to make a local copy of the discoveredService and
bryantaylor 0:eafc3fd41f75 206 * wait for service discovery to terminate before operating on the
bryantaylor 0:eafc3fd41f75 207 * service.
bryantaylor 0:eafc3fd41f75 208 * @param[in] startHandle, endHandle
bryantaylor 0:eafc3fd41f75 209 * Handle range within which to limit the search.
bryantaylor 0:eafc3fd41f75 210 *
bryantaylor 0:eafc3fd41f75 211 * @return
bryantaylor 0:eafc3fd41f75 212 * BLE_ERROR_NONE if service discovery is launched successfully; else an appropriate error.
bryantaylor 0:eafc3fd41f75 213 */
bryantaylor 0:eafc3fd41f75 214 virtual ble_error_t discoverServices(Gap::Handle_t connectionHandle,
bryantaylor 0:eafc3fd41f75 215 ServiceDiscovery::ServiceCallback_t callback,
bryantaylor 0:eafc3fd41f75 216 GattAttribute::Handle_t startHandle,
bryantaylor 0:eafc3fd41f75 217 GattAttribute::Handle_t endHandle) {
bryantaylor 0:eafc3fd41f75 218 /* Avoid compiler warnings about unused variables. */
bryantaylor 0:eafc3fd41f75 219 (void)connectionHandle;
bryantaylor 0:eafc3fd41f75 220 (void)callback;
bryantaylor 0:eafc3fd41f75 221 (void)startHandle;
bryantaylor 0:eafc3fd41f75 222 (void)endHandle;
bryantaylor 0:eafc3fd41f75 223
bryantaylor 0:eafc3fd41f75 224 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 225 }
bryantaylor 0:eafc3fd41f75 226
bryantaylor 0:eafc3fd41f75 227 /**
bryantaylor 0:eafc3fd41f75 228 * Check if service-discovery is currently active.
bryantaylor 0:eafc3fd41f75 229 *
bryantaylor 0:eafc3fd41f75 230 * @return true if service-discovery is active, false otherwise.
bryantaylor 0:eafc3fd41f75 231 */
bryantaylor 0:eafc3fd41f75 232 virtual bool isServiceDiscoveryActive(void) const {
bryantaylor 0:eafc3fd41f75 233 return false; /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 234 }
bryantaylor 0:eafc3fd41f75 235
bryantaylor 0:eafc3fd41f75 236 /**
bryantaylor 0:eafc3fd41f75 237 * Terminate an ongoing service discovery. This should result in an
bryantaylor 0:eafc3fd41f75 238 * invocation of TerminationCallback if service-discovery is active.
bryantaylor 0:eafc3fd41f75 239 */
bryantaylor 0:eafc3fd41f75 240 virtual void terminateServiceDiscovery(void) {
bryantaylor 0:eafc3fd41f75 241 /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 242 }
bryantaylor 0:eafc3fd41f75 243
bryantaylor 0:eafc3fd41f75 244 /**
bryantaylor 0:eafc3fd41f75 245 * Initiate a GATT Client read procedure by attribute-handle.
bryantaylor 0:eafc3fd41f75 246 *
bryantaylor 0:eafc3fd41f75 247 * @param[in] connHandle
bryantaylor 0:eafc3fd41f75 248 * Handle for the connection with the peer.
bryantaylor 0:eafc3fd41f75 249 * @param[in] attributeHandle
bryantaylor 0:eafc3fd41f75 250 * Handle of the attribute to read data from.
bryantaylor 0:eafc3fd41f75 251 * @param[in] offset
bryantaylor 0:eafc3fd41f75 252 * The offset from the start of the attribute value to be read.
bryantaylor 0:eafc3fd41f75 253 *
bryantaylor 0:eafc3fd41f75 254 * @return
bryantaylor 0:eafc3fd41f75 255 * BLE_ERROR_NONE if read procedure was successfully started.
bryantaylor 0:eafc3fd41f75 256 */
bryantaylor 0:eafc3fd41f75 257 virtual ble_error_t read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const {
bryantaylor 0:eafc3fd41f75 258 /* Avoid compiler warnings about unused variables. */
bryantaylor 0:eafc3fd41f75 259 (void)connHandle;
bryantaylor 0:eafc3fd41f75 260 (void)attributeHandle;
bryantaylor 0:eafc3fd41f75 261 (void)offset;
bryantaylor 0:eafc3fd41f75 262
bryantaylor 0:eafc3fd41f75 263 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 264 }
bryantaylor 0:eafc3fd41f75 265
bryantaylor 0:eafc3fd41f75 266 /**
bryantaylor 0:eafc3fd41f75 267 * Initiate a GATT Client write procedure.
bryantaylor 0:eafc3fd41f75 268 *
bryantaylor 0:eafc3fd41f75 269 * @param[in] cmd
bryantaylor 0:eafc3fd41f75 270 * Command can be either a write-request (which generates a
bryantaylor 0:eafc3fd41f75 271 * matching response from the peripheral), or a write-command
bryantaylor 0:eafc3fd41f75 272 * (which doesn't require the connected peer to respond).
bryantaylor 0:eafc3fd41f75 273 * @param[in] connHandle
bryantaylor 0:eafc3fd41f75 274 * Connection handle.
bryantaylor 0:eafc3fd41f75 275 * @param[in] attributeHandle
bryantaylor 0:eafc3fd41f75 276 * Handle for the target attribtue on the remote GATT server.
bryantaylor 0:eafc3fd41f75 277 * @param[in] length
bryantaylor 0:eafc3fd41f75 278 * Length of the new value.
bryantaylor 0:eafc3fd41f75 279 * @param[in] value
bryantaylor 0:eafc3fd41f75 280 * New value being written.
bryantaylor 0:eafc3fd41f75 281 *
bryantaylor 0:eafc3fd41f75 282 * @return
bryantaylor 0:eafc3fd41f75 283 * BLE_ERROR_NONE if write procedure was successfully started.
bryantaylor 0:eafc3fd41f75 284 */
bryantaylor 0:eafc3fd41f75 285 virtual ble_error_t write(GattClient::WriteOp_t cmd,
bryantaylor 0:eafc3fd41f75 286 Gap::Handle_t connHandle,
bryantaylor 0:eafc3fd41f75 287 GattAttribute::Handle_t attributeHandle,
bryantaylor 0:eafc3fd41f75 288 size_t length,
bryantaylor 0:eafc3fd41f75 289 const uint8_t *value) const {
bryantaylor 0:eafc3fd41f75 290 /* Avoid compiler warnings about unused variables. */
bryantaylor 0:eafc3fd41f75 291 (void)cmd;
bryantaylor 0:eafc3fd41f75 292 (void)connHandle;
bryantaylor 0:eafc3fd41f75 293 (void)attributeHandle;
bryantaylor 0:eafc3fd41f75 294 (void)length;
bryantaylor 0:eafc3fd41f75 295 (void)value;
bryantaylor 0:eafc3fd41f75 296
bryantaylor 0:eafc3fd41f75 297 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 298 }
bryantaylor 0:eafc3fd41f75 299
bryantaylor 0:eafc3fd41f75 300 /* Event callback handlers. */
bryantaylor 0:eafc3fd41f75 301 public:
bryantaylor 0:eafc3fd41f75 302 /**
bryantaylor 0:eafc3fd41f75 303 * Set up a callback for read response events.
bryantaylor 0:eafc3fd41f75 304 *
bryantaylor 0:eafc3fd41f75 305 * @param[in] callback
bryantaylor 0:eafc3fd41f75 306 * Event handler being registered.
bryantaylor 0:eafc3fd41f75 307 *
bryantaylor 0:eafc3fd41f75 308 * @note It is possible to chain together multiple onDataRead callbacks
bryantaylor 0:eafc3fd41f75 309 * (potentially from different modules of an application).
bryantaylor 0:eafc3fd41f75 310 *
bryantaylor 0:eafc3fd41f75 311 * @note It is possible to unregister a callback using
bryantaylor 0:eafc3fd41f75 312 * onDataRead().detach(callbackToRemove).
bryantaylor 0:eafc3fd41f75 313 */
bryantaylor 0:eafc3fd41f75 314 void onDataRead(ReadCallback_t callback) {
bryantaylor 0:eafc3fd41f75 315 onDataReadCallbackChain.add(callback);
bryantaylor 0:eafc3fd41f75 316 }
bryantaylor 0:eafc3fd41f75 317
bryantaylor 0:eafc3fd41f75 318 /**
bryantaylor 0:eafc3fd41f75 319 * @brief Provide access to the callchain of read event callbacks.
bryantaylor 0:eafc3fd41f75 320 *
bryantaylor 0:eafc3fd41f75 321 * @return A reference to the read event callback chain.
bryantaylor 0:eafc3fd41f75 322 *
bryantaylor 0:eafc3fd41f75 323 * @note It is possible to register callbacks using onDataRead().add(callback).
bryantaylor 0:eafc3fd41f75 324 *
bryantaylor 0:eafc3fd41f75 325 * @note It is possible to unregister callbacks using onDataRead().detach(callback).
bryantaylor 0:eafc3fd41f75 326 */
bryantaylor 0:eafc3fd41f75 327 ReadCallbackChain_t& onDataRead() {
bryantaylor 0:eafc3fd41f75 328 return onDataReadCallbackChain;
bryantaylor 0:eafc3fd41f75 329 }
bryantaylor 0:eafc3fd41f75 330
bryantaylor 0:eafc3fd41f75 331 /**
bryantaylor 0:eafc3fd41f75 332 * Set up a callback for write response events.
bryantaylor 0:eafc3fd41f75 333 *
bryantaylor 0:eafc3fd41f75 334 * @param[in] callback
bryantaylor 0:eafc3fd41f75 335 * Event handler being registered.
bryantaylor 0:eafc3fd41f75 336 *
bryantaylor 0:eafc3fd41f75 337 * @note It is possible to remove registered callbacks using
bryantaylor 0:eafc3fd41f75 338 * onDataWritten().detach(callbackToRemove).
bryantaylor 0:eafc3fd41f75 339 *
bryantaylor 0:eafc3fd41f75 340 * @note Write commands (issued using writeWoResponse) don't generate a response.
bryantaylor 0:eafc3fd41f75 341 */
bryantaylor 0:eafc3fd41f75 342 void onDataWritten(WriteCallback_t callback) {
bryantaylor 0:eafc3fd41f75 343 onDataWriteCallbackChain.add(callback);
bryantaylor 0:eafc3fd41f75 344 }
bryantaylor 0:eafc3fd41f75 345
bryantaylor 0:eafc3fd41f75 346 /**
bryantaylor 0:eafc3fd41f75 347 * @brief Provide access to the callchain of data written callbacks.
bryantaylor 0:eafc3fd41f75 348 *
bryantaylor 0:eafc3fd41f75 349 * @return A reference to the data written callbacks chain.
bryantaylor 0:eafc3fd41f75 350 *
bryantaylor 0:eafc3fd41f75 351 * @note It is possible to register callbacks using onDataWritten().add(callback).
bryantaylor 0:eafc3fd41f75 352 *
bryantaylor 0:eafc3fd41f75 353 * @note It is possible to unregister callbacks using onDataWritten().detach(callback).
bryantaylor 0:eafc3fd41f75 354 */
bryantaylor 0:eafc3fd41f75 355 WriteCallbackChain_t& onDataWritten() {
bryantaylor 0:eafc3fd41f75 356 return onDataWriteCallbackChain;
bryantaylor 0:eafc3fd41f75 357 }
bryantaylor 0:eafc3fd41f75 358
bryantaylor 0:eafc3fd41f75 359 /**
bryantaylor 0:eafc3fd41f75 360 * Set up a callback for write response events.
bryantaylor 0:eafc3fd41f75 361 *
bryantaylor 0:eafc3fd41f75 362 * @param[in] callback
bryantaylor 0:eafc3fd41f75 363 * Event handler being registered.
bryantaylor 0:eafc3fd41f75 364 *
bryantaylor 0:eafc3fd41f75 365 * @note Write commands (issued using writeWoResponse) don't generate a response.
bryantaylor 0:eafc3fd41f75 366 *
bryantaylor 0:eafc3fd41f75 367 * @deprecated Please use GattServer::onDataWritten() instead.
bryantaylor 0:eafc3fd41f75 368 */
bryantaylor 0:eafc3fd41f75 369 void onDataWrite(WriteCallback_t callback) {
bryantaylor 0:eafc3fd41f75 370 onDataWritten(callback);
bryantaylor 0:eafc3fd41f75 371 }
bryantaylor 0:eafc3fd41f75 372
bryantaylor 0:eafc3fd41f75 373 /**
bryantaylor 0:eafc3fd41f75 374 * Set up a callback for when serviceDiscovery terminates.
bryantaylor 0:eafc3fd41f75 375 *
bryantaylor 0:eafc3fd41f75 376 * @param[in] callback
bryantaylor 0:eafc3fd41f75 377 * Event handler being registered.
bryantaylor 0:eafc3fd41f75 378 */
bryantaylor 0:eafc3fd41f75 379 virtual void onServiceDiscoveryTermination(ServiceDiscovery::TerminationCallback_t callback) {
bryantaylor 0:eafc3fd41f75 380 (void)callback; /* Avoid compiler warnings about ununsed variables. */
bryantaylor 0:eafc3fd41f75 381
bryantaylor 0:eafc3fd41f75 382 /* Requesting action from porters: override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 383 }
bryantaylor 0:eafc3fd41f75 384
bryantaylor 0:eafc3fd41f75 385 /**
bryantaylor 0:eafc3fd41f75 386 * @brief Launch discovery of descriptors for a given characteristic.
bryantaylor 0:eafc3fd41f75 387 *
bryantaylor 0:eafc3fd41f75 388 * @details This function will discover all descriptors available for a
bryantaylor 0:eafc3fd41f75 389 * specific characteristic.
bryantaylor 0:eafc3fd41f75 390 *
bryantaylor 0:eafc3fd41f75 391 * @param[in] characteristic
bryantaylor 0:eafc3fd41f75 392 * The characteristic targeted by this discovery procedure.
bryantaylor 0:eafc3fd41f75 393 * @param[in] discoveryCallback
bryantaylor 0:eafc3fd41f75 394 * User function called each time a descriptor is found during
bryantaylor 0:eafc3fd41f75 395 * the procedure.
bryantaylor 0:eafc3fd41f75 396 * @param[in] terminationCallback
bryantaylor 0:eafc3fd41f75 397 * User provided function which will be called once the
bryantaylor 0:eafc3fd41f75 398 * discovery procedure is terminating. This will get called
bryantaylor 0:eafc3fd41f75 399 * when all the descriptors have been discovered or if an
bryantaylor 0:eafc3fd41f75 400 * error occur during the discovery procedure.
bryantaylor 0:eafc3fd41f75 401 *
bryantaylor 0:eafc3fd41f75 402 * @return
bryantaylor 0:eafc3fd41f75 403 * BLE_ERROR_NONE if characteristic descriptor discovery is launched
bryantaylor 0:eafc3fd41f75 404 * successfully; else an appropriate error.
bryantaylor 0:eafc3fd41f75 405 */
bryantaylor 0:eafc3fd41f75 406 virtual ble_error_t discoverCharacteristicDescriptors(
bryantaylor 0:eafc3fd41f75 407 const DiscoveredCharacteristic& characteristic,
bryantaylor 0:eafc3fd41f75 408 const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& discoveryCallback,
bryantaylor 0:eafc3fd41f75 409 const CharacteristicDescriptorDiscovery::TerminationCallback_t& terminationCallback) {
bryantaylor 0:eafc3fd41f75 410 (void) characteristic;
bryantaylor 0:eafc3fd41f75 411 (void) discoveryCallback;
bryantaylor 0:eafc3fd41f75 412 (void) terminationCallback;
bryantaylor 0:eafc3fd41f75 413 /* Requesting action from porter(s): override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 414 return BLE_ERROR_NOT_IMPLEMENTED;
bryantaylor 0:eafc3fd41f75 415 }
bryantaylor 0:eafc3fd41f75 416
bryantaylor 0:eafc3fd41f75 417 /**
bryantaylor 0:eafc3fd41f75 418 * @brief Indicate if the discovery of characteristic descriptors is active
bryantaylor 0:eafc3fd41f75 419 * for a given characteristic or not.
bryantaylor 0:eafc3fd41f75 420 *
bryantaylor 0:eafc3fd41f75 421 * @param[in] characteristic
bryantaylor 0:eafc3fd41f75 422 * The characteristic concerned by the descriptors discovery.
bryantaylor 0:eafc3fd41f75 423 *
bryantaylor 0:eafc3fd41f75 424 * @return true if a descriptors discovery is active for the characteristic
bryantaylor 0:eafc3fd41f75 425 * in input; otherwise false.
bryantaylor 0:eafc3fd41f75 426 */
bryantaylor 0:eafc3fd41f75 427 virtual bool isCharacteristicDescriptorDiscoveryActive(const DiscoveredCharacteristic& characteristic) const
bryantaylor 0:eafc3fd41f75 428 {
bryantaylor 0:eafc3fd41f75 429 (void) characteristic;
bryantaylor 0:eafc3fd41f75 430 return false; /* Requesting action from porter(s): override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 431 }
bryantaylor 0:eafc3fd41f75 432
bryantaylor 0:eafc3fd41f75 433 /**
bryantaylor 0:eafc3fd41f75 434 * @brief Terminate an ongoing characteristic descriptor discovery.
bryantaylor 0:eafc3fd41f75 435 *
bryantaylor 0:eafc3fd41f75 436 * @details This should result in an invocation of the TerminationCallback if
bryantaylor 0:eafc3fd41f75 437 * the characteristic descriptor discovery is active.
bryantaylor 0:eafc3fd41f75 438 *
bryantaylor 0:eafc3fd41f75 439 * @param[in] characteristic
bryantaylor 0:eafc3fd41f75 440 * The characteristic on which the running descriptors
bryantaylor 0:eafc3fd41f75 441 * discovery should be stopped.
bryantaylor 0:eafc3fd41f75 442 */
bryantaylor 0:eafc3fd41f75 443 virtual void terminateCharacteristicDescriptorDiscovery(const DiscoveredCharacteristic& characteristic) {
bryantaylor 0:eafc3fd41f75 444 /* Requesting action from porter(s): override this API if this capability is supported. */
bryantaylor 0:eafc3fd41f75 445 (void) characteristic;
bryantaylor 0:eafc3fd41f75 446 }
bryantaylor 0:eafc3fd41f75 447
bryantaylor 0:eafc3fd41f75 448 /**
bryantaylor 0:eafc3fd41f75 449 * Set up a callback for when the GATT Client receives an update event
bryantaylor 0:eafc3fd41f75 450 * corresponding to a change in the value of a characteristic on the remote
bryantaylor 0:eafc3fd41f75 451 * GATT Server.
bryantaylor 0:eafc3fd41f75 452 *
bryantaylor 0:eafc3fd41f75 453 * @note It is possible to unregister callbacks using
bryantaylor 0:eafc3fd41f75 454 * onHVX().detach(callbackToRemove).
bryantaylor 0:eafc3fd41f75 455 */
bryantaylor 0:eafc3fd41f75 456 void onHVX(HVXCallback_t callback) {
bryantaylor 0:eafc3fd41f75 457 onHVXCallbackChain.add(callback);
bryantaylor 0:eafc3fd41f75 458 }
bryantaylor 0:eafc3fd41f75 459
bryantaylor 0:eafc3fd41f75 460 /**
bryantaylor 0:eafc3fd41f75 461 * Setup a callback to be invoked to notify the user application that the
bryantaylor 0:eafc3fd41f75 462 * GattClient instance is about to shutdown (possibly as a result of a call
bryantaylor 0:eafc3fd41f75 463 * to BLE::shutdown()).
bryantaylor 0:eafc3fd41f75 464 *
bryantaylor 0:eafc3fd41f75 465 * @param[in] callback
bryantaylor 0:eafc3fd41f75 466 * Event handler being registered.
bryantaylor 0:eafc3fd41f75 467 *
bryantaylor 0:eafc3fd41f75 468 * @note It is possible to chain together multiple onShutdown callbacks
bryantaylor 0:eafc3fd41f75 469 * (potentially from different modules of an application) to be notified
bryantaylor 0:eafc3fd41f75 470 * before the GattClient is shutdown.
bryantaylor 0:eafc3fd41f75 471 *
bryantaylor 0:eafc3fd41f75 472 * @note It is also possible to set up a callback into a member function of
bryantaylor 0:eafc3fd41f75 473 * some object.
bryantaylor 0:eafc3fd41f75 474 *
bryantaylor 0:eafc3fd41f75 475 * @note It is possible to unregister a callback using onShutdown().detach(callback).
bryantaylor 0:eafc3fd41f75 476 */
bryantaylor 0:eafc3fd41f75 477 void onShutdown(const GattClientShutdownCallback_t& callback) {
bryantaylor 0:eafc3fd41f75 478 shutdownCallChain.add(callback);
bryantaylor 0:eafc3fd41f75 479 }
bryantaylor 0:eafc3fd41f75 480
bryantaylor 0:eafc3fd41f75 481 /**
bryantaylor 0:eafc3fd41f75 482 * Same as GattClient::onShutdown(), but allows the possibility to add an object
bryantaylor 0:eafc3fd41f75 483 * reference and member function as handler for shutdown event
bryantaylor 0:eafc3fd41f75 484 * callbacks.
bryantaylor 0:eafc3fd41f75 485 *
bryantaylor 0:eafc3fd41f75 486 * @param[in] objPtr
bryantaylor 0:eafc3fd41f75 487 * Pointer to the object of a class defining the member callback
bryantaylor 0:eafc3fd41f75 488 * function (@p memberPtr).
bryantaylor 0:eafc3fd41f75 489 * @param[in] memberPtr
bryantaylor 0:eafc3fd41f75 490 * The member callback (within the context of an object) to be
bryantaylor 0:eafc3fd41f75 491 * invoked.
bryantaylor 0:eafc3fd41f75 492 */
bryantaylor 0:eafc3fd41f75 493 template <typename T>
bryantaylor 0:eafc3fd41f75 494 void onShutdown(T *objPtr, void (T::*memberPtr)(const GattClient *)) {
bryantaylor 0:eafc3fd41f75 495 shutdownCallChain.add(objPtr, memberPtr);
bryantaylor 0:eafc3fd41f75 496 }
bryantaylor 0:eafc3fd41f75 497
bryantaylor 0:eafc3fd41f75 498 /**
bryantaylor 0:eafc3fd41f75 499 * @brief Provide access to the callchain of shutdown event callbacks.
bryantaylor 0:eafc3fd41f75 500 *
bryantaylor 0:eafc3fd41f75 501 * @return A reference to the shutdown event callbacks chain.
bryantaylor 0:eafc3fd41f75 502 *
bryantaylor 0:eafc3fd41f75 503 * @note It is possible to register callbacks using onShutdown().add(callback).
bryantaylor 0:eafc3fd41f75 504 *
bryantaylor 0:eafc3fd41f75 505 * @note It is possible to unregister callbacks using onShutdown().detach(callback).
bryantaylor 0:eafc3fd41f75 506 */
bryantaylor 0:eafc3fd41f75 507 GattClientShutdownCallbackChain_t& onShutdown() {
bryantaylor 0:eafc3fd41f75 508 return shutdownCallChain;
bryantaylor 0:eafc3fd41f75 509 }
bryantaylor 0:eafc3fd41f75 510
bryantaylor 0:eafc3fd41f75 511 /**
bryantaylor 0:eafc3fd41f75 512 * @brief provide access to the callchain of HVX callbacks.
bryantaylor 0:eafc3fd41f75 513 *
bryantaylor 0:eafc3fd41f75 514 * @return A reference to the HVX callbacks chain.
bryantaylor 0:eafc3fd41f75 515 *
bryantaylor 0:eafc3fd41f75 516 * @note It is possible to register callbacks using onHVX().add(callback).
bryantaylor 0:eafc3fd41f75 517 *
bryantaylor 0:eafc3fd41f75 518 * @note It is possible to unregister callbacks using onHVX().detach(callback).
bryantaylor 0:eafc3fd41f75 519 */
bryantaylor 0:eafc3fd41f75 520 HVXCallbackChain_t& onHVX() {
bryantaylor 0:eafc3fd41f75 521 return onHVXCallbackChain;
bryantaylor 0:eafc3fd41f75 522 }
bryantaylor 0:eafc3fd41f75 523
bryantaylor 0:eafc3fd41f75 524 public:
bryantaylor 0:eafc3fd41f75 525 /**
bryantaylor 0:eafc3fd41f75 526 * Notify all registered onShutdown callbacks that the GattClient is
bryantaylor 0:eafc3fd41f75 527 * about to be shutdown and clear all GattClient state of the
bryantaylor 0:eafc3fd41f75 528 * associated object.
bryantaylor 0:eafc3fd41f75 529 *
bryantaylor 0:eafc3fd41f75 530 * This function is meant to be overridden in the platform-specific
bryantaylor 0:eafc3fd41f75 531 * sub-class. Nevertheless, the sub-class is only expected to reset its
bryantaylor 0:eafc3fd41f75 532 * state and not the data held in GattClient members. This shall be achieved
bryantaylor 0:eafc3fd41f75 533 * by a call to GattClient::reset() from the sub-class' reset()
bryantaylor 0:eafc3fd41f75 534 * implementation.
bryantaylor 0:eafc3fd41f75 535 *
bryantaylor 0:eafc3fd41f75 536 * @return BLE_ERROR_NONE on success.
bryantaylor 0:eafc3fd41f75 537 */
bryantaylor 0:eafc3fd41f75 538 virtual ble_error_t reset(void) {
bryantaylor 0:eafc3fd41f75 539 /* Notify that the instance is about to shutdown */
bryantaylor 0:eafc3fd41f75 540 shutdownCallChain.call(this);
bryantaylor 0:eafc3fd41f75 541 shutdownCallChain.clear();
bryantaylor 0:eafc3fd41f75 542
bryantaylor 0:eafc3fd41f75 543 onDataReadCallbackChain.clear();
bryantaylor 0:eafc3fd41f75 544 onDataWriteCallbackChain.clear();
bryantaylor 0:eafc3fd41f75 545 onHVXCallbackChain.clear();
bryantaylor 0:eafc3fd41f75 546
bryantaylor 0:eafc3fd41f75 547 return BLE_ERROR_NONE;
bryantaylor 0:eafc3fd41f75 548 }
bryantaylor 0:eafc3fd41f75 549
bryantaylor 0:eafc3fd41f75 550 protected:
bryantaylor 0:eafc3fd41f75 551 GattClient() {
bryantaylor 0:eafc3fd41f75 552 /* Empty */
bryantaylor 0:eafc3fd41f75 553 }
bryantaylor 0:eafc3fd41f75 554
bryantaylor 0:eafc3fd41f75 555 /* Entry points for the underlying stack to report events back to the user. */
bryantaylor 0:eafc3fd41f75 556 public:
bryantaylor 0:eafc3fd41f75 557 /**
bryantaylor 0:eafc3fd41f75 558 * Helper function that notifies all registered handlers of an occurrence
bryantaylor 0:eafc3fd41f75 559 * of a data read event. This function is meant to be called from the
bryantaylor 0:eafc3fd41f75 560 * BLE stack specific implementation when a data read event occurs.
bryantaylor 0:eafc3fd41f75 561 *
bryantaylor 0:eafc3fd41f75 562 * @param[in] params
bryantaylor 0:eafc3fd41f75 563 * The data read parameters passed to the registered
bryantaylor 0:eafc3fd41f75 564 * handlers.
bryantaylor 0:eafc3fd41f75 565 */
bryantaylor 0:eafc3fd41f75 566 void processReadResponse(const GattReadCallbackParams *params) {
bryantaylor 0:eafc3fd41f75 567 onDataReadCallbackChain(params);
bryantaylor 0:eafc3fd41f75 568 }
bryantaylor 0:eafc3fd41f75 569
bryantaylor 0:eafc3fd41f75 570 /**
bryantaylor 0:eafc3fd41f75 571 * Helper function that notifies all registered handlers of an occurrence
bryantaylor 0:eafc3fd41f75 572 * of a data written event. This function is meant to be called from the
bryantaylor 0:eafc3fd41f75 573 * BLE stack specific implementation when a data written event occurs.
bryantaylor 0:eafc3fd41f75 574 *
bryantaylor 0:eafc3fd41f75 575 * @param[in] params
bryantaylor 0:eafc3fd41f75 576 * The data written parameters passed to the registered
bryantaylor 0:eafc3fd41f75 577 * handlers.
bryantaylor 0:eafc3fd41f75 578 */
bryantaylor 0:eafc3fd41f75 579 void processWriteResponse(const GattWriteCallbackParams *params) {
bryantaylor 0:eafc3fd41f75 580 onDataWriteCallbackChain(params);
bryantaylor 0:eafc3fd41f75 581 }
bryantaylor 0:eafc3fd41f75 582
bryantaylor 0:eafc3fd41f75 583 /**
bryantaylor 0:eafc3fd41f75 584 * Helper function that notifies all registered handlers of an occurrence
bryantaylor 0:eafc3fd41f75 585 * of an update event. This function is meant to be called from the
bryantaylor 0:eafc3fd41f75 586 * BLE stack specific implementation when an update event occurs.
bryantaylor 0:eafc3fd41f75 587 *
bryantaylor 0:eafc3fd41f75 588 * @param[in] params
bryantaylor 0:eafc3fd41f75 589 * The update event parameters passed to the registered
bryantaylor 0:eafc3fd41f75 590 * handlers.
bryantaylor 0:eafc3fd41f75 591 */
bryantaylor 0:eafc3fd41f75 592 void processHVXEvent(const GattHVXCallbackParams *params) {
bryantaylor 0:eafc3fd41f75 593 if (onHVXCallbackChain) {
bryantaylor 0:eafc3fd41f75 594 onHVXCallbackChain(params);
bryantaylor 0:eafc3fd41f75 595 }
bryantaylor 0:eafc3fd41f75 596 }
bryantaylor 0:eafc3fd41f75 597
bryantaylor 0:eafc3fd41f75 598 protected:
bryantaylor 0:eafc3fd41f75 599 /**
bryantaylor 0:eafc3fd41f75 600 * Callchain containing all registered callback handlers for data read
bryantaylor 0:eafc3fd41f75 601 * events.
bryantaylor 0:eafc3fd41f75 602 */
bryantaylor 0:eafc3fd41f75 603 ReadCallbackChain_t onDataReadCallbackChain;
bryantaylor 0:eafc3fd41f75 604 /**
bryantaylor 0:eafc3fd41f75 605 * Callchain containing all registered callback handlers for data write
bryantaylor 0:eafc3fd41f75 606 * events.
bryantaylor 0:eafc3fd41f75 607 */
bryantaylor 0:eafc3fd41f75 608 WriteCallbackChain_t onDataWriteCallbackChain;
bryantaylor 0:eafc3fd41f75 609 /**
bryantaylor 0:eafc3fd41f75 610 * Callchain containing all registered callback handlers for update
bryantaylor 0:eafc3fd41f75 611 * events.
bryantaylor 0:eafc3fd41f75 612 */
bryantaylor 0:eafc3fd41f75 613 HVXCallbackChain_t onHVXCallbackChain;
bryantaylor 0:eafc3fd41f75 614 /**
bryantaylor 0:eafc3fd41f75 615 * Callchain containing all registered callback handlers for shutdown
bryantaylor 0:eafc3fd41f75 616 * events.
bryantaylor 0:eafc3fd41f75 617 */
bryantaylor 0:eafc3fd41f75 618 GattClientShutdownCallbackChain_t shutdownCallChain;
bryantaylor 0:eafc3fd41f75 619
bryantaylor 0:eafc3fd41f75 620 private:
bryantaylor 0:eafc3fd41f75 621 /* Disallow copy and assignment. */
bryantaylor 0:eafc3fd41f75 622 GattClient(const GattClient &);
bryantaylor 0:eafc3fd41f75 623 GattClient& operator=(const GattClient &);
bryantaylor 0:eafc3fd41f75 624 };
bryantaylor 0:eafc3fd41f75 625
bryantaylor 0:eafc3fd41f75 626 #endif /* ifndef __GATT_CLIENT_H__ */