homescreenapp/runtimeplugins/hsdefaultruntimeplugin/inc/hsbackuprestoreactivecallback.h
branchGCC_SURGE
changeset 68 4c11ecddf6b2
parent 53 f75922b9e380
parent 61 2b1b11a301d2
equal deleted inserted replaced
53:f75922b9e380 68:4c11ecddf6b2
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Home screen active callback in HsBackupRestoreObserver.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef HSBACKUPRESTOREACTIVECALLBACK_H
       
    20 #define HSBACKUPRESTOREACTIVECALLBACK_H
       
    21 
       
    22 #include <e32base.h>    // CBase
       
    23 #include <connect/abclient.h>
       
    24 
       
    25 
       
    26 /**
       
    27  *  Home screen active callback in backup/restore.
       
    28  *
       
    29  *  @lib widgetbackuprestore.exe
       
    30  *  @since S60 ^4
       
    31  */
       
    32 NONSHARABLE_CLASS(CHsBRActiveCallback) : public CBase, 
       
    33 	                                     public conn::MActiveBackupDataClient
       
    34     {
       
    35 public:
       
    36 
       
    37     IMPORT_C static  CHsBRActiveCallback* NewL();
       
    38 
       
    39     virtual ~CHsBRActiveCallback();
       
    40     
       
    41     void FinishBackupRestore();
       
    42     
       
    43     void StartRestore();
       
    44 
       
    45 // new functions
       
    46 
       
    47 // from base class MActiveBackupDataClient
       
    48 
       
    49     /**
       
    50      * This method informs the active backup data client that all 
       
    51      * snapshots have been supplied. If the client has not
       
    52      * received a snapshot then it should perform a base backup
       
    53      */
       
    54     virtual void AllSnapshotsSuppliedL();
       
    55 
       
    56     /**
       
    57      * This method receives all or part of a snapshot of data to allow 
       
    58      * calculation of an incremental backup.  The snapshot is one that
       
    59      * was previously supplied by the data owner.  The snapshot data 
       
    60      * should be read from the location supplied. The snapshot data may
       
    61      * be larger than the location supplied in which case the routine 
       
    62      * will be called repeatedly until all data has been supplied.
       
    63      *
       
    64      * Snapshot data will also be supplied as part of a restore operation
       
    65      *        
       
    66      * @param aDrive the drive being backed up
       
    67      * @param aBuffer a pointer to the base of the location from whence 
       
    68      *        data can be copied.
       
    69      * @param aLastSection ETrue if this is the last section of snapshot 
       
    70      *        data, else EFalse.
       
    71      */
       
    72     virtual void ReceiveSnapshotDataL(
       
    73         TDriveNumber aDrive, TDesC8& aBuffer, TBool aLastSection);
       
    74 
       
    75     /**
       
    76      * This method returns the expected size of backup data that will be
       
    77      * supplied. If an incremental backup is underway then this method
       
    78      * then this method will not be called until after 
       
    79      * ReceiveSnapshotDataL(). The size data will be used for the purpose
       
    80      * of tracking progess during a backup. If it is inaccurate then the
       
    81      * user may see irregular progress but the actual backup data will 
       
    82      * not be affected so it is acceptable to return an estimated value.
       
    83      *
       
    84      * @param aDrive the drive being backed up.
       
    85      * @return the size of the data that will be returned
       
    86      */
       
    87     virtual TUint GetExpectedDataSize(TDriveNumber aDrive);
       
    88 
       
    89     /**
       
    90      * This method returns a snapshot of data to accompany a backup. The 
       
    91      * snapshot is expected to contain details on files / data being 
       
    92      * backed up. The format of the snapshot is only meaningful to the
       
    93      * data owner. The snapshot will be supplied if the data owner is 
       
    94      * asked for an incremental backup and for a restore operation. The 
       
    95      * snapshot data should be copied to the location supplied.
       
    96      *
       
    97      * The snapshot data may be larger than the location supplied in 
       
    98      * which case the routine will be called repeatedly until all data
       
    99      * has been retrieved.
       
   100      *
       
   101      * @param aDrive the drive being backed up
       
   102      * @param aBuffer a pointer to the base of the location where data 
       
   103      *        can be copied.
       
   104      * @param aFinished on return ETrue if all data has been returned 
       
   105      *        for this drive, else EFalse.
       
   106      */
       
   107     virtual void GetSnapshotDataL( 
       
   108         TDriveNumber aDrive, TPtr8& aBuffer, TBool& aFinished);
       
   109 
       
   110     /**
       
   111      * This method prepares the implementor to return backup data. It 
       
   112      * will be followed by a sequence of calls to request the actual 
       
   113      * data.
       
   114      *        
       
   115      * @param aDrive the drive being backed up.
       
   116      */
       
   117     virtual void InitialiseGetBackupDataL(TDriveNumber aDrive);
       
   118 
       
   119     /**
       
   120      * This method requests a section of backup data.  
       
   121      * InitialiseGetBackupDataL() will have been called previously to
       
   122      * specify the drive concerned.  The data returned may be base or
       
   123      * incremental depending on the type of backup and the capability of
       
   124      * the data owner.
       
   125      *
       
   126      * @param aBuffer a pointer to the base of the location where data 
       
   127      *        can be copied.
       
   128      * @param aFinished on return ETrue if all data has been returned 
       
   129      *        for this drive, else EFalse.
       
   130      */
       
   131     virtual void GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished);
       
   132 
       
   133     /**
       
   134      * This method prepares the implementor to receive base restore data
       
   135      * for a drive. It will be followed by a sequence of calls to supply
       
   136      * the actual data.
       
   137      *
       
   138      * @param aDrive the drive being restored.
       
   139      */
       
   140     virtual void InitialiseRestoreBaseDataL(TDriveNumber aDrive);
       
   141 
       
   142     /**
       
   143      * This method receives a section of base restore data.
       
   144      * InitialiseRestoreBaseDataL() will have been called previously to 
       
   145      * specify the drive concerned.
       
   146      *
       
   147      * @param aBuffer a pointer to the base of the location whence data
       
   148      *        can be read.
       
   149      * @param aFinished ETrue if all data has been returned for this 
       
   150      *        drive, else EFalse.
       
   151      */
       
   152     virtual void RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished);
       
   153 
       
   154     /**
       
   155      * This method prepares the implementor to receive incremental 
       
   156      * restore data for a drive. It will be followed by a sequence 
       
   157      * of calls to supply the actual data.  If multiple increments
       
   158      * are supplied then this methid will be called before each increment
       
   159      *
       
   160      * @param aDrive the drive being restored.
       
   161      */
       
   162     virtual void InitialiseRestoreIncrementDataL(TDriveNumber aDrive);
       
   163 
       
   164     /**
       
   165      * This method receives a section of increment restore data.
       
   166      * InitialiseRestoreIncrementDataL() will have been called 
       
   167      * previously to specify the drive concerned.
       
   168      *
       
   169      * @param aBuffer a pointer to the base of the location whence data 
       
   170      *        can be read.
       
   171      * @param aFinished ETrue if all data has been returned for this 
       
   172      *        increment, else EFalse.
       
   173      */
       
   174     virtual void RestoreIncrementDataSectionL(TDesC8& aBuffer, TBool aFinished);
       
   175 
       
   176     /**
       
   177      * This method is called when all data to be restored has been 
       
   178      * supplied.
       
   179      *
       
   180      * @param aDrive the drive being restored.
       
   181      */
       
   182     virtual void RestoreComplete(TDriveNumber aDrive);   
       
   183 
       
   184     /**
       
   185      * This method is called if copying of data is terminated prematurely 
       
   186      * to allow the implementor to tidy up.  The same method applies to 
       
   187      * all types of data and to backup and restore.
       
   188      */
       
   189     virtual void TerminateMultiStageOperation();
       
   190 
       
   191     /**
       
   192      * Gets a 32-bit checksum for its private data.
       
   193      * This routine is for test purposes.  It must be implemented but an
       
   194      * invariant checksum value can be provided.  Some tests may cause 
       
   195      * checksum values to be compared.
       
   196      *
       
   197      * @param aDrive the drive containing data being checksummed
       
   198      * @return the 32-bit checksum
       
   199      */
       
   200     virtual TUint GetDataChecksum(TDriveNumber aDrive);
       
   201 
       
   202 private:
       
   203 
       
   204     CHsBRActiveCallback();
       
   205 
       
   206     void ConstructL();
       
   207     
       
   208     void CloseDataBaseConnection();
       
   209     
       
   210     void OpenDataBaseConnection();
       
   211 
       
   212 private: // data
       
   213 
       
   214     };
       
   215 
       
   216 #endif // HSBACKUPRESTOREACTIVECALLBACK_H
       
   217