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