RUsbDevice Class Reference

class RUsbDevice

Use restricted to the Function Driver Framework, enforced by SID. Provides a means to examine the configuration descriptor, and so load appropriate Function Drivers.

Public Member Functions
RUsbDevice ()
void CancelDeviceStateChangeNotification ()
void Close ()
TInt GetConfigurationDescriptor ( TUsbConfigurationDescriptor &)
TInt GetDeviceDescriptor ( TUsbDeviceDescriptor &)
TInt GetStringDescriptor ( TUsbStringDescriptor *&, TDes8 &, TInt )
TInt GetStringDescriptor ( TUsbStringDescriptor *&, TDes8 &, TInt , TInt )
TInt GetTokenForInterface ( TInt , TUint32 &)
TUint Handle ()
TInt Open ( RUsbHubDriver &, TUint )
void QueueDeviceStateChangeNotification ( TDeviceState &, TRequestStatus &)
TInt Resume ()
TInt Suspend ()
Private Member Functions
TInt GetConfigurationDescriptor ( TDes8 &)
TInt GetConfigurationDescriptorSize ( TInt &)
TInt GetDeviceDescriptor ( TDes8 &)
void GetLocalDescriptorsL ()
TInt GetStringDescriptor ( TDes8 &, TInt , TInt )
TInt ParseStringDescriptor ( TUsbStringDescriptor *&, const TDesC8 &)
Public Member Enumerations
enum TDeviceState { EDeviceActive , EDeviceSuspended , EDeviceTriState }
enum TUsbDeviceControl {
EDeviceControl  = 0x4000000, EOpen , EClose , EGetDeviceDescriptor , EGetConfigurationDescriptorSize , EGetConfigurationDescriptor , EGetStringDescriptor , EGetInterfaceToken , ESuspend , EResume , ECancelDeviceStateChange
}
enum TUsbDeviceRequest { EDeviceRequest  = 0x4000000, EDeviceStateChange }
Private Attributes
const TUint KDeviceDescriptorSize
HBufC8 * iConfigurationDescriptorData
TBuf8 < KDeviceDescriptorSize > iDeviceDescriptorData
TUint iHandle
TUsbConfigurationDescriptor * iHeadConfDescriptor
TUsbDeviceDescriptor * iHeadDeviceDescriptor
RUsbHubDriver * iHub

Constructor & Destructor Documentation

RUsbDevice()

RUsbDevice ( ) [inline]

Member Functions Documentation

CancelDeviceStateChangeNotification()

void CancelDeviceStateChangeNotification ( ) [inline]

Cancels an outstanding request for device state changes QueueDeviceStateChangeNotification

Close()

void Close ( ) [inline]

Close a handle to a device.

GetConfigurationDescriptor(TUsbConfigurationDescriptor &)

TInt GetConfigurationDescriptor ( TUsbConfigurationDescriptor & aDescriptor ) [inline]

Return the USB Configuration Descriptor for this device.

Note: the supplied TUsbConfigurationDescriptor is owned by the caller, but any descriptor objects linked to it remain the property of the RUsbDevice object. Memory leaks will result if the head pointer is not cleaned up, but the pointed to objects should not be destroyed.

Parameters

TUsbConfigurationDescriptor & aDescriptor The supplied TUsbConfigurationDescriptor object will be populated from the data retrieved from the device. Note that the caller owns the head of the list, but not any children or peers.

GetConfigurationDescriptor(TDes8 &)

TInt GetConfigurationDescriptor ( TDes8 & aConfigDesc ) [private, inline]

Parameters

TDes8 & aConfigDesc

GetConfigurationDescriptorSize(TInt &)

TInt GetConfigurationDescriptorSize ( TInt & aConfigDescSize ) [private, inline]

Parameters

TInt & aConfigDescSize

GetDeviceDescriptor(TUsbDeviceDescriptor &)

TInt GetDeviceDescriptor ( TUsbDeviceDescriptor & aDescriptor ) [inline]

Return the USB Device Descriptor for this device.

Note: the supplied TUsbDeviceDescriptor is owned by the caller, but any descriptor objects linked to it remain the property of the RUsbDevice object. Memory leaks will result if the head pointer is not cleaned up, but the pointed to objects should not be destroyed.

Parameters

TUsbDeviceDescriptor & aDescriptor The supplied TUsbDeviceDescriptor object will be populated from the data retrieved from the device.

GetDeviceDescriptor(TDes8 &)

TInt GetDeviceDescriptor ( TDes8 & aDeviceDesc ) [private, inline]

Parameters

TDes8 & aDeviceDesc

GetLocalDescriptorsL()

void GetLocalDescriptorsL ( ) [private, inline]

GetStringDescriptor(TUsbStringDescriptor *&, TDes8 &, TInt)

TInt GetStringDescriptor ( TUsbStringDescriptor *& aDescriptor,
TDes8 & aTarget,
TInt aIndex
) [inline]

Parameters

TUsbStringDescriptor *& aDescriptor
TDes8 & aTarget
TInt aIndex

GetStringDescriptor(TUsbStringDescriptor *&, TDes8 &, TInt, TInt)

TInt GetStringDescriptor ( TUsbStringDescriptor *& aDescriptor,
TDes8 & aTarget,
TInt aIndex,
TInt aLangId
) [inline]

Parameters

TUsbStringDescriptor *& aDescriptor
TDes8 & aTarget
TInt aIndex
TInt aLangId

GetStringDescriptor(TDes8 &, TInt, TInt)

TInt GetStringDescriptor ( TDes8 & aStringDescriptor,
TInt aIndex,
TInt aLangId = 0
) [private, inline]

Parameters

TDes8 & aStringDescriptor
TInt aIndex
TInt aLangId = 0

GetTokenForInterface(TInt, TUint32 &)

TInt GetTokenForInterface ( TInt aInterfaceNumber,
TUint32 & aToken
) [inline]

Return a token which may be used to uniquely identify the supplied interface on this device. The returned token may then be passed to a function driver, to allow it to open the required interface.

Parameters

TInt aInterfaceNumber Interface to return a token for.
TUint32 & aToken The token assigned to the interface.

Handle()

TUint Handle ( ) const [inline]

Return the handle to a device

Open(RUsbHubDriver &, TUint)

TInt Open ( RUsbHubDriver & aHub,
TUint aHandle
) [inline]

Open a handle to a device.

Parameters

RUsbHubDriver & aHub
TUint aHandle

ParseStringDescriptor(TUsbStringDescriptor *&, const TDesC8 &)

TInt ParseStringDescriptor ( TUsbStringDescriptor *& aDescriptor,
const TDesC8 & aData
) [private, inline]

Parameters

TUsbStringDescriptor *& aDescriptor
const TDesC8 & aData

QueueDeviceStateChangeNotification(TDeviceState &, TRequestStatus &)

void QueueDeviceStateChangeNotification ( TDeviceState & aCurrentState,
TRequestStatus & aRequest
) [inline]

Queues an asynchronous request for changes in the state of the device represented by this handle.

Parameters

TDeviceState & aCurrentState The new state of the device
TRequestStatus & aRequest The request status completed when a state change has occured.

Resume()

TInt Resume ( ) [inline]

Resumes the device from a suspended state.

Suspend()

TInt Suspend ( ) [inline]

Places the device into a suspended state.

Member Enumerations Documentation

Enum TDeviceState

Enumerators

EDeviceActive
EDeviceSuspended
EDeviceTriState

Enum TUsbDeviceControl

Enumerators

EDeviceControl = 0x4000000
EOpen
EClose
EGetDeviceDescriptor
EGetConfigurationDescriptorSize
EGetConfigurationDescriptor
EGetStringDescriptor
EGetInterfaceToken
ESuspend
EResume
ECancelDeviceStateChange

Enum TUsbDeviceRequest

Enumerators

EDeviceRequest = 0x4000000
EDeviceStateChange

Member Data Documentation

const TUint KDeviceDescriptorSize

const TUint KDeviceDescriptorSize [private, static]

HBufC8 * iConfigurationDescriptorData

HBufC8 * iConfigurationDescriptorData [private]

TBuf8< KDeviceDescriptorSize > iDeviceDescriptorData

TBuf8 < KDeviceDescriptorSize > iDeviceDescriptorData [private]

TUint iHandle

TUint iHandle [private]

TUsbConfigurationDescriptor * iHeadConfDescriptor

TUsbConfigurationDescriptor * iHeadConfDescriptor [private]

TUsbDeviceDescriptor * iHeadDeviceDescriptor

TUsbDeviceDescriptor * iHeadDeviceDescriptor [private]

RUsbHubDriver * iHub

RUsbHubDriver * iHub [private]