RUsb Class Reference
class RUsb : public RSessionBase |
The RUsb class implements the Symbian OS USB Management API RUsb
Public Member Functions |
---|
| RUsb() |
| ~RUsb() |
IMPORT_C TInt | BusClearError() |
IMPORT_C TInt | BusDrop() |
IMPORT_C TInt | BusRequest() |
IMPORT_C TInt | BusRespondSrp() |
IMPORT_C TInt | CancelInterest(TUsbReqType) |
IMPORT_C TInt | ClassSupported(TInt, TUid, TBool &) |
IMPORT_C TInt | Connect() |
IMPORT_C void | DeviceStateNotification(TUint, TUsbDeviceState &, TRequestStatus &) |
IMPORT_C void | DeviceStateNotificationCancel() |
IMPORT_C void | DisableFunctionDriverLoading() |
IMPORT_C TInt | EnableFunctionDriverLoading() |
IMPORT_C TInt | GetCurrentPersonalityId(TInt &) |
IMPORT_C TInt | GetCurrentState(TUsbServiceState &) |
IMPORT_C TInt | GetDescription(TInt, HBufC *&) |
IMPORT_C TInt | GetDetailedDescription(TInt, HBufC *&) |
IMPORT_C TInt | GetDeviceState(TUsbDeviceState &) |
IMPORT_C TInt | GetManufacturerStringDescriptor(TUint, TUint, TName &) |
IMPORT_C TInt | GetOtgDescriptor(TUint, TOtgDescriptor &) |
IMPORT_C TInt | GetPersonalityIds(RArray< TInt > &) |
IMPORT_C TInt | GetPersonalityProperty(TInt, TUint32 &) |
IMPORT_C TInt | GetProductStringDescriptor(TUint, TUint, TName &) |
IMPORT_C TInt | GetServiceState(TUsbServiceState &) |
IMPORT_C TInt | GetSupportedClasses(TInt, RArray< TUid > &) |
IMPORT_C TInt | GetSupportedLanguages(TUint, RArray< TUint > &) |
IMPORT_C void | HostEventNotification(TRequestStatus &, TDeviceEventInformation &) |
IMPORT_C void | HostEventNotificationCancel() |
IMPORT_C void | MessageNotification(TRequestStatus &, TInt &) |
IMPORT_C void | MessageNotificationCancel() |
IMPORT_C TInt | RequestSession() |
IMPORT_C void | ServiceStateNotification(TUsbServiceState &, TRequestStatus &) |
IMPORT_C void | ServiceStateNotificationCancel() |
IMPORT_C TInt | SetCtlSessionMode(TBool) |
IMPORT_C void | Start(TRequestStatus &) |
IMPORT_C void | StartCancel() |
IMPORT_C void | StateNotification(TUint, TUsbDeviceState &, TRequestStatus &) |
IMPORT_C void | StateNotificationCancel() |
IMPORT_C void | Stop() |
IMPORT_C void | Stop(TRequestStatus &) |
IMPORT_C void | StopCancel() |
IMPORT_C void | TryStart(TInt, TRequestStatus &) |
IMPORT_C void | TryStop(TRequestStatus &) |
IMPORT_C TVersion | Version() |
IMPORT_C TInt | __DbgAlloc() |
IMPORT_C TInt | __DbgCheckHeap(TInt) |
IMPORT_C TInt | __DbgFailNext(TInt) |
IMPORT_C TInt | __DbgMarkEnd(TInt) |
IMPORT_C TInt | __DbgMarkHeap() |
Inherited Functions |
---|
| RHandleBase::Attributes()const |
| RHandleBase::BTraceId()const |
| RHandleBase::Close() |
| RHandleBase::DoExtendedClose() |
| RHandleBase::Duplicate(const RThread &,TOwnerType) |
| RHandleBase::FullName()const |
| RHandleBase::FullName(TDes &)const |
| RHandleBase::Handle()const |
| RHandleBase::HandleInfo(THandleInfo *) |
| RHandleBase::Name()const |
| RHandleBase::NotifyDestruction(TRequestStatus &) |
| RHandleBase::Open(const TFindHandleBase &,TOwnerType) |
| RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt) |
| RHandleBase::RHandleBase() |
| RHandleBase::RHandleBase(TInt) |
| RHandleBase::SetHandle(TInt) |
| RHandleBase::SetHandleNC(TInt) |
| RSessionBase::CreateSession(RServer2,const TVersion &) |
| RSessionBase::CreateSession(RServer2,const TVersion &,TInt) |
| RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *) |
| RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *) |
| RSessionBase::Open(RMessagePtr2,TInt,TOwnerType) |
| RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType) |
| RSessionBase::Open(TInt,TOwnerType) |
| RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType) |
| RSessionBase::Send(TInt)const |
| RSessionBase::Send(TInt,const TIpcArgs &)const |
| RSessionBase::SendReceive(TInt)const |
| RSessionBase::SendReceive(TInt,TRequestStatus &)const |
| RSessionBase::SendReceive(TInt,const TIpcArgs &)const |
| RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const |
| RSessionBase::SetReturnedHandle(TInt) |
| RSessionBase::SetReturnedHandle(TInt,RHandleBase &) |
| RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &) |
| RSessionBase::ShareAuto() |
| RSessionBase::ShareProtected() |
Constructor & Destructor Documentation
Member Functions Documentation
BusClearError()
IMPORT_C TInt | BusClearError | ( | ) | |
Cable watcher wants to clear the Bus Error after A_VBUS_ERR Only works if ID-Pin is present (this is an A-Device) and there has already been a bus erorr. This will not result in any attempt to raise or drop VBus
-
capability
- NetworkControl
BusDrop()
Cable watcher wants to drop VBus. If ID-Pin is present this is an A-Device and this will result in stopping VBus power-up
-
capability
- NetworkControl
BusRequest()
IMPORT_C TInt | BusRequest | ( | ) | |
Cable watcher wants to assert Bus_request. If ID-Pin is present this is an A-Device and this will result in an attempt to raise VBus. Second attempt to raise VBus causes KErrUsbOtgVbusAlreadyRaised error. If ID-Pin is absent this is a B-Device and this will result in an attempt to use SRP. Recently does nothing
When BusRequest() returns an error, VBus remains low until the errors are cleared by BusDrop() or BusClearErr() calls
-
capability
- NetworkControl
BusRespondSrp()
IMPORT_C TInt | BusRespondSrp | ( | ) | |
Cable watcher wants to assert Bus_request after SRP. If ID-Pin is present this is an A-Device and this will result in an attempt to raise VBus
-
capability
- NetworkControl
CancelInterest(TUsbReqType)
Cancels the interest of the pending operation of the device's USB service, either starting or stopping. The pending request will run to the completion. The caller of this function receives a status of KErrCancel.
Parameters
TUsbReqType aMessageId | a message id to identify the request to be cancelled |
ClassSupported(TInt, TUid, TBool &)
Queries the USB manager to determine if a given class is supported
Parameters
TInt aPersonalityId | a personality id |
TUid aClassUid | a class uid |
TBool & aSupported | set upon return |
Connect()
Connect the Handle to the Server Must be called before all other methods except Version()
DeviceStateNotification(TUint, TUsbDeviceState &, TRequestStatus &)
Request to be notified of a change in state of the USB device.
Parameters
TUint aStateMask | State mask of the states the client is interested in |
TUsbDeviceState & aState | State variable to be written to upon completion of the request |
TRequestStatus & aStatus | Status to complete when required state change occurs |
DeviceStateNotificationCancel()
IMPORT_C void | DeviceStateNotificationCancel | ( | ) | |
Cancel the outstanding device state notification request.
DisableFunctionDriverLoading()
IMPORT_C void | DisableFunctionDriverLoading | ( | ) | |
Disable Function Driver Loading.
-
capability
- NetworkControl
EnableFunctionDriverLoading()
IMPORT_C TInt | EnableFunctionDriverLoading | ( | ) | |
Enable Function Driver Loading.
-
capability
- NetworkControl
GetCurrentPersonalityId(TInt &)
IMPORT_C TInt | GetCurrentPersonalityId | ( | TInt & | aPersonalityId | ) | |
Gets the current personality id of the device's USb service
Parameters
TInt & aPersonalityId | set to the current personality of USB device |
GetCurrentState(TUsbServiceState &)
Functions below this point are deprecated and should not be used. Get the current state of the device's USB service. This function is deprecated and has been replaced by the GetServiceState function from version 7.0s onwards.
Parameters
TUsbServiceState & aState | Set by the method to the current state of the USB service |
GetDescription(TInt, HBufC *&)
IMPORT_C TInt | GetDescription | ( | TInt | aPersonalityId, |
| HBufC *& | aLocalizedPersonalityDescriptor |
| ) | |
Gets the textual description of the personality identified by the aPersonalityId. Caller is repsonsible for freeing up memories allocated to aLocalizedPersonalityDescriptor.
Parameters
TInt aPersonalityId | a personality id |
HBufC *& aLocalizedPersonalityDescriptor | a localize text string |
GetDetailedDescription(TInt, HBufC *&)
IMPORT_C TInt | GetDetailedDescription | ( | TInt | aPersonalityId, |
| HBufC *& | aLocalizedPersonalityDescriptor |
| ) | |
Gets the detailed textual description of the personality identified by the aPersonalityId. Caller is repsonsible for freeing up memories allocated to aLocalizedPersonalityDescriptor.
Parameters
TInt aPersonalityId | a personality id |
HBufC *& aLocalizedPersonalityDescriptor | a localize text string |
GetDeviceState(TUsbDeviceState &)
Gets the current device state (eg. powered, configured...).
Parameters
TUsbDeviceState & aState | Set by the method to the current state of the USB device |
GetManufacturerStringDescriptor(TUint, TUint, TName &)
Get Manufacturer Descriptor
Parameters
TUint aDeviceId | DeviceID of given device |
TUint aLangId | required language ID which is supplied by USB-IF and is different from standard Symbian TLanguage enumeration |
TName & aString | manufacturer descriptor value at output |
GetOtgDescriptor(TUint, TOtgDescriptor &)
Retrieve Otg Descriptor for device which has given device Id. Currently
TOtgDescriptor has following fields:
Parameters
TUint aDeviceId | DeviceID of given device |
TOtgDescriptor & aDescriptor | OTG descriptor value at output |
GetPersonalityIds(RArray< TInt > &)
Gets all supported personality ids of the device's USB service.
Parameters
RArray< TInt > & aPersonalityIds | populated with all supported personality ids of the USB device |
GetPersonalityProperty(TInt, TUint32 &)
IMPORT_C TInt | GetPersonalityProperty | ( | TInt | aPersonalityId, |
| TUint32 & | aProperty |
| ) | |
Gets the property of the personality identified by the aPersonalityId.
Parameters
TInt aPersonalityId | a personality id |
TUint32 & aProperty | |
GetProductStringDescriptor(TUint, TUint, TName &)
Parameters
TUint aDeviceId | DeviceID of given device |
TUint aLangId | required language ID which is supplied by USB-IF and is different from standard Symbian TLanguage enumeration |
TName & aString | product descriptor value at output |
GetServiceState(TUsbServiceState &)
Get the current state of the device's USB service.
Parameters
TUsbServiceState & aState | Set by the method to the current state of the USB service |
GetSupportedClasses(TInt, RArray< TUid > &)
Gets supported classes by the given personality identified by the aPersonalityId
Parameters
TInt aPersonalityId | a personality id |
RArray< TUid > & aClassUids | an array of class uids |
GetSupportedLanguages(TUint, RArray< TUint > &)
Get Supported Languages from USB Device
Parameters
TUint aDeviceId | DeviceID of given device |
RArray< TUint > & aLangIds | an array of language IDs supported by given device. These language IDs are supplied by USB-IF and are different from standard Symbian TLanguage enumeration |
HostEventNotification(TRequestStatus &, TDeviceEventInformation &)
Register for Host Device Event notifications. The request only completes when the host event occurs. Calling this function the first time initializes Host Events queue
KErrNone - if successful KErrInUse - if there is another outstanding nofitication request for the same session otherwise an error code returned by FDF
HostEventNotificationCancel()
IMPORT_C void | HostEventNotificationCancel | ( | ) | |
Cancel the outstanding FDF Device Event notification request.
MessageNotification(TRequestStatus &, TInt &)
Register for Messages notifications The request only completes when the new message arrives. Calling this function the first time initializes Messages queue
Parameters
TRequestStatus & aStatus | Status to complete when required state change occurs KErrNone - if successful KErrInUse - if there is another outstanding nofitication request for the same session otherwise an error code returned by OTGDI or Host |
TInt & aMessage | UI Message variable to be written to upon completion of the request |
MessageNotificationCancel()
IMPORT_C void | MessageNotificationCancel | ( | ) | |
Cancel the outstanding Messages notification request.
RequestSession()
IMPORT_C TInt | RequestSession | ( | ) | |
Informs USB Manager that the client would like to initialte USB session. On A-Device, it results in sending a notification to 'controller' application On B-Device, it may trigger either SRP or HNP sequence depending on the state of VBus
ServiceStateNotification(TUsbServiceState &, TRequestStatus &)
Request to be notified of a change in service state of the USB device. The request only completes when the service state changes.
Parameters
TUsbServiceState & aState | State variable to be written to upon completion of the request |
TRequestStatus & aStatus | Status to complete when required state change occurs |
ServiceStateNotificationCancel()
IMPORT_C void | ServiceStateNotificationCancel | ( | ) | |
Cancel the outstanding service state notification request.
SetCtlSessionMode(TBool)
Set or reset the mode in which current RUsb session operates. Recent implementation assumes that there is the one and only application which controls USBMAN, all other clients act as listeners to notification requests. Only application which was previously granted 'control' mode is allowed to reset it at later stage. Any calls from other applications will generate an error.
-
capability
- NetworkControl
Parameters
TBool aValue | True to inform USBMAN that Application wants to 'control' USBMAN False otherwise |
Start(TRequestStatus &)
Start the device's USB service. Should not be called if the USB services have already been started Note: Asynchonous Version, outcome returned when the status is completed
- Since
- 7.0
-
capability
- NetworkControl
Parameters
TRequestStatus & aStatus | Status to complete once the start operation has completed |
StartCancel()
IMPORT_C void | StartCancel | ( | ) | |
Cancels the pending start operation of the device's USB service.
- Since
- 7.0
-
capability
- NetworkControl
StateNotification(TUint, TUsbDeviceState &, TRequestStatus &)
Request to be notified of a change in state of the USB device. This function is deprecated and has been replaced by the DeviceStateNotification function from version 7.0s onwards.
Parameters
TUint aStateMask | State mask of the states the client is interested in |
TUsbDeviceState & aState | State variable to be written to upon completion of the request |
TRequestStatus & aStatus | Status to complete when required state change occurs |
StateNotificationCancel()
IMPORT_C void | StateNotificationCancel | ( | ) | |
Cancel the outstanding device state notification request. This function is deprecated and has been replaced by the DeviceStateNotificationCancel function from version 7.0s onwards.
Stop()
Stops the device's USB service. Should not be called if the USB services have not been started. This is the synchronous variant of this function. This function is deprecated- use the asynchronous version.
- Since
- 7.0
-
capability
- NetworkControl
Stop(TRequestStatus &)
Stops the device's USB service. Should not be called if the USB services have not been started. This is the asynchronous variant of this function.
- Since
- 7.0s
-
capability
- NetworkControl
Parameters
TRequestStatus & aStatus | Status to complete once the stop operation has completed |
StopCancel()
IMPORT_C void | StopCancel | ( | ) | |
Cancels the pending stop operation of the device's USB service.
- Since
- 7.0s
-
capability
- NetworkControl
TryStart(TInt, TRequestStatus &)
Try to start the device's USB service. It starts the current personality only if the service is in the idle state. Calling this API while the server is in any other states has no any effect on the service state.
Note: Asynchonous version, outcome returned when the status is completed
-
capability
- NetworkControl
Parameters
TInt aPersonalityId | a personality id |
TRequestStatus & aStatus | Status to complete once the start operation has completed. It may be one of the following: KErrNotSupported KErrAccessDenied KErrServerBusy KErrAbort KErrNone |
TryStop(TRequestStatus &)
Try to stop the device's USB service. It stops the service only if the serice is in the started state. Calling this API while the server is in the other states has no any effect on the service state.
Note: Asynchonous version, outcome returned when the status is completed
-
capability
- NetworkControl
Parameters
TRequestStatus & aStatus | Status to complete once the stop operation has completed. It may be one of the following: KErrNotSupported KErrAccessDenied KErrServerBusy KErrNone |
Version()
Extract the version of the server providing the RUsb API
__DbgAlloc()
IMPORT_C TInt | __DbgAlloc | ( | ) | |
Simulates memory allocation in the USB Manager. This function is only defined in debug builds.
__DbgCheckHeap(TInt)
Checks that the number of allocated cells on the USB Manager's heap is correct. The USB Manager will be panicked if it is not. This function is only defined in debug builds.
Parameters
TInt aCount | The expected number of heap cells allocated |
__DbgFailNext(TInt)
Simulates memory allocation failure in the USB Manager. This function is only defined in debug builds.
Parameters
TInt aCount | The number of allocations after which memory allocation should fail |
__DbgMarkEnd(TInt)
Marks the end of heap cell checking for the USB Manager. Checks that the number of heap cells allocated since the last __DbgMarkHeap() is aCount; the most common value to pass here is zero. This function is only defined in debug builds.
Parameters
TInt aCount | The expected number of heap cells allocated |
__DbgMarkHeap()
IMPORT_C TInt | __DbgMarkHeap | ( | ) | |
Marks the start of heap cell checking for the USB Manager. This function is only defined in debug builds.
Member Enumerations Documentation
Enum TUsbReqType
Enumerators
EStart | |
EStop | |
ETryStart | |
ETryStop | |
Member Data Documentation
TPckg< TUint32 > iDeviceStatePkg
Used to register device state notifications.
TPckg< TDeviceEventInformation > iHostPkg
Used to register Host state notifications.
TPckg< TUint32 > iMessagePkg
Used to register OTG/Host message notifications.
TPckg< TUint32 > iServiceStatePkg
Used to register service state notifications.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.