TBTDevAddr Class Reference

#include <bttypes.h>

class TBTDevAddr
Public Member Functions
TBTDevAddr()
TBTDevAddr(const TInt64 &)
TBTDevAddr(const TDesC8 &)
IMPORT_C TPtr8Des()
IMPORT_C const TPtrC8Des()
IMPORT_C voidGetReadable(TDes &)
IMPORT_C voidGetReadable(TDes &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C voidReset()
IMPORT_C TIntSetReadable(const TDesC &)
IMPORT_C TBooloperator!=(const TBTDevAddr &)
IMPORT_C TBooloperator<=(const TBTDevAddr &)
IMPORT_C TBooloperator==(const TBTDevAddr &)
IMPORT_C const TUint8 &operator[](TInt)
IMPORT_C TUint8 &operator[](TInt)

Detailed Description

48-bit bluetooth device address. Each bluetooth device has a unique address built into the hardware, which is represented by this class. Used for identifying remote addresses. The interface operates in a big-endian manner -- e.g. addr[0] refers to the most significant byte of the address. This is the same ordering as the addresses would naturally be written down on paper.

Constructor & Destructor Documentation

TBTDevAddr ( )

IMPORT_CTBTDevAddr()

Default constructor. The address is initialised to 0.

TBTDevAddr ( const TInt64 & )

IMPORT_CTBTDevAddr(const TInt64 &aInt)

Constructs a device address from a TInt64.

The function panics if the most significant 16 bits of aInt are non-zero, as device addresses are 48 bits in size.

ParameterDescription
aIntValue for device address.

TBTDevAddr ( const TDesC8 & )

IMPORT_CTBTDevAddr(const TDesC8 &aDes)

Constructs a device address from a data buffer.

The buffer is copied directly into the object. The function panics if aDes does not have a length of 6 bytes (48 bits).

ParameterDescription
aDesData buffer for device address

Member Function Documentation

Des ( )

IMPORT_C TPtr8Des()

Access value as a bigendian descriptor.

Returns: A non-const descriptor.

Des ( )

IMPORT_C const TPtrC8Des()const

Access value as a bigendian descriptor.

Returns: A const descriptor.

GetReadable ( TDes & )

IMPORT_C voidGetReadable(TDes &aDest)const

Extract the Bluetooth device address into a human-readable format, in aDest.

Output is in hexadecimal bigendian format, with no padding characters.

Note: aDest must be large enough to hold the entire output, or else a a panic will occur.

ParameterDescription
aDestDescriptor where result is placed.

GetReadable ( TDes &, const TDesC &, const TDesC &, const TDesC & )

IMPORT_C voidGetReadable(TDes &aDest,
const TDesC &aPrepend,
const TDesC &aByteSeperator,
const TDesC &aAppend
)const

Extract the Bluetooth device address into a human-readable format, in aDest.

Output is in hexadecimal bigendian format, with optional padding characters.

Note: aDest must be large enough to hold the entire output, or else a a panic will occur.

ParameterDescription
aDestDescriptor where result is placed.
aPrependAdded onto front of output.
aByteSeperatorInserted between each byte of address.
aAppendAdded onto end of output.

Reset ( )

IMPORT_C voidReset()

Reset the data contained within the object.

SetReadable ( const TDesC & )

IMPORT_C TIntSetReadable(const TDesC &aSource)

Convert Readable string into a dev addr.

Address may have leading space and "0x" characters.

ParameterDescription
aSourceReadable Hex representation of address

Returns: EPOC error code on fail, or else number of characters used from aSource in conversion

operator!= ( const TBTDevAddr & )

IMPORT_C TBooloperator!=(const TBTDevAddr &aAddr)const

Inequality operator.

ParameterDescription
aAddrThe device address to compare to this object.

Returns: EFalse if the addresses are equal, ETrue if not.

operator<= ( const TBTDevAddr & )

IMPORT_C TBooloperator<=(const TBTDevAddr &aAddr)const

Less than operator.

ParameterDescription
aAddrThe device address to compare to this object.

Returns: EFalse if the aAddr is greater than this TBTDevAddr, ETrue if not.

operator== ( const TBTDevAddr & )

IMPORT_C TBooloperator==(const TBTDevAddr &aAddr)const

Comparison operator.

ParameterDescription
aAddrThe device address to compare to this object.

Returns: ETrue if the addresses are equal, EFalse if not.

operator[] ( TInt )

IMPORT_C const TUint8 &operator[](TIntaIndex)const

Access a single element of the address.

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 address.

ParameterDescription
aIndexThe index of the element to access.

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