harvester/monitorplugins/mmcplugin/inc/mmcscannerao.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 23:14:48 +0200
branchRCL_3
changeset 3 6752808b2036
parent 2 b73a2e62868f
child 7 3cebc1a84278
permissions -rw-r--r--
Revision: 201003 Kit: 201007

/*
* Copyright (c) 2006-2009 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:  Scans MMC after phone reboot for file changes*
*/

#ifndef CMMCSCANNERAO_H
#define CMMCSCANNERAO_H

#include <e32base.h>	// For CActive, link against: euser.lib

#include <e32std.h>		// For RTimer, link against: euser.lib
#include <harvesterdata.h>
#include "mdeharvestersession.h"
#include "mmcfilelist.h"
#include "harvestereventmanager.h"

// FORWARD DECLARATION
class MMonitorPluginObserver;

class CMmcScannerAO : public CTimer 
	{
public:
	// Cancel and destroy
	~CMmcScannerAO();

	// Two-phased constructor.
	static CMmcScannerAO* NewL( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient,
			MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory,
			const TInt aPriority, TBool aAlreadyWaited );

public:

private:
	// C++ constructor
	CMmcScannerAO( TUint32 aMediaId, CMdEHarvesterSession* aMdEClient, 
			MMonitorPluginObserver* aObserver, CHarvesterPluginFactory* aHarvesterPluginFactory,
			const TInt aPriority );

	// Second-phase constructor
	void ConstructL( TBool aAlreadyWaited );

private:
	enum TCMmcScannerAOState
		{
		EUninitialized, // Uninitialized
		EReadFiles,
		EProcessFiles,
		EHarvestFiles,
		ERemoveNPFiles,
		EDone,
		EError // Error condition
		};

private:
	// From CActive
	// Handle completion
	void RunL();

	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	TInt RunError( TInt aError );
	
	void HandleReharvestL();
	
	void SetState( TCMmcScannerAOState aState );		

private:
	TInt iState; // State of the active object
	
	TUint32 iMediaId;
	
	// Not owned
	CMdEHarvesterSession* iMdEClient;
	
	RFs iFs;
	
	TBuf<2> iDrive;
	
	CMmcFileList* iMmcFileList;
	
	// Not owned
	CHarvesterPluginFactory* iHarvesterPluginFactory;
	
	RPointerArray<CPlaceholderData> iEntryArray;
	RPointerArray<CPlaceholderData> iHarvestEntryArray;
	
	// Not owned
	MMonitorPluginObserver* iObserver;
	
	RPointerArray<CHarvesterData> iHdArray;
	
    CHarvesterEventManager* iHEM;
	};

#endif // CMMCSCANNERAO_H