TUUID Class Reference

#include <bttypes.h>

Link against: bluetooth.lib

class TUUID
Public Member Functions
TUUID()
TUUID(TUint32)
TUUID(TUint32, TUint32, TUint32, TUint32)
TUUID(const TUid &)
IMPORT_C const TPtrC8Des()
IMPORT_C const TPtrC8FixedLengthL(TInt)
IMPORT_C const TPtrC8LongForm()
IMPORT_C TIntMinimumSize()
IMPORT_C voidSetFromLittleEndianL(const TDesC8 &)
IMPORT_C voidSetL(const TDesC8 &)
IMPORT_C const TPtrC8ShortestForm()
IMPORT_C const TPtrC8SpecifiedLengthL(TInt)
IMPORT_C TBooloperator!=(const TUUID &)
IMPORT_C TBooloperator==(const TUUID &)
IMPORT_C const TUint8 &operator[](TInt)
IMPORT_C TUint8 &operator[](TInt)

Detailed Description

A Bluetooth Universally Unique Identifier.

This is a 128-bit quantity that can be created without a central registry while still being globally unique. UUIDs are always held in full 128 bit format, however they can be set from BT SIG short form (16 or 32 bit) addresses, and returned as down to their shortest form using ShortestForm().

Constructor & Destructor Documentation

TUUID ( )

IMPORT_CTUUID()

Default constructor. Sets the UUID to all zeros.

TUUID ( TUint32 )

IMPORT_CTUUID(TUint32aLong)

Construct UUID from TUint32. The Bluetooth base UUID will be appended to the value passed. Use this form of constructor for building 16 or 32 bit short-form UUIDs.

ParameterDescription
aLongis a Big-endian format TUint32 containing the UUID.

TUUID ( TUint32, TUint32, TUint32, TUint32 )

IMPORT_CTUUID(TUint32aHH,
TUint32aHL,
TUint32aLH,
TUint32aLL
)

128 bit UUID constructor. Use this constructor to build full length 128 bit UUIDs.

ParameterDescription
aHHHighest order word (bits 96 - 127) in its Big-endian format
aHLSecond highest order word (bits 64 - 95) in its Big-endian format
aLHSecong lowset order word (bits 32 - 63) in its Big-endian format
aLLLow order word (bits 0 - 31) in its Big-endian format

TUUID ( const TUid & )

IMPORT_CTUUID(const TUid &aUid)

Set Bluetooth UUID from an EPOC UUID. Uses a well known reserved range. This defines a one-to-one mapping between all EPOC UIDs and and a range of Bluetooth UUID.

Base UUID used is 00000000-0000-1000-8000-00001B20C7AE; the first four bytes are replaced by the 32 bit Sybmian OS Uid, in big-endian form.

ParameterDescription
aUidEPOC UID to set this Bluetooth UUID from

Member Function Documentation

Des ( )

IMPORT_C const TPtrC8Des()const

FixedLengthL ( TInt )

IMPORT_C const TPtrC8FixedLengthL(TIntaLength)const

DeprecatedUse SpecifiedLengthL(TInt aLength) instead

Return the UUID with a specified length.

If 2 or 4 bytes, the ommitted bytes are implicity those from the Bluetooth base UUID.

leave
KErrArgument The UUID length requested is invalid.
leave
KErrTotalLossOfPrecision The UUID minimum size is less than the requested size.
Deprecateduse TUUID::SpecifiedLengthL() that implements the right size comparison logic
ParameterDescription
aLengthThe required length (2, 4 or 16 bytes).

Returns: TPtrC8 pointing to 2, 4, or 16 bytes of significant UUID data.

LongForm ( )

IMPORT_C const TPtrC8LongForm()const

Returns the full 128 bit version of the UUID.

Returns: The long form version of the UUID.

MinimumSize ( )

IMPORT_C TIntMinimumSize()const

Returns the minimum size of this UUID.

SetFromLittleEndianL ( const TDesC8 & )

IMPORT_C voidSetFromLittleEndianL(const TDesC8 &aDes)

Set the UUID from a binary descriptor containing Little-endian format UUID. Can accept a 2, 4, or 16 byte descriptor. Any other value will cause a leave with KErrArgument. If a 2 or 4 byte descriptor is set, the rest of the UUID will be filled with the Bluetooth well-known base UUID.

leave
This method will leave if an error occurs.
ParameterDescription
aDesThe binary descriptor. Note that the descriptor is interpretted to be in Little-endian format, i.e. index 0 holds the most significant byte.

SetL ( const TDesC8 & )

IMPORT_C voidSetL(const TDesC8 &aDes)

Set the UUID from a binary descriptor. Can accept a 2, 4, or 16 byte descriptor. Any other value will cause a leave with KErrArgument. If a 2 or 4 byte descriptor is set, the rest of the UUID will be filled with the Bluetooth well-known base UUID.

leave
This method will leave if an error occurs.
ParameterDescription
aDesThe binary descriptor. Note that the descriptor is interpretted to be in Big-endian format, i.e. index 0 holds the most significant byte.

ShortestForm ( )

IMPORT_C const TPtrC8ShortestForm()const

Get the smallest version the UUID will compress down to. Might be 2, 4, or 16 bytes. If 2 or 4 bytes, the ommitted bytes are implicity those from the Bluetooth base UUID.

Returns: TPtrC8 pointing to 2, 4, or 16 bytes of significant address.

SpecifiedLengthL ( TInt )

IMPORT_C const TPtrC8SpecifiedLengthL(TIntaLength)const

Return the UUID with a specified length.

Does not allow compressing a UUID to less than its shortest form. If 2 or 4 bytes, the ommitted bytes are implicity those from the Bluetooth base UUID.

leave
KErrArgument The UUID length requested is invalid.
leave
KErrTotalLossOfPrecision The UUID cannot be compressed to the requested length.
ParameterDescription
aLengthThe required length (2, 4 or 16 bytes).

Returns: TPtrC8 pointing to 2, 4, or 16 bytes of significant UUID data.

operator!= ( const TUUID & )

IMPORT_C TBooloperator!=(const TUUID &aUUID)const

Inequality operator.

ParameterDescription
aUUIDObject to compare to this.

Returns: EFalse is aUUID is the same as this, ETrue if not.

operator== ( const TUUID & )

IMPORT_C TBooloperator==(const TUUID &aUUID)const

Comparison operator.

ParameterDescription
aUUIDObject to compare to this.

Returns: ETrue is aUUID is the same as this, EFalse if not.

operator[] ( TInt )

IMPORT_C const TUint8 &operator[](TIntaIndex)const

Access a single element of the UUID.

ParameterDescription
aIndexThe index of the element to access.

Returns: The element. The reference remains valid as long as this object is in scope.

operator[] ( TInt )

IMPORT_C TUint8 &operator[](TIntaIndex)

Access a single element of the UUID.

ParameterDescription
aIndexThe index of the element to access.

Returns: The element. The reference remains valid as long as this object is in scope.