This example demonstrates how an MTP data provider plug-in can be created .
How to create a data provider plug-in class.
How to register it with the ECOM plug-in framework.
How to create an MTP framework data provider configuration file.
How to register an MTP data provider with the MTP Framework at the time of activation.
How to load vendor defined operations and support them with the data provider.
How to process transactions.
The example delivers the following project:
mtpdataproviderexample: The example data provider plug-in.
1. Creating a data provider plug-in class: A data provider plug-in class is created by defining a CMTPExampleDataProvider class that derives from the CMTPDataProviderPlugin class. The CMTPExampleDataProvider class represents a unique data provider that is being created. The example class implements all of the pure virtualMMTPDataProvider SPI methods.
The example data provider registers itself with the ECOM plug-in framework by creating and exporting a standard ECOM plug-in framework registration file. The mtpexampledp.rss file is the required registration file for the example data provider.
In addition to the registration file the example data provider plug-in DLL exports an ECOM implementation proxy table that links the implementation_uid defined in the mtpexampledp.rss file with CMTPExampleDataProvider::NewL() function, which is used for loading the example.
3. Creating an MTP framework data provider configuration file: Along with the ECOM registration file, the example data provider has a separate data provider configuration file, which provides information on the operational modes supported by the data provider. The file containing this information is mtpdataproviderpluginexample_config.rss. The example data provider supports KMTPModeMTP, which specifies it as having an MTP operational mode.
4. Registering an MTP data provider with the MTP Framework at the time of activation: For registration, the example data provider supplies information on the various operations it supports and defines them in the implementation of the Supported() function. The example supports two operations, EMTPOpVendorDefined1 and EMTPOpVendorDefined2, defined in cmtpexampledpconst.h. Any vendor extension information for the example data provider is defined by implementing theSupportedL() function. The example data provider does not support objects, hence there is no object and store enumeration.
5. Using vendor defined operations: The operations supported specify the functionality of the data provider. The example data provider supports EMTPOpVendorDefined1 and EMTPOpVendorDefined2 operations. These are dummy operations that send an EMTPRespCodeOK response as and when invoked. These dummy operations are implemented using the CMTPExampleDpVendorDefinedOp1 and CMTPExampleDpVendorDefinedOp2 classes. Both these classes are derived from the CMTPExampleDpRequestProcessor class, which encapsulates differing operation handling. For handling any unexpected operation sent by the PC, the CMTPRequestUnknown class has been defined.
The example data provider implements the mtpexamplerequestprocessor.cpp file, which is designed to dispatch the operations to a concrete request processor.
6. Transaction processing: The Responder to Initiator data phase is implemented where the Responder will send object data to the Initiator. Here, the example data provider plug-in is the responder and the PC acts as an initiator.
An incoming request can be processed using the HandleRequestL() function . Once the request is handled, CompleteRequestL() is called to signal the framework about the completion of the request transaction.
Click on the following link to download the example: MtpDataProvider.zip.
Click browse to view the example code.
You can build the example from your IDE or the command line:
If you use an IDE, import the bld.inf file of the example into your IDE, and use the build command of the IDE.
If you use the command line, open a command prompt, and set the current directory to the source code directory of the example. You can then build the example with the SBSv1 build tools using the following commands:
bldmake bldfiles
abld build
mtpexampledp.dll : example data provider plug-in.
in the epoc32\release\winscw\<udeb or urel>\ folder.
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.