diff -r 491b3ed49290 -r 65326cf895ed filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filemanager/bkupengine/src/CMMCScBkupStateGetDataOwnerStatuses.cpp Wed Sep 01 12:31:07 2010 +0100 @@ -0,0 +1,194 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0"" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMMCScBkupStateGetDataOwnerStatuses implementation +* +* +*/ + +#include "CMMCScBkupStateGetDataOwnerStatuses.h" + +// System includes +#include + +// User includes +#include "MMCScBkupLogger.h" +#include "CMMCScBkupDataOwnerInfo.h" +#include "CMMCScBkupDataOwnerCollection.h" + + + + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() +// +// C++ constructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses( MMMCScBkupDriver& aDriver ) +: CMMCScBkupState( aDriver ) + { + __LOG1("CMMCScBkupStateGetDataOwnerStatuses::CMMCScBkupStateGetDataOwnerStatuses() - 0x%08x", StateId().iUid ); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() +// +// Destructor. +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses::~CMMCScBkupStateGetDataOwnerStatuses() + { + Cancel(); + // + iStatusArray.Close(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::NewL() +// +// +// --------------------------------------------------------------------------- +CMMCScBkupStateGetDataOwnerStatuses* CMMCScBkupStateGetDataOwnerStatuses::NewL( MMMCScBkupDriver& aDriver ) + { + CMMCScBkupStateGetDataOwnerStatuses* self = new(ELeave) CMMCScBkupStateGetDataOwnerStatuses( aDriver ); + return self; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::StateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::StateId() const + { + return KMMCScBkupStateIdGetDataOwnerStatuses; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::NextStateId() +// +// +// --------------------------------------------------------------------------- +TMMCScBkupStateId CMMCScBkupStateGetDataOwnerStatuses::NextStateId() const + { + return KMMCScBkupStateIdArchiveOpActiveData; + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PerformStateInitL() + { + SetState( EPrearingQuery ); + CompleteSelf(); + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PerformAsynchronousStateStepL() + { + switch( State() ) + { + case EPrearingQuery: + PrepareQueryL(); + break; + case EGettingStatus: + Driver().DrvSecureBackupClient().SIDStatusL( iStatusArray ); + SetState( EProcessingResults ); + CompleteSelf(); + break; + case EProcessingResults: + ProcessStatusResultsL(); + break; + default: + ASSERT( EFalse ); + } + } + + +// --------------------------------------------------------------------------- +// CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() +// +// +// --------------------------------------------------------------------------- +void CMMCScBkupStateGetDataOwnerStatuses::PrepareQueryL() + { + const TDataOwnerStatus KMMCScBkupDefaultOwnerStatus = EUnset; + const TInt KMMCScBkupDefaultOwnerStatusError = 0; + + // Build an array of all of the active data owners that we require + // the statuses for. + CMMCScBkupDataOwnerCollection& ownerCollection = Driver().DrvDataOwners(); + const TInt count = ownerCollection.Count(); + for(TInt i=0; iSetStatus( ownerStatus.iStatus ); + } + } + } + +