Official Sheffield ARMBand micro:bit program

Committer:
MrBedfordVan
Date:
Mon Oct 17 12:41:20 2016 +0000
Revision:
0:b9164b348919
Official Sheffield ARMBand Micro:bit program

Who changed what in which revision?

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