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 TIntCreateAndSendEvent(const TDesC8 &, MHCICommandEventObserver &, MHCIDataEventObserver &, TAny *)
IMPORT_C THCIErrorCodeErrorCode()
IMPORT_C THCIEventCodeEventCode()
Protected Member Functions
THCIEventBase(THCIEventCode, TUint8, TDes8 &)
THCIEventBase(const TDesC8 &)
IMPORT_C TPtrC8AsBluetoothDeviceName(TInt)
IMPORT_C THCIConnectionHandleAsConnectionHandle(TInt)
IMPORT_C THCIConnectionHandleAsConnectionHandle(TInt, TInt, TInt)
IMPORT_C TBTDevAddrAsDevAddr(TInt)
IMPORT_C TBTDevAddrAsDevAddr(TInt, TInt, TInt)
IMPORT_C TBTLinkKeyAsLinkKey(TInt)
IMPORT_C TBTLinkKeyAsLinkKey(TInt, TInt, TInt)
IMPORT_C TPtrC8AsNullTerminatedString(TInt)
IMPORT_C TBluetoothSimplePairingHashAsSimplePairingHash(TInt)
IMPORT_C TBluetoothSimplePairingRandomizerAsSimplePairingRandomizer(TInt)
IMPORT_C TPtrC8AsString(TInt)
IMPORT_C TInt8AsTInt8(TInt)
IMPORT_C TInt8AsTInt8(TInt, TInt, TInt)
IMPORT_C TUint16AsTUint16(TInt)
IMPORT_C TUint16AsTUint16(TInt, TInt, TInt)
IMPORT_C TUint32AsTUint32(TInt, TUint8)
IMPORT_C TUint32AsTUint32(TInt, TInt, TInt, TUint8)
IMPORT_C TUint64AsTUint64(TInt)
IMPORT_C TUint64AsTUint64(TInt, TInt, TInt)
IMPORT_C TUint8AsTUint8(TInt)
IMPORT_C TUint8AsTUint8(TInt, TInt, TInt)
voidPutConnectionHandle(THCIConnectionHandle, TDes8 &)
voidPutDevAddr(const TBTDevAddr &, TDes8 &)
voidPutEventCode(THCIEventCode, TDes8 &)
voidPutLinkKey(const TBTLinkKey, TDes8 &)
voidPutPaddedString(const TDesC8 &, TInt, TDes8 &)
voidPutSimplePairingHash(const TBluetoothSimplePairingHash &, TDes8 &)
voidPutSimplePairingRandomizer(const TBluetoothSimplePairingRandomizer &, TDes8 &)
voidPutString(const TDesC8 &, TDes8 &)
voidPutTInt8(TInt8, TDes8 &)
voidPutTUint16(TUint16, TDes8 &)
voidPutTUint32(TUint32, TUint8, TDes8 &)
voidPutTUint64(TUint64, TDes8 &)
voidPutTUint8(TUint8, TDes8 &)
Private Member Functions
THCIEventBase(const THCIEventBase &)
TInt CreateAndSendCommandCompleteEvent(const TDesC8 &, MHCICommandEventObserver &)
Public Attributes
const TUintKEventCodeLength
const TUintKEventCodeOffset
const TUintKEventCommonFieldsLength
const TUintKTotalParameterLengthLength
const TUintKTotalParameterLengthOffset
Protected Attributes
THCIErrorCode iErrorCode
TPtrC8 iEventData
Private Attributes
TUint32 iReserved1
TUint32 iReserved2

Constructor & Destructor Documentation

THCIEventBase(THCIEventCode, TUint8, TDes8 &)

THCIEventBase(THCIEventCodeaEventCode,
TUint8aParameterTotalLength,
TDes8 &aEventData
)[protected]

Constructor used for creating a faked event

Parameters

THCIEventCode aEventCodeThe event code for the event
TUint8 aParameterTotalLengthThe total length of the event parameters
TDes8 & aEventDataEmpty 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_CTHCIEventBase(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 & aEventDataBuffer holding event data received from the Controller

THCIEventBase(const THCIEventBase &)

THCIEventBase(const THCIEventBase &)[private]

Parameters

const THCIEventBase &

Member Functions Documentation

AsBluetoothDeviceName(TInt)

IMPORT_C TPtrC8AsBluetoothDeviceName(TIntaOffset)const [protected]

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

Parameters

TInt aOffset

AsConnectionHandle(TInt)

IMPORT_C THCIConnectionHandleAsConnectionHandle(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsConnectionHandle(TInt, TInt, TInt)

IMPORT_C THCIConnectionHandleAsConnectionHandle(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of THCIConnectionHandle of this event.

AsDevAddr(TInt)

IMPORT_C TBTDevAddrAsDevAddr(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsDevAddr(TInt, TInt, TInt)

IMPORT_C TBTDevAddrAsDevAddr(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TBTDevAddrs of this event.

AsLinkKey(TInt)

IMPORT_C TBTLinkKeyAsLinkKey(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsLinkKey(TInt, TInt, TInt)

IMPORT_C TBTLinkKeyAsLinkKey(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TBTLinkKeys of this event.

AsNullTerminatedString(TInt)

IMPORT_C TPtrC8AsNullTerminatedString(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsSimplePairingHash(TInt)

IMPORT_C TBluetoothSimplePairingHashAsSimplePairingHash(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsSimplePairingRandomizer(TInt)

IMPORT_C TBluetoothSimplePairingRandomizerAsSimplePairingRandomizer(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsString(TInt)

IMPORT_C TPtrC8AsString(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsTInt8(TInt)

IMPORT_C TInt8AsTInt8(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsTInt8(TInt, TInt, TInt)

IMPORT_C TInt8AsTInt8(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TUint8s of this event.

AsTUint16(TInt)

IMPORT_C TUint16AsTUint16(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsTUint16(TInt, TInt, TInt)

IMPORT_C TUint16AsTUint16(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TUint16s of this event.

AsTUint32(TInt, TUint8)

IMPORT_C TUint32AsTUint32(TIntaOffset,
TUint8aSize
)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.
TUint8 aSizehow many bytes to get.

AsTUint32(TInt, TInt, TInt, TUint8)

IMPORT_C TUint32AsTUint32(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex,
TUint8aSize
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TUint32s of this event.
TUint8 aSizehow many bytes to get.

AsTUint64(TInt)

IMPORT_C TUint64AsTUint64(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsTUint64(TInt, TInt, TInt)

IMPORT_C TUint64AsTUint64(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex into the array of TUint64s of this event.

AsTUint8(TInt)

IMPORT_C TUint8AsTUint8(TIntaOffset)const [protected]

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

Parameters

TInt aOffsetoffset of value in event data.

AsTUint8(TInt, TInt, TInt)

IMPORT_C TUint8AsTUint8(TIntaOffset,
TIntaArrayBlockSize,
TIntaIndex
)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 aOffsetoffset of value in event data.
TInt aArrayBlockSizesize of one array entry, i.e. all parameters for an array entry.
TInt aIndexindex 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 TIntCreateAndSendEvent(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 & aEventDataThe data packet containing the event
MHCICommandEventObserver & aEventObserverThe observer for handling command-related events
MHCIDataEventObserver & aDataEventObserverThe observer for handling data-related events
TAny * aObserver = NULLAdditional observer parameter to allow the licensee extra future flexibility

ErrorCode()

IMPORT_C THCIErrorCodeErrorCode()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 THCIEventCodeEventCode()const

Getter for the event code.

PutConnectionHandle(THCIConnectionHandle, TDes8 &)

voidPutConnectionHandle(THCIConnectionHandleaConnectionHandle,
TDes8 &aEventData
)[protected]

Writes a THCIConnectionHandle to the event data descriptor.

Parameters

THCIConnectionHandle aConnectionHandlethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutDevAddr(const TBTDevAddr &, TDes8 &)

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

Writes a TBTDevAddr to the event data descriptor.

Parameters

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

PutEventCode(THCIEventCode, TDes8 &)

voidPutEventCode(THCIEventCodeaValue,
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 aValuethe event code to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutLinkKey(const TBTLinkKey, TDes8 &)

voidPutLinkKey(const TBTLinkKeyaValue,
TDes8 &aEventData
)[protected]

Writes a TBTLinkKey to the event data descriptor.

Parameters

const TBTLinkKey aValuethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutPaddedString(const TDesC8 &, TInt, TDes8 &)

voidPutPaddedString(const TDesC8 &aString,
TIntaRequiredLength,
TDes8 &aEventData
)[protected]

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

Parameters

const TDesC8 & aStringthe string to write
TInt aRequiredLengththe required length the writen string is to be
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutSimplePairingHash(const TBluetoothSimplePairingHash &, TDes8 &)

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

Writes a TBTSimplePairingHashC to the event data descriptor.

Parameters

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

PutSimplePairingRandomizer(const TBluetoothSimplePairingRandomizer &, TDes8 &)

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

Writes a TBTSimplePairingRandomizerR to the event data descriptor.

Parameters

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

PutString(const TDesC8 &, TDes8 &)

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

Writes a TDesC8& to the event data descriptor.

Parameters

const TDesC8 & aStringthe string to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutTInt8(TInt8, TDes8 &)

voidPutTInt8(TInt8aValue,
TDes8 &aEventData
)[protected]

Writes a TInt8 to the event data descriptor.

Parameters

TInt8 aValuethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutTUint16(TUint16, TDes8 &)

voidPutTUint16(TUint16aValue,
TDes8 &aEventData
)[protected]

Writes a TUint16 to the event data descriptor.

Parameters

TUint16 aValuethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutTUint32(TUint32, TUint8, TDes8 &)

voidPutTUint32(TUint32aValue,
TUint8aSize,
TDes8 &aEventData
)[protected]

Writes a TUint32 to the event data descriptor.

Parameters

TUint32 aValuethe value to write
TUint8 aSizehow many bytes to write.
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutTUint64(TUint64, TDes8 &)

voidPutTUint64(TUint64aValue,
TDes8 &aEventData
)[protected]

Writes a TUint64 to the event data descriptor.

Parameters

TUint64 aValuethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

PutTUint8(TUint8, TDes8 &)

voidPutTUint8(TUint8aValue,
TDes8 &aEventData
)[protected]

Writes a TUint8 to the event data descriptor.

Parameters

TUint8 aValuethe value to write
TDes8 & aEventDatamodifiable descriptor buffer where the faked event is being created

Member Data Documentation

const TUint KEventCodeLength

const TUintKEventCodeLength[static]

const TUint KEventCodeOffset

const TUintKEventCodeOffset[static]

const TUint KEventCommonFieldsLength

const TUintKEventCommonFieldsLength[static]

const TUint KTotalParameterLengthLength

const TUintKTotalParameterLengthLength[static]

const TUint KTotalParameterLengthOffset

const TUintKTotalParameterLengthOffset[static]

THCIErrorCode iErrorCode

THCIErrorCode iErrorCode[protected]

TPtrC8 iEventData

TPtrC8 iEventData[protected]

TUint32 iReserved1

TUint32 iReserved1[private]

TUint32 iReserved2

TUint32 iReserved2[private]