add UUID::setupLong()

This commit is contained in:
Rohit Grover 2015-05-27 08:16:47 +01:00
parent 6208ed9a35
commit f4773ae12f
1 changed files with 10 additions and 2 deletions

View File

@ -43,8 +43,7 @@ public:
* 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 @@ public:
/* 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 {