MFdcInterfaceV1 Class Reference

class MFdcInterfaceV1

Mixin for the FDC API.

Member Functions Documentation

Mfi1DeviceDetached(TUint)

void Mfi1DeviceDetached ( TUint aDeviceId ) [pure virtual]

Called when a device is detached. The device is one of those which have previously been notified to the Function Driver in a Mfi1NewFunction call. Any RUsbInterface handles which were opened as a result of the corresponding earlier Mfi1NewFunction call should be closed as they will be useless.

Parameters

TUint aDeviceId This serves to identify the device which has disappeared. This will be the device ID given in a previously completed Mfi1NewFunction call.

Mfi1NewFunction(TUint, const TArray< TUint > &, const TUsbDeviceDescriptor &, const TUsbConfigurationDescriptor &)

TInt Mfi1NewFunction ( TUint aDeviceId,
const TArray < TUint > & aInterfaces,
const TUsbDeviceDescriptor & aDeviceDescriptor,
const TUsbConfigurationDescriptor & aConfigurationDescriptor
) [pure virtual]

Called when a device is attached.

The Function Driver Framework has determined that this Function Driver is the most suitable to drive at least one of the interfaces in the device's selected configuration.

Each call to this method represents an attempt by the Function Driver Framework to get the Function Driver Controller to take ownership of interfaces (exactly one Function) on the device.

Not all the interfaces contained may be relevant to this Function Driver. Some interfaces may be relevant to this Function Driver, but should *not* be claimed in this call, as described below.

The device's entire device descriptor and configuration descriptor are given.

The Function Driver Framework provides a collection (aInterfaces) of interfaces which it is offering to the Function Driver Controller. The Function Driver Controller MUST take ownership of the first of these by calling MFdcPluginObserver::TokenForInterface (the Function Driver Controller was selected by the Function Driver Framework on the basis of its default_data field matching this particular interface). The Function Driver Controller MUST also take ownership of as many following interfaces as make up a single Function as defined by the relevant USB Class, again by calling MFdcPluginObserver::TokenForInterface for them.

The Function Driver Controller may examine interface descriptors for the interfaces it is being offered using the bInterfaceNumber items in aInterfaces, and the TUsbConfigurationDescriptor given (aConfigurationDescriptor).

Once exactly one Function has been claimed, the Function Driver Controller may return from this method. The Function Driver Framework does not make further attempts to load Function Drivers for the interfaces that have been claimed, whether an error is returned or not. If an error is returned, then (a) the FDF will send a driver loading error to USBMAN, and (b) the FDC must not have opened ANY RUsbInterfaces as a result of this call to Mfi1NewFunction. It is important for the Function Driver Controller to claim all the interfaces it should, even if it finds out early on that it won't be able to handle the Function for environmental or other reasons. The FDC may also return an error indicating that the Class-specific descriptors are incorrectly formatted.

The FD is not required to open RUsbInterface handles during Mfi1NewFunction. If it does, then it can pass any failure back as a return value to Mfi1NewFunction and this will be relayed to USBMAN as a driver loading error. If it does not, then the FD must itself take responsibility for relaying relevant failures to the user. (This is in aid of the 'no silent failures' requirement.)

This method may be called zero or more times for each device attached, depending on the interfaces present in the device's active configuration and on the other FDs present on the phone. If this function is called (and returns KErrNone) one or more times on a particular FDC, then Mfi1DeviceDetached will be called exactly once when the device is detached. If on device attachment this function is called one or more times for a particular FDC, and each time the FDC returns an error, then no device detachment notification will be given to that FDC. Hence any RUsbInterface handles successfully opened in a call to this function should be cleaned up immediately if the function returns error.

MFdcPluginObserver::TokenForInterface .

Parameters

TUint aDeviceId This is the ID of the new device. This identifier is private between the Function Driver Framework and the Function Driver. Its significance is to identify a device when it is removed (see Mfi1DeviceDetached). It is not equivalent to the device address or to anything else.
const TArray < TUint > & aInterfaces A collection of interface numbers (bInterfaceNumber) which are being offered to the Function Driver Controller. The Function Driver Controller uses items in this array in calls to MFdcPluginObserver::TokenForInterface. Ownership of the array is retained by the FDF.
const TUsbDeviceDescriptor & aDeviceDescriptor The device descriptor of the device. Ownership is retained by the FDF.
const TUsbConfigurationDescriptor & aConfigurationDescriptor The selected configuration descriptor of the device. Ownership is retained by the FDF.