Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: BLE_ANCS_SDAPI BLE_temperature BLE_HeartRate BLE_ANCS_SDAPI_IRC ... more
Diff: public/UUID.h
- Revision:
- 421:e8e1eb82b99e
- Parent:
- 420:feaaae454283
- Child:
- 422:b45d7dc06a41
--- a/public/UUID.h Mon Jun 08 10:41:19 2015 +0100 +++ b/public/UUID.h Mon Jun 08 10:41:19 2015 +0100 @@ -43,8 +43,7 @@ * The 128-bit (16-byte) UUID value, MSB first (big-endian). */ UUID(const LongUUIDBytes_t longUUID) : type(UUID_TYPE_LONG), baseUUID(), shortUUID(0) { - memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID); - shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3])); + setupLong(longUUID); } /** @@ -87,6 +86,15 @@ /* empty */ } + /** + * Fill in a 128-bit UUID; this is useful when UUID isn't known at the time of object construction. + */ + void setupLong(const LongUUIDBytes_t longUUID) { + type = UUID_TYPE_LONG; + memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID); + shortUUID = (uint16_t)((longUUID[2] << 8) | (longUUID[3])); + } + public: UUID_Type_t shortOrLong(void) const {return type; } const uint8_t *getBaseUUID(void) const {