Symbian3/PDK/Source/GUID-C6EA2CFE-EA35-5B05-8103-B06A87BE1828.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 16 Jul 2010 17:23:46 +0100
changeset 12 80ef3a206772
parent 9 59758314f811
child 14 578be2adaf3e
permissions -rw-r--r--
Week 28 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 1897, Bug 344, Bug 2681, Bug 463, Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-C6EA2CFE-EA35-5B05-8103-B06A87BE1828"><title>MTP Data Types Overview</title><shortdesc>The MTP Data Types library implements the MTP data types. The implemented data types closely represent the raw MTP data streaming encoding and are optimized for the streaming performance. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>MTP Data Types library details</title> <p>The DLL that provides the functionality and the library to which your code must link is identified below. </p> <table id="GUID-D6364FB8-5982-5DA0-AF63-31F6F526B716"><tgroup cols="3"><colspec colname="col0"/><colspec colname="col1"/><colspec colname="col2"/><thead><row><entry>DLL</entry> <entry>LIB</entry> <entry>Short description</entry> </row> </thead> <tbody><row><entry><p> <filepath>mtpdatatypes.dll</filepath>  </p> </entry> <entry><p> <filepath>mtpdatatypes.lib</filepath>  </p> </entry> <entry><p>This file is used to represent the MTP data types or provide a common interface for writing new data types. </p> </entry> </row> </tbody> </tgroup> </table> </section> <section><title>Description</title> <p>There are two kinds of MTP data defined in the MTP specification: </p> <ul><li id="GUID-2E3EBB0D-22AB-57CE-9CFD-A1488FEC8D01"><p> <b>Data</b> used in MTP operations, responses or events. It can be data passed as a parameter to an MTP operation, response or event, or dataset transferred for an operation request. For example, if a host PC sends the <codeph>GetServiceInfo</codeph> operation request to a device, the host PC expects the <codeph>ServiceInfo</codeph> dataset from the device. </p> </li> <li id="GUID-9FA2573C-09C6-588E-9CE7-44334D7A3156"><p> <b>Media data file</b> transferred between an initiator and a responder. The MTP specification refers it to as binary object data or object data. The <codeph>GetObject</codeph> operation and <codeph>SendObject</codeph> operations transfer the object binary data. </p> </li> </ul> <p>The MTP Data Types library supports the above kinds of MTP data. When the Symbian MTP Framework receives a request (from a host PC or a device) for MTP data, it loads the corresponding <xref href="GUID-EA9D7B60-C4EA-5D29-9296-3E4C8B973F59.dita">data providers</xref>. The data providers process the dataset or binary data file using the Data Types library and pass it to the Framework. The Framework can then transfer the data to the host PC, or use it as a parameter in an operation, response or event. </p> <p>The Data Types library provides four types of data: Simple, Flat, Complex and Compound. Simple data type implements MTP integer data types while Flat, Complex and Compound data types implement <xref href="GUID-FD2BCFE4-27DC-3E6E-96E3-5E5EE7B9EDBD.dita"><apiname>MMTPType</apiname></xref> interface. </p> <p> <b>Note</b>: Binary object data is represented by <xref href="GUID-E9359E92-6521-3438-B32B-0285B4863A61.dita"><apiname>CMTPTypeFile</apiname></xref> which is a complex data type. </p> </section> <section><title>APIs</title> <p> <b> Simple data type</b> –a single integer value. </p> <table id="GUID-9E407A3E-8A6C-5E89-90FB-E6764AE485EB"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>API</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <xref href="GUID-5775EA1E-364F-31E0-9E90-5F872D345DD1.dita"><apiname>TMTPTypeInt8</apiname></xref>, </p> <p> <xref href="GUID-B703DB95-CEB8-32D2-B096-A4F435E44D9A.dita"><apiname>TMTPTypeInt16</apiname></xref>, </p> <p> <xref href="GUID-D09E696D-CCCC-35BB-AB41-22B49935B07C.dita"><apiname>TMTPTypeInt32</apiname></xref>, </p> <p> <xref href="GUID-AF1326F6-F908-3E96-BAF0-741149C6CA61.dita"><apiname>TMTPTypeInt64</apiname></xref>, </p> <p> <xref href="GUID-CDB84775-DA1D-3B04-ABD3-2E3F07CF545B.dita"><apiname>TMTPTypeInt128</apiname></xref>  </p> </entry> <entry><p>Implements the MTP signed 8, 16, 32, 64, and 128-bit integer data types respectively. </p> </entry> </row> <row><entry><p> <xref href="GUID-74FAE9F6-F485-3BFC-A2A4-5D1B2E364547.dita"><apiname>TMTPTypeUint8</apiname></xref>, </p> <p> <xref href="GUID-459E3806-39BF-3670-906F-3DC1E6B52532.dita"><apiname>TMTPTypeUint16</apiname></xref>, </p> <p> <xref href="GUID-E9C7ADF5-1024-3AB1-AA49-ED2F871377B1.dita"><apiname>TMTPTypeUint32</apiname></xref>, </p> <p> <xref href="GUID-97111086-198D-3602-B8EE-793A46FDD63E.dita"><apiname>TMTPTypeUint64</apiname></xref>, </p> <p> <xref href="GUID-BC423A03-5D06-3A24-938E-8E2659F73A79.dita"><apiname>TMTPTypeUint128</apiname></xref>  </p> </entry> <entry><p>Implements the MTP unsigned 8, 16, 32, 64, and 128-bit integer data types respectively. </p> </entry> </row> </tbody> </tgroup> </table> <p> <b> Flat data type</b> –a fixed-length collection of simple descrete data values. For example,<xref href="GUID-22FA2C54-7FC1-3973-AE71-A43386D44D9A.dita"><apiname>TMTPTypeEvent</apiname></xref> consists of seven elements. Each is a simple data type which can be different. </p> <codeblock id="GUID-F76A42BF-7542-5CA0-B0DA-A4FC566336B3" xml:space="preserve">class TMTPTypeEvent : public TMTPTypeFlatBase
    {    
public: 
    /**
    MTP event dataset element identifiers.
    */
    enum TElements
        {        
        /**
        Event Code, 
        */
        EEventCode,  //TMTPTypeUint32 
        
        /**
        SessionID.
        */
        EEventSessionID,  //TMTPTypeUint32
        
        /**
        TransactionID  
        */
        EEventTransactionID,  //TMTPTypeUint32
        
        /**
        Parameter 1.
        */
        EEventParameter1,  //TMTPTypeUint32
        
        /**
        Parameter 2.
        */
        EEventParameter2,  //TMTPTypeUint32
        
        /**
        Parameter 3.
        */
        EEventParameter3,  //TMTPTypeUint32
        
        /**
        The number of dataset elements.
        */
        ENumElements,  //TMTPTypeUint32
        };
</codeblock> <p>The following diagram shows the flat classes and their relationships. </p> <fig id="GUID-1FB1AF83-3A53-564E-9997-5C4AC4AFB4EA"><title>
             Flat data type 
          </title> <image href="GUID-10936B26-D4F3-5EC6-BBBA-009AA27045F7_d0e647742_href.jpg" placement="inline"/></fig> <table id="GUID-80FCAA03-DF25-5F0C-9958-3CEBF739AEA5"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>API</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <xref href="GUID-1ABB0CFA-A678-37F4-A315-D99C9FCC5321.dita"><apiname>TMTPTypeFlatBase </apiname></xref>  </p> </entry> <entry><p>The base class of MTP flat data types. </p> </entry> </row> <row><entry><p> <xref href="GUID-22FA2C54-7FC1-3973-AE71-A43386D44D9A.dita"><apiname>TMTPTypeEvent</apiname></xref>  </p> </entry> <entry><p>Represents MTP event dataset. </p> </entry> </row> <row><entry><p> <xref href="GUID-E6DEAAFF-8F6D-3AED-AD94-ECF4B0C72E89.dita"><apiname>TMTPTypeRequest</apiname></xref>  </p> </entry> <entry><p>Represents MTP operation request dataset. </p> </entry> </row> <row><entry><p> <xref href="GUID-E828F5A9-AFFA-3452-B5C3-7FFD4C4422AF.dita"><apiname>TMTPTypeResponse</apiname></xref>  </p> </entry> <entry><p>Represents MTP operation response dataset. </p> </entry> </row> </tbody> </tgroup> </table> <p> <b> Complex data type</b> –a variable-length contiguous array or string. The following diagram shows the complex classes and their relationships. </p> <fig id="GUID-147EF226-9C6B-523B-BB92-7FE9395C3639"><title>
             Complex data type 
          </title> <image href="GUID-4666DC80-EF7D-5761-9B6B-B2D14BDAB762_d0e647836_href.jpg" placement="inline"/></fig> <table id="GUID-E7D6EC73-7607-55E1-BBFD-8477F4A133B5"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>API</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <xref href="GUID-FF497532-C4AD-387D-87D5-3898EE6E6691.dita"><apiname>CMTPTypeArray</apiname></xref>  </p> </entry> <entry><p>Represents MTP array data type. </p> </entry> </row> <row><entry><p> <xref href="GUID-E9359E92-6521-3438-B32B-0285B4863A61.dita"><apiname>CMTPTypeFile</apiname></xref>  </p> </entry> <entry><p>Represents MTP binary object data type. </p> </entry> </row> <row><entry><p> <xref href="GUID-415619B7-BAC7-31BC-BA18-5A33CCA79F4B.dita"><apiname>CMTPTypeString</apiname></xref>  </p> </entry> <entry><p>Represents MTP string data type. </p> </entry> </row> </tbody> </tgroup> </table> <p> <b> Compound data type</b> –a mixed sequence of simple, flat, complex and compound types. </p> <p>Compound classes were initially derived from <xref href="GUID-30FD4C57-0B74-36B6-9F93-49FD816DDA11.dita"><apiname>CMTPTypeCompoundBase</apiname></xref>. The derived class can represent a list dataset or an element of a list dataset. For example, <xref href="GUID-DF980D13-2A8D-3863-A45D-4E44AD04E78A.dita"><apiname>CMTPTypeObjectPropListElement</apiname></xref> is an element of <xref href="GUID-0A1A998F-3E6C-362D-A1A2-6B32339380FB.dita"><apiname>CMTPTypeObjectPropList</apiname></xref>. They are both derived from <xref href="GUID-30FD4C57-0B74-36B6-9F93-49FD816DDA11.dita"><apiname>CMTPTypeCompoundBase</apiname></xref>. </p> <p> <xref href="GUID-F678E2AD-5F1F-3C47-8157-3412B5C6DF8C.dita"><apiname>CMTTypeList</apiname></xref> is then added to represent list dataset. It derives from <xref href="GUID-30FD4C57-0B74-36B6-9F93-49FD816DDA11.dita"><apiname>CMTPTypeCompoundBase</apiname></xref>. The list classes added later are derived from <xref href="GUID-F678E2AD-5F1F-3C47-8157-3412B5C6DF8C.dita"><apiname>CMTTypeList</apiname></xref>. For example, <xref href="GUID-A055345B-D7A5-3A30-A16A-27302A956CF5.dita"><apiname>CMTPTypeServicePropertyList</apiname></xref> is derived from <xref href="GUID-F678E2AD-5F1F-3C47-8157-3412B5C6DF8C.dita"><apiname>CMTTypeList</apiname></xref> and its elment <xref href="GUID-242F6B40-ADAD-34DC-854D-36B03048D9AE.dita"><apiname>CMTPTypeServicePropertyElement</apiname></xref> is derived from <xref href="GUID-30FD4C57-0B74-36B6-9F93-49FD816DDA11.dita"><apiname>CMTPTypeCompoundBase</apiname></xref>. </p> <p> <b>Note</b>:<codeph>CMTPTypeCompoundBase::ChunkAppendL()</codeph> can be used to append any <xref href="GUID-FD2BCFE4-27DC-3E6E-96E3-5E5EE7B9EDBD.dita"><apiname>MMTPType</apiname></xref> data types to the compound data. </p> <p>The following diagram and table describe the compound base classes. For a complete set of the derived classes, refer the MTP API references. </p> <fig id="GUID-F0884369-56D9-5F49-8C2D-A774856E54DC"><title>
             Compound data type-base classes 
          </title> <image href="GUID-A4559463-7665-5733-9AEB-2316C991AE76_d0e647980_href.jpg" placement="inline"/></fig> <table id="GUID-89D28F17-CF5D-541B-A70D-E2483DDA72E5"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>API</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <xref href="GUID-30FD4C57-0B74-36B6-9F93-49FD816DDA11.dita"><apiname>CMTPTypeCompoundBase</apiname></xref>  </p> </entry> <entry><p>The base class of MTP compound data types. </p> </entry> </row> <row><entry><p> <xref href="GUID-98C9BE6A-6336-36FF-BE4A-26B34D7F878B.dita"><apiname>CMTPTypeList</apiname></xref>  </p> </entry> <entry><p>The base class of MTP list dataset. </p> </entry> </row> <row><entry><p> <xref href="GUID-0FAC3211-78C5-38E2-AC4D-30AFAEB09265.dita"><apiname>RMTPType</apiname></xref>  </p> </entry> <entry><p>The general class for containing, accessing, and manipulating a reference to any <xref href="GUID-FD2BCFE4-27DC-3E6E-96E3-5E5EE7B9EDBD.dita"><apiname>MMTPType</apiname></xref> -derived data type. </p> </entry> </row> </tbody> </tgroup> </table> </section> <section><title>Using MTP Data Types library</title> <p>MTP data providers use the MTP Data Types library to process datasets for MTP operations and events. Device creators can provide their extended data types. </p> </section> </conbody></concept>