Lancaster University's fork of the mbed BLE API. Lives on github, https://github.com/lancaster-university/BLE_API

Dependents:   microbit-dal microbit-dal microbit-ble-open microbit-dal ... more

Fork of BLE_API by Bluetooth Low Energy

Committer:
LancasterUniversity
Date:
Wed Apr 06 18:40:33 2016 +0100
Revision:
1137:290d499dd0e8
Parent:
1134:faa0160c87ff
Synchronized with git rev a5f6d4b8
Author: Joe Finney
microbit: Disabled default instantiation of DFUService.

micro:bit operates its own custom service for this purpose.

Who changed what in which revision?

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