filemanager/bkupengine/src/CMMCScBkupStateArchiveOpArchiveHeader.cpp
branchRCL_3
changeset 38 491b3ed49290
parent 36 95243422089a
child 39 65326cf895ed
equal deleted inserted replaced
36:95243422089a 38:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2005 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 "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: CMMCScBkupStateArchiveOpArchiveHeader implementation
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #include "CMMCScBkupStateArchiveOpArchiveHeader.h"
       
    20 
       
    21 // System includes
       
    22 #include <e32std.h>
       
    23 #include <s32strm.h>
       
    24 #include <s32mem.h>
       
    25 
       
    26 // User includes
       
    27 #include "MMCScBkupLogger.h"
       
    28 #include "CMMCScBkupArchive.h"
       
    29 #include "CMMCScBkupArchiveHeader.h"
       
    30 
       
    31 
       
    32 
       
    33 // ========================= MEMBER FUNCTIONS ================================
       
    34 
       
    35 // ---------------------------------------------------------------------------
       
    36 // CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader()
       
    37 // 
       
    38 // C++ constructor.
       
    39 // ---------------------------------------------------------------------------
       
    40 CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader( MMMCScBkupDriver& aDriver )
       
    41 :   CMMCScBkupState( aDriver )
       
    42     {
       
    43     __LOG1("CMMCScBkupStateArchiveOpArchiveHeader::CMMCScBkupStateArchiveOpArchiveHeader() - 0x%08x", StateId().iUid );
       
    44     }
       
    45 
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CMMCScBkupStateArchiveOpArchiveHeader::NewL()
       
    49 // 
       
    50 // 
       
    51 // ---------------------------------------------------------------------------
       
    52 CMMCScBkupStateArchiveOpArchiveHeader* CMMCScBkupStateArchiveOpArchiveHeader::NewL( MMMCScBkupDriver& aDriver )
       
    53     {
       
    54     CMMCScBkupStateArchiveOpArchiveHeader* self = new(ELeave) CMMCScBkupStateArchiveOpArchiveHeader( aDriver );
       
    55     return self;
       
    56     }
       
    57 
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // CMMCScBkupStateArchiveOpArchiveHeader::StateId()
       
    61 // 
       
    62 // 
       
    63 // ---------------------------------------------------------------------------
       
    64 TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::StateId() const
       
    65     {
       
    66     return KMMCScBkupStateArchiveOpArchiveHeader;
       
    67     }
       
    68 
       
    69 
       
    70 // ---------------------------------------------------------------------------
       
    71 // CMMCScBkupStateArchiveOpArchiveHeader::NextStateId()
       
    72 // 
       
    73 // 
       
    74 // ---------------------------------------------------------------------------
       
    75 TMMCScBkupStateId CMMCScBkupStateArchiveOpArchiveHeader::NextStateId() const
       
    76     {
       
    77     TMMCScBkupStateId nextState = KMMCScBkupStateIdGetDataOwners;
       
    78     //
       
    79     const TMMCScBkupOperationType type = Driver().DrvOperation();
       
    80     switch(type)
       
    81         {
       
    82     case EMMCScBkupOperationTypeFullBackup:
       
    83         nextState = KMMCScBkupStateIdGetDataOwners;
       
    84         break;
       
    85     case EMMCScBkupOperationTypeFullRestore:
       
    86         nextState = KMMCScBkupStateIdArchiveOpArchiveFooter;
       
    87         break;
       
    88     default:
       
    89         ASSERT( EFalse );
       
    90         break;
       
    91         }
       
    92     //
       
    93     return nextState;
       
    94     }
       
    95 
       
    96 
       
    97 // ---------------------------------------------------------------------------
       
    98 // CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL()
       
    99 // 
       
   100 // 
       
   101 // ---------------------------------------------------------------------------
       
   102 void CMMCScBkupStateArchiveOpArchiveHeader::PerformStateInitL()
       
   103     {
       
   104     CompleteSelf();
       
   105     }
       
   106 
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL()
       
   110 // 
       
   111 // 
       
   112 // ---------------------------------------------------------------------------
       
   113 void CMMCScBkupStateArchiveOpArchiveHeader::PerformAsynchronousStateStepL()
       
   114     {
       
   115     CMMCScBkupArchive& archive = Driver().DrvArchive();
       
   116     CMMCScBkupArchiveHeader& header = archive.Header();
       
   117     //
       
   118     const TMMCScBkupOperationType type = Driver().DrvOperation();
       
   119     switch(type)
       
   120         {
       
   121     case EMMCScBkupOperationTypeFullBackup:
       
   122         header.StoreL(archive.Category());
       
   123 #ifdef RD_FILE_MANAGER_BACKUP
       
   124         // Activate crc-calculation for payload data. Header crc'd separately
       
   125         Driver().DrvADI().ADIActivateCrcCalculation(ETrue);
       
   126 #endif
       
   127         break;
       
   128     case EMMCScBkupOperationTypeFullRestore:
       
   129         header.RestoreL();
       
   130         break;
       
   131     default:
       
   132         User::Leave(KErrNotSupported);
       
   133         break;
       
   134         }
       
   135     }
       
   136 
       
   137 
       
   138