THCIEventBase Class Reference

class THCIEventBase

Represents the common data for a HCI event.

All of the event classes have been design to be used in a synchronous manner. All data is used by reference and hence any other object that requires persistence of the event parameters should make their own copy of them.

Public Member Functions
IMPORT_C TInt CreateAndSendEvent (const TDesC8 &, MHCICommandEventObserver &, MHCIDataEventObserver &, TAny *)
IMPORT_C THCIErrorCode ErrorCode ()
IMPORT_C THCIEventCode EventCode ()
Protected Member Functions
THCIEventBase ( THCIEventCode , TUint8 , TDes8 &)
THCIEventBase (const TDesC8 &)
IMPORT_C TPtrC8 AsBluetoothDeviceName ( TInt )
IMPORT_C THCIConnectionHandle AsConnectionHandle ( TInt )
IMPORT_C THCIConnectionHandle AsConnectionHandle ( TInt , TInt , TInt )
IMPORT_C TBTDevAddr AsDevAddr ( TInt )
IMPORT_C TBTDevAddr AsDevAddr ( TInt , TInt , TInt )
IMPORT_C TBTLinkKey AsLinkKey ( TInt )
IMPORT_C TBTLinkKey AsLinkKey ( TInt , TInt , TInt )
IMPORT_C TPtrC8 AsNullTerminatedString ( TInt )
IMPORT_C TBluetoothSimplePairingHash AsSimplePairingHash ( TInt )
IMPORT_C TBluetoothSimplePairingRandomizer AsSimplePairingRandomizer ( TInt )
IMPORT_C TPtrC8 AsString ( TInt )
IMPORT_C TInt8 AsTInt8 ( TInt )
IMPORT_C TInt8 AsTInt8 ( TInt , TInt , TInt )
IMPORT_C TUint16 AsTUint16 ( TInt )
IMPORT_C TUint16 AsTUint16 ( TInt , TInt , TInt )
IMPORT_C TUint32 AsTUint32 ( TInt , TUint8 )
IMPORT_C TUint32 AsTUint32 ( TInt , TInt , TInt , TUint8 )
IMPORT_C TUint64 AsTUint64 ( TInt )
IMPORT_C TUint64 AsTUint64 ( TInt , TInt , TInt )
IMPORT_C TUint8 AsTUint8 ( TInt )
IMPORT_C TUint8 AsTUint8 ( TInt , TInt , TInt )
void PutConnectionHandle ( THCIConnectionHandle , TDes8 &)
void PutDevAddr (const TBTDevAddr &, TDes8 &)
void PutEventCode ( THCIEventCode , TDes8 &)
void PutLinkKey (const TBTLinkKey , TDes8 &)
void PutPaddedString (const TDesC8 &, TInt , TDes8 &)
void PutSimplePairingHash (const TBluetoothSimplePairingHash &, TDes8 &)
void PutSimplePairingRandomizer (const TBluetoothSimplePairingRandomizer &, TDes8 &)
void PutString (const TDesC8 &, TDes8 &)
void PutTInt8 ( TInt8 , TDes8 &)
void PutTUint16 ( TUint16 , TDes8 &)
void PutTUint32 ( TUint32 , TUint8 , TDes8 &)
void PutTUint64 ( TUint64 , TDes8 &)
void PutTUint8 ( TUint8 , TDes8 &)
Private Member Functions
THCIEventBase (const THCIEventBase &)
TInt CreateAndSendCommandCompleteEvent (const TDesC8 &, MHCICommandEventObserver &)
Public Attributes
const TUint KEventCodeLength
const TUint KEventCodeOffset
const TUint KEventCommonFieldsLength
const TUint KTotalParameterLengthLength
const TUint KTotalParameterLengthOffset
Protected Attributes
THCIErrorCode iErrorCode
TPtrC8 iEventData
Private Attributes
TUint32 iReserved1
TUint32 iReserved2

Constructor & Destructor Documentation

THCIEventBase(THCIEventCode, TUint8, TDes8 &)

THCIEventBase ( THCIEventCode aEventCode,
TUint8 aParameterTotalLength,
TDes8 & aEventData
) [protected]

Constructor used for creating a faked event

Parameters

THCIEventCode aEventCode The event code for the event
TUint8 aParameterTotalLength The total length of the event parameters
TDes8 & aEventData Empty buffer where the faked event data will be built. Every event starts with a one-byte event code and one-byte parameter total length field, so these are managed in this base class. The data after this is event specific and has length equal to Parameter Total Length. It is the responsibility of the derived class faking constructor to populate the rest of the aEventData buffer and then to set the member variable iEventData to reference this buffer when it is complete. Note that the aEventData buffer must persist as long as the object itself. It must be empty intially, and must be big enough to hold all the data for the given event type.

THCIEventBase(const TDesC8 &)

IMPORT_C THCIEventBase ( const TDesC8 & aEventData ) [protected]

Normal constructor. This is used to create an event object to wrap event data received from the Controller

Parameters

const TDesC8 & aEventData Buffer holding event data received from the Controller

THCIEventBase(const THCIEventBase &)

THCIEventBase ( const THCIEventBase & ) [private]

Parameters

const THCIEventBase &

Member Functions Documentation

AsBluetoothDeviceName(TInt)

IMPORT_C TPtrC8 AsBluetoothDeviceName ( TInt aOffset ) const [protected]

Retrieves a Null terminated Bluetooth Device Name from a specified event data descriptor.

Parameters

TInt aOffset

AsConnectionHandle(TInt)

IMPORT_C THCIConnectionHandle AsConnectionHandle ( TInt aOffset ) const [protected]

Retrieves a THCIConnectionHandle from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsConnectionHandle(TInt, TInt, TInt)

IMPORT_C THCIConnectionHandle AsConnectionHandle ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a THCIConnectionHandle from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of THCIConnectionHandle of this event.

AsDevAddr(TInt)

IMPORT_C TBTDevAddr AsDevAddr ( TInt aOffset ) const [protected]

Retrieves a TBTDevAddr from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsDevAddr(TInt, TInt, TInt)

IMPORT_C TBTDevAddr AsDevAddr ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TBTDevAddr from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TBTDevAddrs of this event.

AsLinkKey(TInt)

IMPORT_C TBTLinkKey AsLinkKey ( TInt aOffset ) const [protected]

Retrieves a TBTLinkKey from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsLinkKey(TInt, TInt, TInt)

IMPORT_C TBTLinkKey AsLinkKey ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TBTLinkKey from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TBTLinkKeys of this event.

AsNullTerminatedString(TInt)

IMPORT_C TPtrC8 AsNullTerminatedString ( TInt aOffset ) const [protected]

Retrieves a Null terminated TDesC8 & from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsSimplePairingHash(TInt)

IMPORT_C TBluetoothSimplePairingHash AsSimplePairingHash ( TInt aOffset ) const [protected]

Retrieves a TBTDevAddr from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsSimplePairingRandomizer(TInt)

IMPORT_C TBluetoothSimplePairingRandomizer AsSimplePairingRandomizer ( TInt aOffset ) const [protected]

Retrieves a TBTDevAddr from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsString(TInt)

IMPORT_C TPtrC8 AsString ( TInt aOffset ) const [protected]

Retrieves a TDesC8 & from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsTInt8(TInt)

IMPORT_C TInt8 AsTInt8 ( TInt aOffset ) const [protected]

Retrieves a TInt8 from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsTInt8(TInt, TInt, TInt)

IMPORT_C TInt8 AsTInt8 ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TInt8 from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TUint8s of this event.

AsTUint16(TInt)

IMPORT_C TUint16 AsTUint16 ( TInt aOffset ) const [protected]

Retrieves a TUint16 from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsTUint16(TInt, TInt, TInt)

IMPORT_C TUint16 AsTUint16 ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TUint16 from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TUint16s of this event.

AsTUint32(TInt, TUint8)

IMPORT_C TUint32 AsTUint32 ( TInt aOffset,
TUint8 aSize
) const [protected]

Retrieves a TUint32 from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.
TUint8 aSize how many bytes to get.

AsTUint32(TInt, TInt, TInt, TUint8)

IMPORT_C TUint32 AsTUint32 ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex,
TUint8 aSize
) const [protected]

Retrieves a TUint32 from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TUint32s of this event.
TUint8 aSize how many bytes to get.

AsTUint64(TInt)

IMPORT_C TUint64 AsTUint64 ( TInt aOffset ) const [protected]

Retrieves a TUint64 from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsTUint64(TInt, TInt, TInt)

IMPORT_C TUint64 AsTUint64 ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TUint64 from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TUint64s of this event.

AsTUint8(TInt)

IMPORT_C TUint8 AsTUint8 ( TInt aOffset ) const [protected]

Retrieves a TUint8 from specified offset within the event data descriptor.

Parameters

TInt aOffset offset of value in event data.

AsTUint8(TInt, TInt, TInt)

IMPORT_C TUint8 AsTUint8 ( TInt aOffset,
TInt aArrayBlockSize,
TInt aIndex
) const [protected]

Retrieves a TUint8 from specified offset and index within the event data descriptor. Is intended to be used with events returning variable number of parameters.

Parameters

TInt aOffset offset of value in event data.
TInt aArrayBlockSize size of one array entry, i.e. all parameters for an array entry.
TInt aIndex index into the array of TUint8s of this event.

CreateAndSendCommandCompleteEvent(const TDesC8 &, MHCICommandEventObserver &)

TInt CreateAndSendCommandCompleteEvent ( const TDesC8 & aEventData,
MHCICommandEventObserver &
) [private, static]

Parameters

const TDesC8 & aEventData
MHCICommandEventObserver &

CreateAndSendEvent(const TDesC8 &, MHCICommandEventObserver &, MHCIDataEventObserver &, TAny *)

IMPORT_C TInt CreateAndSendEvent ( const TDesC8 & aEventData,
MHCICommandEventObserver & aEventObserver,
MHCIDataEventObserver & aDataEventObserver,
TAny * aObserver = NULL
) [static]

Static factory and despatcher method.

This method creates an object of the appropriate derived type according to the event code in the event data supplied. Depending upon the type of event, it is then passed to the supplied Command Event observer or Data Event observer as appropriate. The event object is created on the stack and is therefore destroyed before CreateAndSendEvent returns.

Parameters

const TDesC8 & aEventData The data packet containing the event
MHCICommandEventObserver & aEventObserver The observer for handling command-related events
MHCIDataEventObserver & aDataEventObserver The observer for handling data-related events
TAny * aObserver = NULL Additional observer parameter to allow the licensee extra future flexibility

ErrorCode()

IMPORT_C THCIErrorCode ErrorCode ( ) const

Getter for the error code.

Although this error code is not defined for all events in the HCI specification, the error code is in the base class so that the command queue can use the event error in its decisions without casting to a derived class. Those events that do not contain an error code in the specification should return with THCIErrorCode::EOK .

EventCode()

IMPORT_C THCIEventCode EventCode ( ) const

Getter for the event code.

PutConnectionHandle(THCIConnectionHandle, TDes8 &)

void PutConnectionHandle ( THCIConnectionHandle aConnectionHandle,
TDes8 & aEventData
) [protected]

Writes a THCIConnectionHandle to the event data descriptor.

Parameters

THCIConnectionHandle aConnectionHandle the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutDevAddr(const TBTDevAddr &, TDes8 &)

void PutDevAddr ( const TBTDevAddr & aBdaddr,
TDes8 & aEventData
) [protected]

Writes a TBTDevAddr to the event data descriptor.

Parameters

const TBTDevAddr & aBdaddr
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutEventCode(THCIEventCode, TDes8 &)

void PutEventCode ( THCIEventCode aValue,
TDes8 & aEventData
) [protected]

Writes an Event code to the event data descriptor. ALL the write functions are intended to be used ONE AFTER ANOTHER in the order the objects need to be written to the event data. Thus: PutEventCode(n); PutTUint8(int1); PutTUint16(int2); will product an event string n int1 int2 It is NOT possible to write these into the string in the order n, int2, int1 and get them to produce the event string shown. This is very similar to the way you construct commands.

Parameters

THCIEventCode aValue the event code to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutLinkKey(const TBTLinkKey, TDes8 &)

void PutLinkKey ( const TBTLinkKey aValue,
TDes8 & aEventData
) [protected]

Writes a TBTLinkKey to the event data descriptor.

Parameters

const TBTLinkKey aValue the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutPaddedString(const TDesC8 &, TInt, TDes8 &)

void PutPaddedString ( const TDesC8 & aString,
TInt aRequiredLength,
TDes8 & aEventData
) [protected]

Writes a TDesC8 & to the event data descriptor padding with '' up to the required length.

Parameters

const TDesC8 & aString the string to write
TInt aRequiredLength the required length the writen string is to be
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutSimplePairingHash(const TBluetoothSimplePairingHash &, TDes8 &)

void PutSimplePairingHash ( const TBluetoothSimplePairingHash & aHash,
TDes8 & aEventData
) [protected]

Writes a TBTSimplePairingHashC to the event data descriptor.

Parameters

const TBluetoothSimplePairingHash & aHash
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutSimplePairingRandomizer(const TBluetoothSimplePairingRandomizer &, TDes8 &)

void PutSimplePairingRandomizer ( const TBluetoothSimplePairingRandomizer & aRandomizer,
TDes8 & aEventData
) [protected]

Writes a TBTSimplePairingRandomizerR to the event data descriptor.

Parameters

const TBluetoothSimplePairingRandomizer & aRandomizer
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutString(const TDesC8 &, TDes8 &)

void PutString ( const TDesC8 & aString,
TDes8 & aEventData
) [protected]

Writes a TDesC8 & to the event data descriptor.

Parameters

const TDesC8 & aString the string to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutTInt8(TInt8, TDes8 &)

void PutTInt8 ( TInt8 aValue,
TDes8 & aEventData
) [protected]

Writes a TInt8 to the event data descriptor.

Parameters

TInt8 aValue the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutTUint16(TUint16, TDes8 &)

void PutTUint16 ( TUint16 aValue,
TDes8 & aEventData
) [protected]

Writes a TUint16 to the event data descriptor.

Parameters

TUint16 aValue the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutTUint32(TUint32, TUint8, TDes8 &)

void PutTUint32 ( TUint32 aValue,
TUint8 aSize,
TDes8 & aEventData
) [protected]

Writes a TUint32 to the event data descriptor.

Parameters

TUint32 aValue the value to write
TUint8 aSize how many bytes to write.
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutTUint64(TUint64, TDes8 &)

void PutTUint64 ( TUint64 aValue,
TDes8 & aEventData
) [protected]

Writes a TUint64 to the event data descriptor.

Parameters

TUint64 aValue the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

PutTUint8(TUint8, TDes8 &)

void PutTUint8 ( TUint8 aValue,
TDes8 & aEventData
) [protected]

Writes a TUint8 to the event data descriptor.

Parameters

TUint8 aValue the value to write
TDes8 & aEventData modifiable descriptor buffer where the faked event is being created

Member Data Documentation

const TUint KEventCodeLength

const TUint KEventCodeLength [static]

const TUint KEventCodeOffset

const TUint KEventCodeOffset [static]

const TUint KEventCommonFieldsLength

const TUint KEventCommonFieldsLength [static]

const TUint KTotalParameterLengthLength

const TUint KTotalParameterLengthLength [static]

const TUint KTotalParameterLengthOffset

const TUint KTotalParameterLengthOffset [static]

THCIErrorCode iErrorCode

THCIErrorCode iErrorCode [protected]

TPtrC8 iEventData

TPtrC8 iEventData [protected]

TUint32 iReserved1

TUint32 iReserved1 [private]

TUint32 iReserved2

TUint32 iReserved2 [private]