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