Symbian3/SDK/Source/GUID-DFF9DFC5-1BE0-5CA2-A2B9-27FA2DECFF59.dita
changeset 7 51a74ef9ed63
parent 0 89d6a7a84779
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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 task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-DFF9DFC5-1BE0-5CA2-A2B9-27FA2DECFF59" xml:lang="en"><title>Writing
       
    13 an Active Backup Client Tutorial</title><shortdesc>A backup client application is often referred to as a data owner
       
    14 as it owns the data. This section describes how to write an active backup
       
    15 client which works with the Backup Engine and the Backup Server for data backup
       
    16 and restore. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    17 <prereq id="GUID-B83C3258-BE3B-597F-A8EB-5598F059E2E3"><p>Before you start,
       
    18 you must understand: </p> <ul>
       
    19 <li id="GUID-909ACEA0-363B-585F-AAC7-D85706158930"><p><xref href="GUID-7FDD9FEC-5017-5E5D-A50A-5F343A3C7F6C.dita">Backup
       
    20 Engine Concepts</xref> introduce the backup and restore types. </p> </li>
       
    21 <li id="GUID-DB7C6BE8-A9A5-592F-BFD2-131FA7139BE2"><p><xref href="GUID-5CA933B9-7987-5DDE-AE12-B0D5AFD31451.dita">Symbian
       
    22 Backup and Restore architecture</xref> describes the two ways of data backup
       
    23 and restore. </p> </li>
       
    24 <li id="GUID-E1A1DC99-39BC-59AD-A2A9-0261D6E689EB"><p><xref href="GUID-937C3D70-2DCC-5084-AC87-3B1E5865A827.dita">Active
       
    25 Backup Client Architecture</xref> describes the components involved to do
       
    26 active data backup and restore. </p> </li>
       
    27 <li id="GUID-1FA3D484-3460-5A81-BD1E-52810746ECD8"><p><xref href="GUID-A81C65CF-CF4E-571C-8080-9D387F46AAD6.dita">Symbian
       
    28 Publish and Subscribe</xref> describes how to publish and subscribe events
       
    29 using properties. </p> </li>
       
    30 </ul> </prereq>
       
    31 <context id="GUID-06AB41B7-201A-5EB9-AFF2-1CF231B06118"><p>In an active backup
       
    32 and restore, the Backup Engine calls the active backup client to supply the
       
    33 data for the backup. Writing an active backup client means to: </p> <ul>
       
    34 <li id="GUID-FAAB2D8E-14AD-5866-9D13-26D1DD39EBBC"><p>Create a user defined
       
    35 class that has a data member pointer to <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-17E48B80-2421-3256-B8B4-A0FED424D54A"><apiname>conn::CActiveBackupClient</apiname></xref>. </p> </li>
       
    36 <li id="GUID-BB8DB868-66D9-5CE4-8CBD-0D9201365522"><p>Implement the <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-DB245BC3-2ADA-311D-8024-B40335D22822"><apiname>conn::MActiveBackupDataClient</apiname></xref> interface. </p> </li>
       
    37 </ul> </context>
       
    38 <steps id="GUID-7D9E4BEE-5BBB-55B1-AB2C-C47E176B0CE7">
       
    39 <step id="GUID-95BE7D7F-D355-5CC9-9A02-3351FBC8E709"><cmd/>
       
    40 <info>Write an active backup client (data owner) class which must subscribe
       
    41 for the <codeph>KUidBackupRestoreKey</codeph> property published by the backup
       
    42 server. </info>
       
    43 <info>When a backup server receives a request from a client (a host PC) for
       
    44 a backup or a restore, it reads backup registration files for a list of data
       
    45 owners (refer to step 3). It then calls the <codeph>CSBEClient::SetBURModeL()</codeph> function
       
    46 with the registered types (base or incremental, full or partial). This function
       
    47 signals start or completion of a backup or restore to all data owners. Data
       
    48 owners must subscribe the following publish and subscribe property: </info>
       
    49 <substeps id="GUID-29550A41-94C4-5F36-9175-B0FDF2E55483">
       
    50 <substep id="GUID-E291A40F-9573-52D7-833D-DDCA3F194B59"><cmd/>
       
    51 <info>Key–<codeph>KUidBackupRestoreKey</codeph> defined in the <filepath>epoc32\include\connect\sbdefs.h</filepath> header
       
    52 file. This key belongs to the <codeph>KUidSystemCategoryValue</codeph> category. </info>
       
    53 </substep>
       
    54 <substep id="GUID-774E7565-EB05-5302-B7C7-BD25F6CAFAE0"><cmd/>
       
    55 <info>Value–<codeph>TBURPartType</codeph> or <codeph>TBackupIncType</codeph>. </info>
       
    56 </substep>
       
    57 </substeps>
       
    58 <info>The backup client must check the value of the property (flag) on startup,
       
    59 in case the device is already in a backup or restore mode. A <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-17E48B80-2421-3256-B8B4-A0FED424D54A"><apiname>conn::CActiveBackupClient</apiname></xref> object
       
    60 can only be created once the publish and subscribe flag has transitioned into
       
    61 a backup or restore mode. The backup client can be deleted once the backup
       
    62 or restore operation has finished. This releases valuable system resources. </info>
       
    63 <info> <codeph>CActiveBackupClient::ConfirmReadyForBURL()</codeph> is called
       
    64 to indicate that the backup client is ready for the data supply to the Backup
       
    65 Engine. </info>
       
    66 <stepxmp><codeblock id="GUID-179BD485-939F-5D89-A123-55FDB8815140" xml:space="preserve">class CReferenceActiveDataOwner : public CActive
       
    67     {
       
    68     // Methods
       
    69 public:
       
    70     static CReferenceActiveDataOwner* NewL();
       
    71     ~CReferenceActiveDataOwner();
       
    72     
       
    73     // From CActive
       
    74     void RunL();
       
    75     TInt RunError(TInt aError);
       
    76     void DoCancel();
       
    77 
       
    78 private:
       
    79     CReferenceActiveDataOwner() 
       
    80     void ConstructL();
       
    81     void SubscribeToPSFlag();
       
    82     void ProcessBackupStateL(TInt aBackupStateValue);
       
    83 
       
    84     // Attributes
       
    85 private:
       
    86     //Active Backup Client
       
    87     CActiveBackupClient* iActiveBackupClient;
       
    88     
       
    89     //The publish and subscribe flag from the Backup Engine
       
    90     RProperty iProperty;
       
    91     
       
    92     //Pointer to the callback implementation
       
    93     CReferenceCallbackImplementation* iCallbackImpl;
       
    94     };
       
    95     
       
    96 /** Subscribe to the publish and subscribe flag.
       
    97     Call RunL() when the flag changes.
       
    98 */
       
    99 void CReferenceActiveDataOwner::SubscribeToPSFlag()
       
   100     {
       
   101     iStatus = KRequestPending;
       
   102     iProperty.Subscribe(iStatus);
       
   103     SetActive();
       
   104     }
       
   105 
       
   106 /** Check the flag in case the data owner has been started for a backup or restore, 
       
   107     or in case the publish and subscribe transition is missed.
       
   108 */
       
   109 void CReferenceActiveDataOwner::ConstructL()
       
   110     {
       
   111     // Set up the property to catch the flag.
       
   112     TInt backupStateValue = 0;
       
   113     iProperty.Attach(KUidSystemCategory, KUidBackupRestoreKey);
       
   114 
       
   115     // Process the mode change accordingly
       
   116     iProperty.Get(backupStateValue);
       
   117     ProcessBackupStateL(backupStateValue);
       
   118 
       
   119     // Add to the active scheduler
       
   120     CActiveScheduler::Add(this);
       
   121 
       
   122     // Subscribe to the flag to catch transitions
       
   123     SubscribeToPSFlag();    
       
   124 }
       
   125 
       
   126 /** Create the CActiveBackupClient and the callback implementation
       
   127     based on the flag.
       
   128 @param aBackupStateValue the new backup state value
       
   129 */
       
   130 void CReferenceActiveDataOwner::ProcessBackupStateL(TInt aBackupStateValue)
       
   131     {
       
   132     TInt type = aBackupStateValue &amp; KBURPartTypeMask;
       
   133     
       
   134     // Create the the CActiveBackupClient and the callback implementation if
       
   135     // the device is in a backup or a restore mode.
       
   136     if (type == EBURBackupFull || type == EBURRestoreFull ||
       
   137         type == EBURBackupPartial || type == EBURRestorePartial)
       
   138         if (iCallbackImpl == NULL)
       
   139             {
       
   140             iCallbackImpl = CReferenceCallbackImplementation::NewL();
       
   141             }
       
   142         if (iActiveBackupClient == NULL)
       
   143             {
       
   144             iActiveBackupClient = 
       
   145                       CActiveBackupClient::NewL(iCallbackImpl);
       
   146             }
       
   147         }
       
   148 
       
   149     // Confirm the readiness of the active backup client.
       
   150     if ((type == EBURBackupFull || type == EBURRestoreFull) ||
       
   151         ((type == EBURBackupPartial || type == EBURRestorePartial) &amp;&amp;
       
   152          iActiveBackupClient-&gt;DoesPartialBURAffectMeL()))
       
   153         {
       
   154 
       
   155          .... // Things handled by a device vendor.
       
   156 
       
   157         //Inform the Backup Engine that the client is ready for data supply.
       
   158         iActiveBackupClient-&gt;ConfirmReadyForBURL(KErrNone);
       
   159         }
       
   160     else        
       
   161         {
       
   162         // CActiveBackupClient and the callback implementation 
       
   163         // if it is not an active backup.
       
   164         if (iActiveBackupClient != NULL)
       
   165             {
       
   166             delete iActiveBackupClient;
       
   167             iActiveBackupClient = NULL;
       
   168             }
       
   169 
       
   170         // The callback implementation must be deleted after 
       
   171         // the CActiveBackupClient is deleted.
       
   172         if (iCallbackImpl != NULL)
       
   173             {
       
   174             delete iCallbackImpl;
       
   175             iCallbackImpl = NULL;
       
   176             }
       
   177         }
       
   178     }
       
   179 
       
   180 /** When the flag changes, RunL() is called.
       
   181 */
       
   182 void CReferenceActiveDataOwner::RunL()
       
   183     {
       
   184  
       
   185     TInt backupStateValue = 0;   // re-set the flag value
       
   186 
       
   187     // re-subscribe to the flag to monitor future changes
       
   188     SubscribeToPSFlag();
       
   189 
       
   190     iProperty.Get(backupStateValue);
       
   191 
       
   192     // Process the mode change accordingly
       
   193     ProcessBackupStateL(backupStateValue);
       
   194     }
       
   195 
       
   196 ...
       
   197 </codeblock> </stepxmp>
       
   198 </step>
       
   199 <step id="GUID-E17042E5-A5FE-56DF-A36C-594B4B5451B2"><cmd/>
       
   200 <info>Implement <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-DB245BC3-2ADA-311D-8024-B40335D22822"><apiname>conn::MActiveBackupDataClient</apiname></xref> to write
       
   201 a callback handler. </info>
       
   202 <info>The callback handler prepares the data to the Backup Engine for a backup
       
   203 or a restore. For more information about each function, refer to the <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-DB245BC3-2ADA-311D-8024-B40335D22822"><apiname>conn::MActiveBackupDataClient</apiname></xref> API
       
   204 reference. The callback implementation must fulfill the following requirements: </info>
       
   205 <substeps id="GUID-90CAC68A-4EDF-5B09-865B-DDDA5128780A">
       
   206 <substep id="GUID-30B4E7CC-C5E2-5E37-B8B8-C110953D88FF"><cmd/>
       
   207 <info>The Initialise function is usually called before the actual backup or
       
   208 restore function is called. For example, <codeph>InitialiseGetBackupDataL()</codeph> is
       
   209 called before <codeph>GetBackupDataSectionL()</codeph>. The Initialise function
       
   210 gives a chance to a device vendor to prepare the data before the actual data
       
   211 supply. </info>
       
   212 </substep>
       
   213 <substep id="GUID-661B4417-F1E4-5000-AA64-13BAFDB43234"><cmd/>
       
   214 <info>In an incremental backup or restore, a snapshot is the dataset after
       
   215 each incremental backup or restore. If <codeph>MActiveBackupDataClient::AllSnapshotsSuppliedL()</codeph> is
       
   216 called, it means that all snapshots have been supplied to the <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-17E48B80-2421-3256-B8B4-A0FED424D54A"><apiname>conn::CActiveBackupClient</apiname></xref>.
       
   217 If <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-17E48B80-2421-3256-B8B4-A0FED424D54A"><apiname>conn::CActiveBackupClient</apiname></xref> does not receive a snapshot,
       
   218 it performs a base backup. </info>
       
   219 </substep>
       
   220 <substep id="GUID-03A009F5-7E05-5FBE-867A-13F8B93E66E5"><cmd/>
       
   221 <info>For a backup function, a <xref href="GUID-4B942C06-1BAC-3A21-B3B1-89FB5C51ADA0.dita"><apiname>TBool</apiname></xref> reference parameter
       
   222 named <codeph>aFinished</codeph> is passed as an argument. This indicates
       
   223 to the Backup Engine if all of the data for a backup is supplied. Setting
       
   224 this to <xref href="GUID-A759CA2D-8327-348F-9337-4886E619D920.dita"><apiname>EFalse</apiname></xref> causes the Backup Engine to repeatedly call
       
   225 the backup function for more data. </info>
       
   226 </substep>
       
   227 <substep id="GUID-174C6057-A621-542E-A1C2-0F3879B4291D"><cmd/>
       
   228 <info>For a restore function, <codeph>aFinished</codeph> is passed from the
       
   229 Backup Engine to indicate to the data owner if all of the restore data is
       
   230 supplied. The Backup Engine sets <codeph>aFinished</codeph> to <xref href="GUID-781E8158-805B-3784-8FED-D7A191822FC3.dita"><apiname>ETrue</apiname></xref> after
       
   231 the final call of the restore function. </info>
       
   232 </substep>
       
   233 <substep id="GUID-26C220A3-2B91-575F-BA73-C19AD7A836E0"><cmd/>
       
   234 <info>Any leaves in the callback are propagated over Inter-Processor Communications
       
   235 (IPC) to the Backup Engine and potentially to the PC as errors. For this reason,
       
   236 any internal calls must be trapped in the callback. </info>
       
   237 </substep>
       
   238 </substeps>
       
   239 <stepxmp><codeblock id="GUID-E20C5B20-8956-50AB-98A8-3FAF1B98B925" xml:space="preserve">class CReferenceCallbackImplementation :
       
   240     public CBase,
       
   241     public MActiveBackupDataClient
       
   242     {
       
   243     // Methods
       
   244 public:
       
   245     static CReferenceCallbackImplementation* NewL();
       
   246     ~CReferenceCallbackImplementation();
       
   247 
       
   248     // The following functions are from the MActiveBackupDataClient  
       
   249     void AllSnapshotsSuppliedL();
       
   250     void ReceiveSnapshotDataL(TDriveNumber aDrive, TDesC8&amp; aBuffer, 
       
   251                                 TBool aLastSection);
       
   252     TUint GetExpectedDataSize(TDriveNumber aDrive);
       
   253     void GetSnapshotDataL(TDriveNumber aDrive, TPtr8&amp; aBuffer, 
       
   254                             TBool&amp; aFinished);
       
   255     void InitialiseGetBackupDataL(TDriveNumber aDrive);
       
   256     void GetBackupDataSectionL(TPtr8&amp; aBuffer, TBool&amp; aFinished);
       
   257     void InitialiseRestoreBaseDataL(TDriveNumber aDrive);
       
   258     void RestoreBaseDataSectionL(TDesC8&amp; aBuffer, TBool aFinished);
       
   259     void InitialiseRestoreIncrementDataL(TDriveNumber aDrive);
       
   260     void RestoreIncrementDataSectionL(TDesC8&amp; aBuffer, TBool aFinished);
       
   261     void RestoreComplete(TDriveNumber aDrive);
       
   262     void TerminateMultiStageOperation();
       
   263     TUint GetDataChecksum(TDriveNumber aDrive);
       
   264 
       
   265     //The following two functions are for the proxy backup client only and 
       
   266     // Symbian provides a default implementation for each function.
       
   267     void InitialiseGetProxyBackupDataL(TSecureId aSID, TDriveNumber aDrive);
       
   268     void InitialiseRestoreProxyBaseDataL(TSecureId aSID, TDriveNumber aDrive);
       
   269     
       
   270 private:
       
   271     CReferenceCallbackImplementation() {}        
       
   272     CMyABData* iSnapshot;
       
   273     CMyABData* iData;
       
   274     TBool iProxy;
       
   275     TInt iOffset;
       
   276     TInt iSourceSize;
       
   277     TUint iFillChar;
       
   278     TSecureId iID;
       
   279     };
       
   280 
       
   281 void CReferenceCallbackImplementation::AllSnapshotsSuppliedL()
       
   282     {
       
   283     __LOG1("[0x%08x]: CReferenceCallbackImplementation::AllSnapshotsSuppliedL()", 
       
   284          iID.iId);
       
   285     }
       
   286     
       
   287 void CReferenceCallbackImplementation::ReceiveSnapshotDataL(
       
   288                                            TDriveNumber aDrive, 
       
   289                                            TDesC8&amp; aBuffer,
       
   290                                            TBool /*aLastSection*/)
       
   291     {
       
   292     __LOG1("[0x%08x]: CReferenceCallbackImplementation::ReceiveSnapshotDataL()", iID.iId);
       
   293     // Create or append a buffer containing the snapshot
       
   294     if (!iSnapshot)
       
   295         {
       
   296         iSnapshot = CMyABData::NewL(aDrive);
       
   297         }
       
   298 
       
   299     iSnapshot-&gt;AddDataL(aBuffer);
       
   300     }
       
   301     
       
   302 TUint CReferenceCallbackImplementation::GetExpectedDataSize(TDriveNumber /*aDrive*/)
       
   303     {
       
   304     __LOG1("[0x%08x]: CReferenceCallbackImplementation::GetExpectedDataSize()", iID.iId);
       
   305         
       
   306     return iSourceSize;
       
   307     }
       
   308     
       
   309 void CReferenceCallbackImplementation::GetSnapshotDataL(
       
   310                                            TDriveNumber /*aDrive*/,
       
   311                                            TPtr8&amp; aBuffer,
       
   312                                            TBool&amp; aFinished)
       
   313     {
       
   314     __LOG1("[0x%08x]: CReferenceCallbackImplementation::GetSnapshotDataL()", iID.iId);
       
   315     aBuffer.Append(KABTestSnapshot());
       
   316     
       
   317     aFinished = ETrue;
       
   318     }
       
   319     
       
   320 void CReferenceCallbackImplementation::InitialiseGetBackupDataL(TDriveNumber /*aDrive*/)
       
   321     {
       
   322     __LOG1("[0x%08x]: CReferenceCallbackImplementation::InitialiseGetBackupData()", iID.iId);
       
   323     iOffset = 0;
       
   324 
       
   325     if (!iSnapshot)
       
   326         {
       
   327         iFillChar = 66;
       
   328         }
       
   329     else
       
   330         {
       
   331         iFillChar = 73;
       
   332         }
       
   333     }
       
   334     
       
   335 void CReferenceCallbackImplementation::GetBackupDataSectionL(
       
   336                                             TPtr8&amp; aBuffer,
       
   337                                             TBool&amp; aFinished)
       
   338     {
       
   339     __LOG1("[0x%08x]: CReferenceCallbackImplementation::GetBackupDataSectionL()", iID.iId);
       
   340     
       
   341     FillBuffer(aBuffer, aFinished);
       
   342     }
       
   343     
       
   344 void CReferenceCallbackImplementation::InitialiseRestoreBaseDataL(TDriveNumber aDrive)
       
   345     {
       
   346     __LOG("CReferenceCallbackImplementation::InitialiseRestoreBaseDataL()");
       
   347 
       
   348     iData = CMyABData::NewL(aDrive);
       
   349     }
       
   350     
       
   351 void CReferenceCallbackImplementation::RestoreBaseDataSectionL(
       
   352                                            TDesC8&amp; aBuffer,
       
   353                                            TBool aFinished)
       
   354     {
       
   355     __LOG1("[0x%08x]: CReferenceCallbackImplementation::RestoreBaseDataSectionL()", iID.iId);
       
   356 
       
   357     // append a buffer containing the base data
       
   358     iData-&gt;AddDataL(aBuffer);
       
   359     
       
   360     if (aFinished)
       
   361         {
       
   362         ValidateRestoredData();
       
   363     
       
   364         delete iData;
       
   365         iData = NULL;
       
   366         }
       
   367     }
       
   368     
       
   369 void CReferenceCallbackImplementation::InitialiseRestoreIncrementDataL(TDriveNumber aDrive)
       
   370     {
       
   371     __LOG1("[0x%08x]: CReferenceCallbackImplementation::InitialiseRestoreIncrementDataL()", iID.iId);
       
   372     if (!iSnapshot)
       
   373         {
       
   374         User::Leave(KErrCorrupt);
       
   375         }
       
   376 
       
   377     if (!iData)
       
   378         {
       
   379         iData = CMyABData::NewL(aDrive);
       
   380         }
       
   381     }
       
   382     
       
   383 void CReferenceCallbackImplementation::RestoreIncrementDataSectionL(
       
   384                                            TDesC8&amp; aBuffer,
       
   385                                            TBool aFinished)
       
   386     {
       
   387     __LOG1("[0x%08x]: CReferenceCallbackImplementation::RestoreIncrementDataSectionL()", iID.iId);
       
   388 
       
   389     iData-&gt;AddDataL(aBuffer);
       
   390     
       
   391     if (aFinished)
       
   392         {
       
   393         ValidateRestoredData();
       
   394     
       
   395         delete iData;
       
   396         iData = NULL;
       
   397         }
       
   398     }
       
   399     
       
   400 void CReferenceCallbackImplementation::RestoreComplete(TDriveNumber /*aDrive*/)
       
   401     {
       
   402     __LOG1("[0x%08x]: CReferenceCallbackImplementation::RestoreComplete()", iID.iId);
       
   403     }
       
   404     
       
   405 void CReferenceCallbackImplementation::TerminateMultiStageOperation()
       
   406     {
       
   407     __LOG1("[0x%08x]: CReferenceCallbackImplementation::TerminateMultiStageOperation()", iID.iId);
       
   408     // We also don't do anything here until we start testing multipart?
       
   409     }
       
   410     
       
   411 TUint CReferenceCallbackImplementation::GetDataChecksum(TDriveNumber /*aDrive*/)
       
   412     {
       
   413     __LOG1("[0x%08x]: CReferenceCallbackImplementation::GetDataChecksum()", iID.iId);
       
   414     return 0;
       
   415     }
       
   416 
       
   417 void CReferenceCallbackImplementation::InitialiseGetProxyBackupDataL(
       
   418                                            TSecureId aSID, 
       
   419                                            TDriveNumber /*aDrive*/)
       
   420     {
       
   421     __LOG1("[0x%08x]: CReferenceCallbackImplementation::InitialiseGetProxyBackupDataL()", iID.iId);
       
   422     __LOG2("[0x%08x]: Proxy data about to be requested for SID 0x%08x", iID.iId, aSID.iId);
       
   423     iProxy = ETrue;
       
   424     iOffset = 0;
       
   425     
       
   426     iFillChar = 80;        // 'P'
       
   427     }
       
   428 
       
   429 void CReferenceCallbackImplementation::InitialiseRestoreProxyBaseDataL(
       
   430                                             TSecureId aSID, 
       
   431                                             TDriveNumber aDrive)
       
   432     {
       
   433     __LOG1("[0x%08x]: CReferenceCallbackImplementation::InitialiseRestoreProxyBaseDataL()", iID.iId);
       
   434     __LOG2("[0x%08x]: Proxy data about to be restored for SID 0x%08x", iID.iId, aSID.iId);
       
   435     iProxy = ETrue;
       
   436     iData = CMyABData::NewL(aDrive);
       
   437     }
       
   438 ...</codeblock> </stepxmp>
       
   439 </step>
       
   440 <step id="GUID-FBC19F0B-1763-595C-BF4E-F6289AD6EFCA"><cmd/>
       
   441 <info>Create a backup registration file to set attribute values for the data
       
   442 owner application. </info>
       
   443 <info>The Backup Engine parses backup registration files to get the data own
       
   444 list. The list includes details of data owners and data for backup and restore. </info>
       
   445 <info>Create the file using a text editor and save it as <filepath>backup_registration.xml</filepath> under
       
   446 the private folder of the data owner application on the Symbian device. Refer
       
   447 to <xref href="GUID-9A6273D8-7797-5190-AFEC-1AD113980B84.dita">Backup Registration
       
   448 Files</xref> for more information. </info>
       
   449 <substeps id="GUID-08064C91-CC63-502F-807C-D1932C0D05DB">
       
   450 <substep id="GUID-D2C54ED8-54C5-564A-B5DF-66CC60F85630"><cmd/>
       
   451 <info> <codeph> process_name</codeph> is the name of the data owner application. </info>
       
   452 </substep>
       
   453 <substep id="GUID-20E42C15-0B8C-5302-8927-1ADB9231AC33"><cmd/>
       
   454 <info> <codeph>active_type is set</codeph> to <codeph>activeonly</codeph> for
       
   455 an active backup. </info>
       
   456 </substep>
       
   457 <substep id="GUID-595FE2CF-06C4-599F-9E70-B9B9CD6A71B5"><cmd/>
       
   458 <info> <codeph>supports_incremental</codeph> can be set to <codeph>false</codeph> to
       
   459 disable the incremental backup support from the active backup client. </info>
       
   460 </substep>
       
   461 </substeps>
       
   462 <stepxmp><codeblock id="GUID-0A5E0FBC-16FD-568A-8530-368101B28EBF" xml:space="preserve">&lt;!-- backup_registration.xml file for referencetestdataowner.exe --&gt;
       
   463 
       
   464 &lt;?xml version="1.0" standalone="yes"?&gt;
       
   465 
       
   466 &lt;backup_registration version="1.0"&gt;
       
   467     &lt;active_backup process_name = "referencetestdataowner.exe"
       
   468              active_type = "activeonly"
       
   469                    requires_delay_to_prepare_data = "yes" &lt;!--deprecated--&gt;
       
   470                    supports_incremental = "yes"&gt; 
       
   471     &lt;/active_backup&gt;
       
   472 
       
   473     &lt;restore requires_reboot = "no"/&gt;  &lt;!--Currently only support no--&gt;
       
   474 &lt;/backup_registration&gt;
       
   475 </codeblock><p>Finally, test the data owner application. The logging information
       
   476 appends to the <filepath>securebackup.txt</filepath> log file. To enable the
       
   477 log generation, the <filepath>C:\logs\connect</filepath> directory must be
       
   478 created on the device. </p> </stepxmp>
       
   479 </step>
       
   480 </steps>
       
   481 </taskbody></task>