homescreenapp/hsdomainmodel/src/hsbackuprestoreactivecallback.cpp
changeset 62 341166945d65
parent 51 4785f57bf3d4
child 90 3ac3aaebaee5
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
    14 * Description:  Active callback for Backup/Restore observer.
    14 * Description:  Active callback for Backup/Restore observer.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // INCLUDE FILES
       
    20 #include <bautils.h>
    19 #include <bautils.h>
    21 
    20 
    22 #include "hsbackuprestoreactivecallback.h"
    21 #include "hsbackuprestoreactivecallback.h"
    23 #include "hsbackuprestoreobserver.h"
    22 #include "hsbackuprestoreobserver.h"
    24 
    23 
    25 //  CONSTANTS
    24 /*!
    26 
    25     \class CHsBURActiveCallback
    27 // ======== MEMBER FUNCTIONS ========
    26     \ingroup group_hsdomainmodel
    28 
    27     \brief B&R active callback.
    29 // ---------------------------------------------------------------------------
    28     Home screen active callback in backup/restore.
    30 // 
    29 */
    31 // ---------------------------------------------------------------------------
    30 
    32 //
    31 /*!
       
    32     Constructor.
       
    33     \a observer Backup restore observer
       
    34 */
    33 CHsBURActiveCallback* CHsBURActiveCallback::NewL(HsBackupRestoreObserver* observer)
    35 CHsBURActiveCallback* CHsBURActiveCallback::NewL(HsBackupRestoreObserver* observer)
    34 {
    36 {
    35     CHsBURActiveCallback* self =
    37     CHsBURActiveCallback* self =
    36         new( ELeave ) CHsBURActiveCallback(observer);
    38         new( ELeave ) CHsBURActiveCallback(observer);
    37     CleanupStack::PushL( self );
    39     CleanupStack::PushL( self );
    39     CleanupStack::Pop( self );
    41     CleanupStack::Pop( self );
    40 
    42 
    41     return self;
    43     return self;
    42 }
    44 }
    43 
    45 
    44 // ---------------------------------------------------------------------------
    46 /*!
    45 // Destructor
    47     Destructor.
    46 // ---------------------------------------------------------------------------
    48 */
    47 //
       
    48 CHsBURActiveCallback::~CHsBURActiveCallback()
    49 CHsBURActiveCallback::~CHsBURActiveCallback()
    49 {
    50 {
    50 }
    51 }
    51 
    52 
    52 // ---------------------------------------------------------------------------
    53 /*!
    53 // Inform that all data has been backed up or restored.
    54     This method informs the active backup data client that all 
    54 // ---------------------------------------------------------------------------
    55     snapshots have been supplied. If the client has not
    55 //
    56     received a snapshot then it should perform a base backup.
       
    57     Inform that all data has been backed up or restored.
       
    58 */
    56 void CHsBURActiveCallback::AllSnapshotsSuppliedL()
    59 void CHsBURActiveCallback::AllSnapshotsSuppliedL()
    57 {
    60 {
    58     // No implementation needed. Must not leave    
    61     // No implementation needed. Must not leave    
    59 }
    62 }
    60 
    63 
    61 // ---------------------------------------------------------------------------
    64 /*!
    62 // Not supported.
    65     This method receives all or part of a snapshot of data to allow 
    63 // ---------------------------------------------------------------------------
    66     calculation of an incremental backup.  The snapshot is one that
    64 //
    67     was previously supplied by the data owner.  The snapshot data 
       
    68     should be read from the location supplied. The snapshot data may
       
    69     be larger than the location supplied in which case the routine 
       
    70     will be called repeatedly until all data has been supplied.
       
    71 
       
    72     Snapshot data will also be supplied as part of a restore operation
       
    73           
       
    74     @param aDrive the drive being backed up
       
    75     @param aBuffer a pointer to the base of the location from whence 
       
    76            data can be copied.
       
    77     @param aLastSection ETrue if this is the last section of snapshot 
       
    78            data, else EFalse.
       
    79     
       
    80     Not supported.
       
    81 */
    65 void CHsBURActiveCallback::ReceiveSnapshotDataL(
    82 void CHsBURActiveCallback::ReceiveSnapshotDataL(
    66     TDriveNumber /*aDrive*/, TDesC8& /*aBuffer*/, TBool /*aLastSection*/)
    83     TDriveNumber /*aDrive*/, TDesC8& /*aBuffer*/, TBool /*aLastSection*/)
    67 {
    84 {
    68 	// No implementation needed
    85 	// No implementation needed
    69     User::Leave( KErrNotSupported );
    86     User::Leave( KErrNotSupported );
    70 }
    87 }
    71 
    88 
    72 // ---------------------------------------------------------------------------
    89 /*!
    73 // Make a guess about data size.
    90     This method returns the expected size of backup data that will be
    74 // ---------------------------------------------------------------------------
    91     supplied. If an incremental backup is underway then this method
    75 //
    92     then this method will not be called until after 
       
    93     ReceiveSnapshotDataL(). The size data will be used for the purpose
       
    94     of tracking progess during a backup. If it is inaccurate then the
       
    95     user may see irregular progress but the actual backup data will 
       
    96     not be affected so it is acceptable to return an estimated value.
       
    97     
       
    98     @param aDrive the drive being backed up.
       
    99     @return the size of the data that will be returned
       
   100 	
       
   101 	Make a guess about data size.
       
   102 */
    76 TUint CHsBURActiveCallback::GetExpectedDataSize(
   103 TUint CHsBURActiveCallback::GetExpectedDataSize(
    77     TDriveNumber /*aDrive*/)
   104     TDriveNumber /*aDrive*/)
    78 {
   105 {
    79     // No implementation needed
   106     // No implementation needed
    80     return 0;
   107     return 0;
    81 }
   108 }
    82 
   109 
    83 // ---------------------------------------------------------------------------
   110 /*!
    84 // Not supported.
   111     This method returns a snapshot of data to accompany a backup. The 
    85 // ---------------------------------------------------------------------------
   112     snapshot is expected to contain details on files / data being 
    86 //
   113     backed up. The format of the snapshot is only meaningful to the
       
   114     data owner. The snapshot will be supplied if the data owner is 
       
   115     asked for an incremental backup and for a restore operation. The 
       
   116     snapshot data should be copied to the location supplied.
       
   117     
       
   118     The snapshot data may be larger than the location supplied in 
       
   119     which case the routine will be called repeatedly until all data
       
   120     has been retrieved.
       
   121     
       
   122     @param aDrive the drive being backed up
       
   123     @param aBuffer a pointer to the base of the location where data 
       
   124            can be copied.
       
   125     @param aFinished on return ETrue if all data has been returned 
       
   126            for this drive, else EFalse.
       
   127            
       
   128     Not supported.
       
   129 */
    87 void CHsBURActiveCallback::GetSnapshotDataL(
   130 void CHsBURActiveCallback::GetSnapshotDataL(
    88     TDriveNumber /*aDrive*/, TPtr8& /*aBuffer*/, TBool& /*aFinished*/)
   131     TDriveNumber /*aDrive*/, TPtr8& /*aBuffer*/, TBool& /*aFinished*/)
    89 {
   132 {
    90     // No implementation needed
   133     // No implementation needed
    91     User::Leave( KErrNotSupported );
   134     User::Leave( KErrNotSupported );
    92 }
   135 }
    93 
   136 
    94 // ---------------------------------------------------------------------------
   137 /*!
    95 // Initialize for backup.
   138     This method prepares the implementor to return backup data. It 
    96 // ---------------------------------------------------------------------------
   139     will be followed by a sequence of calls to request the actual 
    97 //
   140     data.
       
   141           
       
   142     @param aDrive the drive being backed up.
       
   143 	
       
   144     Initialize for backup.
       
   145 */
    98 void CHsBURActiveCallback::InitialiseGetBackupDataL(
   146 void CHsBURActiveCallback::InitialiseGetBackupDataL(
    99     TDriveNumber /*aDrive*/)
   147     TDriveNumber /*aDrive*/)
   100 {
   148 {
   101     iObserver->backupRestoreStarted();    
   149     iObserver->backupRestoreStarted();    
   102 }
   150 }
   103 
   151 
   104 // ---------------------------------------------------------------------------
   152 /*!
   105 // ---------------------------------------------------------------------------
   153     This method requests a section of backup data.  
   106 //
   154     InitialiseGetBackupDataL() will have been called previously to
       
   155     specify the drive concerned.  The data returned may be base or
       
   156     incremental depending on the type of backup and the capability of
       
   157     the data owner.
       
   158     
       
   159     @param aBuffer a pointer to the base of the location where data 
       
   160            can be copied.
       
   161     @param aFinished on return ETrue if all data has been returned 
       
   162           for this drive, else EFalse.
       
   163 */
   107 void CHsBURActiveCallback::GetBackupDataSectionL(
   164 void CHsBURActiveCallback::GetBackupDataSectionL(
   108     TPtr8& /*aBuffer*/, TBool& aFinished)
   165     TPtr8& /*aBuffer*/, TBool& aFinished)
   109 {
   166 {
   110     // No data for active backup
   167     // No data for active backup
   111     aFinished = ETrue;
   168     aFinished = ETrue;
   112 }
   169 }
   113 
   170 
   114 // ---------------------------------------------------------------------------
   171 /*!
   115 // Initialize restore.
   172     This method prepares the implementor to receive base restore data
   116 // ---------------------------------------------------------------------------
   173     for a drive. It will be followed by a sequence of calls to supply
   117 //
   174     the actual data.
       
   175     
       
   176     @param aDrive the drive being restored.
       
   177 	
       
   178 	Initialize restore.
       
   179 */
   118 void CHsBURActiveCallback::InitialiseRestoreBaseDataL(
   180 void CHsBURActiveCallback::InitialiseRestoreBaseDataL(
   119     TDriveNumber /*aDrive*/ )
   181     TDriveNumber /*aDrive*/ )
   120 {
   182 {
   121     // No implementation needed
   183     // No implementation needed
   122     User::Leave( KErrNotSupported );    
   184     User::Leave( KErrNotSupported );    
   123 }
   185 }
   124 
   186 
   125 // ---------------------------------------------------------------------------
   187 /*!
   126 // Run state machine for restore. Receive stream from BUR engine and turn it
   188     This method receives a section of base restore data.
   127 // to file(s).
   189     InitialiseRestoreBaseDataL() will have been called previously to 
   128 // ---------------------------------------------------------------------------
   190     specify the drive concerned.
   129 //
   191     
       
   192     @param aBuffer a pointer to the base of the location whence data
       
   193            can be read.
       
   194     @param aFinished ETrue if all data has been returned for this 
       
   195            drive, else EFalse.
       
   196  
       
   197     Run state machine for restore. Receive stream from BUR engine and turn it
       
   198     to file(s).
       
   199 */
   130 void CHsBURActiveCallback::RestoreBaseDataSectionL(
   200 void CHsBURActiveCallback::RestoreBaseDataSectionL(
   131     TDesC8& /*aBuffer*/, TBool /*aFinished*/ )
   201     TDesC8& /*aBuffer*/, TBool /*aFinished*/ )
   132 {
   202 {
   133     // No implementation needed
   203     // No implementation needed
   134     User::Leave( KErrNotSupported );  
   204     User::Leave( KErrNotSupported );  
   135 }
   205 }
   136 
   206 
   137 // ---------------------------------------------------------------------------
   207 /*!
   138 // Incremental restoration is not supported.
   208     This method prepares the implementor to receive incremental 
   139 // ---------------------------------------------------------------------------
   209     restore data for a drive. It will be followed by a sequence 
   140 //
   210     of calls to supply the actual data.  If multiple increments
       
   211     are supplied then this methid will be called before each increment
       
   212     
       
   213     @param aDrive the drive being restored.
       
   214     
       
   215     Not supported.
       
   216 */
   141 void CHsBURActiveCallback::InitialiseRestoreIncrementDataL(
   217 void CHsBURActiveCallback::InitialiseRestoreIncrementDataL(
   142     TDriveNumber /*aDrive*/)
   218     TDriveNumber /*aDrive*/)
   143 {
   219 {
   144     // No implementation needed
   220     // No implementation needed
   145     User::Leave( KErrNotSupported );
   221     User::Leave( KErrNotSupported );
   146 }
   222 }
   147 
   223 
   148 // ---------------------------------------------------------------------------
   224 /*!
   149 // Incremental restoration is not supported.
   225     This method receives a section of increment restore data.
   150 // ---------------------------------------------------------------------------
   226     InitialiseRestoreIncrementDataL() will have been called 
   151 //
   227     previously to specify the drive concerned.
       
   228     
       
   229     @param aBuffer a pointer to the base of the location whence data 
       
   230            can be read.
       
   231     @param aFinished ETrue if all data has been returned for this 
       
   232            increment, else EFalse.
       
   233  
       
   234     Not supported.
       
   235 */
   152 void CHsBURActiveCallback::RestoreIncrementDataSectionL(
   236 void CHsBURActiveCallback::RestoreIncrementDataSectionL(
   153     TDesC8& /*aBuffer*/, TBool /*aFinished*/)
   237     TDesC8& /*aBuffer*/, TBool /*aFinished*/)
   154 {
   238 {
   155     // No implementation needed
   239     // No implementation needed
   156     User::Leave( KErrNotSupported );
   240     User::Leave( KErrNotSupported );
   157 }
   241 }
   158 
   242 
   159 // ---------------------------------------------------------------------------
   243 /*!
   160 // Called when restore is complete - sets data back to initial state.
   244     This method is called when all data to be restored has been 
   161 // ---------------------------------------------------------------------------
   245     supplied.
   162 //
   246     
       
   247     @param aDrive the drive being restored.
       
   248     
       
   249     Called when restore is complete - sets data back to initial state.
       
   250 */
   163 void CHsBURActiveCallback::RestoreComplete(TDriveNumber /*aDrive*/)
   251 void CHsBURActiveCallback::RestoreComplete(TDriveNumber /*aDrive*/)
   164 {
   252 {
   165     // No implementation needed
   253     // No implementation needed
   166 }
   254 }
   167 
   255 
   168 // ---------------------------------------------------------------------------
   256 /*!
   169 // Tidy up when operation is over.
   257     This method is called if copying of data is terminated prematurely 
   170 // ---------------------------------------------------------------------------
   258     to allow the implementor to tidy up.  The same method applies to 
   171 //
   259     all types of data and to backup and restore.
       
   260     Tidy up when operation is over.
       
   261 */
   172 void CHsBURActiveCallback::TerminateMultiStageOperation()
   262 void CHsBURActiveCallback::TerminateMultiStageOperation()
   173 {
   263 {
   174     // No implementation needed
   264     // No implementation needed
   175 }
   265 }
   176 
   266 
   177 // ---------------------------------------------------------------------------
   267 /*!
   178 //
   268     Gets a 32-bit checksum for its private data.
   179 // ---------------------------------------------------------------------------
   269     This routine is for test purposes.  It must be implemented but an
   180 //
   270     invariant checksum value can be provided.  Some tests may cause 
       
   271     checksum values to be compared.
       
   272     
       
   273     @param aDrive the drive containing data being checksummed
       
   274     @return the 32-bit checksum
       
   275 */
   181 TUint CHsBURActiveCallback::GetDataChecksum(TDriveNumber /*aDrive*/)
   276 TUint CHsBURActiveCallback::GetDataChecksum(TDriveNumber /*aDrive*/)
   182 {
   277 {
   183     // No implementation needed
   278     // No implementation needed
   184     return 0;
   279     return 0;
   185 }
   280 }
   186 
   281 
   187 // ---------------------------------------------------------------------------
   282 /*!
   188 // C++ constructor.
   283     C++ constructor.
   189 // ---------------------------------------------------------------------------
   284 */
   190 //
       
   191 CHsBURActiveCallback::CHsBURActiveCallback(HsBackupRestoreObserver* observer)
   285 CHsBURActiveCallback::CHsBURActiveCallback(HsBackupRestoreObserver* observer)
   192 {
   286 {
   193 	iObserver = observer;
   287 	iObserver = observer;
   194 }
   288 }
   195 
   289 
   196 // ---------------------------------------------------------------------------
   290 /*!
   197 // 2nd phase constructor.
   291     2nd phase constructor.
   198 // ---------------------------------------------------------------------------
   292 */
   199 //
       
   200 void CHsBURActiveCallback::ConstructL()
   293 void CHsBURActiveCallback::ConstructL()
   201 {
   294 {
   202 }
   295 }
   203  
   296  
   204 // End of file
   297 // End of file