Symbian3/PDK/Source/GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-12-1-28-1-1-4-1-3-1-6-1-6-1.dita
changeset 12 80ef3a206772
equal deleted inserted replaced
11:5072524fcc79 12:80ef3a206772
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-12-1-28-1-1-4-1-3-1-6-1-6-1" xml:lang="en"><title>Creating
       
    13 Transfer Types</title><shortdesc>To transfer data between the Backup Engine and the backup server,
       
    14 a particular type of <codeph>conn::CSBGenericTransferType</codeph> must be
       
    15 created. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    16 <section id="GUID-21601609-18C3-401C-84FC-08184A52E2C7"><title>Introduction</title> <p>The <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-FB671D02-0F15-396F-9FB7-EE3E9372093C"><apiname>conn::CSBEClient</apiname></xref> uses <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-27BF6AEB-72A0-3E39-9598-AB97BE2569FC"><apiname>conn::CSBGenericTransferType</apiname></xref> to
       
    17 request (for backup) or supply (for restore) data. One of the following three
       
    18 derived classes must be created to transfer data. </p> <ul>
       
    19 <li id="GUID-9002670C-20FB-5FCA-BB11-BAA96FC591A8"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-6921D016-99BB-3CF0-B77C-CEF652A6D16B"><apiname>conn::CSBSIDTransferType</apiname></xref> transfers
       
    20 data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A592A578-6E32-36C8-A2CE-590E99173AF8"><apiname>conn::ESIDDerivedType</apiname></xref>.
       
    21 Data owners of this type are the common applications or servers built into
       
    22 the ROM. </p> <p>You can specify the creation of passive data, active data
       
    23 or snapshot data transfer type by passing a <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-55127967-CF91-3AEF-8304-DB60B287036F"><apiname>conn::TTransferDataType</apiname></xref> parameter
       
    24 value to the <codeph>CSBSIDTransferType::NewL()</codeph> function. For example,
       
    25 passing <codeph>EActiveSnapshotData</codeph> to <codeph>CSBSIDTransferType:NewL()</codeph> creates
       
    26 an active snapshot transfer type. </p> </li>
       
    27 <li id="GUID-550A62AA-0E27-5DD0-B014-3498CFDEDDEA"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-EB313AA2-302E-352F-B1A4-E60DAFBEBCFB"><apiname>conn::CSBPackageTransferType</apiname></xref> transfers
       
    28 data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A68EF3B1-2DF6-3787-83E0-F72CE16E785D"><apiname>conn::EPackageDerivedType</apiname></xref>.
       
    29 Data owners of this type are usually installed through SIS files. Installing
       
    30 a package may install may install several applications (data owners). Each
       
    31 package is identified by a package ID while each data owner is identified
       
    32 by a package ID, a package name and an SID. </p> <p>Packages are often installed
       
    33 to a system drive, their data and snapshots are referred to as system data
       
    34 and system data snapshots. </p> </li>
       
    35 <li id="GUID-03178C8B-DFD8-5094-BFA6-65DB923E77BC"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A655F770-18F9-3F43-ADAB-9048EF14A5EC"><apiname>conn::CSBJavaId</apiname></xref> transfers
       
    36 data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-BCB77CBF-1B06-38E1-96C1-FF3CFCA5B734"><apiname>conn::EJavaDerivedType</apiname></xref>.
       
    37 Data owners of this type are Java applications. </p> </li>
       
    38 </ul> </section>
       
    39 <section id="GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-12-1-28-1-1-4-1-3-1-6-1-6-1-3-2"><title>Procedure</title> <p>Create
       
    40 an array of a particular type, for example passive data for all data owners.
       
    41 Then go through the array to create the transfer types. </p> <p>The following
       
    42 example shows how to create the <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-EB313AA2-302E-352F-B1A4-E60DAFBEBCFB"><apiname>conn::CSBPackageTransferType</apiname></xref>.
       
    43 You can further specify to create the data or snapshots. </p> <codeblock id="GUID-1D28813F-25CA-5169-8FC9-88FDA081DDD5" xml:space="preserve">/**
       
    44 Each data owner in iDataOwners is a CDataOwnerInfo object, the following creates 
       
    45 CSBGenericTransferTypes based on the TPackageDataType passed. 
       
    46 @param aTransferTypes - Array of package transfer types.
       
    47 @param aPkgDataType - system data or system data snapshot.
       
    48 */
       
    49 
       
    50 void::GeneratePIDTransferTypesL(
       
    51            RPointerArray&lt;CSBGenericTransferType&gt;&amp; aTransferTypes,
       
    52            TPackageDataType aPkgDataType)
       
    53 {
       
    54 
       
    55     aTransferTypes.ResetAndDestroy();
       
    56     TUid id;
       
    57 
       
    58     //need array to avoid duplications
       
    59     RArray&lt;TUid&gt; uidArray;
       
    60     CleanupClosePushL(uidArray);
       
    61 
       
    62     //One transfer type is created for each drive 
       
    63     //on which the data owner has data.
       
    64     TInt length = iDriveList.Length();
       
    65     for (TInt driveCount = 0; driveCount &lt; length; driveCount++)
       
    66        {
       
    67        if (iDriveList[driveCount])
       
    68               {
       
    69               TInt count = iDataOwners.Count();
       
    70               for (TInt i = 0; i &lt; count; i++)
       
    71                     {
       
    72                     switch (iDataOwners[i]-&gt;Identifier().DerivedTypeL())
       
    73                        {
       
    74                         case EPackageDerivedType:
       
    75                          if (iDataOwners[i]-&gt;CommonSettings() &amp; EHasSystemFiles)
       
    76                                {
       
    77                                //Create CSBPackageId for each data owner in the package
       
    78                                CSBPackageId* pkgId = 
       
    79                                   CSBPackageId::NewL(&amp;(iDataOwners[i]-&gt;Identifier()));
       
    80                                CleanupStack::PushL(pkgId);
       
    81                                           
       
    82                                id = pkgId-&gt;PackageIdL();
       
    83                                if (uidArray.Find(id) == KErrNotFound)
       
    84                                   {
       
    85                                   
       
    86                                   //Create the package transfer type based on the 
       
    87                                   //aPkgDataType parameter value passed in, 
       
    88                                   //system data or snapshot.
       
    89                                   CSBPackageTransferType* idType = 
       
    90                                       CSBPackageTransferType::NewL(
       
    91                                                                    id,
       
    92                                                                    TDriveNumber(driveCount), 
       
    93                                                                    aPkgDataType  
       
    94                                                                   );
       
    95                                   CleanupStack::PushL(idType);
       
    96                                   aTransferTypes.AppendL(idType);
       
    97                                   CleanupStack::Pop(idType);
       
    98 
       
    99                                   //add to uid array
       
   100                                   uidArray.AppendL(id);
       
   101                                   }
       
   102                                CleanupStack::PopAndDestroy(pkgId);      
       
   103                                } //if
       
   104                         break;
       
   105                        } // switch
       
   106                     } //for              
       
   107                 } //if 
       
   108           } //for
       
   109 
       
   110 CleanupStack::PopAndDestroy(&amp;uidArray);
       
   111 }
       
   112 </codeblock> </section>
       
   113 </conbody><related-links>
       
   114 <link href="GUID-0BD22FDB-1A5C-56AA-A7FC-BD2271B2F928.dita"><linktext>Writing a
       
   115 Backup Engine Client                 (CSBEClient)</linktext></link>
       
   116 </related-links></concept>