Greg Steiert / pegasus_dev

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
switches 0:5c4d7b2438d3 1 /* mbed Microcontroller Library
switches 0:5c4d7b2438d3 2 * Copyright (c) 2006-2013 ARM Limited
switches 0:5c4d7b2438d3 3 *
switches 0:5c4d7b2438d3 4 * Licensed under the Apache License, Version 2.0 (the "License");
switches 0:5c4d7b2438d3 5 * you may not use this file except in compliance with the License.
switches 0:5c4d7b2438d3 6 * You may obtain a copy of the License at
switches 0:5c4d7b2438d3 7 *
switches 0:5c4d7b2438d3 8 * http://www.apache.org/licenses/LICENSE-2.0
switches 0:5c4d7b2438d3 9 *
switches 0:5c4d7b2438d3 10 * Unless required by applicable law or agreed to in writing, software
switches 0:5c4d7b2438d3 11 * distributed under the License is distributed on an "AS IS" BASIS,
switches 0:5c4d7b2438d3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
switches 0:5c4d7b2438d3 13 * See the License for the specific language governing permissions and
switches 0:5c4d7b2438d3 14 * limitations under the License.
switches 0:5c4d7b2438d3 15 */
switches 0:5c4d7b2438d3 16
switches 0:5c4d7b2438d3 17 #ifndef __GATT_SERVER_H__
switches 0:5c4d7b2438d3 18 #define __GATT_SERVER_H__
switches 0:5c4d7b2438d3 19
switches 0:5c4d7b2438d3 20 #include "Gap.h"
switches 0:5c4d7b2438d3 21 #include "GattService.h"
switches 0:5c4d7b2438d3 22 #include "GattAttribute.h"
switches 0:5c4d7b2438d3 23 #include "GattServerEvents.h"
switches 0:5c4d7b2438d3 24 #include "GattCallbackParamTypes.h"
switches 0:5c4d7b2438d3 25 #include "CallChainOfFunctionPointersWithContext.h"
switches 0:5c4d7b2438d3 26
switches 0:5c4d7b2438d3 27 class GattServer {
switches 0:5c4d7b2438d3 28 public:
switches 0:5c4d7b2438d3 29 /**
switches 0:5c4d7b2438d3 30 * Type for the registered callbacks added to the data sent callchain.
switches 0:5c4d7b2438d3 31 * Refer to GattServer::onDataSent().
switches 0:5c4d7b2438d3 32 */
switches 0:5c4d7b2438d3 33 typedef FunctionPointerWithContext<unsigned> DataSentCallback_t;
switches 0:5c4d7b2438d3 34 /**
switches 0:5c4d7b2438d3 35 * Type for the data sent event callchain. Refer to GattServer::onDataSent().
switches 0:5c4d7b2438d3 36 */
switches 0:5c4d7b2438d3 37 typedef CallChainOfFunctionPointersWithContext<unsigned> DataSentCallbackChain_t;
switches 0:5c4d7b2438d3 38
switches 0:5c4d7b2438d3 39 /**
switches 0:5c4d7b2438d3 40 * Type for the registered callbacks added to the data written callchain.
switches 0:5c4d7b2438d3 41 * Refer to GattServer::onDataWritten().
switches 0:5c4d7b2438d3 42 */
switches 0:5c4d7b2438d3 43 typedef FunctionPointerWithContext<const GattWriteCallbackParams*> DataWrittenCallback_t;
switches 0:5c4d7b2438d3 44 /**
switches 0:5c4d7b2438d3 45 * Type for the data written event callchain. Refer to GattServer::onDataWritten().
switches 0:5c4d7b2438d3 46 */
switches 0:5c4d7b2438d3 47 typedef CallChainOfFunctionPointersWithContext<const GattWriteCallbackParams*> DataWrittenCallbackChain_t;
switches 0:5c4d7b2438d3 48
switches 0:5c4d7b2438d3 49 /**
switches 0:5c4d7b2438d3 50 * Type for the registered callbacks added to the data read callchain.
switches 0:5c4d7b2438d3 51 * Refer to GattServer::onDataRead().
switches 0:5c4d7b2438d3 52 */
switches 0:5c4d7b2438d3 53 typedef FunctionPointerWithContext<const GattReadCallbackParams*> DataReadCallback_t;
switches 0:5c4d7b2438d3 54 /**
switches 0:5c4d7b2438d3 55 * Type for the data read event callchain. Refer to GattServer::onDataRead().
switches 0:5c4d7b2438d3 56 */
switches 0:5c4d7b2438d3 57 typedef CallChainOfFunctionPointersWithContext<const GattReadCallbackParams *> DataReadCallbackChain_t;
switches 0:5c4d7b2438d3 58
switches 0:5c4d7b2438d3 59 /**
switches 0:5c4d7b2438d3 60 * Type for the registered callbacks added to the shutdown callchain.
switches 0:5c4d7b2438d3 61 * Refer to GattServer::onShutdown().
switches 0:5c4d7b2438d3 62 */
switches 0:5c4d7b2438d3 63 typedef FunctionPointerWithContext<const GattServer *> GattServerShutdownCallback_t;
switches 0:5c4d7b2438d3 64 /**
switches 0:5c4d7b2438d3 65 * Type for the shutdown event callchain. Refer to GattServer::onShutdown().
switches 0:5c4d7b2438d3 66 */
switches 0:5c4d7b2438d3 67 typedef CallChainOfFunctionPointersWithContext<const GattServer *> GattServerShutdownCallbackChain_t;
switches 0:5c4d7b2438d3 68
switches 0:5c4d7b2438d3 69 /**
switches 0:5c4d7b2438d3 70 * Type for the registered callback for various events. Refer to
switches 0:5c4d7b2438d3 71 * GattServer::onUpdatesEnabled(), GattServer::onUpdateDisabled() and
switches 0:5c4d7b2438d3 72 * GattServer::onConfirmationReceived().
switches 0:5c4d7b2438d3 73 */
switches 0:5c4d7b2438d3 74 typedef FunctionPointerWithContext<GattAttribute::Handle_t> EventCallback_t;
switches 0:5c4d7b2438d3 75
switches 0:5c4d7b2438d3 76 protected:
switches 0:5c4d7b2438d3 77 /**
switches 0:5c4d7b2438d3 78 * Construct a GattServer instance.
switches 0:5c4d7b2438d3 79 */
switches 0:5c4d7b2438d3 80 GattServer() :
switches 0:5c4d7b2438d3 81 serviceCount(0),
switches 0:5c4d7b2438d3 82 characteristicCount(0),
switches 0:5c4d7b2438d3 83 dataSentCallChain(),
switches 0:5c4d7b2438d3 84 dataWrittenCallChain(),
switches 0:5c4d7b2438d3 85 dataReadCallChain(),
switches 0:5c4d7b2438d3 86 updatesEnabledCallback(NULL),
switches 0:5c4d7b2438d3 87 updatesDisabledCallback(NULL),
switches 0:5c4d7b2438d3 88 confirmationReceivedCallback(NULL) {
switches 0:5c4d7b2438d3 89 /* empty */
switches 0:5c4d7b2438d3 90 }
switches 0:5c4d7b2438d3 91
switches 0:5c4d7b2438d3 92 /*
switches 0:5c4d7b2438d3 93 * The following functions are meant to be overridden in the platform-specific sub-class.
switches 0:5c4d7b2438d3 94 */
switches 0:5c4d7b2438d3 95 public:
switches 0:5c4d7b2438d3 96
switches 0:5c4d7b2438d3 97 /**
switches 0:5c4d7b2438d3 98 * Add a service declaration to the local server ATT table. Also add the
switches 0:5c4d7b2438d3 99 * characteristics contained within.
switches 0:5c4d7b2438d3 100 *
switches 0:5c4d7b2438d3 101 * @param[in] service
switches 0:5c4d7b2438d3 102 * The service to be added.
switches 0:5c4d7b2438d3 103 *
switches 0:5c4d7b2438d3 104 * @return BLE_ERROR_NONE if the service was successfully added.
switches 0:5c4d7b2438d3 105 */
switches 0:5c4d7b2438d3 106 virtual ble_error_t addService(GattService &service) {
switches 0:5c4d7b2438d3 107 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 108 (void)service;
switches 0:5c4d7b2438d3 109
switches 0:5c4d7b2438d3 110 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 111 }
switches 0:5c4d7b2438d3 112
switches 0:5c4d7b2438d3 113 /**
switches 0:5c4d7b2438d3 114 * Read the value of a characteristic from the local GATT server.
switches 0:5c4d7b2438d3 115 *
switches 0:5c4d7b2438d3 116 * @param[in] attributeHandle
switches 0:5c4d7b2438d3 117 * Attribute handle for the value attribute of the characteristic.
switches 0:5c4d7b2438d3 118 * @param[out] buffer
switches 0:5c4d7b2438d3 119 * A buffer to hold the value being read.
switches 0:5c4d7b2438d3 120 * @param[in,out] lengthP
switches 0:5c4d7b2438d3 121 * Length of the buffer being supplied. If the attribute
switches 0:5c4d7b2438d3 122 * value is longer than the size of the supplied buffer,
switches 0:5c4d7b2438d3 123 * this variable will hold upon return the total attribute value length
switches 0:5c4d7b2438d3 124 * (excluding offset). The application may use this
switches 0:5c4d7b2438d3 125 * information to allocate a suitable buffer size.
switches 0:5c4d7b2438d3 126 *
switches 0:5c4d7b2438d3 127 * @return BLE_ERROR_NONE if a value was read successfully into the buffer.
switches 0:5c4d7b2438d3 128 */
switches 0:5c4d7b2438d3 129 virtual ble_error_t read(GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) {
switches 0:5c4d7b2438d3 130 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 131 (void)attributeHandle;
switches 0:5c4d7b2438d3 132 (void)buffer;
switches 0:5c4d7b2438d3 133 (void)lengthP;
switches 0:5c4d7b2438d3 134
switches 0:5c4d7b2438d3 135 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 136 }
switches 0:5c4d7b2438d3 137
switches 0:5c4d7b2438d3 138 /**
switches 0:5c4d7b2438d3 139 * Read the value of a characteristic from the local GATT server.
switches 0:5c4d7b2438d3 140 *
switches 0:5c4d7b2438d3 141 * @param[in] connectionHandle
switches 0:5c4d7b2438d3 142 * Connection handle.
switches 0:5c4d7b2438d3 143 * @param[in] attributeHandle
switches 0:5c4d7b2438d3 144 * Attribute handle for the value attribute of the characteristic.
switches 0:5c4d7b2438d3 145 * @param[out] buffer
switches 0:5c4d7b2438d3 146 * A buffer to hold the value being read.
switches 0:5c4d7b2438d3 147 * @param[in,out] lengthP
switches 0:5c4d7b2438d3 148 * Length of the buffer being supplied. If the attribute
switches 0:5c4d7b2438d3 149 * value is longer than the size of the supplied buffer,
switches 0:5c4d7b2438d3 150 * this variable will hold upon return the total attribute value length
switches 0:5c4d7b2438d3 151 * (excluding offset). The application may use this
switches 0:5c4d7b2438d3 152 * information to allocate a suitable buffer size.
switches 0:5c4d7b2438d3 153 *
switches 0:5c4d7b2438d3 154 * @return BLE_ERROR_NONE if a value was read successfully into the buffer.
switches 0:5c4d7b2438d3 155 *
switches 0:5c4d7b2438d3 156 * @note This API is a version of the above, with an additional connection handle
switches 0:5c4d7b2438d3 157 * parameter to allow fetches for connection-specific multivalued
switches 0:5c4d7b2438d3 158 * attributes (such as the CCCDs).
switches 0:5c4d7b2438d3 159 */
switches 0:5c4d7b2438d3 160 virtual ble_error_t read(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t *buffer, uint16_t *lengthP) {
switches 0:5c4d7b2438d3 161 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 162 (void)connectionHandle;
switches 0:5c4d7b2438d3 163 (void)attributeHandle;
switches 0:5c4d7b2438d3 164 (void)buffer;
switches 0:5c4d7b2438d3 165 (void)lengthP;
switches 0:5c4d7b2438d3 166
switches 0:5c4d7b2438d3 167 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 168 }
switches 0:5c4d7b2438d3 169
switches 0:5c4d7b2438d3 170 /**
switches 0:5c4d7b2438d3 171 * Update the value of a characteristic on the local GATT server.
switches 0:5c4d7b2438d3 172 *
switches 0:5c4d7b2438d3 173 * @param[in] attributeHandle
switches 0:5c4d7b2438d3 174 * Handle for the value attribute of the characteristic.
switches 0:5c4d7b2438d3 175 * @param[in] value
switches 0:5c4d7b2438d3 176 * A pointer to a buffer holding the new value.
switches 0:5c4d7b2438d3 177 * @param[in] size
switches 0:5c4d7b2438d3 178 * Size of the new value (in bytes).
switches 0:5c4d7b2438d3 179 * @param[in] localOnly
switches 0:5c4d7b2438d3 180 * Should this update be kept on the local
switches 0:5c4d7b2438d3 181 * GATT server regardless of the state of the
switches 0:5c4d7b2438d3 182 * notify/indicate flag in the CCCD for this
switches 0:5c4d7b2438d3 183 * Characteristic? If set to true, no notification
switches 0:5c4d7b2438d3 184 * or indication is generated.
switches 0:5c4d7b2438d3 185 *
switches 0:5c4d7b2438d3 186 * @return BLE_ERROR_NONE if we have successfully set the value of the attribute.
switches 0:5c4d7b2438d3 187 */
switches 0:5c4d7b2438d3 188 virtual ble_error_t write(GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false) {
switches 0:5c4d7b2438d3 189 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 190 (void)attributeHandle;
switches 0:5c4d7b2438d3 191 (void)value;
switches 0:5c4d7b2438d3 192 (void)size;
switches 0:5c4d7b2438d3 193 (void)localOnly;
switches 0:5c4d7b2438d3 194
switches 0:5c4d7b2438d3 195 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 196 }
switches 0:5c4d7b2438d3 197
switches 0:5c4d7b2438d3 198 /**
switches 0:5c4d7b2438d3 199 * Update the value of a characteristic on the local GATT server. A version
switches 0:5c4d7b2438d3 200 * of the same as the above, with a connection handle parameter to allow updates
switches 0:5c4d7b2438d3 201 * for connection-specific multivalued attributes (such as the CCCDs).
switches 0:5c4d7b2438d3 202 *
switches 0:5c4d7b2438d3 203 * @param[in] connectionHandle
switches 0:5c4d7b2438d3 204 * Connection handle.
switches 0:5c4d7b2438d3 205 * @param[in] attributeHandle
switches 0:5c4d7b2438d3 206 * Handle for the value attribute of the characteristic.
switches 0:5c4d7b2438d3 207 * @param[in] value
switches 0:5c4d7b2438d3 208 * A pointer to a buffer holding the new value.
switches 0:5c4d7b2438d3 209 * @param[in] size
switches 0:5c4d7b2438d3 210 * Size of the new value (in bytes).
switches 0:5c4d7b2438d3 211 * @param[in] localOnly
switches 0:5c4d7b2438d3 212 * Should this update be kept on the local
switches 0:5c4d7b2438d3 213 * GattServer regardless of the state of the
switches 0:5c4d7b2438d3 214 * notify/indicate flag in the CCCD for this
switches 0:5c4d7b2438d3 215 * Characteristic? If set to true, no notification
switches 0:5c4d7b2438d3 216 * or indication is generated.
switches 0:5c4d7b2438d3 217 *
switches 0:5c4d7b2438d3 218 * @return BLE_ERROR_NONE if we have successfully set the value of the attribute.
switches 0:5c4d7b2438d3 219 */
switches 0:5c4d7b2438d3 220 virtual ble_error_t write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, const uint8_t *value, uint16_t size, bool localOnly = false) {
switches 0:5c4d7b2438d3 221 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 222 (void)connectionHandle;
switches 0:5c4d7b2438d3 223 (void)attributeHandle;
switches 0:5c4d7b2438d3 224 (void)value;
switches 0:5c4d7b2438d3 225 (void)size;
switches 0:5c4d7b2438d3 226 (void)localOnly;
switches 0:5c4d7b2438d3 227
switches 0:5c4d7b2438d3 228 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 229 }
switches 0:5c4d7b2438d3 230
switches 0:5c4d7b2438d3 231 /**
switches 0:5c4d7b2438d3 232 * Determine the updates-enabled status (notification or indication) for the current connection from a characteristic's CCCD.
switches 0:5c4d7b2438d3 233 *
switches 0:5c4d7b2438d3 234 * @param[in] characteristic
switches 0:5c4d7b2438d3 235 * The characteristic.
switches 0:5c4d7b2438d3 236 * @param[out] enabledP
switches 0:5c4d7b2438d3 237 * Upon return, *enabledP is true if updates are enabled, else false.
switches 0:5c4d7b2438d3 238 *
switches 0:5c4d7b2438d3 239 * @return BLE_ERROR_NONE if the connection and handle are found. False otherwise.
switches 0:5c4d7b2438d3 240 */
switches 0:5c4d7b2438d3 241 virtual ble_error_t areUpdatesEnabled(const GattCharacteristic &characteristic, bool *enabledP) {
switches 0:5c4d7b2438d3 242 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 243 (void)characteristic;
switches 0:5c4d7b2438d3 244 (void)enabledP;
switches 0:5c4d7b2438d3 245
switches 0:5c4d7b2438d3 246 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 247 }
switches 0:5c4d7b2438d3 248
switches 0:5c4d7b2438d3 249 /**
switches 0:5c4d7b2438d3 250 * Determine the connection-specific updates-enabled status (notification or indication) from a characteristic's CCCD.
switches 0:5c4d7b2438d3 251 *
switches 0:5c4d7b2438d3 252 * @param[in] connectionHandle
switches 0:5c4d7b2438d3 253 * The connection handle.
switches 0:5c4d7b2438d3 254 * @param[in] characteristic
switches 0:5c4d7b2438d3 255 * The characteristic.
switches 0:5c4d7b2438d3 256 * @param[out] enabledP
switches 0:5c4d7b2438d3 257 * Upon return, *enabledP is true if updates are enabled, else false.
switches 0:5c4d7b2438d3 258 *
switches 0:5c4d7b2438d3 259 * @return BLE_ERROR_NONE if the connection and handle are found. False otherwise.
switches 0:5c4d7b2438d3 260 */
switches 0:5c4d7b2438d3 261 virtual ble_error_t areUpdatesEnabled(Gap::Handle_t connectionHandle, const GattCharacteristic &characteristic, bool *enabledP) {
switches 0:5c4d7b2438d3 262 /* Avoid compiler warnings about unused variables. */
switches 0:5c4d7b2438d3 263 (void)connectionHandle;
switches 0:5c4d7b2438d3 264 (void)characteristic;
switches 0:5c4d7b2438d3 265 (void)enabledP;
switches 0:5c4d7b2438d3 266
switches 0:5c4d7b2438d3 267 return BLE_ERROR_NOT_IMPLEMENTED; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 268 }
switches 0:5c4d7b2438d3 269
switches 0:5c4d7b2438d3 270 /**
switches 0:5c4d7b2438d3 271 * A virtual function to allow underlying stacks to indicate if they support
switches 0:5c4d7b2438d3 272 * onDataRead(). It should be overridden to return true as applicable.
switches 0:5c4d7b2438d3 273 *
switches 0:5c4d7b2438d3 274 * @return true if onDataRead is supported, false otherwise.
switches 0:5c4d7b2438d3 275 */
switches 0:5c4d7b2438d3 276 virtual bool isOnDataReadAvailable() const {
switches 0:5c4d7b2438d3 277 return false; /* Requesting action from porters: override this API if this capability is supported. */
switches 0:5c4d7b2438d3 278 }
switches 0:5c4d7b2438d3 279
switches 0:5c4d7b2438d3 280 /*
switches 0:5c4d7b2438d3 281 * APIs with non-virtual implementations.
switches 0:5c4d7b2438d3 282 */
switches 0:5c4d7b2438d3 283 public:
switches 0:5c4d7b2438d3 284 /**
switches 0:5c4d7b2438d3 285 * Add a callback for the GATT event DATA_SENT (which is triggered when
switches 0:5c4d7b2438d3 286 * updates are sent out by GATT in the form of notifications).
switches 0:5c4d7b2438d3 287 *
switches 0:5c4d7b2438d3 288 * @param[in] callback
switches 0:5c4d7b2438d3 289 * Event handler being registered.
switches 0:5c4d7b2438d3 290 *
switches 0:5c4d7b2438d3 291 * @note It is possible to chain together multiple onDataSent callbacks
switches 0:5c4d7b2438d3 292 * (potentially from different modules of an application) to receive updates
switches 0:5c4d7b2438d3 293 * to characteristics.
switches 0:5c4d7b2438d3 294 *
switches 0:5c4d7b2438d3 295 * @note It is also possible to set up a callback into a member function of
switches 0:5c4d7b2438d3 296 * some object.
switches 0:5c4d7b2438d3 297 */
switches 0:5c4d7b2438d3 298 void onDataSent(const DataSentCallback_t& callback) {
switches 0:5c4d7b2438d3 299 dataSentCallChain.add(callback);
switches 0:5c4d7b2438d3 300 }
switches 0:5c4d7b2438d3 301
switches 0:5c4d7b2438d3 302 /**
switches 0:5c4d7b2438d3 303 * Same as GattServer::onDataSent(), but allows the possibility to add an object
switches 0:5c4d7b2438d3 304 * reference and member function as handler for DATA_SENT event
switches 0:5c4d7b2438d3 305 * callbacks.
switches 0:5c4d7b2438d3 306 *
switches 0:5c4d7b2438d3 307 * @param[in] objPtr
switches 0:5c4d7b2438d3 308 * Pointer to the object of a class defining the member callback
switches 0:5c4d7b2438d3 309 * function (@p memberPtr).
switches 0:5c4d7b2438d3 310 * @param[in] memberPtr
switches 0:5c4d7b2438d3 311 * The member callback (within the context of an object) to be
switches 0:5c4d7b2438d3 312 * invoked.
switches 0:5c4d7b2438d3 313 */
switches 0:5c4d7b2438d3 314 template <typename T>
switches 0:5c4d7b2438d3 315 void onDataSent(T *objPtr, void (T::*memberPtr)(unsigned count)) {
switches 0:5c4d7b2438d3 316 dataSentCallChain.add(objPtr, memberPtr);
switches 0:5c4d7b2438d3 317 }
switches 0:5c4d7b2438d3 318
switches 0:5c4d7b2438d3 319 /**
switches 0:5c4d7b2438d3 320 * @brief Provide access to the callchain of DATA_SENT event callbacks.
switches 0:5c4d7b2438d3 321 *
switches 0:5c4d7b2438d3 322 * @return A reference to the DATA_SENT event callback chain.
switches 0:5c4d7b2438d3 323 */
switches 0:5c4d7b2438d3 324 DataSentCallbackChain_t& onDataSent() {
switches 0:5c4d7b2438d3 325 return dataSentCallChain;
switches 0:5c4d7b2438d3 326 }
switches 0:5c4d7b2438d3 327
switches 0:5c4d7b2438d3 328 /**
switches 0:5c4d7b2438d3 329 * Set up a callback for when an attribute has its value updated by or at the
switches 0:5c4d7b2438d3 330 * connected peer. For a peripheral, this callback is triggered when the local
switches 0:5c4d7b2438d3 331 * GATT server has an attribute updated by a write command from the peer.
switches 0:5c4d7b2438d3 332 * For a central, this callback is triggered when a response is received for
switches 0:5c4d7b2438d3 333 * a write request.
switches 0:5c4d7b2438d3 334 *
switches 0:5c4d7b2438d3 335 * @param[in] callback
switches 0:5c4d7b2438d3 336 * Event handler being registered.
switches 0:5c4d7b2438d3 337 *
switches 0:5c4d7b2438d3 338 * @note It is possible to chain together multiple onDataWritten callbacks
switches 0:5c4d7b2438d3 339 * (potentially from different modules of an application) to receive updates
switches 0:5c4d7b2438d3 340 * to characteristics. Many services, such as DFU and UART, add their own
switches 0:5c4d7b2438d3 341 * onDataWritten callbacks behind the scenes to trap interesting events.
switches 0:5c4d7b2438d3 342 *
switches 0:5c4d7b2438d3 343 * @note It is also possible to set up a callback into a member function of
switches 0:5c4d7b2438d3 344 * some object.
switches 0:5c4d7b2438d3 345 *
switches 0:5c4d7b2438d3 346 * @note It is possible to unregister a callback using onDataWritten().detach(callback)
switches 0:5c4d7b2438d3 347 */
switches 0:5c4d7b2438d3 348 void onDataWritten(const DataWrittenCallback_t& callback) {
switches 0:5c4d7b2438d3 349 dataWrittenCallChain.add(callback);
switches 0:5c4d7b2438d3 350 }
switches 0:5c4d7b2438d3 351
switches 0:5c4d7b2438d3 352 /**
switches 0:5c4d7b2438d3 353 * Same as GattServer::onDataWritten(), but allows the possibility to add an object
switches 0:5c4d7b2438d3 354 * reference and member function as handler for data written event
switches 0:5c4d7b2438d3 355 * callbacks.
switches 0:5c4d7b2438d3 356 *
switches 0:5c4d7b2438d3 357 * @param[in] objPtr
switches 0:5c4d7b2438d3 358 * Pointer to the object of a class defining the member callback
switches 0:5c4d7b2438d3 359 * function (@p memberPtr).
switches 0:5c4d7b2438d3 360 * @param[in] memberPtr
switches 0:5c4d7b2438d3 361 * The member callback (within the context of an object) to be
switches 0:5c4d7b2438d3 362 * invoked.
switches 0:5c4d7b2438d3 363 */
switches 0:5c4d7b2438d3 364 template <typename T>
switches 0:5c4d7b2438d3 365 void onDataWritten(T *objPtr, void (T::*memberPtr)(const GattWriteCallbackParams *context)) {
switches 0:5c4d7b2438d3 366 dataWrittenCallChain.add(objPtr, memberPtr);
switches 0:5c4d7b2438d3 367 }
switches 0:5c4d7b2438d3 368
switches 0:5c4d7b2438d3 369 /**
switches 0:5c4d7b2438d3 370 * @brief Provide access to the callchain of data written event callbacks.
switches 0:5c4d7b2438d3 371 *
switches 0:5c4d7b2438d3 372 * @return A reference to the data written event callbacks chain.
switches 0:5c4d7b2438d3 373 *
switches 0:5c4d7b2438d3 374 * @note It is possible to register callbacks using onDataWritten().add(callback).
switches 0:5c4d7b2438d3 375 *
switches 0:5c4d7b2438d3 376 * @note It is possible to unregister callbacks using onDataWritten().detach(callback).
switches 0:5c4d7b2438d3 377 */
switches 0:5c4d7b2438d3 378 DataWrittenCallbackChain_t& onDataWritten() {
switches 0:5c4d7b2438d3 379 return dataWrittenCallChain;
switches 0:5c4d7b2438d3 380 }
switches 0:5c4d7b2438d3 381
switches 0:5c4d7b2438d3 382 /**
switches 0:5c4d7b2438d3 383 * Setup a callback to be invoked on the peripheral when an attribute is
switches 0:5c4d7b2438d3 384 * being read by a remote client.
switches 0:5c4d7b2438d3 385 *
switches 0:5c4d7b2438d3 386 * @param[in] callback
switches 0:5c4d7b2438d3 387 * Event handler being registered.
switches 0:5c4d7b2438d3 388 *
switches 0:5c4d7b2438d3 389 * @return BLE_ERROR_NOT_IMPLEMENTED if this functionality isn't available;
switches 0:5c4d7b2438d3 390 * else BLE_ERROR_NONE.
switches 0:5c4d7b2438d3 391 *
switches 0:5c4d7b2438d3 392 * @note This functionality may not be available on all underlying stacks.
switches 0:5c4d7b2438d3 393 * You could use GattCharacteristic::setReadAuthorizationCallback() as an
switches 0:5c4d7b2438d3 394 * alternative. Refer to isOnDataReadAvailable().
switches 0:5c4d7b2438d3 395 *
switches 0:5c4d7b2438d3 396 * @note It is possible to chain together multiple onDataRead callbacks
switches 0:5c4d7b2438d3 397 * (potentially from different modules of an application) to receive updates
switches 0:5c4d7b2438d3 398 * to characteristics. Services may add their own onDataRead callbacks
switches 0:5c4d7b2438d3 399 * behind the scenes to trap interesting events.
switches 0:5c4d7b2438d3 400 *
switches 0:5c4d7b2438d3 401 * @note It is also possible to set up a callback into a member function of
switches 0:5c4d7b2438d3 402 * some object.
switches 0:5c4d7b2438d3 403 *
switches 0:5c4d7b2438d3 404 * @note It is possible to unregister a callback using onDataRead().detach(callback).
switches 0:5c4d7b2438d3 405 */
switches 0:5c4d7b2438d3 406 ble_error_t onDataRead(const DataReadCallback_t& callback) {
switches 0:5c4d7b2438d3 407 if (!isOnDataReadAvailable()) {
switches 0:5c4d7b2438d3 408 return BLE_ERROR_NOT_IMPLEMENTED;
switches 0:5c4d7b2438d3 409 }
switches 0:5c4d7b2438d3 410
switches 0:5c4d7b2438d3 411 dataReadCallChain.add(callback);
switches 0:5c4d7b2438d3 412 return BLE_ERROR_NONE;
switches 0:5c4d7b2438d3 413 }
switches 0:5c4d7b2438d3 414
switches 0:5c4d7b2438d3 415 /**
switches 0:5c4d7b2438d3 416 * Same as GattServer::onDataRead(), but allows the possibility to add an object
switches 0:5c4d7b2438d3 417 * reference and member function as handler for data read event
switches 0:5c4d7b2438d3 418 * callbacks.
switches 0:5c4d7b2438d3 419 *
switches 0:5c4d7b2438d3 420 * @param[in] objPtr
switches 0:5c4d7b2438d3 421 * Pointer to the object of a class defining the member callback
switches 0:5c4d7b2438d3 422 * function (@p memberPtr).
switches 0:5c4d7b2438d3 423 * @param[in] memberPtr
switches 0:5c4d7b2438d3 424 * The member callback (within the context of an object) to be
switches 0:5c4d7b2438d3 425 * invoked.
switches 0:5c4d7b2438d3 426 */
switches 0:5c4d7b2438d3 427 template <typename T>
switches 0:5c4d7b2438d3 428 ble_error_t onDataRead(T *objPtr, void (T::*memberPtr)(const GattReadCallbackParams *context)) {
switches 0:5c4d7b2438d3 429 if (!isOnDataReadAvailable()) {
switches 0:5c4d7b2438d3 430 return BLE_ERROR_NOT_IMPLEMENTED;
switches 0:5c4d7b2438d3 431 }
switches 0:5c4d7b2438d3 432
switches 0:5c4d7b2438d3 433 dataReadCallChain.add(objPtr, memberPtr);
switches 0:5c4d7b2438d3 434 return BLE_ERROR_NONE;
switches 0:5c4d7b2438d3 435 }
switches 0:5c4d7b2438d3 436
switches 0:5c4d7b2438d3 437 /**
switches 0:5c4d7b2438d3 438 * @brief Provide access to the callchain of data read event callbacks.
switches 0:5c4d7b2438d3 439 *
switches 0:5c4d7b2438d3 440 * @return A reference to the data read event callbacks chain.
switches 0:5c4d7b2438d3 441 *
switches 0:5c4d7b2438d3 442 * @note It is possible to register callbacks using onDataRead().add(callback).
switches 0:5c4d7b2438d3 443 *
switches 0:5c4d7b2438d3 444 * @note It is possible to unregister callbacks using onDataRead().detach(callback).
switches 0:5c4d7b2438d3 445 */
switches 0:5c4d7b2438d3 446 DataReadCallbackChain_t& onDataRead() {
switches 0:5c4d7b2438d3 447 return dataReadCallChain;
switches 0:5c4d7b2438d3 448 }
switches 0:5c4d7b2438d3 449
switches 0:5c4d7b2438d3 450 /**
switches 0:5c4d7b2438d3 451 * Setup a callback to be invoked to notify the user application that the
switches 0:5c4d7b2438d3 452 * GattServer instance is about to shutdown (possibly as a result of a call
switches 0:5c4d7b2438d3 453 * to BLE::shutdown()).
switches 0:5c4d7b2438d3 454 *
switches 0:5c4d7b2438d3 455 * @param[in] callback
switches 0:5c4d7b2438d3 456 * Event handler being registered.
switches 0:5c4d7b2438d3 457 *
switches 0:5c4d7b2438d3 458 * @note It is possible to chain together multiple onShutdown callbacks
switches 0:5c4d7b2438d3 459 * (potentially from different modules of an application) to be notified
switches 0:5c4d7b2438d3 460 * before the GattServer is shutdown.
switches 0:5c4d7b2438d3 461 *
switches 0:5c4d7b2438d3 462 * @note It is also possible to set up a callback into a member function of
switches 0:5c4d7b2438d3 463 * some object.
switches 0:5c4d7b2438d3 464 *
switches 0:5c4d7b2438d3 465 * @note It is possible to unregister a callback using onShutdown().detach(callback)
switches 0:5c4d7b2438d3 466 */
switches 0:5c4d7b2438d3 467 void onShutdown(const GattServerShutdownCallback_t& callback) {
switches 0:5c4d7b2438d3 468 shutdownCallChain.add(callback);
switches 0:5c4d7b2438d3 469 }
switches 0:5c4d7b2438d3 470
switches 0:5c4d7b2438d3 471 /**
switches 0:5c4d7b2438d3 472 * Same as GattServer::onShutdown(), but allows the possibility to add an object
switches 0:5c4d7b2438d3 473 * reference and member function as handler for shutdown event
switches 0:5c4d7b2438d3 474 * callbacks.
switches 0:5c4d7b2438d3 475 *
switches 0:5c4d7b2438d3 476 * @param[in] objPtr
switches 0:5c4d7b2438d3 477 * Pointer to the object of a class defining the member callback
switches 0:5c4d7b2438d3 478 * function (@p memberPtr).
switches 0:5c4d7b2438d3 479 * @param[in] memberPtr
switches 0:5c4d7b2438d3 480 * The member callback (within the context of an object) to be
switches 0:5c4d7b2438d3 481 * invoked.
switches 0:5c4d7b2438d3 482 */
switches 0:5c4d7b2438d3 483 template <typename T>
switches 0:5c4d7b2438d3 484 void onShutdown(T *objPtr, void (T::*memberPtr)(const GattServer *)) {
switches 0:5c4d7b2438d3 485 shutdownCallChain.add(objPtr, memberPtr);
switches 0:5c4d7b2438d3 486 }
switches 0:5c4d7b2438d3 487
switches 0:5c4d7b2438d3 488 /**
switches 0:5c4d7b2438d3 489 * @brief Provide access to the callchain of shutdown event callbacks.
switches 0:5c4d7b2438d3 490 *
switches 0:5c4d7b2438d3 491 * @return A reference to the shutdown event callbacks chain.
switches 0:5c4d7b2438d3 492 *
switches 0:5c4d7b2438d3 493 * @note It is possible to register callbacks using onShutdown().add(callback).
switches 0:5c4d7b2438d3 494 *
switches 0:5c4d7b2438d3 495 * @note It is possible to unregister callbacks using onShutdown().detach(callback).
switches 0:5c4d7b2438d3 496 */
switches 0:5c4d7b2438d3 497 GattServerShutdownCallbackChain_t& onShutdown() {
switches 0:5c4d7b2438d3 498 return shutdownCallChain;
switches 0:5c4d7b2438d3 499 }
switches 0:5c4d7b2438d3 500
switches 0:5c4d7b2438d3 501 /**
switches 0:5c4d7b2438d3 502 * Set up a callback for when notifications or indications are enabled for a
switches 0:5c4d7b2438d3 503 * characteristic on the local GATT server.
switches 0:5c4d7b2438d3 504 *
switches 0:5c4d7b2438d3 505 * @param[in] callback
switches 0:5c4d7b2438d3 506 * Event handler being registered.
switches 0:5c4d7b2438d3 507 */
switches 0:5c4d7b2438d3 508 void onUpdatesEnabled(EventCallback_t callback) {
switches 0:5c4d7b2438d3 509 updatesEnabledCallback = callback;
switches 0:5c4d7b2438d3 510 }
switches 0:5c4d7b2438d3 511
switches 0:5c4d7b2438d3 512 /**
switches 0:5c4d7b2438d3 513 * Set up a callback for when notifications or indications are disabled for a
switches 0:5c4d7b2438d3 514 * characteristic on the local GATT server.
switches 0:5c4d7b2438d3 515 *
switches 0:5c4d7b2438d3 516 * @param[in] callback
switches 0:5c4d7b2438d3 517 * Event handler being registered.
switches 0:5c4d7b2438d3 518 */
switches 0:5c4d7b2438d3 519 void onUpdatesDisabled(EventCallback_t callback) {
switches 0:5c4d7b2438d3 520 updatesDisabledCallback = callback;
switches 0:5c4d7b2438d3 521 }
switches 0:5c4d7b2438d3 522
switches 0:5c4d7b2438d3 523 /**
switches 0:5c4d7b2438d3 524 * Set up a callback for when the GATT server receives a response for an
switches 0:5c4d7b2438d3 525 * indication event sent previously.
switches 0:5c4d7b2438d3 526 *
switches 0:5c4d7b2438d3 527 * @param[in] callback
switches 0:5c4d7b2438d3 528 * Event handler being registered.
switches 0:5c4d7b2438d3 529 */
switches 0:5c4d7b2438d3 530 void onConfirmationReceived(EventCallback_t callback) {
switches 0:5c4d7b2438d3 531 confirmationReceivedCallback = callback;
switches 0:5c4d7b2438d3 532 }
switches 0:5c4d7b2438d3 533
switches 0:5c4d7b2438d3 534 /* Entry points for the underlying stack to report events back to the user. */
switches 0:5c4d7b2438d3 535 protected:
switches 0:5c4d7b2438d3 536 /**
switches 0:5c4d7b2438d3 537 * Helper function that notifies all registered handlers of an occurrence
switches 0:5c4d7b2438d3 538 * of a data written event. This function is meant to be called from the
switches 0:5c4d7b2438d3 539 * BLE stack specific implementation when a data written event occurs.
switches 0:5c4d7b2438d3 540 *
switches 0:5c4d7b2438d3 541 * @param[in] params
switches 0:5c4d7b2438d3 542 * The data written parameters passed to the registered
switches 0:5c4d7b2438d3 543 * handlers.
switches 0:5c4d7b2438d3 544 */
switches 0:5c4d7b2438d3 545 void handleDataWrittenEvent(const GattWriteCallbackParams *params) {
switches 0:5c4d7b2438d3 546 dataWrittenCallChain.call(params);
switches 0:5c4d7b2438d3 547 }
switches 0:5c4d7b2438d3 548
switches 0:5c4d7b2438d3 549 /**
switches 0:5c4d7b2438d3 550 * Helper function that notifies all registered handlers of an occurrence
switches 0:5c4d7b2438d3 551 * of a data read event. This function is meant to be called from the
switches 0:5c4d7b2438d3 552 * BLE stack specific implementation when a data read event occurs.
switches 0:5c4d7b2438d3 553 *
switches 0:5c4d7b2438d3 554 * @param[in] params
switches 0:5c4d7b2438d3 555 * The data read parameters passed to the registered
switches 0:5c4d7b2438d3 556 * handlers.
switches 0:5c4d7b2438d3 557 */
switches 0:5c4d7b2438d3 558 void handleDataReadEvent(const GattReadCallbackParams *params) {
switches 0:5c4d7b2438d3 559 dataReadCallChain.call(params);
switches 0:5c4d7b2438d3 560 }
switches 0:5c4d7b2438d3 561
switches 0:5c4d7b2438d3 562 /**
switches 0:5c4d7b2438d3 563 * Helper function that notifies the registered handler of an occurrence
switches 0:5c4d7b2438d3 564 * of updates enabled, updates disabled and confirmation received events.
switches 0:5c4d7b2438d3 565 * This function is meant to be called from the BLE stack specific
switches 0:5c4d7b2438d3 566 * implementation when any of these events occurs.
switches 0:5c4d7b2438d3 567 *
switches 0:5c4d7b2438d3 568 * @param[in] type
switches 0:5c4d7b2438d3 569 * The type of event that occurred.
switches 0:5c4d7b2438d3 570 * @param[in] attributeHandle
switches 0:5c4d7b2438d3 571 * The handle of the attribute that was modified.
switches 0:5c4d7b2438d3 572 */
switches 0:5c4d7b2438d3 573 void handleEvent(GattServerEvents::gattEvent_e type, GattAttribute::Handle_t attributeHandle) {
switches 0:5c4d7b2438d3 574 switch (type) {
switches 0:5c4d7b2438d3 575 case GattServerEvents::GATT_EVENT_UPDATES_ENABLED:
switches 0:5c4d7b2438d3 576 if (updatesEnabledCallback) {
switches 0:5c4d7b2438d3 577 updatesEnabledCallback(attributeHandle);
switches 0:5c4d7b2438d3 578 }
switches 0:5c4d7b2438d3 579 break;
switches 0:5c4d7b2438d3 580 case GattServerEvents::GATT_EVENT_UPDATES_DISABLED:
switches 0:5c4d7b2438d3 581 if (updatesDisabledCallback) {
switches 0:5c4d7b2438d3 582 updatesDisabledCallback(attributeHandle);
switches 0:5c4d7b2438d3 583 }
switches 0:5c4d7b2438d3 584 break;
switches 0:5c4d7b2438d3 585 case GattServerEvents::GATT_EVENT_CONFIRMATION_RECEIVED:
switches 0:5c4d7b2438d3 586 if (confirmationReceivedCallback) {
switches 0:5c4d7b2438d3 587 confirmationReceivedCallback(attributeHandle);
switches 0:5c4d7b2438d3 588 }
switches 0:5c4d7b2438d3 589 break;
switches 0:5c4d7b2438d3 590 default:
switches 0:5c4d7b2438d3 591 break;
switches 0:5c4d7b2438d3 592 }
switches 0:5c4d7b2438d3 593 }
switches 0:5c4d7b2438d3 594
switches 0:5c4d7b2438d3 595 /**
switches 0:5c4d7b2438d3 596 * Helper function that notifies all registered handlers of an occurrence
switches 0:5c4d7b2438d3 597 * of a data sent event. This function is meant to be called from the
switches 0:5c4d7b2438d3 598 * BLE stack specific implementation when a data sent event occurs.
switches 0:5c4d7b2438d3 599 *
switches 0:5c4d7b2438d3 600 * @param[in] count
switches 0:5c4d7b2438d3 601 * Number of packets sent.
switches 0:5c4d7b2438d3 602 */
switches 0:5c4d7b2438d3 603 void handleDataSentEvent(unsigned count) {
switches 0:5c4d7b2438d3 604 dataSentCallChain.call(count);
switches 0:5c4d7b2438d3 605 }
switches 0:5c4d7b2438d3 606
switches 0:5c4d7b2438d3 607 public:
switches 0:5c4d7b2438d3 608 /**
switches 0:5c4d7b2438d3 609 * Notify all registered onShutdown callbacks that the GattServer is
switches 0:5c4d7b2438d3 610 * about to be shutdown and clear all GattServer state of the
switches 0:5c4d7b2438d3 611 * associated object.
switches 0:5c4d7b2438d3 612 *
switches 0:5c4d7b2438d3 613 * This function is meant to be overridden in the platform-specific
switches 0:5c4d7b2438d3 614 * sub-class. Nevertheless, the sub-class is only expected to reset its
switches 0:5c4d7b2438d3 615 * state and not the data held in GattServer members. This shall be achieved
switches 0:5c4d7b2438d3 616 * by a call to GattServer::reset() from the sub-class' reset()
switches 0:5c4d7b2438d3 617 * implementation.
switches 0:5c4d7b2438d3 618 *
switches 0:5c4d7b2438d3 619 * @return BLE_ERROR_NONE on success.
switches 0:5c4d7b2438d3 620 */
switches 0:5c4d7b2438d3 621 virtual ble_error_t reset(void) {
switches 0:5c4d7b2438d3 622 /* Notify that the instance is about to shutdown */
switches 0:5c4d7b2438d3 623 shutdownCallChain.call(this);
switches 0:5c4d7b2438d3 624 shutdownCallChain.clear();
switches 0:5c4d7b2438d3 625
switches 0:5c4d7b2438d3 626 serviceCount = 0;
switches 0:5c4d7b2438d3 627 characteristicCount = 0;
switches 0:5c4d7b2438d3 628
switches 0:5c4d7b2438d3 629 dataSentCallChain.clear();
switches 0:5c4d7b2438d3 630 dataWrittenCallChain.clear();
switches 0:5c4d7b2438d3 631 dataReadCallChain.clear();
switches 0:5c4d7b2438d3 632 updatesEnabledCallback = NULL;
switches 0:5c4d7b2438d3 633 updatesDisabledCallback = NULL;
switches 0:5c4d7b2438d3 634 confirmationReceivedCallback = NULL;
switches 0:5c4d7b2438d3 635
switches 0:5c4d7b2438d3 636 return BLE_ERROR_NONE;
switches 0:5c4d7b2438d3 637 }
switches 0:5c4d7b2438d3 638
switches 0:5c4d7b2438d3 639 protected:
switches 0:5c4d7b2438d3 640 /**
switches 0:5c4d7b2438d3 641 * The total number of services added to the ATT table.
switches 0:5c4d7b2438d3 642 */
switches 0:5c4d7b2438d3 643 uint8_t serviceCount;
switches 0:5c4d7b2438d3 644 /**
switches 0:5c4d7b2438d3 645 * The total number of characteristics added to the ATT table.
switches 0:5c4d7b2438d3 646 */
switches 0:5c4d7b2438d3 647 uint8_t characteristicCount;
switches 0:5c4d7b2438d3 648
switches 0:5c4d7b2438d3 649 private:
switches 0:5c4d7b2438d3 650 /**
switches 0:5c4d7b2438d3 651 * Callchain containing all registered callback handlers for data sent
switches 0:5c4d7b2438d3 652 * events.
switches 0:5c4d7b2438d3 653 */
switches 0:5c4d7b2438d3 654 DataSentCallbackChain_t dataSentCallChain;
switches 0:5c4d7b2438d3 655 /**
switches 0:5c4d7b2438d3 656 * Callchain containing all registered callback handlers for data written
switches 0:5c4d7b2438d3 657 * events.
switches 0:5c4d7b2438d3 658 */
switches 0:5c4d7b2438d3 659 DataWrittenCallbackChain_t dataWrittenCallChain;
switches 0:5c4d7b2438d3 660 /**
switches 0:5c4d7b2438d3 661 * Callchain containing all registered callback handlers for data read
switches 0:5c4d7b2438d3 662 * events.
switches 0:5c4d7b2438d3 663 */
switches 0:5c4d7b2438d3 664 DataReadCallbackChain_t dataReadCallChain;
switches 0:5c4d7b2438d3 665 /**
switches 0:5c4d7b2438d3 666 * Callchain containing all registered callback handlers for shutdown
switches 0:5c4d7b2438d3 667 * events.
switches 0:5c4d7b2438d3 668 */
switches 0:5c4d7b2438d3 669 GattServerShutdownCallbackChain_t shutdownCallChain;
switches 0:5c4d7b2438d3 670 /**
switches 0:5c4d7b2438d3 671 * The registered callback handler for updates enabled events.
switches 0:5c4d7b2438d3 672 */
switches 0:5c4d7b2438d3 673 EventCallback_t updatesEnabledCallback;
switches 0:5c4d7b2438d3 674 /**
switches 0:5c4d7b2438d3 675 * The registered callback handler for updates disabled events.
switches 0:5c4d7b2438d3 676 */
switches 0:5c4d7b2438d3 677 EventCallback_t updatesDisabledCallback;
switches 0:5c4d7b2438d3 678 /**
switches 0:5c4d7b2438d3 679 * The registered callback handler for confirmation received events.
switches 0:5c4d7b2438d3 680 */
switches 0:5c4d7b2438d3 681 EventCallback_t confirmationReceivedCallback;
switches 0:5c4d7b2438d3 682
switches 0:5c4d7b2438d3 683 private:
switches 0:5c4d7b2438d3 684 /* Disallow copy and assignment. */
switches 0:5c4d7b2438d3 685 GattServer(const GattServer &);
switches 0:5c4d7b2438d3 686 GattServer& operator=(const GattServer &);
switches 0:5c4d7b2438d3 687 };
switches 0:5c4d7b2438d3 688
switches 0:5c4d7b2438d3 689 #endif /* ifndef __GATT_SERVER_H__ */