os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FileManData.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FileManData.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,169 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 +@test
    1.24 +@internalComponent
    1.25 +
    1.26 +This contains CT_FileManData
    1.27 +*/
    1.28 +
    1.29 +#if (!defined __T_FILEMAN_DATA_H__)
    1.30 +#define __T_FILEMAN_DATA_H__
    1.31 +
    1.32 +//	User Includes
    1.33 +#include "DataWrapperBase.h"
    1.34 +#include "FileserverUtil.h"
    1.35 +
    1.36 +//	EPOC includes
    1.37 +#include <e32std.h>
    1.38 +#include <f32file.h>
    1.39 +#include <f32fsys.h>
    1.40 +
    1.41 +struct THistoryData
    1.42 +	{
    1.43 +	TFileName 			iCurrentSource;
    1.44 +	TFileName 			iCurrentTarget;
    1.45 +	TEntry 				iCurrentEntry;
    1.46 +	TInt 				iBytesTransferred;
    1.47 +	CFileMan::TAction	iCurrentAction;
    1.48 +	TFileManError		iMoreInfoAboutError;
    1.49 +	TInt 				iLastError;
    1.50 +	TPtrC 				iFullPath;
    1.51 +	TPtrC				iAbbreviatedPath;
    1.52 +	};
    1.53 +enum TObserverNotifyType
    1.54 +	{
    1.55 +	ENotifyStarted,
    1.56 +	ENotifyOperation,
    1.57 +	ENotifyEnded,
    1.58 +	ENotifyUnknown
    1.59 +	};
    1.60 +
    1.61 +class CT_FileManData: public CDataWrapperBase, public MFileManObserver
    1.62 +	{
    1.63 +public:
    1.64 +	static CT_FileManData*	NewL();
    1.65 +	~CT_FileManData();
    1.66 +
    1.67 +	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
    1.68 +	virtual TAny*	GetObject();
    1.69 +	
    1.70 +protected:
    1.71 +	CT_FileManData();
    1.72 +	void ConstructL();
    1.73 +	
    1.74 +	void RunL(CActive* aActive, TInt aIndex);
    1.75 +	void DoCancel(CActive* aActive, TInt aIndex);
    1.76 +	
    1.77 +private:
    1.78 +	inline void	DoCmdNewL(const TDesC& aSection);
    1.79 +	inline void DoCmdAttribsL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.80 +	inline void DoCmdCopyL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.81 +	inline void DoCmdDeleteL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.82 +	inline void DoCmdMoveL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.83 +	inline void DoCmdRenameL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.84 +	inline void DoCmdRmDirL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    1.85 +	inline void DoCmdSetObserver();
    1.86 +	
    1.87 +	inline void DoCmdCurrentAction(const TDesC& aSection);	
    1.88 +	inline void DoCmdGetCurrentTarget(const TDesC& aSection);
    1.89 +	inline void DoCmdGetCurrentSource(const TDesC& aSection);
    1.90 +	inline void DoCmdBytesTransferredByCopyStep(const TDesC& aSection);
    1.91 +	inline void DoCmdCurrentEntryL(const TDesC& aSection);
    1.92 +	inline void DoCmdAbbreviatedPath(const TDesC& aSection);
    1.93 +	inline void DoCmdFullPath(const TDesC& aSection);
    1.94 +	inline void DoCmdGetLastError(const TDesC& aSection);
    1.95 +	inline void DoCmdGetMoreInfoAboutError(const TDesC& aSection);
    1.96 +	inline void	DoCleanup();
    1.97 +		
    1.98 +//  MFileManObserver events
    1.99 +	inline TControl NotifyFileManStarted();
   1.100 +	inline TControl NotifyFileManOperation();
   1.101 +	inline TControl NotifyFileManEnded();
   1.102 +
   1.103 +// Helper functions for MFileManObserver Testing
   1.104 +	void 	ReadTControl(const TDesC& aSection);
   1.105 +	TBool	GetTControlFromConfig(const TDesC& aParameterName, const TDesC& aSection, TControl& aFlag);
   1.106 +		
   1.107 +//  Helper function
   1.108 +	TBool	GetActionFromConfig(const TDesC& aParameterName, const TDesC& aSection, CFileMan::TAction& aAction);
   1.109 +	TBool	GetFileManErrorFromConfig(const TDesC& aParameterName, const TDesC& aSection, TFileManError& aError);
   1.110 +	void 	ConvertFileManErrorToString(TFileManError& aError, TPtrC& aErrorStr);
   1.111 +	void	ConvertActionToString(CFileMan::TAction aAction, TPtrC& aActionStr);
   1.112 +	TBool	GetOperationFromConfig(const TDesC& aParameterName, const TDesC& aSection, TUint& aSwitch);
   1.113 +	void 	ClearHistory();
   1.114 +	void	CreateHistoryRecord(THistoryData& aRecord);
   1.115 +	TBool 	GetNotifyType(const TDesC& aParameterName, const TDesC& aSection, TObserverNotifyType& aType);
   1.116 +	RPointerArray<THistoryData>* GetHistoryDataByType(const TDesC& aSection);
   1.117 +	
   1.118 +private:
   1.119 +	//** CFileMan class instance that is tested */
   1.120 +	CFileMan*			                iFileMan;
   1.121 +	
   1.122 +	/** Sores aAsyncErrorIndex (Only For MFileObserver notifications). */
   1.123 +	TInt								iAsyncErrorIndex;
   1.124 +	
   1.125 +	/** Indicates if functions called asynchronouslly (Only For MFileObserver notifications). */
   1.126 +	TBool								iAsyncCall;
   1.127 +	
   1.128 +	/** MFileManObserver class instance */
   1.129 +	MFileManObserver*	                iFileManObserver;
   1.130 +	
   1.131 +    /** The request status for disk space events */
   1.132 +	RPointerArray<CActiveCallback>		iAttribs;
   1.133 +	
   1.134 +	/** The request status for disk space events */
   1.135 +	RPointerArray<CActiveCallback>		iCopy;
   1.136 +	
   1.137 +	/** The request status for disk space events */
   1.138 +	RPointerArray<CActiveCallback>		iDelete;
   1.139 +	
   1.140 +	/** The request status for disk space events */
   1.141 +	RPointerArray<CActiveCallback>		iMove;
   1.142 +	
   1.143 +	/** The request status for disk space events */
   1.144 +	RPointerArray<CActiveCallback>		iRename;
   1.145 +	
   1.146 +	/** The request status for disk space events */
   1.147 +	RPointerArray<CActiveCallback>		iRmDir;
   1.148 +	
   1.149 +	/** Stores history for NotifyFileManStarted  */
   1.150 +	RPointerArray<THistoryData>			iStartedHistory;
   1.151 +	
   1.152 +	/** Stores history for NotifyFileManOperation  */
   1.153 +	RPointerArray<THistoryData>			iOperationHistory;
   1.154 +	
   1.155 +	/** Stores history for NotifyFileManEnded  */
   1.156 +	RPointerArray<THistoryData>			iEndedHistory;
   1.157 +	
   1.158 +	/** Stores return value for MFileManObserver Notifications */
   1.159 +	TControl							iTControl;
   1.160 +	
   1.161 +	/** Stores source of filename for which return specified TControl value. */
   1.162 +	TFileName							iNotifyFileName;
   1.163 +	
   1.164 +	/** Stores name of Notify Function. */
   1.165 +	TObserverNotifyType					iObserverNotifyType;
   1.166 +	
   1.167 +	/** Idicates if we need to use specified TControl value in notifications. */
   1.168 +	TBool								iUseTControl;
   1.169 +	
   1.170 +	};
   1.171 +	
   1.172 +#endif /* __T_FILEMAN_DATA_H__ */