add UUID::setupLong()

This commit is contained in:
Rohit Grover 2015-05-27 08:16:47 +01:00
parent 27aae6bf41
commit cdaa23edfd

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 {