CBTDevice Class Reference

class CBTDevice : public CBase

Encapsulates all information that must be known about a device.

Stores useful information concerning a remote device, including names

Inherits from

Public Member Functions
~CBTDevice ()
IMPORT_C TBTNamelessDevice & AsNamelessDevice ()
IMPORT_C const TBTNamelessDevice & AsNamelessDevice ()
IMPORT_C void AssignL ( CBTDevice &)
IMPORT_C const TBTDevAddr & BDAddr ()
IMPORT_C TUint CompareTo (const CBTDevice &)
IMPORT_C CBTDevice * CopyL ()
IMPORT_C void DeleteLinkKey ()
IMPORT_C TBTDeviceClass DeviceClass ()
IMPORT_C const TDesC8 & DeviceName ()
IMPORT_C void ExternalizeL ( RWriteStream &)
IMPORT_C const TDesC & FriendlyName ()
IMPORT_C const TBTDeviceSecurity GlobalSecurity ()
IMPORT_C void InternalizeL ( RReadStream &)
IMPORT_C TBool IsPaired ()
IMPORT_C TBool IsValidBDAddr ()
IMPORT_C TBool IsValidDeviceClass ()
IMPORT_C TBool IsValidDeviceName ()
IMPORT_C TBool IsValidFriendlyName ()
IMPORT_C TBool IsValidGlobalSecurity ()
IMPORT_C TBool IsValidLinkKey ()
IMPORT_C TBool IsValidPaired ()
IMPORT_C TBool IsValidPassKey ()
IMPORT_C TBool IsValidSeen ()
IMPORT_C TBool IsValidUiCookie ()
IMPORT_C TBool IsValidUsed ()
IMPORT_C const TBTLinkKey & LinkKey ()
IMPORT_C TBTLinkKeyType LinkKeyType ()
IMPORT_C CBTDevice * NewL (const TBTDevAddr &)
IMPORT_C CBTDevice * NewL (const TBTNamelessDevice &)
IMPORT_C CBTDevice * NewL ()
IMPORT_C CBTDevice * NewLC (const TBTDevAddr &)
IMPORT_C CBTDevice * NewLC (const TBTNamelessDevice &)
IMPORT_C CBTDevice * NewLC ()
IMPORT_C const TBTPinCode & PassKey ()
IMPORT_C TUint PassKeyLength ()
IMPORT_C const TTime & Seen ()
IMPORT_C void SetDeviceAddress (const TBTDevAddr &)
IMPORT_C void SetDeviceClass ( TBTDeviceClass )
IMPORT_C void SetDeviceNameL (const TDesC8 &)
IMPORT_C void SetFriendlyNameL (const TDesC &)
IMPORT_C void SetGlobalSecurity (const TBTDeviceSecurity &)
IMPORT_C void SetLinkKey (const TBTLinkKey &)
IMPORT_C void SetLinkKey (const TBTLinkKey &, TBTLinkKeyType )
IMPORT_C void SetPaired ( TBool )
IMPORT_C void SetPaired ( TBTLinkKeyType )
IMPORT_C void SetPassKey (const TBTPinCode &)
IMPORT_C void SetSeen (const TTime &)
IMPORT_C void SetUiCookie ( TUint32 )
IMPORT_C void SetUsed (const TTime &)
IMPORT_C TUint32 UiCookie ()
IMPORT_C void UpdateL (const CBTDevice &)
IMPORT_C const TTime & Used ()
IMPORT_C TBool operator!= (const CBTDevice &)
IMPORT_C TBool operator== (const CBTDevice &)
Private Member Functions
CBTDevice ()
void CommonConstructL ()
void ConstructL ()
void ConstructL (const TBTDevAddr &)
void ConstructL (const TBTNamelessDevice &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TBTDeviceNameSelector { EDeviceName  = 0x40000000, EFriendlyName  = 0x80000000, EAllNameProperties  = 0xff000000, ELast  = KMaxTUint }
Private Attributes
const TUint32 KStreamVersion
TBTNamelessDevice iDevice
HBufC8 * iDeviceName
HBufC * iFriendlyName

Constructor & Destructor Documentation

CBTDevice()

CBTDevice ( ) [private]

Constructor. Use NewL() or NewLC() to create an object of this type instead of this constructor.

~CBTDevice()

IMPORT_C ~CBTDevice ( )

Destructor.

Member Functions Documentation

AsNamelessDevice()

IMPORT_C TBTNamelessDevice & AsNamelessDevice ( )

Get the TBTNamelessDevice portion of this.

AsNamelessDevice()

IMPORT_C const TBTNamelessDevice & AsNamelessDevice ( ) const

Get the TBTNamelessDevice portion of this.

AssignL(CBTDevice &)

IMPORT_C void AssignL ( CBTDevice & aDevice )
Effectively operator=, but can leave.
leave
This method will leave if an error occurs.

Parameters

CBTDevice & aDevice The device details to assign to this object.

BDAddr()

IMPORT_C const TBTDevAddr & BDAddr ( ) const

Get the device address.

CommonConstructL()

void CommonConstructL ( ) [private]

CompareTo(const CBTDevice &)

IMPORT_C TUint CompareTo ( const CBTDevice & aDevice ) const

Compares two devices.

Parameters

const CBTDevice & aDevice instance against which this is compared

ConstructL()

void ConstructL ( ) [private]

ConstructL(const TBTDevAddr &)

void ConstructL ( const TBTDevAddr & aAddr ) [private]

Parameters

const TBTDevAddr & aAddr

ConstructL(const TBTNamelessDevice &)

void ConstructL ( const TBTNamelessDevice & aNamelessDevice ) [private]

Parameters

const TBTNamelessDevice & aNamelessDevice

CopyL()

IMPORT_C CBTDevice * CopyL ( ) const
Copies the contents of this into a new CBTDevice object.
leave
This method will leave if an error occurs.

DeleteLinkKey()

IMPORT_C void DeleteLinkKey ( )

Ensure that the previously known link key is discarded

DeviceClass()

IMPORT_C TBTDeviceClass DeviceClass ( ) const

Get the device class.

DeviceName()

IMPORT_C const TDesC8 & DeviceName ( ) const

Returns the name of the device

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) const
Externalise this object to aStream.
leave
This method will leave if an error occurs.

Parameters

RWriteStream & aStream The stream to which this object will be written.

FriendlyName()

IMPORT_C const TDesC & FriendlyName ( ) const

Returns the friendly name of the device

GlobalSecurity()

IMPORT_C const TBTDeviceSecurity GlobalSecurity ( ) const

Get the global security settings.

InternalizeL(RReadStream &)

IMPORT_C void InternalizeL ( RReadStream & aStream )
Internalize this object from aStream.
leave
This method will leave if an error occurs.

Parameters

RReadStream & aStream The stream from which this object shall be internalized.

IsPaired()

IMPORT_C TBool IsPaired ( ) const

Check whether the device is paired.

IsValidBDAddr()

IMPORT_C TBool IsValidBDAddr ( ) const

Denotes whether the device address has been set.

IsValidDeviceClass()

IMPORT_C TBool IsValidDeviceClass ( ) const

Denotes whether the device class has been set.

IsValidDeviceName()

IMPORT_C TBool IsValidDeviceName ( ) const

Has the name of the device been set?

IsValidFriendlyName()

IMPORT_C TBool IsValidFriendlyName ( ) const

Has the friendly name of the device been set?

IsValidGlobalSecurity()

IMPORT_C TBool IsValidGlobalSecurity ( ) const

Denotes whether the global security settings have been set.

IsValidLinkKey()

IMPORT_C TBool IsValidLinkKey ( ) const

Denotes whether the link key has been set, and hence whether this is a paired device.

IsValidPaired()

IMPORT_C TBool IsValidPaired ( ) const

Denotes whether the device is paired has been set.

IsValidPassKey()

IMPORT_C TBool IsValidPassKey ( ) const

Denotes whether the PIN code has been set.

IsValidSeen()

IMPORT_C TBool IsValidSeen ( ) const

Denotes whether the time last seen has been set.

IsValidUiCookie()

IMPORT_C TBool IsValidUiCookie ( ) const

Denotes whether the UI Cookie has been set.

IsValidUsed()

IMPORT_C TBool IsValidUsed ( ) const

Denotes whether the time last used has been set.

LinkKey()

IMPORT_C const TBTLinkKey & LinkKey ( ) const

Get the link key.

LinkKeyType()

IMPORT_C TBTLinkKeyType LinkKeyType ( ) const

Get the link key type.

NewL(const TBTDevAddr &)

IMPORT_C CBTDevice * NewL ( const TBTDevAddr & aBDAddr ) [static]
Two-phase constructor Create a device and set its address.
leave
This method will leave if an error occurs.

Parameters

const TBTDevAddr & aBDAddr the address of the device to which this class refers

NewL(const TBTNamelessDevice &)

IMPORT_C CBTDevice * NewL ( const TBTNamelessDevice & aNamelessDevice ) [static]
Two-phase copy constructor Create a device based on the smaller nameless device
leave
This method will leave if an error occurs.

Parameters

const TBTNamelessDevice & aNamelessDevice the device to copy

NewL()

IMPORT_C CBTDevice * NewL ( ) [static]
Two-phase default constructor Create an empty device.
leave
This method will leave if an error occurs.

NewLC(const TBTDevAddr &)

IMPORT_C CBTDevice * NewLC ( const TBTDevAddr & aBDAddr ) [static]
Two-phase constructor
leave
This method will leave if an error occurs.

Parameters

const TBTDevAddr & aBDAddr the address of the device to which this class refers

NewLC(const TBTNamelessDevice &)

IMPORT_C CBTDevice * NewLC ( const TBTNamelessDevice & aNamelessDevice ) [static]
Two-phase copy constructor Create a device based on the smaller nameless device
leave
This method will leave if an error occurs.

Parameters

const TBTNamelessDevice & aNamelessDevice the device to copy

NewLC()

IMPORT_C CBTDevice * NewLC ( ) [static]
Two-phase default constructor Create an empty device. The object will be placed on the cleanupstack and must be removed by the caller.
leave
This method will leave if an error occurs.

PassKey()

IMPORT_C const TBTPinCode & PassKey ( ) const

Get the PIN code

PassKeyLength()

IMPORT_C TUint PassKeyLength ( ) const

Get the PIN code length

Seen()

IMPORT_C const TTime & Seen ( ) const

Get the time when the device was last seen. Note that this feature is not yet implemented in the bluetooth stack, and the method CBTDevice::Used() should be used instead.

SetDeviceAddress(const TBTDevAddr &)

IMPORT_C void SetDeviceAddress ( const TBTDevAddr & aBDAddr )

Set the device address.

Parameters

const TBTDevAddr & aBDAddr the address of the device

SetDeviceClass(TBTDeviceClass)

IMPORT_C void SetDeviceClass ( TBTDeviceClass aDeviceClass )

Set the device class.

Parameters

TBTDeviceClass aDeviceClass the device class of the device

SetDeviceNameL(const TDesC8 &)

IMPORT_C void SetDeviceNameL ( const TDesC8 & aName )
Set the device name.
leave
This method will leave if an error occurs.

Parameters

const TDesC8 & aName device name

SetFriendlyNameL(const TDesC &)

IMPORT_C void SetFriendlyNameL ( const TDesC & aName )
Set the friendly name.
leave
This method will leave if an error occurs.

Parameters

const TDesC & aName friendly name of the device

SetGlobalSecurity(const TBTDeviceSecurity &)

IMPORT_C void SetGlobalSecurity ( const TBTDeviceSecurity & aSetting )

Set the global security settings.

Parameters

const TBTDeviceSecurity & aSetting the security override of the device

SetLinkKey(const TBTLinkKey &)

IMPORT_C void SetLinkKey ( const TBTLinkKey & aLinkKey )

Set the link key.

Parameters

const TBTLinkKey & aLinkKey the link key of the device

SetLinkKey(const TBTLinkKey &, TBTLinkKeyType)

IMPORT_C void SetLinkKey ( const TBTLinkKey & aLinkKey,
TBTLinkKeyType aLinkKeyType
)

Set the link key type of the device.

Parameters

const TBTLinkKey & aLinkKey the link key of the device
TBTLinkKeyType aLinkKeyType the link key type of the device

SetPaired(TBool)

IMPORT_C void SetPaired ( TBool aPaired )

Set whether the device is paired; This function should no longer be used, the overloaded SetPaired function should be used. CBTDevice::SetPaired(TBTLinkKeyType aLinkKeyType)

Parameters

TBool aPaired Whether the device is paired

SetPaired(TBTLinkKeyType)

IMPORT_C void SetPaired ( TBTLinkKeyType aLinkKeyType )

Set whether the link key type when the device is paired;

Parameters

TBTLinkKeyType aLinkKeyType the link key type of the paired device

SetPassKey(const TBTPinCode &)

IMPORT_C void SetPassKey ( const TBTPinCode & aPassKey )

Set the passkey.

Parameters

const TBTPinCode & aPassKey the PIN code of the device

SetSeen(const TTime &)

IMPORT_C void SetSeen ( const TTime & aDateTime )

Set the time when the device was last seen.

Parameters

const TTime & aDateTime The time when the device was last seen.

SetUiCookie(TUint32)

IMPORT_C void SetUiCookie ( TUint32 aUiCookie )

Sets the UI Cookie for the device. The format of the cookie is specific to the UI using the field.

Parameters

TUint32 aUiCookie The 32bit cookie value.

SetUsed(const TTime &)

IMPORT_C void SetUsed ( const TTime & aDateTime )

Set the time when the device was last used.

Parameters

const TTime & aDateTime The time when the device was last used.

UiCookie()

IMPORT_C TUint32 UiCookie ( ) const

Returns the UI Cookie value associated with the device. The format of the cookie is specific to the UI using the field.

UpdateL(const CBTDevice &)

IMPORT_C void UpdateL ( const CBTDevice & aDevice )
Copies the contents of aDevice into *this
leave
This method will leave if an error occurs.

Parameters

const CBTDevice & aDevice copied into *this

Used()

IMPORT_C const TTime & Used ( ) const

Get the time when the device was last connected to.

operator!=(const CBTDevice &)

IMPORT_C TBool operator!= ( const CBTDevice & aDevice ) const

Inequality operator

Parameters

const CBTDevice & aDevice instance against which this is compared

operator==(const CBTDevice &)

IMPORT_C TBool operator== ( const CBTDevice & aDevice ) const

Equality operator

Parameters

const CBTDevice & aDevice instance against which this is compared

Member Enumerations Documentation

Enum TBTDeviceNameSelector

Describes the similarities between two devices.

Enumerators

EDeviceName = 0x40000000

Device name.

EFriendlyName = 0x80000000

Friendly name.

EAllNameProperties = 0xff000000

All name properties

ELast = KMaxTUint

Last enum. This is NOT a name property

Member Data Documentation

const TUint32 KStreamVersion

const TUint32 KStreamVersion [private, static]

TBTNamelessDevice iDevice

TBTNamelessDevice iDevice [private]

HBufC8 * iDeviceName

HBufC8 * iDeviceName [private]

HBufC * iFriendlyName

HBufC * iFriendlyName [private]