smsprotocols/smsstack/smsu/src/smsubackup.cpp
branchRCL_3
changeset 66 07a122eea281
parent 65 630d2f34d719
equal deleted inserted replaced
65:630d2f34d719 66:07a122eea281
     1 // Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    17 
    17 
    18 /**
    18 /**
    19  @file
    19  @file
    20 */
    20 */
    21 
    21 
    22 
       
    23 #include "OstTraceDefinitions.h"
       
    24 #ifdef OST_TRACE_COMPILER_IN_USE
       
    25 #include "smsubackupTraces.h"
       
    26 #endif
       
    27 
       
    28 #include <e32std.h>
    22 #include <e32std.h>
    29 #include "SmsuBackup.h"
    23 #include "SmsuBackup.h"
    30 #include <babackup.h>
    24 #include <babackup.h>
       
    25 #include "smsstacklog.h"
    31 
    26 
    32 
    27 
    33 const TInt KBURPartMask = 0x000000FF;
    28 const TInt KBURPartMask = 0x000000FF;
    34 
    29 
    35 #include <connect/sbdefs.h>
    30 #include <connect/sbdefs.h>
    37 using namespace conn;
    32 using namespace conn;
    38 
    33 
    39 
    34 
    40 EXPORT_C CBackupAndRestore* CBackupAndRestore::NewL(MNBBackupAndRestoreObserver& aBackupAndRestoreObserver)
    35 EXPORT_C CBackupAndRestore* CBackupAndRestore::NewL(MNBBackupAndRestoreObserver& aBackupAndRestoreObserver)
    41  	{
    36  	{
    42  	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CBACKUPANDRESTORE_NEWL_1, "CBackupAndRestore::NewL()");
    37  	LOGSMSU1("CBackupAndRestore::NewL()");
    43 
    38 
    44  	CBackupAndRestore* me = new(ELeave) CBackupAndRestore(aBackupAndRestoreObserver);
    39  	CBackupAndRestore* me = new(ELeave) CBackupAndRestore(aBackupAndRestoreObserver);
    45  	CleanupStack::PushL(me);
    40  	CleanupStack::PushL(me);
    46  	me->ConstructL();
    41  	me->ConstructL();
    47  	CleanupStack::Pop(me);
    42  	CleanupStack::Pop(me);
    56  	}
    51  	}
    57 
    52 
    58 
    53 
    59 void CBackupAndRestore::ConstructL()
    54 void CBackupAndRestore::ConstructL()
    60  	{
    55  	{
    61  	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBACKUPANDRESTORE_CONSTRUCTL_1, "CBackupAndRestore::ConstructL()");
    56  	LOGSMSU1("CBackupAndRestore::ConstructL()");
    62 
    57 
    63  	iBackupOrRestoreInProgress = EFalse;
    58  	iBackupOrRestoreInProgress = EFalse;
    64 	User::LeaveIfError(iBackupProperty.Attach(KUidSystemCategory,KUidBackupRestoreKey));
    59 	User::LeaveIfError(iBackupProperty.Attach(KUidSystemCategory,KUidBackupRestoreKey));
    65 	CActiveScheduler::Add(this);
    60 	CActiveScheduler::Add(this);
    66  	iBackupProperty.Subscribe(iStatus);
    61  	iBackupProperty.Subscribe(iStatus);
    75  	} // CBackupAndRestore::~CBackupAndRestore
    70  	} // CBackupAndRestore::~CBackupAndRestore
    76 
    71 
    77 
    72 
    78 void CBackupAndRestore::DoCancel()
    73 void CBackupAndRestore::DoCancel()
    79  	{
    74  	{
    80  	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBACKUPANDRESTORE_DOCANCEL_1, "CBackupAndRestore::DoCancel()");
    75  	LOGSMSU1("CBackupAndRestore::DoCancel()");
    81 
    76 
    82  	iBackupProperty.Cancel();
    77  	iBackupProperty.Cancel();
    83  	} // CBackupAndRestore::DoCancel
    78  	} // CBackupAndRestore::DoCancel
    84 
    79 
    85 
    80 
    86 EXPORT_C TBool CBackupAndRestore::IsBackupOrRestoreInProgress()
    81 EXPORT_C TBool CBackupAndRestore::IsBackupOrRestoreInProgress()
    87 	{
    82 	{
    88 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CBACKUPANDRESTORE_ISBACKUPORRESTOREINPROGRESS_1, "CBackupAndRestore::IsBackupOrRestoreInProgress()");
    83 	LOGSMSU1("CBackupAndRestore::IsBackupOrRestoreInProgress()");
    89 
    84 
    90 	return iBackupOrRestoreInProgress;
    85 	return iBackupOrRestoreInProgress;
    91 	} // CBackupAndRestore::IsBackupOrRestoreInProgress
    86 	} // CBackupAndRestore::IsBackupOrRestoreInProgress
    92 
    87 
    93 
    88 
    94 /**
    89 /**
    95  *  @leave KErrNotSupported if unknown backup flag is found
    90  *  @leave KErrNotSupported if unknown backup flag is found
    96  */
    91  */
    97 void CBackupAndRestore::RunL()
    92 void CBackupAndRestore::RunL()
    98  	{
    93  	{
    99  	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CBACKUPANDRESTORE_RUNL_1, "CBackupAndRestore::RunL()");
    94  	LOGSMSU1("CBackupAndRestore::RunL()");
   100 
    95 
   101  	iBackupProperty.Subscribe(iStatus);
    96  	iBackupProperty.Subscribe(iStatus);
   102  	SetActive();
    97  	SetActive();
   103 
    98 
   104 
    99