fka mod

Fork of BLE_API by Bluetooth Low Energy

Committer:
vcoubard
Date:
Wed Apr 06 19:15:13 2016 +0100
Revision:
1170:e8f2db0e8e11
Parent:
1134:d540a48f650d
Child:
1179:4ab722f8dca0
Synchronized with git rev e2afffee
Author: Andres Amaya Garcia
Add missing docs and fix doxy warnings in UUID.h

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 __UUID_H__
vcoubard 1131:692ddf04fc42 18 #define __UUID_H__
vcoubard 1131:692ddf04fc42 19
vcoubard 1131:692ddf04fc42 20 #include <stdint.h>
vcoubard 1131:692ddf04fc42 21 #include <string.h>
vcoubard 1134:d540a48f650d 22 #include <algorithm>
vcoubard 1131:692ddf04fc42 23
vcoubard 1131:692ddf04fc42 24 #include "blecommon.h"
vcoubard 1131:692ddf04fc42 25
vcoubard 1134:d540a48f650d 26 /**
vcoubard 1170:e8f2db0e8e11 27 * A trivial converter for single hexadecimal character to an unsigned integer.
vcoubard 1170:e8f2db0e8e11 28 *
vcoubard 1170:e8f2db0e8e11 29 * @param c
vcoubard 1170:e8f2db0e8e11 30 * Hexadecimal character.
vcoubard 1170:e8f2db0e8e11 31 *
vcoubard 1170:e8f2db0e8e11 32 * @return The corresponding value as unsigned integer.
vcoubard 1134:d540a48f650d 33 */
vcoubard 1134:d540a48f650d 34 static uint8_t char2int(char c) {
vcoubard 1134:d540a48f650d 35 if ((c >= '0') && (c <= '9')) {
vcoubard 1134:d540a48f650d 36 return c - '0';
vcoubard 1134:d540a48f650d 37 } else if ((c >= 'a') && (c <= 'f')) {
vcoubard 1134:d540a48f650d 38 return c - 'a' + 10;
vcoubard 1134:d540a48f650d 39 } else if ((c >= 'A') && (c <= 'F')) {
vcoubard 1134:d540a48f650d 40 return c - 'A' + 10;
vcoubard 1134:d540a48f650d 41 } else {
vcoubard 1134:d540a48f650d 42 return 0;
vcoubard 1134:d540a48f650d 43 }
vcoubard 1134:d540a48f650d 44 }
vcoubard 1134:d540a48f650d 45
vcoubard 1170:e8f2db0e8e11 46 /**
vcoubard 1170:e8f2db0e8e11 47 * An instance of this class represents a Universally Unique Identifier (UUID)
vcoubard 1170:e8f2db0e8e11 48 * in the BLE API.
vcoubard 1170:e8f2db0e8e11 49 */
vcoubard 1131:692ddf04fc42 50 class UUID {
vcoubard 1131:692ddf04fc42 51 public:
vcoubard 1170:e8f2db0e8e11 52 /**
vcoubard 1170:e8f2db0e8e11 53 * Enumeration of the possible types of UUIDs in BLE with regards to length.
vcoubard 1170:e8f2db0e8e11 54 */
vcoubard 1131:692ddf04fc42 55 enum UUID_Type_t {
vcoubard 1170:e8f2db0e8e11 56 UUID_TYPE_SHORT = 0, /**< Short 16-bit UUID. */
vcoubard 1170:e8f2db0e8e11 57 UUID_TYPE_LONG = 1 /**< Full 128-bit UUID. */
vcoubard 1131:692ddf04fc42 58 };
vcoubard 1131:692ddf04fc42 59
vcoubard 1134:d540a48f650d 60 /**
vcoubard 1170:e8f2db0e8e11 61 * Enumeration to specify byte ordering of the long version of the UUID.
vcoubard 1134:d540a48f650d 62 */
vcoubard 1134:d540a48f650d 63 typedef enum {
vcoubard 1170:e8f2db0e8e11 64 MSB, /**< Most-significant byte first (at the smallest address) */
vcoubard 1170:e8f2db0e8e11 65 LSB /**< least-significant byte first (at the smallest address) */
vcoubard 1134:d540a48f650d 66 } ByteOrder_t;
vcoubard 1134:d540a48f650d 67
vcoubard 1170:e8f2db0e8e11 68 /**
vcoubard 1170:e8f2db0e8e11 69 * Type for a 16-bit UUID.
vcoubard 1170:e8f2db0e8e11 70 */
vcoubard 1131:692ddf04fc42 71 typedef uint16_t ShortUUIDBytes_t;
vcoubard 1131:692ddf04fc42 72
vcoubard 1170:e8f2db0e8e11 73 /**
vcoubard 1170:e8f2db0e8e11 74 * Length of a long UUID in bytes.
vcoubard 1170:e8f2db0e8e11 75 */
vcoubard 1131:692ddf04fc42 76 static const unsigned LENGTH_OF_LONG_UUID = 16;
vcoubard 1170:e8f2db0e8e11 77 /**
vcoubard 1170:e8f2db0e8e11 78 * Type for a 128-bit UUID.
vcoubard 1170:e8f2db0e8e11 79 */
vcoubard 1131:692ddf04fc42 80 typedef uint8_t LongUUIDBytes_t[LENGTH_OF_LONG_UUID];
vcoubard 1131:692ddf04fc42 81
vcoubard 1170:e8f2db0e8e11 82 /**
vcoubard 1170:e8f2db0e8e11 83 * Maximum length of a string representation of a UUID not including the
vcoubard 1170:e8f2db0e8e11 84 * null termination ('\0'): two characters per
vcoubard 1170:e8f2db0e8e11 85 * byte plus four '-' characters.
vcoubard 1170:e8f2db0e8e11 86 */
vcoubard 1134:d540a48f650d 87 static const unsigned MAX_UUID_STRING_LENGTH = LENGTH_OF_LONG_UUID * 2 + 4;
vcoubard 1134:d540a48f650d 88
vcoubard 1131:692ddf04fc42 89 public:
vcoubard 1134:d540a48f650d 90
vcoubard 1134:d540a48f650d 91 /**
vcoubard 1134:d540a48f650d 92 * Creates a new 128-bit UUID.
vcoubard 1134:d540a48f650d 93 *
vcoubard 1134:d540a48f650d 94 * @note The UUID is a unique 128-bit (16 byte) ID used to identify
vcoubard 1134:d540a48f650d 95 * different service or characteristics on the BLE device.
vcoubard 1134:d540a48f650d 96 *
vcoubard 1134:d540a48f650d 97 * @param stringUUID
vcoubard 1134:d540a48f650d 98 * The 128-bit (16-byte) UUID as a human readable const-string.
vcoubard 1134:d540a48f650d 99 * Format: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
vcoubard 1134:d540a48f650d 100 * Upper and lower case supported. Hyphens are optional, but only
vcoubard 1134:d540a48f650d 101 * upto four of them. The UUID is stored internally as a 16 byte
vcoubard 1134:d540a48f650d 102 * array, LSB (little endian), which is opposite from the string.
vcoubard 1134:d540a48f650d 103 */
vcoubard 1134:d540a48f650d 104 UUID(const char* stringUUID) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) {
vcoubard 1134:d540a48f650d 105 bool nibble = false;
vcoubard 1134:d540a48f650d 106 uint8_t byte = 0;
vcoubard 1134:d540a48f650d 107 size_t baseIndex = 0;
vcoubard 1134:d540a48f650d 108 uint8_t tempUUID[LENGTH_OF_LONG_UUID];
vcoubard 1134:d540a48f650d 109
vcoubard 1170:e8f2db0e8e11 110 /*
vcoubard 1170:e8f2db0e8e11 111 * Iterate through string, abort if NULL is encountered prematurely.
vcoubard 1170:e8f2db0e8e11 112 * Ignore upto four hyphens.
vcoubard 1170:e8f2db0e8e11 113 */
vcoubard 1134:d540a48f650d 114 for (size_t index = 0; (index < MAX_UUID_STRING_LENGTH) && (baseIndex < LENGTH_OF_LONG_UUID); index++) {
vcoubard 1134:d540a48f650d 115 if (stringUUID[index] == '\0') {
vcoubard 1170:e8f2db0e8e11 116 /* Error abort */
vcoubard 1134:d540a48f650d 117 break;
vcoubard 1134:d540a48f650d 118 } else if (stringUUID[index] == '-') {
vcoubard 1170:e8f2db0e8e11 119 /* Ignore hyphen */
vcoubard 1134:d540a48f650d 120 continue;
vcoubard 1134:d540a48f650d 121 } else if (nibble) {
vcoubard 1170:e8f2db0e8e11 122 /* Got second nibble */
vcoubard 1134:d540a48f650d 123 byte |= char2int(stringUUID[index]);
vcoubard 1134:d540a48f650d 124 nibble = false;
vcoubard 1134:d540a48f650d 125
vcoubard 1170:e8f2db0e8e11 126 /* Store copy */
vcoubard 1134:d540a48f650d 127 tempUUID[baseIndex++] = byte;
vcoubard 1134:d540a48f650d 128 } else {
vcoubard 1170:e8f2db0e8e11 129 /* Got first nibble */
vcoubard 1134:d540a48f650d 130 byte = char2int(stringUUID[index]) << 4;
vcoubard 1134:d540a48f650d 131 nibble = true;
vcoubard 1134:d540a48f650d 132 }
vcoubard 1134:d540a48f650d 133 }
vcoubard 1134:d540a48f650d 134
vcoubard 1170:e8f2db0e8e11 135 /* Populate internal variables if string was successfully parsed */
vcoubard 1134:d540a48f650d 136 if (baseIndex == LENGTH_OF_LONG_UUID) {
vcoubard 1134:d540a48f650d 137 setupLong(tempUUID, UUID::MSB);
vcoubard 1134:d540a48f650d 138 } else {
vcoubard 1134:d540a48f650d 139 const uint8_t sig[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
vcoubard 1134:d540a48f650d 140 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
vcoubard 1134:d540a48f650d 141 setupLong(sig, UUID::MSB);
vcoubard 1134:d540a48f650d 142 }
vcoubard 1134:d540a48f650d 143 }
vcoubard 1134:d540a48f650d 144
vcoubard 1131:692ddf04fc42 145 /**
vcoubard 1131:692ddf04fc42 146 * Creates a new 128-bit UUID.
vcoubard 1131:692ddf04fc42 147 *
vcoubard 1170:e8f2db0e8e11 148 * @param[in] longUUID
vcoubard 1170:e8f2db0e8e11 149 * The 128-bit (16-byte) UUID value.
vcoubard 1170:e8f2db0e8e11 150 * @param[in] order
vcoubard 1170:e8f2db0e8e11 151 * The bit order of the UUID, MSB by default.
vcoubard 1170:e8f2db0e8e11 152 *
vcoubard 1131:692ddf04fc42 153 * @note The UUID is a unique 128-bit (16 byte) ID used to identify
vcoubard 1131:692ddf04fc42 154 * different service or characteristics on the BLE device.
vcoubard 1131:692ddf04fc42 155 */
vcoubard 1134:d540a48f650d 156 UUID(const LongUUIDBytes_t longUUID, ByteOrder_t order = UUID::MSB) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) {
vcoubard 1134:d540a48f650d 157 setupLong(longUUID, order);
vcoubard 1131:692ddf04fc42 158 }
vcoubard 1131:692ddf04fc42 159
vcoubard 1131:692ddf04fc42 160 /**
vcoubard 1131:692ddf04fc42 161 * Creates a new 16-bit UUID.
vcoubard 1131:692ddf04fc42 162 *
vcoubard 1131:692ddf04fc42 163 * For efficiency, and because 16 bytes would take a large chunk of the
vcoubard 1131:692ddf04fc42 164 * 27-byte data payload length of the Link Layer, the BLE specification adds
vcoubard 1131:692ddf04fc42 165 * two additional UUID formats: 16-bit and 32-bit UUIDs. These shortened
vcoubard 1131:692ddf04fc42 166 * formats can be used only with UUIDs that are defined in the Bluetooth
vcoubard 1131:692ddf04fc42 167 * specification (listed by the Bluetooth SIG as standard
vcoubard 1131:692ddf04fc42 168 * Bluetooth UUIDs).
vcoubard 1131:692ddf04fc42 169 *
vcoubard 1131:692ddf04fc42 170 * To reconstruct the full 128-bit UUID from the shortened version, insert
vcoubard 1131:692ddf04fc42 171 * the 16-bit short value (indicated by xxxx, including leading zeros) into
vcoubard 1131:692ddf04fc42 172 * the Bluetooth Base UUID:
vcoubard 1131:692ddf04fc42 173 *
vcoubard 1131:692ddf04fc42 174 * 0000xxxx-0000-1000-8000-00805F9B34FB
vcoubard 1131:692ddf04fc42 175 *
vcoubard 1170:e8f2db0e8e11 176 * @param[in] _shortUUID
vcoubard 1170:e8f2db0e8e11 177 * The short UUID value.
vcoubard 1170:e8f2db0e8e11 178 *
vcoubard 1131:692ddf04fc42 179 * @note Shortening is not available for UUIDs that are not derived from the
vcoubard 1131:692ddf04fc42 180 * Bluetooth Base UUID. Such non-standard UUIDs are commonly called
vcoubard 1131:692ddf04fc42 181 * vendor-specific UUIDs. In these cases, you’ll need to use the full
vcoubard 1131:692ddf04fc42 182 * 128-bit UUID value at all times.
vcoubard 1131:692ddf04fc42 183 *
vcoubard 1170:e8f2db0e8e11 184 * @note The UUID is a unique 16-bit (2 byte) ID used to identify
vcoubard 1170:e8f2db0e8e11 185 * different service or characteristics on the BLE device.
vcoubard 1170:e8f2db0e8e11 186 *
vcoubard 1170:e8f2db0e8e11 187 * @note We do not yet support 32-bit shortened UUIDs.
vcoubard 1131:692ddf04fc42 188 */
vcoubard 1131:692ddf04fc42 189 UUID(ShortUUIDBytes_t _shortUUID) : type(UUID_TYPE_SHORT), baseUUID(), shortUUID(_shortUUID) {
vcoubard 1131:692ddf04fc42 190 /* Empty */
vcoubard 1131:692ddf04fc42 191 }
vcoubard 1131:692ddf04fc42 192
vcoubard 1170:e8f2db0e8e11 193 /**
vcoubard 1170:e8f2db0e8e11 194 * Copy constructor.
vcoubard 1170:e8f2db0e8e11 195 *
vcoubard 1170:e8f2db0e8e11 196 * @param[in] source
vcoubard 1170:e8f2db0e8e11 197 * The UUID to copy.
vcoubard 1170:e8f2db0e8e11 198 */
vcoubard 1131:692ddf04fc42 199 UUID(const UUID &source) {
vcoubard 1131:692ddf04fc42 200 type = source.type;
vcoubard 1131:692ddf04fc42 201 shortUUID = source.shortUUID;
vcoubard 1131:692ddf04fc42 202 memcpy(baseUUID, source.baseUUID, LENGTH_OF_LONG_UUID);
vcoubard 1131:692ddf04fc42 203 }
vcoubard 1131:692ddf04fc42 204
vcoubard 1170:e8f2db0e8e11 205 /**
vcoubard 1170:e8f2db0e8e11 206 * The empty constructor.
vcoubard 1170:e8f2db0e8e11 207 *
vcoubard 1170:e8f2db0e8e11 208 * @note The type of the resulting UUID instance is UUID_TYPE_SHORT and the
vcoubard 1170:e8f2db0e8e11 209 * value BLE_UUID_UNKNOWN.
vcoubard 1170:e8f2db0e8e11 210 */
vcoubard 1131:692ddf04fc42 211 UUID(void) : type(UUID_TYPE_SHORT), shortUUID(BLE_UUID_UNKNOWN) {
vcoubard 1131:692ddf04fc42 212 /* empty */
vcoubard 1131:692ddf04fc42 213 }
vcoubard 1131:692ddf04fc42 214
vcoubard 1131:692ddf04fc42 215 /**
vcoubard 1170:e8f2db0e8e11 216 * Fill in a 128-bit UUID; this is useful when the UUID is not known at the
vcoubard 1170:e8f2db0e8e11 217 * time of the object construction.
vcoubard 1170:e8f2db0e8e11 218 *
vcoubard 1170:e8f2db0e8e11 219 * @param[in] longUUID
vcoubard 1170:e8f2db0e8e11 220 * The UUID value to copy.
vcoubard 1170:e8f2db0e8e11 221 * @param[in] order
vcoubard 1170:e8f2db0e8e11 222 * The byte ordering of the UUID at @p longUUID.
vcoubard 1131:692ddf04fc42 223 */
vcoubard 1134:d540a48f650d 224 void setupLong(const LongUUIDBytes_t longUUID, ByteOrder_t order = UUID::MSB) {
vcoubard 1131:692ddf04fc42 225 type = UUID_TYPE_LONG;
vcoubard 1134:d540a48f650d 226 if (order == UUID::MSB) {
vcoubard 1170:e8f2db0e8e11 227 /*
vcoubard 1170:e8f2db0e8e11 228 * Switch endian. Input is big-endian, internal representation
vcoubard 1170:e8f2db0e8e11 229 * is little endian.
vcoubard 1170:e8f2db0e8e11 230 */
vcoubard 1134:d540a48f650d 231 std::reverse_copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID);
vcoubard 1134:d540a48f650d 232 } else {
vcoubard 1134:d540a48f650d 233 std::copy(longUUID, longUUID + LENGTH_OF_LONG_UUID, baseUUID);
vcoubard 1134:d540a48f650d 234 }
vcoubard 1134:d540a48f650d 235 shortUUID = (uint16_t)((baseUUID[13] << 8) | (baseUUID[12]));
vcoubard 1131:692ddf04fc42 236 }
vcoubard 1131:692ddf04fc42 237
vcoubard 1131:692ddf04fc42 238 public:
vcoubard 1170:e8f2db0e8e11 239 /**
vcoubard 1170:e8f2db0e8e11 240 * Check whether this UUID is short or long.
vcoubard 1170:e8f2db0e8e11 241 *
vcoubard 1170:e8f2db0e8e11 242 * @return UUID_TYPE_SHORT if the UUID is short, UUID_TYPE_LONG otherwise.
vcoubard 1170:e8f2db0e8e11 243 */
vcoubard 1170:e8f2db0e8e11 244 UUID_Type_t shortOrLong(void) const {
vcoubard 1170:e8f2db0e8e11 245 return type;
vcoubard 1170:e8f2db0e8e11 246 }
vcoubard 1170:e8f2db0e8e11 247
vcoubard 1170:e8f2db0e8e11 248 /**
vcoubard 1170:e8f2db0e8e11 249 * Get a pointer to the UUID value based on the current UUID type.
vcoubard 1170:e8f2db0e8e11 250 *
vcoubard 1170:e8f2db0e8e11 251 * @return A pointer to the short UUID if the type is set to
vcoubard 1170:e8f2db0e8e11 252 * UUID_TYPE_SHORT. Otherwise, a pointer to the long UUID if the
vcoubard 1170:e8f2db0e8e11 253 * type is set to UUID_TYPE_LONG.
vcoubard 1170:e8f2db0e8e11 254 */
vcoubard 1170:e8f2db0e8e11 255 const uint8_t *getBaseUUID(void) const {
vcoubard 1131:692ddf04fc42 256 if (type == UUID_TYPE_SHORT) {
vcoubard 1131:692ddf04fc42 257 return (const uint8_t*)&shortUUID;
vcoubard 1131:692ddf04fc42 258 } else {
vcoubard 1131:692ddf04fc42 259 return baseUUID;
vcoubard 1131:692ddf04fc42 260 }
vcoubard 1131:692ddf04fc42 261 }
vcoubard 1131:692ddf04fc42 262
vcoubard 1170:e8f2db0e8e11 263 /**
vcoubard 1170:e8f2db0e8e11 264 * Get the short UUID.
vcoubard 1170:e8f2db0e8e11 265 *
vcoubard 1170:e8f2db0e8e11 266 * @return The short UUID.
vcoubard 1170:e8f2db0e8e11 267 */
vcoubard 1170:e8f2db0e8e11 268 ShortUUIDBytes_t getShortUUID(void) const {
vcoubard 1170:e8f2db0e8e11 269 return shortUUID;
vcoubard 1170:e8f2db0e8e11 270 }
vcoubard 1170:e8f2db0e8e11 271
vcoubard 1170:e8f2db0e8e11 272 /**
vcoubard 1170:e8f2db0e8e11 273 * Get the length (in bytes) of the UUID based on its type.
vcoubard 1170:e8f2db0e8e11 274 *
vcoubard 1170:e8f2db0e8e11 275 * @retval sizeof(ShortUUIDBytes_t) if the UUID type is UUID_TYPE_SHORT.
vcoubard 1170:e8f2db0e8e11 276 * @retval LENGTH_OF_LONG_UUID if the UUID type is UUID_TYPE_LONG.
vcoubard 1170:e8f2db0e8e11 277 */
vcoubard 1170:e8f2db0e8e11 278 uint8_t getLen(void) const {
vcoubard 1131:692ddf04fc42 279 return ((type == UUID_TYPE_SHORT) ? sizeof(ShortUUIDBytes_t) : LENGTH_OF_LONG_UUID);
vcoubard 1131:692ddf04fc42 280 }
vcoubard 1131:692ddf04fc42 281
vcoubard 1170:e8f2db0e8e11 282 /**
vcoubard 1170:e8f2db0e8e11 283 * Overload == operator to enable UUID comparisons.
vcoubard 1170:e8f2db0e8e11 284 *
vcoubard 1170:e8f2db0e8e11 285 * @param[in] other
vcoubard 1170:e8f2db0e8e11 286 * The other UUID in the comparison.
vcoubard 1170:e8f2db0e8e11 287 *
vcoubard 1170:e8f2db0e8e11 288 * @return true if this == @p other, false otherwise.
vcoubard 1170:e8f2db0e8e11 289 */
vcoubard 1131:692ddf04fc42 290 bool operator== (const UUID &other) const {
vcoubard 1131:692ddf04fc42 291 if ((this->type == UUID_TYPE_SHORT) && (other.type == UUID_TYPE_SHORT) &&
vcoubard 1131:692ddf04fc42 292 (this->shortUUID == other.shortUUID)) {
vcoubard 1131:692ddf04fc42 293 return true;
vcoubard 1131:692ddf04fc42 294 }
vcoubard 1131:692ddf04fc42 295
vcoubard 1131:692ddf04fc42 296 if ((this->type == UUID_TYPE_LONG) && (other.type == UUID_TYPE_LONG) &&
vcoubard 1131:692ddf04fc42 297 (memcmp(this->baseUUID, other.baseUUID, LENGTH_OF_LONG_UUID) == 0)) {
vcoubard 1131:692ddf04fc42 298 return true;
vcoubard 1131:692ddf04fc42 299 }
vcoubard 1131:692ddf04fc42 300
vcoubard 1131:692ddf04fc42 301 return false;
vcoubard 1131:692ddf04fc42 302 }
vcoubard 1131:692ddf04fc42 303
vcoubard 1170:e8f2db0e8e11 304 /**
vcoubard 1170:e8f2db0e8e11 305 * Overload != operator to enable UUID comparisons.
vcoubard 1170:e8f2db0e8e11 306 *
vcoubard 1170:e8f2db0e8e11 307 * @param[in] other
vcoubard 1170:e8f2db0e8e11 308 * The other UUID in the comparison.
vcoubard 1170:e8f2db0e8e11 309 *
vcoubard 1170:e8f2db0e8e11 310 * @return true if this != @p other, false otherwise.
vcoubard 1170:e8f2db0e8e11 311 */
vcoubard 1131:692ddf04fc42 312 bool operator!= (const UUID &other) const {
vcoubard 1131:692ddf04fc42 313 return !(*this == other);
vcoubard 1131:692ddf04fc42 314 }
vcoubard 1131:692ddf04fc42 315
vcoubard 1131:692ddf04fc42 316 private:
vcoubard 1170:e8f2db0e8e11 317 /**
vcoubard 1170:e8f2db0e8e11 318 * The UUID type. Refer to UUID_Type_t.
vcoubard 1170:e8f2db0e8e11 319 */
vcoubard 1170:e8f2db0e8e11 320 UUID_Type_t type;
vcoubard 1170:e8f2db0e8e11 321 /**
vcoubard 1170:e8f2db0e8e11 322 * The long UUID value.
vcoubard 1170:e8f2db0e8e11 323 */
vcoubard 1170:e8f2db0e8e11 324 LongUUIDBytes_t baseUUID;
vcoubard 1170:e8f2db0e8e11 325 /**
vcoubard 1170:e8f2db0e8e11 326 * The short UUID value.
vcoubard 1170:e8f2db0e8e11 327 */
vcoubard 1170:e8f2db0e8e11 328 ShortUUIDBytes_t shortUUID;
vcoubard 1131:692ddf04fc42 329 };
vcoubard 1131:692ddf04fc42 330
rgrover1 710:b2e1a2660ec2 331 #endif // ifndef __UUID_H__