os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FsData.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_FsData
sl@0
    24
*/
sl@0
    25
sl@0
    26
#if (!defined __T_FS_DATA_H__)
sl@0
    27
#define __T_FS_DATA_H__
sl@0
    28
sl@0
    29
//	User Includes
sl@0
    30
#include "DataWrapperBase.h"
sl@0
    31
#include "T_DirData.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
//	User includes
sl@0
    39
#include "T_ActiveNotifyChange.h"
sl@0
    40
sl@0
    41
const TInt KBufferStringLength = 256;
sl@0
    42
sl@0
    43
sl@0
    44
class CT_FsData: public CDataWrapperBase
sl@0
    45
	{
sl@0
    46
public:
sl@0
    47
	static CT_FsData*	NewL();
sl@0
    48
	~CT_FsData();
sl@0
    49
sl@0
    50
	/**
sl@0
    51
	* Process a command read from the ini file
sl@0
    52
	*
sl@0
    53
	* @param	aCommand requiring command to be processed
sl@0
    54
	* @param	aSection the section in the ini file requiring the command to be processed
sl@0
    55
	* @param	aAsyncErrorIndex the index of asynchronous command error code belongs to.
sl@0
    56
	* 
sl@0
    57
	* @leave	system wide error
sl@0
    58
	*
sl@0
    59
	* @return	ETrue if the command is processed
sl@0
    60
	*/
sl@0
    61
	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
sl@0
    62
sl@0
    63
	/**
sl@0
    64
	* Return a pointer to the object that the data wraps
sl@0
    65
	*
sl@0
    66
	* @return	pointer to the object that the data wraps
sl@0
    67
	*/
sl@0
    68
	virtual TAny*	GetObject();
sl@0
    69
sl@0
    70
	/**
sl@0
    71
	* Query to see if there are any outstanding requests
sl@0
    72
	*
sl@0
    73
	* @return ETrue if there are any outstanding requests
sl@0
    74
	*/
sl@0
    75
	
sl@0
    76
	void RunL(CActive* aActive, TInt aIndex);
sl@0
    77
	void DoCancel(CActive* aActive, TInt aIndex);
sl@0
    78
sl@0
    79
protected:
sl@0
    80
	CT_FsData();
sl@0
    81
	void ConstructL();
sl@0
    82
sl@0
    83
private:
sl@0
    84
sl@0
    85
	virtual TBool	DoCommandDrivesL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
sl@0
    86
	virtual TBool	DoCommandFilesL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
sl@0
    87
	virtual TBool	DoCommandMountsL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
sl@0
    88
sl@0
    89
sl@0
    90
	void	DoCmdNewL();
sl@0
    91
	void	DoCmdClose();
sl@0
    92
	void	DoCmdDestructor();
sl@0
    93
sl@0
    94
	// Mount commands
sl@0
    95
	void	DoCmdAddFileSystem(const TDesC& aSection);
sl@0
    96
	void	DoCmdMountFileSystem(const TDesC& aSection);
sl@0
    97
	void	DoCmdMountFileSystemAndScan(const TDesC& aSection);
sl@0
    98
	void	DoCmdDismountFileSystem(const TDesC& aSection);
sl@0
    99
	void	DoCmdRemoveFileSystem(const TDesC& aSection);
sl@0
   100
	void	DoCmdFileSystemName(const TDesC& aSection);
sl@0
   101
	void	DoCmdAddExtension(const TDesC& aSection);
sl@0
   102
	void	DoCmdMountExtension(const TDesC& aSection);
sl@0
   103
	void	DoCmdDismountExtension(const TDesC& aSection);
sl@0
   104
	void	DoCmdRemoveExtension(const TDesC& aSection);
sl@0
   105
	void	DoCmdExtensionName(const TDesC& aSection);
sl@0
   106
	void	DoCmdRemountDriveL(const TDesC& aSection);
sl@0
   107
	void	DoCmdNotifyDismountL(const TDesC& aSection, const TInt aAsyncErrorIndex);
sl@0
   108
	void	DoCmdNotifyDismountCancel(const TDesC& aSection);
sl@0
   109
	void	DoCmdAllowDismount(const TDesC& aSection);
sl@0
   110
	void	DoCmdSetStartupConfigurationL(const TDesC& aSection);
sl@0
   111
	void	DoCmdAddCompositeMount(const TDesC& aSection);
sl@0
   112
	void	DoCmdStartupInitCompleteL(TInt aAsyncErrorIndex);
sl@0
   113
	void	DoCmdSetLocalDriveMappingL(const TDesC& aSection);
sl@0
   114
	void	DoCmdSwapFileSystem(const TDesC& aSection);
sl@0
   115
	void	DoCmdFinaliseDrives();
sl@0
   116
	void 	DoCmdFileSystemSubType(const TDesC& aSection);
sl@0
   117
sl@0
   118
	// Misc commands
sl@0
   119
	void	DoCmdConnect(const TDesC& aSection);
sl@0
   120
	void	DoCmdVersion(const TDesC& aSection);
sl@0
   121
	void	DoCmdNotifyChangeL(const TDesC& aSection, const TInt aAsyncErrorIndex);
sl@0
   122
	void	DoCmdNotifyChangeCancel(const TDesC& aSection);
sl@0
   123
	void	DoCmdNotifyDiskSpaceL(const TDesC& aSection, const TInt aAsyncErrorIndex);
sl@0
   124
	void	DoCmdNotifyDiskSpaceCancel(const TDesC& aSection);
sl@0
   125
	void	DoCmdIsRomAddress(const TDesC& aSection);
sl@0
   126
	void	DoCmdResourceCountMarkStart();
sl@0
   127
	void	DoCmdResourceCountMarkEnd();
sl@0
   128
	void	DoCmdResourceCount(const TDesC& aSection);
sl@0
   129
	void	DoCmdGetNotifyUser(const TDesC& aSection);
sl@0
   130
	void	DoCmdSetNotifyUser(const TDesC& aSection);
sl@0
   131
	void	DoCmdLoaderHeapFunctionL(const TDesC& aSection);
sl@0
   132
	void	DoCmdSetNotifyChange(const TDesC& aSection);
sl@0
   133
	void	DoCmdInitialisePropertiesFile(const TDesC& aSection);
sl@0
   134
sl@0
   135
	// Files commands
sl@0
   136
	void	DoCmdRealName(const TDesC& aSection);
sl@0
   137
	void	DoCmdSessionPath(const TDesC& aSection);
sl@0
   138
	void	DoCmdSetSessionPath(const TDesC& aSection);
sl@0
   139
	void	DoCmdParse(const TDesC& aSection);
sl@0
   140
	void	DoCmdMkDir(const TDesC& aSection);
sl@0
   141
	void	DoCmdMkDirAll(const TDesC& aSection);
sl@0
   142
	void	DoCmdRmDir(const TDesC& aSection);
sl@0
   143
	void	DoCmdGetDir(const TDesC& aSection);
sl@0
   144
	void	DoCmdDelete(const TDesC& aSection);
sl@0
   145
	void	DoCmdRename(const TDesC& aSection);
sl@0
   146
	void	DoCmdReplace(const TDesC& aSection);
sl@0
   147
	void	DoCmdAtt(const TDesC& aSection);
sl@0
   148
	void	DoCmdSetAtt(const TDesC& aSection);
sl@0
   149
	void	DoCmdModified(const TDesC& aSection);
sl@0
   150
	void	DoCmdSetModified(const TDesC& aSection);
sl@0
   151
	void	DoCmdEntryL(const TDesC& aSection);
sl@0
   152
	void	DoCmdSetEntry(const TDesC& aSection);
sl@0
   153
	void	DoCmdReadFileSectionL(const TDesC& aSection);
sl@0
   154
	void	DoCmdIsFileOpen(const TDesC& aSection);
sl@0
   155
	void	DoCmdGetShortName(const TDesC& aSection);
sl@0
   156
	void	DoCmdGetLongName(const TDesC& aSection);
sl@0
   157
	void	DoCmdIsFileInRom(const TDesC& aSection);
sl@0
   158
	void	DoCmdIsValidName(const TDesC& aSection);
sl@0
   159
	void	DoCmdSetSessionToPrivate(const TDesC& aSection);
sl@0
   160
	void	DoCmdPrivatePath(const TDesC& aSection);
sl@0
   161
	void	DoCmdCreatePrivatePath(const TDesC& aSection);
sl@0
   162
sl@0
   163
	// Drives commands
sl@0
   164
	void	DoCmdDriveList(const TDesC& aSection);
sl@0
   165
	void	DoCmdDriveL(const TDesC& aSection);
sl@0
   166
	void	DoCmdVolumeL(const TDesC& aSection);
sl@0
   167
	void	DoCmdSetVolumeLabel(const TDesC& aSection);
sl@0
   168
	void	DoCmdSubst(const TDesC& aSection);
sl@0
   169
	void	DoCmdSetSubst(const TDesC& aSection);
sl@0
   170
	void	DoCmdGetMediaSerialNumber(const TDesC& aSection);
sl@0
   171
	void	DoCmdIsValidDrive(const TDesC& aSection);
sl@0
   172
	void	DoCmdCharToDrive(const TDesC& aSection);
sl@0
   173
	void	DoCmdDriveToChar(const TDesC& aSection);
sl@0
   174
	void	DoCmdCheckDisk(const TDesC& aSection);
sl@0
   175
	void	DoCmdScanDrive(const TDesC& aSection);
sl@0
   176
	void	DoCmdGetDriveName(const TDesC& aSection);
sl@0
   177
	void	DoCmdSetDriveName(const TDesC& aSection);
sl@0
   178
	void	DoCmdLockDrive(const TDesC& aSection);
sl@0
   179
	void	DoCmdUnlockDrive(const TDesC& aSection);
sl@0
   180
	void	DoCmdClearPassword(const TDesC& aSection);
sl@0
   181
	void	DoCmdErasePassword(const TDesC& aSection);
sl@0
   182
	void	DoCmdReserveDriveSpace(const TDesC& aSection);
sl@0
   183
	void	DoCmdGetReserveAccess(const TDesC& aSection);
sl@0
   184
	void	DoCmdReleaseReserveAccess(const TDesC& aSection);
sl@0
   185
	void	DoCmdGetSystemDrive(const TDesC& aSection);
sl@0
   186
	void	DoCmdSetSystemDrive(const TDesC& aSection);
sl@0
   187
	void	DoCmdGetSystemDriveChar(const TDesC& aSection);
sl@0
   188
	void	DoCmdVolumeIOParam(const TDesC& aSection);
sl@0
   189
sl@0
   190
	// Helpers
sl@0
   191
	void	DoCleanup();
sl@0
   192
	void	DoCmdPromptL(const TDesC &aSection);
sl@0
   193
	inline RFs& CT_FsData::FileServer(){ return iFs2; }
sl@0
   194
	TBool 	VerifyTDriveInfoDataFromIniL(const TDesC& aSection, TDriveInfo& aDriveInfo);
sl@0
   195
sl@0
   196
	
sl@0
   197
sl@0
   198
	const TDesC&	ConvertToStrAttMask(TUint aAttMask);
sl@0
   199
	TBool		ConvertToSortKey(const TDesC& aSortKeyStr, TUint& aSortKey);	
sl@0
   200
	TBool		ConvertToNotifyType(const TDesC& aNotifyTypeStr, TNotifyType& aNotifyType);
sl@0
   201
	TBool		ConvertToMediaAtts(const TDesC& aMediaAttStr, TUint& aMediaAtt);
sl@0
   202
	TBool		ConvertToDriveAtts(const TDesC& aMediaAttStr, TUint& aMediaAtt);
sl@0
   203
	TBool		GetDriveNumberFromConfig(const TDesC& aSection, const TDesC& aParameterName, TDriveNumber& aDriveNumber);
sl@0
   204
	TBool		GetMediaTypeFromConfig(const TDesC& aSection, TMediaType& aMediaType);
sl@0
   205
	TBool		GetMediaAttsFromConfig(const TDesC& aSection, TUint& aMediaAtt);
sl@0
   206
	TBool		GetDriveAttsFromConfig(const TDesC& aSection, TUint& aDriveAtt);
sl@0
   207
	TBool		GetBatteryStateFromConfig(const TDesC& aSection, TBatteryState& aBatteryState);
sl@0
   208
	TBool 		GetDrvMapOperationFromConfig(const TDesC& aSection, const TDesC& aParameterName, TLocalDriveMappingInfo::TDrvMapOperation& aOperation);
sl@0
   209
public:
sl@0
   210
	TUint64 ThreadId();
sl@0
   211
sl@0
   212
private:
sl@0
   213
	/** RFs class instance that is tested */
sl@0
   214
	RFs*									iFs;
sl@0
   215
sl@0
   216
	/** RFs class instance for additional purpoces */
sl@0
   217
	RFs										iFs2;
sl@0
   218
sl@0
   219
	/** The request status for files/dir events */
sl@0
   220
	RPointerArray<CT_ActiveNotifyChange>	iNotifyChange;
sl@0
   221
sl@0
   222
	/** The request status for disk space events */
sl@0
   223
	RPointerArray<CActiveCallback>			iNotifyDiskSpace;
sl@0
   224
sl@0
   225
	/** The request status for dismounts a file system on a drive */
sl@0
   226
	RPointerArray<CActiveCallback>			iNotifyDismount;
sl@0
   227
sl@0
   228
	/** The request status for dismounts a file system on a drive */
sl@0
   229
	RPointerArray<CActiveCallback>			iStartupInitComplete;
sl@0
   230
sl@0
   231
	/** The volume label for a drive */
sl@0
   232
	TVolumeInfo								iVolumeInfo;
sl@0
   233
sl@0
   234
	/** Optional name of the volume */
sl@0
   235
	TFileName								iDriveName;
sl@0
   236
	TFileName								iVolumeLabel;
sl@0
   237
sl@0
   238
	/** Extension name */
sl@0
   239
	TFullName								iExtensionName;
sl@0
   240
sl@0
   241
	/** IsFileInRom result */
sl@0
   242
	TUint8*									iIsFileInRom;
sl@0
   243
sl@0
   244
	/**	FileSystemName retuned value */
sl@0
   245
	TFullName								iFileSystemName;
sl@0
   246
sl@0
   247
	/** LockDrive password */
sl@0
   248
	TMediaPassword							iPassword;
sl@0
   249
	};
sl@0
   250
sl@0
   251
#define GET_MANDATORY_STRING_PARAMETER(aParamName, aSection, aResult)	GetCommandStringParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
sl@0
   252
#define GET_MANDATORY_INT_PARAMETER(aParamName, aSection, aResult)		GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
sl@0
   253
#define GET_MANDATORY_INT64_PARAMETER(aParamName, aSection, aResult)	GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
sl@0
   254
#define GET_MANDATORY_BOOL_PARAMETER(aParamName, aSection, aResult)		GetCommandBoolParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
sl@0
   255
sl@0
   256
#define GET_OPTIONAL_STRING_PARAMETER(aParamName, aSection, aResult)	GetCommandStringParameter(aParamName, aSection, aResult, (TText8*) __FILE__, __LINE__, EFalse)
sl@0
   257
#define GET_OPTIONAL_INT_PARAMETER(aParamName, aSection, aResult)		GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
sl@0
   258
#define GET_OPTIONAL_INT64_PARAMETER(aParamName, aSection, aResult)		GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
sl@0
   259
#define GET_OPTIONAL_BOOL_PARAMETER(aParamName, aSection, aResult)		GetCommandBoolParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
sl@0
   260
sl@0
   261
#endif /* __T_FS_DATA_H__ */