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 voidAssignL(CBTDevice &)
IMPORT_C const TBTDevAddr &BDAddr()
IMPORT_C TUintCompareTo(const CBTDevice &)
IMPORT_C CBTDevice *CopyL()
IMPORT_C voidDeleteLinkKey()
IMPORT_C TBTDeviceClassDeviceClass()
IMPORT_C const TDesC8 &DeviceName()
IMPORT_C voidExternalizeL(RWriteStream &)
IMPORT_C const TDesC &FriendlyName()
IMPORT_C const TBTDeviceSecurityGlobalSecurity()
IMPORT_C voidInternalizeL(RReadStream &)
IMPORT_C TBoolIsPaired()
IMPORT_C TBoolIsValidBDAddr()
IMPORT_C TBoolIsValidDeviceClass()
IMPORT_C TBoolIsValidDeviceName()
IMPORT_C TBoolIsValidFriendlyName()
IMPORT_C TBoolIsValidGlobalSecurity()
IMPORT_C TBoolIsValidLinkKey()
IMPORT_C TBoolIsValidPaired()
IMPORT_C TBoolIsValidPassKey()
IMPORT_C TBoolIsValidSeen()
IMPORT_C TBoolIsValidUiCookie()
IMPORT_C TBoolIsValidUsed()
IMPORT_C const TBTLinkKey &LinkKey()
IMPORT_C TBTLinkKeyTypeLinkKeyType()
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 TUintPassKeyLength()
IMPORT_C const TTime &Seen()
IMPORT_C voidSetDeviceAddress(const TBTDevAddr &)
IMPORT_C voidSetDeviceClass(TBTDeviceClass)
IMPORT_C voidSetDeviceNameL(const TDesC8 &)
IMPORT_C voidSetFriendlyNameL(const TDesC &)
IMPORT_C voidSetGlobalSecurity(const TBTDeviceSecurity &)
IMPORT_C voidSetLinkKey(const TBTLinkKey &)
IMPORT_C voidSetLinkKey(const TBTLinkKey &, TBTLinkKeyType)
IMPORT_C voidSetPaired(TBool)
IMPORT_C voidSetPaired(TBTLinkKeyType)
IMPORT_C voidSetPassKey(const TBTPinCode &)
IMPORT_C voidSetSeen(const TTime &)
IMPORT_C voidSetUiCookie(TUint32)
IMPORT_C voidSetUsed(const TTime &)
IMPORT_C TUint32UiCookie()
IMPORT_C voidUpdateL(const CBTDevice &)
IMPORT_C const TTime &Used()
IMPORT_C TBooloperator!=(const CBTDevice &)
IMPORT_C TBooloperator==(const CBTDevice &)
Private Member Functions
CBTDevice()
voidCommonConstructL()
voidConstructL()
voidConstructL(const TBTDevAddr &)
voidConstructL(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
enumTBTDeviceNameSelector { EDeviceName = 0x40000000, EFriendlyName = 0x80000000, EAllNameProperties = 0xff000000, ELast = KMaxTUint }
Private Attributes
const TUint32KStreamVersion
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 voidAssignL(CBTDevice &aDevice)
Effectively operator=, but can leave.
leave
This method will leave if an error occurs.

Parameters

CBTDevice & aDeviceThe device details to assign to this object.

BDAddr()

IMPORT_C const TBTDevAddr &BDAddr()const

Get the device address.

CommonConstructL()

voidCommonConstructL()[private]

CompareTo(const CBTDevice &)

IMPORT_C TUintCompareTo(const CBTDevice &aDevice)const

Compares two devices.

Parameters

const CBTDevice & aDeviceinstance against which this is compared

ConstructL()

voidConstructL()[private]

ConstructL(const TBTDevAddr &)

voidConstructL(const TBTDevAddr &aAddr)[private]

Parameters

const TBTDevAddr & aAddr

ConstructL(const TBTNamelessDevice &)

voidConstructL(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 voidDeleteLinkKey()

Ensure that the previously known link key is discarded

DeviceClass()

IMPORT_C TBTDeviceClassDeviceClass()const

Get the device class.

DeviceName()

IMPORT_C const TDesC8 &DeviceName()const

Returns the name of the device

ExternalizeL(RWriteStream &)

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

Parameters

RWriteStream & aStreamThe 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 TBTDeviceSecurityGlobalSecurity()const

Get the global security settings.

InternalizeL(RReadStream &)

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

Parameters

RReadStream & aStreamThe stream from which this object shall be internalized.

IsPaired()

IMPORT_C TBoolIsPaired()const

Check whether the device is paired.

IsValidBDAddr()

IMPORT_C TBoolIsValidBDAddr()const

Denotes whether the device address has been set.

IsValidDeviceClass()

IMPORT_C TBoolIsValidDeviceClass()const

Denotes whether the device class has been set.

IsValidDeviceName()

IMPORT_C TBoolIsValidDeviceName()const

Has the name of the device been set?

IsValidFriendlyName()

IMPORT_C TBoolIsValidFriendlyName()const

Has the friendly name of the device been set?

IsValidGlobalSecurity()

IMPORT_C TBoolIsValidGlobalSecurity()const

Denotes whether the global security settings have been set.

IsValidLinkKey()

IMPORT_C TBoolIsValidLinkKey()const

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

IsValidPaired()

IMPORT_C TBoolIsValidPaired()const

Denotes whether the device is paired has been set.

IsValidPassKey()

IMPORT_C TBoolIsValidPassKey()const

Denotes whether the PIN code has been set.

IsValidSeen()

IMPORT_C TBoolIsValidSeen()const

Denotes whether the time last seen has been set.

IsValidUiCookie()

IMPORT_C TBoolIsValidUiCookie()const

Denotes whether the UI Cookie has been set.

IsValidUsed()

IMPORT_C TBoolIsValidUsed()const

Denotes whether the time last used has been set.

LinkKey()

IMPORT_C const TBTLinkKey &LinkKey()const

Get the link key.

LinkKeyType()

IMPORT_C TBTLinkKeyTypeLinkKeyType()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 & aBDAddrthe 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 & aNamelessDevicethe 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 & aBDAddrthe 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 & aNamelessDevicethe 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 TUintPassKeyLength()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 voidSetDeviceAddress(const TBTDevAddr &aBDAddr)

Set the device address.

Parameters

const TBTDevAddr & aBDAddrthe address of the device

SetDeviceClass(TBTDeviceClass)

IMPORT_C voidSetDeviceClass(TBTDeviceClassaDeviceClass)

Set the device class.

Parameters

TBTDeviceClass aDeviceClassthe device class of the device

SetDeviceNameL(const TDesC8 &)

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

Parameters

const TDesC8 & aNamedevice name

SetFriendlyNameL(const TDesC &)

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

Parameters

const TDesC & aNamefriendly name of the device

SetGlobalSecurity(const TBTDeviceSecurity &)

IMPORT_C voidSetGlobalSecurity(const TBTDeviceSecurity &aSetting)

Set the global security settings.

Parameters

const TBTDeviceSecurity & aSettingthe security override of the device

SetLinkKey(const TBTLinkKey &)

IMPORT_C voidSetLinkKey(const TBTLinkKey &aLinkKey)

Set the link key.

Parameters

const TBTLinkKey & aLinkKeythe link key of the device

SetLinkKey(const TBTLinkKey &, TBTLinkKeyType)

IMPORT_C voidSetLinkKey(const TBTLinkKey &aLinkKey,
TBTLinkKeyTypeaLinkKeyType
)

Set the link key type of the device.

Parameters

const TBTLinkKey & aLinkKeythe link key of the device
TBTLinkKeyType aLinkKeyTypethe link key type of the device

SetPaired(TBool)

IMPORT_C voidSetPaired(TBoolaPaired)

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 aPairedWhether the device is paired

SetPaired(TBTLinkKeyType)

IMPORT_C voidSetPaired(TBTLinkKeyTypeaLinkKeyType)

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

Parameters

TBTLinkKeyType aLinkKeyTypethe link key type of the paired device

SetPassKey(const TBTPinCode &)

IMPORT_C voidSetPassKey(const TBTPinCode &aPassKey)

Set the passkey.

Parameters

const TBTPinCode & aPassKeythe PIN code of the device

SetSeen(const TTime &)

IMPORT_C voidSetSeen(const TTime &aDateTime)

Set the time when the device was last seen.

Parameters

const TTime & aDateTimeThe time when the device was last seen.

SetUiCookie(TUint32)

IMPORT_C voidSetUiCookie(TUint32aUiCookie)

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

Parameters

TUint32 aUiCookieThe 32bit cookie value.

SetUsed(const TTime &)

IMPORT_C voidSetUsed(const TTime &aDateTime)

Set the time when the device was last used.

Parameters

const TTime & aDateTimeThe time when the device was last used.

UiCookie()

IMPORT_C TUint32UiCookie()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 voidUpdateL(const CBTDevice &aDevice)
Copies the contents of aDevice into *this
leave
This method will leave if an error occurs.

Parameters

const CBTDevice & aDevicecopied into *this

Used()

IMPORT_C const TTime &Used()const

Get the time when the device was last connected to.

operator!=(const CBTDevice &)

IMPORT_C TBooloperator!=(const CBTDevice &aDevice)const

Inequality operator

Parameters

const CBTDevice & aDeviceinstance against which this is compared

operator==(const CBTDevice &)

IMPORT_C TBooloperator==(const CBTDevice &aDevice)const

Equality operator

Parameters

const CBTDevice & aDeviceinstance 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 TUint32KStreamVersion[private, static]

TBTNamelessDevice iDevice

TBTNamelessDevice iDevice[private]

HBufC8 * iDeviceName

HBufC8 *iDeviceName[private]

HBufC * iFriendlyName

HBufC *iFriendlyName[private]