harvester/monitorplugins/mmcplugin/inc/mmcmounttaskao.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 31 Aug 2010 15:37:30 +0300
branchRCL_3
changeset 20 f23c07ec56e2
parent 19 b73252188534
child 21 85f623e1ef41
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* 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:  Handles mount tasks*
*/

#ifndef __MMCMOUNTTASKAO_H__
#define __MMCMOUNTTASKAO_H__

#include <e32base.h>
#include <e32msgqueue.h>
#include <f32file.h>

#include "monitorplugin.h"
#include "mdeharvestersession.h"
#include "mmcfilelist.h"
#include "harvestereventmanager.h"

class CHarvesterPluginFactory;

class CMMCMountTaskAO : public CActive
  	{
	public:
		enum TRequest
			{
			ERequestStartTask,
			ERequestMount,
			ERequestUnmount,
			ERequestFormat,
			ERequestHandleFileEntry,
			ERequestHandleReharvest,
			ERequestCleanup,
			ERequestIdle
			};

		static CMMCMountTaskAO* NewL();	
		virtual ~CMMCMountTaskAO();
		
		void StartMountL( TMountData& aMountData );
		void StartUnmountL( TMountData& aMountData );
		void SetMonitorObserver( MMonitorPluginObserver& aObserver );
		void SetMdeSession( CMdEHarvesterSession* aSession );
		void SetHarvesterPluginFactory( CHarvesterPluginFactory* aPluginFactory );
		
		/**
		 * Returns internal hard drive's media id if the device has one.
		 */
		TUint32 GetInternalDriveMediaId( TBool& aPresent );
		
        void SetCachingStatus( TBool aCachingStatus );
        
	protected:

		void RunL();
		TInt RunError( TInt aError );
		void DoCancel();
		void SetNextRequest( TRequest aRequest );
		
		void Initialize();
		void Deinitialize();
		void SetNotPresentToMDE();
		void HandleReharvestL( RPointerArray<CPlaceholderData>& aArray );
		void RemoveNotPresentFromMDE();
		void StartNotifyL();
		void StopNotifyL();
		
	private:
	
		CMMCMountTaskAO();		
		void ConstructL();
				
	private:
		
		RFs iFs;
		TRequest iNextRequest;
		TMountData* iMountData;
		RPointerArray<TMountData> iMountDataQueue;
		RPointerArray<CPlaceholderData> iEntryArray;
		RPointerArray<CPlaceholderData> iHarvestEntryArray;
		MMonitorPluginObserver* iObserver;
		CMdEHarvesterSession* iMdeSession;
		CHarvesterPluginFactory* iHarvesterPluginFactory;
		CMmcFileList* iMmcFileList;
		CHarvesterEventManager* iHEM;
        TBool iCacheEvents;
        RPointerArray<CHarvesterData> iHdArray;
		
	};

#endif // __MMCMOUNTTASKAO_H__