Symbian3/PDK/Source/GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-7-1-23-1-1-4-1-3-1-6-1-6-1.dita
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
<?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-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-7-1-23-1-1-4-1-3-1-6-1-6-1"><title>Creating Transfer Types</title><shortdesc>To transfer data between the Backup Engine and the backup server, a particular type of <apiname>conn::CSBGenericTransferType</apiname> must be created. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section><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 request (for backup) or supply (for restore) data. One of the following three derived classes must be created to transfer data. </p> <ul><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 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>. Data owners of this type are the common applications or servers built into the ROM. </p> <p>You can specify the creation of passive data, active data 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 value to the <codeph>CSBSIDTransferType::NewL()</codeph> function. For example, passing <codeph>EActiveSnapshotData</codeph> to <codeph>CSBSIDTransferType:NewL()</codeph> creates an active snapshot transfer type. </p> </li> <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 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>. Data owners of this type are usually installed through SIS files. Installing a package may install may install several applications (data owners). Each package is identified by a package ID while each data owner is identified by a package ID, a package name and an SID. </p> <p>Packages are often installed to a system drive, their data and snapshots are referred to as system data and system data snapshots. </p> </li> <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 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>. Data owners of this type are Java applications. </p> </li> </ul> </section> <section id="GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-7-1-23-1-1-4-1-3-1-6-1-6-1-3-2"><title>Procedure</title> <p>Create an array of a particular type, for example passive data for all data owners. Then go through the array to create the transfer types. </p> <p>The following 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>. You can further specify to create the data or snapshots. </p> <codeblock id="GUID-1D28813F-25CA-5169-8FC9-88FDA081DDD5" xml:space="preserve">/**
Each data owner in iDataOwners is a CDataOwnerInfo object, the following creates
CSBGenericTransferTypes based on the TPackageDataType passed.
@param aTransferTypes - Array of package transfer types.
@param aPkgDataType - system data or system data snapshot.
*/
void::GeneratePIDTransferTypesL(
RPointerArray<CSBGenericTransferType>& aTransferTypes,
TPackageDataType aPkgDataType)
{
aTransferTypes.ResetAndDestroy();
TUid id;
//need array to avoid duplications
RArray<TUid> uidArray;
CleanupClosePushL(uidArray);
//One transfer type is created for each drive
//on which the data owner has data.
TInt length = iDriveList.Length();
for (TInt driveCount = 0; driveCount < length; driveCount++)
{
if (iDriveList[driveCount])
{
TInt count = iDataOwners.Count();
for (TInt i = 0; i < count; i++)
{
switch (iDataOwners[i]->Identifier().DerivedTypeL())
{
case EPackageDerivedType:
if (iDataOwners[i]->CommonSettings() & EHasSystemFiles)
{
//Create CSBPackageId for each data owner in the package
CSBPackageId* pkgId =
CSBPackageId::NewL(&(iDataOwners[i]->Identifier()));
CleanupStack::PushL(pkgId);
id = pkgId->PackageIdL();
if (uidArray.Find(id) == KErrNotFound)
{
//Create the package transfer type based on the
//aPkgDataType parameter value passed in,
//system data or snapshot.
CSBPackageTransferType* idType =
CSBPackageTransferType::NewL(
id,
TDriveNumber(driveCount),
aPkgDataType
);
CleanupStack::PushL(idType);
aTransferTypes.AppendL(idType);
CleanupStack::Pop(idType);
//add to uid array
uidArray.AppendL(id);
}
CleanupStack::PopAndDestroy(pkgId);
} //if
break;
} // switch
} //for
} //if
} //for
CleanupStack::PopAndDestroy(&uidArray);
}
</codeblock> </section> </conbody><related-links><link href="GUID-0BD22FDB-1A5C-56AA-A7FC-BD2271B2F928.dita"><linktext>Writing a Backup Engine Client
(CSBEClient)</linktext> </link> </related-links></concept>