os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FileManData.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 /**
    20 @test
    21 @internalComponent
    22 
    23 This contains CT_FileManData
    24 */
    25 
    26 #if (!defined __T_FILEMAN_DATA_H__)
    27 #define __T_FILEMAN_DATA_H__
    28 
    29 //	User Includes
    30 #include "DataWrapperBase.h"
    31 #include "FileserverUtil.h"
    32 
    33 //	EPOC includes
    34 #include <e32std.h>
    35 #include <f32file.h>
    36 #include <f32fsys.h>
    37 
    38 struct THistoryData
    39 	{
    40 	TFileName 			iCurrentSource;
    41 	TFileName 			iCurrentTarget;
    42 	TEntry 				iCurrentEntry;
    43 	TInt 				iBytesTransferred;
    44 	CFileMan::TAction	iCurrentAction;
    45 	TFileManError		iMoreInfoAboutError;
    46 	TInt 				iLastError;
    47 	TPtrC 				iFullPath;
    48 	TPtrC				iAbbreviatedPath;
    49 	};
    50 enum TObserverNotifyType
    51 	{
    52 	ENotifyStarted,
    53 	ENotifyOperation,
    54 	ENotifyEnded,
    55 	ENotifyUnknown
    56 	};
    57 
    58 class CT_FileManData: public CDataWrapperBase, public MFileManObserver
    59 	{
    60 public:
    61 	static CT_FileManData*	NewL();
    62 	~CT_FileManData();
    63 
    64 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
    65 	virtual TAny*	GetObject();
    66 	
    67 protected:
    68 	CT_FileManData();
    69 	void ConstructL();
    70 	
    71 	void RunL(CActive* aActive, TInt aIndex);
    72 	void DoCancel(CActive* aActive, TInt aIndex);
    73 	
    74 private:
    75 	inline void	DoCmdNewL(const TDesC& aSection);
    76 	inline void DoCmdAttribsL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    77 	inline void DoCmdCopyL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    78 	inline void DoCmdDeleteL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    79 	inline void DoCmdMoveL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    80 	inline void DoCmdRenameL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    81 	inline void DoCmdRmDirL(const TDesC& aSection, const TInt aAsyncErrorIndex);
    82 	inline void DoCmdSetObserver();
    83 	
    84 	inline void DoCmdCurrentAction(const TDesC& aSection);	
    85 	inline void DoCmdGetCurrentTarget(const TDesC& aSection);
    86 	inline void DoCmdGetCurrentSource(const TDesC& aSection);
    87 	inline void DoCmdBytesTransferredByCopyStep(const TDesC& aSection);
    88 	inline void DoCmdCurrentEntryL(const TDesC& aSection);
    89 	inline void DoCmdAbbreviatedPath(const TDesC& aSection);
    90 	inline void DoCmdFullPath(const TDesC& aSection);
    91 	inline void DoCmdGetLastError(const TDesC& aSection);
    92 	inline void DoCmdGetMoreInfoAboutError(const TDesC& aSection);
    93 	inline void	DoCleanup();
    94 		
    95 //  MFileManObserver events
    96 	inline TControl NotifyFileManStarted();
    97 	inline TControl NotifyFileManOperation();
    98 	inline TControl NotifyFileManEnded();
    99 
   100 // Helper functions for MFileManObserver Testing
   101 	void 	ReadTControl(const TDesC& aSection);
   102 	TBool	GetTControlFromConfig(const TDesC& aParameterName, const TDesC& aSection, TControl& aFlag);
   103 		
   104 //  Helper function
   105 	TBool	GetActionFromConfig(const TDesC& aParameterName, const TDesC& aSection, CFileMan::TAction& aAction);
   106 	TBool	GetFileManErrorFromConfig(const TDesC& aParameterName, const TDesC& aSection, TFileManError& aError);
   107 	void 	ConvertFileManErrorToString(TFileManError& aError, TPtrC& aErrorStr);
   108 	void	ConvertActionToString(CFileMan::TAction aAction, TPtrC& aActionStr);
   109 	TBool	GetOperationFromConfig(const TDesC& aParameterName, const TDesC& aSection, TUint& aSwitch);
   110 	void 	ClearHistory();
   111 	void	CreateHistoryRecord(THistoryData& aRecord);
   112 	TBool 	GetNotifyType(const TDesC& aParameterName, const TDesC& aSection, TObserverNotifyType& aType);
   113 	RPointerArray<THistoryData>* GetHistoryDataByType(const TDesC& aSection);
   114 	
   115 private:
   116 	//** CFileMan class instance that is tested */
   117 	CFileMan*			                iFileMan;
   118 	
   119 	/** Sores aAsyncErrorIndex (Only For MFileObserver notifications). */
   120 	TInt								iAsyncErrorIndex;
   121 	
   122 	/** Indicates if functions called asynchronouslly (Only For MFileObserver notifications). */
   123 	TBool								iAsyncCall;
   124 	
   125 	/** MFileManObserver class instance */
   126 	MFileManObserver*	                iFileManObserver;
   127 	
   128     /** The request status for disk space events */
   129 	RPointerArray<CActiveCallback>		iAttribs;
   130 	
   131 	/** The request status for disk space events */
   132 	RPointerArray<CActiveCallback>		iCopy;
   133 	
   134 	/** The request status for disk space events */
   135 	RPointerArray<CActiveCallback>		iDelete;
   136 	
   137 	/** The request status for disk space events */
   138 	RPointerArray<CActiveCallback>		iMove;
   139 	
   140 	/** The request status for disk space events */
   141 	RPointerArray<CActiveCallback>		iRename;
   142 	
   143 	/** The request status for disk space events */
   144 	RPointerArray<CActiveCallback>		iRmDir;
   145 	
   146 	/** Stores history for NotifyFileManStarted  */
   147 	RPointerArray<THistoryData>			iStartedHistory;
   148 	
   149 	/** Stores history for NotifyFileManOperation  */
   150 	RPointerArray<THistoryData>			iOperationHistory;
   151 	
   152 	/** Stores history for NotifyFileManEnded  */
   153 	RPointerArray<THistoryData>			iEndedHistory;
   154 	
   155 	/** Stores return value for MFileManObserver Notifications */
   156 	TControl							iTControl;
   157 	
   158 	/** Stores source of filename for which return specified TControl value. */
   159 	TFileName							iNotifyFileName;
   160 	
   161 	/** Stores name of Notify Function. */
   162 	TObserverNotifyType					iObserverNotifyType;
   163 	
   164 	/** Idicates if we need to use specified TControl value in notifications. */
   165 	TBool								iUseTControl;
   166 	
   167 	};
   168 	
   169 #endif /* __T_FILEMAN_DATA_H__ */