rename "value" member of UUID as shortUUID

This commit is contained in:
Rohit Grover 2014-05-30 10:48:48 +01:00
parent abed1b0557
commit 9c2849d88e
2 changed files with 10 additions and 9 deletions

View file

@ -67,10 +67,10 @@
UUID::UUID(const uint8_t longUUID[LENGTH_OF_LONG_UUID]) :
type(UUID_TYPE_SHORT),
baseUUID(),
value(0)
shortUUID(0)
{
memcpy(baseUUID, longUUID, LENGTH_OF_LONG_UUID);
value = (uint16_t)((longUUID[3] << 8) | (longUUID[2]));/* NEEDS REVIEW */
shortUUID = (uint16_t)((longUUID[3] << 8) | (longUUID[2]));/* NEEDS REVIEW */
/* Check if this is a short of a long UUID */
unsigned index;
@ -102,11 +102,12 @@ UUID::UUID(const uint8_t longUUID[LENGTH_OF_LONG_UUID]) :
The 16-bit BLE UUID value.
*/
/**************************************************************************/
UUID::UUID(const uint16_t shortUUID) : type(UUID_TYPE_SHORT),
baseUUID(),
value(shortUUID)
UUID::UUID(uint16_t shortUUID) : type(UUID_TYPE_SHORT),
baseUUID(),
shortUUID(shortUUID)
{
/* NEEDS REVIEW */
/* NEEDS REVIEW; actually, I'm not sure if we need to populate the baseUUID
* with the shortUUID here.*/
baseUUID[2] = (shortUUID >> 8);
baseUUID[3] = (shortUUID & 0xff);
}

6
UUID.h
View file

@ -32,7 +32,7 @@ public:
public:
UUID(const uint8_t longUUID[LENGTH_OF_LONG_UUID]);
UUID(uint16_t shortUUID);
UUID(uint16_t uuid);
virtual ~UUID(void);
public:
@ -43,7 +43,7 @@ public:
return baseUUID;
}
uint16_t get16BitUUID(void) const {
return value;
return shortUUID;
}
private:
@ -53,7 +53,7 @@ private:
* are zeroed out to allow comparison with other long
* UUIDs which differ only in the 16-bit relative
* part.*/
uint16_t value; // 16 bit uuid (byte 2-3 using with base)
uint16_t shortUUID; // 16 bit uuid (byte 2-3 using with base)
};
#endif // ifndef __UUID_H__