High level Bluetooth Low Energy API and radio abstraction layer

Dependents:   BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more

Overview

The BLE_API is a high level abstraction for using Bluetooth Low Energy on multiple platforms. For details and examples using the BLE_API please see the BLE_API Summary Page. Or click on the API Documentation tab above.

Supported Services

Supported services can be found in the BLE_API/services folder.

Committer:
vcoubard
Date:
Wed Apr 06 19:15:30 2016 +0100
Revision:
1179:4ab722f8dca0
Parent:
1177:f9060dc8c5ab
Child:
1183:1589830dbdb7
Synchronized with git rev ca632aaf
Author: Andres Amaya Garcia
Update Gap state after advertising times out

The BLE API was not updating the Gap internal state when the advertising stops
because of a user timeout. This commit fixes the issue by updating the internal
state structure in Gap just before the registered callbacks are notified of the
advertising timeout.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vcoubard 1131:692ddf04fc42 1 /* mbed Microcontroller Library
vcoubard 1131:692ddf04fc42 2 * Copyright (c) 2006-2013 ARM Limited
vcoubard 1131:692ddf04fc42 3 *
vcoubard 1131:692ddf04fc42 4 * Licensed under the Apache License, Version 2.0 (the "License");
vcoubard 1131:692ddf04fc42 5 * you may not use this file except in compliance with the License.
vcoubard 1131:692ddf04fc42 6 * You may obtain a copy of the License at
vcoubard 1131:692ddf04fc42 7 *
vcoubard 1131:692ddf04fc42 8 * http://www.apache.org/licenses/LICENSE-2.0
vcoubard 1131:692ddf04fc42 9 *
vcoubard 1131:692ddf04fc42 10 * Unless required by applicable law or agreed to in writing, software
vcoubard 1131:692ddf04fc42 11 * distributed under the License is distributed on an "AS IS" BASIS,
vcoubard 1131:692ddf04fc42 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vcoubard 1131:692ddf04fc42 13 * See the License for the specific language governing permissions and
vcoubard 1131:692ddf04fc42 14 * limitations under the License.
vcoubard 1131:692ddf04fc42 15 */
vcoubard 1131:692ddf04fc42 16
vcoubard 1131:692ddf04fc42 17 #ifndef __DISCOVERED_CHARACTERISTIC_H__
vcoubard 1131:692ddf04fc42 18 #define __DISCOVERED_CHARACTERISTIC_H__
vcoubard 1131:692ddf04fc42 19
vcoubard 1131:692ddf04fc42 20 #include "UUID.h"
vcoubard 1131:692ddf04fc42 21 #include "Gap.h"
vcoubard 1131:692ddf04fc42 22 #include "GattAttribute.h"
vcoubard 1131:692ddf04fc42 23 #include "GattClient.h"
vcoubard 1135:22aada733dbd 24 #include "CharacteristicDescriptorDiscovery.h"
vcoubard 1135:22aada733dbd 25 #include "ble/DiscoveredCharacteristicDescriptor.h"
vcoubard 1131:692ddf04fc42 26
vcoubard 1131:692ddf04fc42 27 /**
vcoubard 1135:22aada733dbd 28 * @brief Representation of a characteristic discovered during a GattClient
vcoubard 1135:22aada733dbd 29 * discovery procedure (see GattClient::launchServiceDiscovery ).
vcoubard 1135:22aada733dbd 30 *
vcoubard 1179:4ab722f8dca0 31 * @detail Provide detailed informations about a discovered characteristic like:
vcoubard 1179:4ab722f8dca0 32 * - Its UUID (see #getUUID).
vcoubard 1135:22aada733dbd 33 * - The most important handles of the characteristic definition
vcoubard 1179:4ab722f8dca0 34 * (see #getDeclHandle, #getValueHandle, #getLastHandle )
vcoubard 1179:4ab722f8dca0 35 * - Its properties (see #getProperties).
vcoubard 1135:22aada733dbd 36 * This class also provide functions to operate on the characteristic:
vcoubard 1179:4ab722f8dca0 37 * - Read the characteristic value (see #read)
vcoubard 1179:4ab722f8dca0 38 * - Writing a characteristic value (see #write or #writeWoResponse)
vcoubard 1135:22aada733dbd 39 * - Discover descriptors inside the characteristic definition. These descriptors
vcoubard 1135:22aada733dbd 40 * extends the characteristic. More information about descriptor usage is
vcoubard 1135:22aada733dbd 41 * available in DiscoveredCharacteristicDescriptor class.
vcoubard 1131:692ddf04fc42 42 */
vcoubard 1131:692ddf04fc42 43 class DiscoveredCharacteristic {
vcoubard 1131:692ddf04fc42 44 public:
vcoubard 1131:692ddf04fc42 45 struct Properties_t {
vcoubard 1131:692ddf04fc42 46 uint8_t _broadcast :1; /**< Broadcasting the value permitted. */
vcoubard 1131:692ddf04fc42 47 uint8_t _read :1; /**< Reading the value permitted. */
vcoubard 1131:692ddf04fc42 48 uint8_t _writeWoResp :1; /**< Writing the value with Write Command permitted. */
vcoubard 1131:692ddf04fc42 49 uint8_t _write :1; /**< Writing the value with Write Request permitted. */
vcoubard 1135:22aada733dbd 50 uint8_t _notify :1; /**< Notifications of the value permitted. */
vcoubard 1131:692ddf04fc42 51 uint8_t _indicate :1; /**< Indications of the value permitted. */
vcoubard 1131:692ddf04fc42 52 uint8_t _authSignedWrite :1; /**< Writing the value with Signed Write Command permitted. */
vcoubard 1131:692ddf04fc42 53
vcoubard 1131:692ddf04fc42 54 public:
vcoubard 1179:4ab722f8dca0 55 bool broadcast(void) const {return _broadcast; }
vcoubard 1179:4ab722f8dca0 56 bool read(void) const {return _read; }
vcoubard 1179:4ab722f8dca0 57 bool writeWoResp(void) const {return _writeWoResp; }
vcoubard 1179:4ab722f8dca0 58 bool write(void) const {return _write; }
vcoubard 1179:4ab722f8dca0 59 bool notify(void) const {return _notify; }
vcoubard 1179:4ab722f8dca0 60 bool indicate(void) const {return _indicate; }
vcoubard 1179:4ab722f8dca0 61 bool authSignedWrite(void) const {return _authSignedWrite;}
vcoubard 1131:692ddf04fc42 62
vcoubard 1135:22aada733dbd 63 /**
vcoubard 1135:22aada733dbd 64 * @brief "Equal to" operator for DiscoveredCharacteristic::Properties_t
vcoubard 1135:22aada733dbd 65 *
vcoubard 1179:4ab722f8dca0 66 * @param lhs[in] The left hand side of the equality expression
vcoubard 1179:4ab722f8dca0 67 * @param rhs[in] The right hand side of the equality expression
vcoubard 1135:22aada733dbd 68 *
vcoubard 1135:22aada733dbd 69 * @return true if operands are equals, false otherwise.
vcoubard 1135:22aada733dbd 70 */
vcoubard 1135:22aada733dbd 71 friend bool operator==(Properties_t lhs, Properties_t rhs) {
vcoubard 1135:22aada733dbd 72 return lhs._broadcast == rhs._broadcast &&
vcoubard 1135:22aada733dbd 73 lhs._read == rhs._read &&
vcoubard 1135:22aada733dbd 74 lhs._writeWoResp == rhs._writeWoResp &&
vcoubard 1135:22aada733dbd 75 lhs._write == rhs._write &&
vcoubard 1135:22aada733dbd 76 lhs._notify == rhs._notify &&
vcoubard 1135:22aada733dbd 77 lhs._indicate == rhs._indicate &&
vcoubard 1135:22aada733dbd 78 lhs._authSignedWrite == rhs._authSignedWrite;
vcoubard 1135:22aada733dbd 79 }
vcoubard 1135:22aada733dbd 80
vcoubard 1135:22aada733dbd 81 /**
vcoubard 1135:22aada733dbd 82 * @brief "Not equal to" operator for DiscoveredCharacteristic::Properties_t
vcoubard 1135:22aada733dbd 83 *
vcoubard 1135:22aada733dbd 84 * @param lhs The right hand side of the expression
vcoubard 1135:22aada733dbd 85 * @param rhs The left hand side of the expression
vcoubard 1135:22aada733dbd 86 *
vcoubard 1135:22aada733dbd 87 * @return true if operands are not equals, false otherwise.
vcoubard 1135:22aada733dbd 88 */
vcoubard 1135:22aada733dbd 89 friend bool operator!=(Properties_t lhs, Properties_t rhs) {
vcoubard 1135:22aada733dbd 90 return !(lhs == rhs);
vcoubard 1135:22aada733dbd 91 }
vcoubard 1135:22aada733dbd 92
vcoubard 1131:692ddf04fc42 93 private:
vcoubard 1131:692ddf04fc42 94 operator uint8_t() const; /* Disallow implicit conversion into an integer. */
vcoubard 1131:692ddf04fc42 95 operator unsigned() const; /* Disallow implicit conversion into an integer. */
vcoubard 1131:692ddf04fc42 96 };
vcoubard 1131:692ddf04fc42 97
vcoubard 1131:692ddf04fc42 98 /**
vcoubard 1131:692ddf04fc42 99 * Initiate (or continue) a read for the value attribute, optionally at a
vcoubard 1131:692ddf04fc42 100 * given offset. If the characteristic or descriptor to be read is longer
vcoubard 1131:692ddf04fc42 101 * than ATT_MTU - 1, this function must be called multiple times with
vcoubard 1131:692ddf04fc42 102 * appropriate offset to read the complete value.
vcoubard 1131:692ddf04fc42 103 *
vcoubard 1179:4ab722f8dca0 104 * @param offset[in] The position - in the characteristic value bytes stream - where
vcoubard 1179:4ab722f8dca0 105 * the read operation begin.
vcoubard 1135:22aada733dbd 106 *
vcoubard 1131:692ddf04fc42 107 * @return BLE_ERROR_NONE if a read has been initiated, or
vcoubard 1131:692ddf04fc42 108 * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or
vcoubard 1131:692ddf04fc42 109 * BLE_STACK_BUSY if some client procedure is already in progress, or
vcoubard 1131:692ddf04fc42 110 * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties.
vcoubard 1131:692ddf04fc42 111 */
vcoubard 1131:692ddf04fc42 112 ble_error_t read(uint16_t offset = 0) const;
vcoubard 1131:692ddf04fc42 113
vcoubard 1135:22aada733dbd 114 /**
vcoubard 1135:22aada733dbd 115 * @brief Same as #read(uint16_t) const but allow the user to register a callback
vcoubard 1135:22aada733dbd 116 * which will be fired once the read is done.
vcoubard 1135:22aada733dbd 117 *
vcoubard 1179:4ab722f8dca0 118 * @param offset[in] The position - in the characteristic value bytes stream - where
vcoubard 1179:4ab722f8dca0 119 * the read operation begin.
vcoubard 1179:4ab722f8dca0 120 * @param onRead[in] Continuation of the read operation
vcoubard 1135:22aada733dbd 121 */
vcoubard 1131:692ddf04fc42 122 ble_error_t read(uint16_t offset, const GattClient::ReadCallback_t& onRead) const;
vcoubard 1131:692ddf04fc42 123
vcoubard 1131:692ddf04fc42 124 /**
vcoubard 1131:692ddf04fc42 125 * Perform a write without response procedure.
vcoubard 1131:692ddf04fc42 126 *
vcoubard 1135:22aada733dbd 127 * @param[in] length
vcoubard 1131:692ddf04fc42 128 * The amount of data being written.
vcoubard 1135:22aada733dbd 129 * @param[in] value
vcoubard 1131:692ddf04fc42 130 * The bytes being written.
vcoubard 1131:692ddf04fc42 131 *
vcoubard 1131:692ddf04fc42 132 * @note It is important to note that a write without response will generate
vcoubard 1131:692ddf04fc42 133 * an onDataSent() callback when the packet has been transmitted. There
vcoubard 1131:692ddf04fc42 134 * will be a BLE-stack specific limit to the number of pending
vcoubard 1131:692ddf04fc42 135 * writeWoResponse operations; the user may want to use the onDataSent()
vcoubard 1131:692ddf04fc42 136 * callback for flow-control.
vcoubard 1131:692ddf04fc42 137 *
vcoubard 1131:692ddf04fc42 138 * @retval BLE_ERROR_NONE Successfully started the Write procedure, or
vcoubard 1131:692ddf04fc42 139 * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or
vcoubard 1131:692ddf04fc42 140 * BLE_STACK_BUSY if some client procedure is already in progress, or
vcoubard 1131:692ddf04fc42 141 * BLE_ERROR_NO_MEM if there are no available buffers left to process the request, or
vcoubard 1131:692ddf04fc42 142 * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties.
vcoubard 1131:692ddf04fc42 143 */
vcoubard 1131:692ddf04fc42 144 ble_error_t writeWoResponse(uint16_t length, const uint8_t *value) const;
vcoubard 1131:692ddf04fc42 145
vcoubard 1131:692ddf04fc42 146 /**
vcoubard 1131:692ddf04fc42 147 * Initiate a GATT Characteristic Descriptor Discovery procedure for descriptors within this characteristic.
vcoubard 1131:692ddf04fc42 148 *
vcoubard 1135:22aada733dbd 149 * @param[in] onDescriptorDiscovered This callback will be called every time a descriptor is discovered
vcoubard 1135:22aada733dbd 150 * @param[in] onTermination This callback will be called when the discovery process is over.
vcoubard 1131:692ddf04fc42 151 *
vcoubard 1135:22aada733dbd 152 * @return BLE_ERROR_NONE if descriptor discovery is launched successfully; else an appropriate error.
vcoubard 1131:692ddf04fc42 153 */
vcoubard 1135:22aada733dbd 154 ble_error_t discoverDescriptors(const CharacteristicDescriptorDiscovery::DiscoveryCallback_t& onDescriptorDiscovered,
vcoubard 1135:22aada733dbd 155 const CharacteristicDescriptorDiscovery::TerminationCallback_t& onTermination) const;
vcoubard 1131:692ddf04fc42 156
vcoubard 1131:692ddf04fc42 157 /**
vcoubard 1131:692ddf04fc42 158 * Perform a write procedure.
vcoubard 1131:692ddf04fc42 159 *
vcoubard 1135:22aada733dbd 160 * @param[in] length
vcoubard 1131:692ddf04fc42 161 * The amount of data being written.
vcoubard 1135:22aada733dbd 162 * @param[in] value
vcoubard 1131:692ddf04fc42 163 * The bytes being written.
vcoubard 1131:692ddf04fc42 164 *
vcoubard 1131:692ddf04fc42 165 * @note It is important to note that a write will generate
vcoubard 1131:692ddf04fc42 166 * an onDataWritten() callback when the peer acknowledges the request.
vcoubard 1131:692ddf04fc42 167 *
vcoubard 1131:692ddf04fc42 168 * @retval BLE_ERROR_NONE Successfully started the Write procedure, or
vcoubard 1131:692ddf04fc42 169 * BLE_ERROR_INVALID_STATE if some internal state about the connection is invalid, or
vcoubard 1131:692ddf04fc42 170 * BLE_STACK_BUSY if some client procedure is already in progress, or
vcoubard 1131:692ddf04fc42 171 * BLE_ERROR_NO_MEM if there are no available buffers left to process the request, or
vcoubard 1131:692ddf04fc42 172 * BLE_ERROR_OPERATION_NOT_PERMITTED due to the characteristic's properties.
vcoubard 1131:692ddf04fc42 173 */
vcoubard 1131:692ddf04fc42 174 ble_error_t write(uint16_t length, const uint8_t *value) const;
vcoubard 1131:692ddf04fc42 175
vcoubard 1134:d540a48f650d 176 /**
vcoubard 1179:4ab722f8dca0 177 * Same as #write(uint16_t, const uint8_t *) const but register a callback
vcoubard 1135:22aada733dbd 178 * which will be called once the data has been written.
vcoubard 1135:22aada733dbd 179 *
vcoubard 1179:4ab722f8dca0 180 * @param[in] length The amount of bytes to write.
vcoubard 1179:4ab722f8dca0 181 * @param[in] value The bytes to write.
vcoubard 1179:4ab722f8dca0 182 * @param[in] onRead Continuation callback for the write operation
vcoubard 1131:692ddf04fc42 183 */
vcoubard 1135:22aada733dbd 184 ble_error_t write(uint16_t length, const uint8_t *value, const GattClient::WriteCallback_t& onWrite) const;
vcoubard 1131:692ddf04fc42 185
vcoubard 1134:d540a48f650d 186 void setupLongUUID(UUID::LongUUIDBytes_t longUUID, UUID::ByteOrder_t order = UUID::MSB) {
vcoubard 1134:d540a48f650d 187 uuid.setupLong(longUUID, order);
vcoubard 1131:692ddf04fc42 188 }
vcoubard 1131:692ddf04fc42 189
vcoubard 1131:692ddf04fc42 190 public:
vcoubard 1135:22aada733dbd 191 /**
vcoubard 1135:22aada733dbd 192 * @brief Get the UUID of the discovered characteristic
vcoubard 1135:22aada733dbd 193 * @return the UUID of this characteristic
vcoubard 1135:22aada733dbd 194 */
vcoubard 1131:692ddf04fc42 195 const UUID& getUUID(void) const {
vcoubard 1131:692ddf04fc42 196 return uuid;
vcoubard 1131:692ddf04fc42 197 }
vcoubard 1131:692ddf04fc42 198
vcoubard 1135:22aada733dbd 199 /**
vcoubard 1135:22aada733dbd 200 * @brief Get the properties of this characteristic
vcoubard 1135:22aada733dbd 201 * @return the set of properties of this characteristic
vcoubard 1135:22aada733dbd 202 */
vcoubard 1131:692ddf04fc42 203 const Properties_t& getProperties(void) const {
vcoubard 1131:692ddf04fc42 204 return props;
vcoubard 1131:692ddf04fc42 205 }
vcoubard 1131:692ddf04fc42 206
vcoubard 1135:22aada733dbd 207 /**
vcoubard 1135:22aada733dbd 208 * @brief Get the declaration handle of this characteristic.
vcoubard 1179:4ab722f8dca0 209 * @detail The declaration handle is the first handle of a characteristic
vcoubard 1135:22aada733dbd 210 * definition. The value accessible at this handle contains the following
vcoubard 1135:22aada733dbd 211 * informations:
vcoubard 1135:22aada733dbd 212 * - The characteristics properties (see Properties_t). This value can
vcoubard 1135:22aada733dbd 213 * be accessed by using #getProperties .
vcoubard 1135:22aada733dbd 214 * - The characteristic value attribute handle. This field can be accessed
vcoubard 1135:22aada733dbd 215 * by using #getValueHandle .
vcoubard 1135:22aada733dbd 216 * - The characteristic UUID, this value can be accessed by using the
vcoubard 1135:22aada733dbd 217 * function #getUUID .
vcoubard 1135:22aada733dbd 218 * @return the declaration handle of this characteristic.
vcoubard 1135:22aada733dbd 219 */
vcoubard 1135:22aada733dbd 220 GattAttribute::Handle_t getDeclHandle(void) const {
vcoubard 1131:692ddf04fc42 221 return declHandle;
vcoubard 1131:692ddf04fc42 222 }
vcoubard 1135:22aada733dbd 223
vcoubard 1135:22aada733dbd 224 /**
vcoubard 1135:22aada733dbd 225 * @brief Return the handle used to access the value of this characteristic.
vcoubard 1135:22aada733dbd 226 * @details This handle is the one provided in the characteristic declaration
vcoubard 1135:22aada733dbd 227 * value. Usually, it is equal to #getDeclHandle() + 1. But it is not always
vcoubard 1135:22aada733dbd 228 * the case. Anyway, users are allowed to use #getDeclHandle() + 1 to access
vcoubard 1135:22aada733dbd 229 * the value of a characteristic.
vcoubard 1135:22aada733dbd 230 * @return The handle to access the value of this characteristic.
vcoubard 1135:22aada733dbd 231 */
vcoubard 1135:22aada733dbd 232 GattAttribute::Handle_t getValueHandle(void) const {
vcoubard 1131:692ddf04fc42 233 return valueHandle;
vcoubard 1131:692ddf04fc42 234 }
vcoubard 1131:692ddf04fc42 235
vcoubard 1135:22aada733dbd 236 /**
vcoubard 1135:22aada733dbd 237 * @brief Return the last handle of the characteristic definition.
vcoubard 1135:22aada733dbd 238 * @details A Characteristic definition can contain a lot of handles:
vcoubard 1135:22aada733dbd 239 * - one for the declaration (see #getDeclHandle)
vcoubard 1135:22aada733dbd 240 * - one for the value (see #getValueHandle)
vcoubard 1135:22aada733dbd 241 * - zero of more for the characteristic descriptors.
vcoubard 1135:22aada733dbd 242 * This handle is the last handle of the characteristic definition.
vcoubard 1135:22aada733dbd 243 * @return The last handle of this characteristic definition.
vcoubard 1135:22aada733dbd 244 */
vcoubard 1135:22aada733dbd 245 GattAttribute::Handle_t getLastHandle(void) const {
vcoubard 1135:22aada733dbd 246 return lastHandle;
vcoubard 1135:22aada733dbd 247 }
vcoubard 1135:22aada733dbd 248
vcoubard 1135:22aada733dbd 249 /**
vcoubard 1135:22aada733dbd 250 * @brief Return the GattClient which can operate on this characteristic.
vcoubard 1135:22aada733dbd 251 * @return The GattClient which can operate on this characteristic.
vcoubard 1135:22aada733dbd 252 */
vcoubard 1135:22aada733dbd 253 GattClient* getGattClient() {
vcoubard 1135:22aada733dbd 254 return gattc;
vcoubard 1135:22aada733dbd 255 }
vcoubard 1135:22aada733dbd 256
vcoubard 1135:22aada733dbd 257 /**
vcoubard 1135:22aada733dbd 258 * @brief Return the GattClient which can operate on this characteristic.
vcoubard 1135:22aada733dbd 259 * @return The GattClient which can operate on this characteristic.
vcoubard 1135:22aada733dbd 260 */
vcoubard 1135:22aada733dbd 261 const GattClient* getGattClient() const {
vcoubard 1135:22aada733dbd 262 return gattc;
vcoubard 1135:22aada733dbd 263 }
vcoubard 1135:22aada733dbd 264
vcoubard 1135:22aada733dbd 265 /**
vcoubard 1135:22aada733dbd 266 * @brief Return the connection handle to the GattServer which contain
vcoubard 1135:22aada733dbd 267 * this characteristic.
vcoubard 1135:22aada733dbd 268 * @return the connection handle to the GattServer which contain
vcoubard 1135:22aada733dbd 269 * this characteristic.
vcoubard 1135:22aada733dbd 270 */
vcoubard 1135:22aada733dbd 271 Gap::Handle_t getConnectionHandle() const {
vcoubard 1135:22aada733dbd 272 return connHandle;
vcoubard 1135:22aada733dbd 273 }
vcoubard 1135:22aada733dbd 274
vcoubard 1135:22aada733dbd 275 /**
vcoubard 1135:22aada733dbd 276 * @brief "Equal to" operator for DiscoveredCharacteristic
vcoubard 1135:22aada733dbd 277 *
vcoubard 1179:4ab722f8dca0 278 * @param lhs[in] The left hand side of the equality expression
vcoubard 1179:4ab722f8dca0 279 * @param rhs[in] The right hand side of the equality expression
vcoubard 1135:22aada733dbd 280 *
vcoubard 1135:22aada733dbd 281 * @return true if operands are equals, false otherwise.
vcoubard 1135:22aada733dbd 282 */
vcoubard 1135:22aada733dbd 283 friend bool operator==(const DiscoveredCharacteristic& lhs, const DiscoveredCharacteristic& rhs) {
vcoubard 1135:22aada733dbd 284 return lhs.gattc == rhs.gattc &&
vcoubard 1135:22aada733dbd 285 lhs.uuid == rhs.uuid &&
vcoubard 1135:22aada733dbd 286 lhs.props == rhs.props &&
vcoubard 1135:22aada733dbd 287 lhs.declHandle == rhs.declHandle &&
vcoubard 1135:22aada733dbd 288 lhs.valueHandle == rhs.valueHandle &&
vcoubard 1135:22aada733dbd 289 lhs.lastHandle == rhs.lastHandle &&
vcoubard 1135:22aada733dbd 290 lhs.connHandle == rhs.connHandle;
vcoubard 1135:22aada733dbd 291 }
vcoubard 1135:22aada733dbd 292
vcoubard 1135:22aada733dbd 293 /**
vcoubard 1135:22aada733dbd 294 * @brief "Not equal to" operator for DiscoveredCharacteristic
vcoubard 1135:22aada733dbd 295 *
vcoubard 1179:4ab722f8dca0 296 * @param lhs[in] The right hand side of the expression
vcoubard 1179:4ab722f8dca0 297 * @param rhs[in] The left hand side of the expression
vcoubard 1135:22aada733dbd 298 *
vcoubard 1179:4ab722f8dca0 299 * @return true if operands are not equals, false otherwise.
vcoubard 1135:22aada733dbd 300 */
vcoubard 1135:22aada733dbd 301 friend bool operator !=(const DiscoveredCharacteristic& lhs, const DiscoveredCharacteristic& rhs) {
vcoubard 1135:22aada733dbd 302 return !(lhs == rhs);
vcoubard 1135:22aada733dbd 303 }
vcoubard 1135:22aada733dbd 304
vcoubard 1131:692ddf04fc42 305 public:
vcoubard 1131:692ddf04fc42 306 DiscoveredCharacteristic() : gattc(NULL),
vcoubard 1131:692ddf04fc42 307 uuid(UUID::ShortUUIDBytes_t(0)),
vcoubard 1131:692ddf04fc42 308 props(),
vcoubard 1131:692ddf04fc42 309 declHandle(GattAttribute::INVALID_HANDLE),
vcoubard 1135:22aada733dbd 310 valueHandle(GattAttribute::INVALID_HANDLE),
vcoubard 1135:22aada733dbd 311 lastHandle(GattAttribute::INVALID_HANDLE),
vcoubard 1135:22aada733dbd 312 connHandle() {
vcoubard 1131:692ddf04fc42 313 /* empty */
vcoubard 1131:692ddf04fc42 314 }
vcoubard 1131:692ddf04fc42 315
vcoubard 1131:692ddf04fc42 316 protected:
vcoubard 1131:692ddf04fc42 317 GattClient *gattc;
vcoubard 1131:692ddf04fc42 318
vcoubard 1131:692ddf04fc42 319 protected:
vcoubard 1131:692ddf04fc42 320 UUID uuid;
vcoubard 1131:692ddf04fc42 321 Properties_t props;
vcoubard 1131:692ddf04fc42 322 GattAttribute::Handle_t declHandle;
vcoubard 1131:692ddf04fc42 323 GattAttribute::Handle_t valueHandle;
vcoubard 1135:22aada733dbd 324 GattAttribute::Handle_t lastHandle;
vcoubard 1131:692ddf04fc42 325
vcoubard 1131:692ddf04fc42 326 Gap::Handle_t connHandle;
vcoubard 1131:692ddf04fc42 327 };
vcoubard 1131:692ddf04fc42 328
rgrover1 716:11b41f651697 329 #endif /*__DISCOVERED_CHARACTERISTIC_H__*/