1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/inc/T_FsData.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,261 @@
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_FsData
1.27 +*/
1.28 +
1.29 +#if (!defined __T_FS_DATA_H__)
1.30 +#define __T_FS_DATA_H__
1.31 +
1.32 +// User Includes
1.33 +#include "DataWrapperBase.h"
1.34 +#include "T_DirData.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 +// User includes
1.42 +#include "T_ActiveNotifyChange.h"
1.43 +
1.44 +const TInt KBufferStringLength = 256;
1.45 +
1.46 +
1.47 +class CT_FsData: public CDataWrapperBase
1.48 + {
1.49 +public:
1.50 + static CT_FsData* NewL();
1.51 + ~CT_FsData();
1.52 +
1.53 + /**
1.54 + * Process a command read from the ini file
1.55 + *
1.56 + * @param aCommand requiring command to be processed
1.57 + * @param aSection the section in the ini file requiring the command to be processed
1.58 + * @param aAsyncErrorIndex the index of asynchronous command error code belongs to.
1.59 + *
1.60 + * @leave system wide error
1.61 + *
1.62 + * @return ETrue if the command is processed
1.63 + */
1.64 + virtual TBool DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
1.65 +
1.66 + /**
1.67 + * Return a pointer to the object that the data wraps
1.68 + *
1.69 + * @return pointer to the object that the data wraps
1.70 + */
1.71 + virtual TAny* GetObject();
1.72 +
1.73 + /**
1.74 + * Query to see if there are any outstanding requests
1.75 + *
1.76 + * @return ETrue if there are any outstanding requests
1.77 + */
1.78 +
1.79 + void RunL(CActive* aActive, TInt aIndex);
1.80 + void DoCancel(CActive* aActive, TInt aIndex);
1.81 +
1.82 +protected:
1.83 + CT_FsData();
1.84 + void ConstructL();
1.85 +
1.86 +private:
1.87 +
1.88 + virtual TBool DoCommandDrivesL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
1.89 + virtual TBool DoCommandFilesL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
1.90 + virtual TBool DoCommandMountsL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
1.91 +
1.92 +
1.93 + void DoCmdNewL();
1.94 + void DoCmdClose();
1.95 + void DoCmdDestructor();
1.96 +
1.97 + // Mount commands
1.98 + void DoCmdAddFileSystem(const TDesC& aSection);
1.99 + void DoCmdMountFileSystem(const TDesC& aSection);
1.100 + void DoCmdMountFileSystemAndScan(const TDesC& aSection);
1.101 + void DoCmdDismountFileSystem(const TDesC& aSection);
1.102 + void DoCmdRemoveFileSystem(const TDesC& aSection);
1.103 + void DoCmdFileSystemName(const TDesC& aSection);
1.104 + void DoCmdAddExtension(const TDesC& aSection);
1.105 + void DoCmdMountExtension(const TDesC& aSection);
1.106 + void DoCmdDismountExtension(const TDesC& aSection);
1.107 + void DoCmdRemoveExtension(const TDesC& aSection);
1.108 + void DoCmdExtensionName(const TDesC& aSection);
1.109 + void DoCmdRemountDriveL(const TDesC& aSection);
1.110 + void DoCmdNotifyDismountL(const TDesC& aSection, const TInt aAsyncErrorIndex);
1.111 + void DoCmdNotifyDismountCancel(const TDesC& aSection);
1.112 + void DoCmdAllowDismount(const TDesC& aSection);
1.113 + void DoCmdSetStartupConfigurationL(const TDesC& aSection);
1.114 + void DoCmdAddCompositeMount(const TDesC& aSection);
1.115 + void DoCmdStartupInitCompleteL(TInt aAsyncErrorIndex);
1.116 + void DoCmdSetLocalDriveMappingL(const TDesC& aSection);
1.117 + void DoCmdSwapFileSystem(const TDesC& aSection);
1.118 + void DoCmdFinaliseDrives();
1.119 + void DoCmdFileSystemSubType(const TDesC& aSection);
1.120 +
1.121 + // Misc commands
1.122 + void DoCmdConnect(const TDesC& aSection);
1.123 + void DoCmdVersion(const TDesC& aSection);
1.124 + void DoCmdNotifyChangeL(const TDesC& aSection, const TInt aAsyncErrorIndex);
1.125 + void DoCmdNotifyChangeCancel(const TDesC& aSection);
1.126 + void DoCmdNotifyDiskSpaceL(const TDesC& aSection, const TInt aAsyncErrorIndex);
1.127 + void DoCmdNotifyDiskSpaceCancel(const TDesC& aSection);
1.128 + void DoCmdIsRomAddress(const TDesC& aSection);
1.129 + void DoCmdResourceCountMarkStart();
1.130 + void DoCmdResourceCountMarkEnd();
1.131 + void DoCmdResourceCount(const TDesC& aSection);
1.132 + void DoCmdGetNotifyUser(const TDesC& aSection);
1.133 + void DoCmdSetNotifyUser(const TDesC& aSection);
1.134 + void DoCmdLoaderHeapFunctionL(const TDesC& aSection);
1.135 + void DoCmdSetNotifyChange(const TDesC& aSection);
1.136 + void DoCmdInitialisePropertiesFile(const TDesC& aSection);
1.137 +
1.138 + // Files commands
1.139 + void DoCmdRealName(const TDesC& aSection);
1.140 + void DoCmdSessionPath(const TDesC& aSection);
1.141 + void DoCmdSetSessionPath(const TDesC& aSection);
1.142 + void DoCmdParse(const TDesC& aSection);
1.143 + void DoCmdMkDir(const TDesC& aSection);
1.144 + void DoCmdMkDirAll(const TDesC& aSection);
1.145 + void DoCmdRmDir(const TDesC& aSection);
1.146 + void DoCmdGetDir(const TDesC& aSection);
1.147 + void DoCmdDelete(const TDesC& aSection);
1.148 + void DoCmdRename(const TDesC& aSection);
1.149 + void DoCmdReplace(const TDesC& aSection);
1.150 + void DoCmdAtt(const TDesC& aSection);
1.151 + void DoCmdSetAtt(const TDesC& aSection);
1.152 + void DoCmdModified(const TDesC& aSection);
1.153 + void DoCmdSetModified(const TDesC& aSection);
1.154 + void DoCmdEntryL(const TDesC& aSection);
1.155 + void DoCmdSetEntry(const TDesC& aSection);
1.156 + void DoCmdReadFileSectionL(const TDesC& aSection);
1.157 + void DoCmdIsFileOpen(const TDesC& aSection);
1.158 + void DoCmdGetShortName(const TDesC& aSection);
1.159 + void DoCmdGetLongName(const TDesC& aSection);
1.160 + void DoCmdIsFileInRom(const TDesC& aSection);
1.161 + void DoCmdIsValidName(const TDesC& aSection);
1.162 + void DoCmdSetSessionToPrivate(const TDesC& aSection);
1.163 + void DoCmdPrivatePath(const TDesC& aSection);
1.164 + void DoCmdCreatePrivatePath(const TDesC& aSection);
1.165 +
1.166 + // Drives commands
1.167 + void DoCmdDriveList(const TDesC& aSection);
1.168 + void DoCmdDriveL(const TDesC& aSection);
1.169 + void DoCmdVolumeL(const TDesC& aSection);
1.170 + void DoCmdSetVolumeLabel(const TDesC& aSection);
1.171 + void DoCmdSubst(const TDesC& aSection);
1.172 + void DoCmdSetSubst(const TDesC& aSection);
1.173 + void DoCmdGetMediaSerialNumber(const TDesC& aSection);
1.174 + void DoCmdIsValidDrive(const TDesC& aSection);
1.175 + void DoCmdCharToDrive(const TDesC& aSection);
1.176 + void DoCmdDriveToChar(const TDesC& aSection);
1.177 + void DoCmdCheckDisk(const TDesC& aSection);
1.178 + void DoCmdScanDrive(const TDesC& aSection);
1.179 + void DoCmdGetDriveName(const TDesC& aSection);
1.180 + void DoCmdSetDriveName(const TDesC& aSection);
1.181 + void DoCmdLockDrive(const TDesC& aSection);
1.182 + void DoCmdUnlockDrive(const TDesC& aSection);
1.183 + void DoCmdClearPassword(const TDesC& aSection);
1.184 + void DoCmdErasePassword(const TDesC& aSection);
1.185 + void DoCmdReserveDriveSpace(const TDesC& aSection);
1.186 + void DoCmdGetReserveAccess(const TDesC& aSection);
1.187 + void DoCmdReleaseReserveAccess(const TDesC& aSection);
1.188 + void DoCmdGetSystemDrive(const TDesC& aSection);
1.189 + void DoCmdSetSystemDrive(const TDesC& aSection);
1.190 + void DoCmdGetSystemDriveChar(const TDesC& aSection);
1.191 + void DoCmdVolumeIOParam(const TDesC& aSection);
1.192 +
1.193 + // Helpers
1.194 + void DoCleanup();
1.195 + void DoCmdPromptL(const TDesC &aSection);
1.196 + inline RFs& CT_FsData::FileServer(){ return iFs2; }
1.197 + TBool VerifyTDriveInfoDataFromIniL(const TDesC& aSection, TDriveInfo& aDriveInfo);
1.198 +
1.199 +
1.200 +
1.201 + const TDesC& ConvertToStrAttMask(TUint aAttMask);
1.202 + TBool ConvertToSortKey(const TDesC& aSortKeyStr, TUint& aSortKey);
1.203 + TBool ConvertToNotifyType(const TDesC& aNotifyTypeStr, TNotifyType& aNotifyType);
1.204 + TBool ConvertToMediaAtts(const TDesC& aMediaAttStr, TUint& aMediaAtt);
1.205 + TBool ConvertToDriveAtts(const TDesC& aMediaAttStr, TUint& aMediaAtt);
1.206 + TBool GetDriveNumberFromConfig(const TDesC& aSection, const TDesC& aParameterName, TDriveNumber& aDriveNumber);
1.207 + TBool GetMediaTypeFromConfig(const TDesC& aSection, TMediaType& aMediaType);
1.208 + TBool GetMediaAttsFromConfig(const TDesC& aSection, TUint& aMediaAtt);
1.209 + TBool GetDriveAttsFromConfig(const TDesC& aSection, TUint& aDriveAtt);
1.210 + TBool GetBatteryStateFromConfig(const TDesC& aSection, TBatteryState& aBatteryState);
1.211 + TBool GetDrvMapOperationFromConfig(const TDesC& aSection, const TDesC& aParameterName, TLocalDriveMappingInfo::TDrvMapOperation& aOperation);
1.212 +public:
1.213 + TUint64 ThreadId();
1.214 +
1.215 +private:
1.216 + /** RFs class instance that is tested */
1.217 + RFs* iFs;
1.218 +
1.219 + /** RFs class instance for additional purpoces */
1.220 + RFs iFs2;
1.221 +
1.222 + /** The request status for files/dir events */
1.223 + RPointerArray<CT_ActiveNotifyChange> iNotifyChange;
1.224 +
1.225 + /** The request status for disk space events */
1.226 + RPointerArray<CActiveCallback> iNotifyDiskSpace;
1.227 +
1.228 + /** The request status for dismounts a file system on a drive */
1.229 + RPointerArray<CActiveCallback> iNotifyDismount;
1.230 +
1.231 + /** The request status for dismounts a file system on a drive */
1.232 + RPointerArray<CActiveCallback> iStartupInitComplete;
1.233 +
1.234 + /** The volume label for a drive */
1.235 + TVolumeInfo iVolumeInfo;
1.236 +
1.237 + /** Optional name of the volume */
1.238 + TFileName iDriveName;
1.239 + TFileName iVolumeLabel;
1.240 +
1.241 + /** Extension name */
1.242 + TFullName iExtensionName;
1.243 +
1.244 + /** IsFileInRom result */
1.245 + TUint8* iIsFileInRom;
1.246 +
1.247 + /** FileSystemName retuned value */
1.248 + TFullName iFileSystemName;
1.249 +
1.250 + /** LockDrive password */
1.251 + TMediaPassword iPassword;
1.252 + };
1.253 +
1.254 +#define GET_MANDATORY_STRING_PARAMETER(aParamName, aSection, aResult) GetCommandStringParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
1.255 +#define GET_MANDATORY_INT_PARAMETER(aParamName, aSection, aResult) GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
1.256 +#define GET_MANDATORY_INT64_PARAMETER(aParamName, aSection, aResult) GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, ETrue)
1.257 +#define GET_MANDATORY_BOOL_PARAMETER(aParamName, aSection, aResult) GetCommandBoolParameter(aParamName, aSection, aResult, (TText8*)__FILE__, __LINE__, ETrue)
1.258 +
1.259 +#define GET_OPTIONAL_STRING_PARAMETER(aParamName, aSection, aResult) GetCommandStringParameter(aParamName, aSection, aResult, (TText8*) __FILE__, __LINE__, EFalse)
1.260 +#define GET_OPTIONAL_INT_PARAMETER(aParamName, aSection, aResult) GetCommandIntParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
1.261 +#define GET_OPTIONAL_INT64_PARAMETER(aParamName, aSection, aResult) GetCommandInt64Parameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
1.262 +#define GET_OPTIONAL_BOOL_PARAMETER(aParamName, aSection, aResult) GetCommandBoolParameter(aParamName, aSection, aResult,(TText8*) __FILE__, __LINE__, EFalse)
1.263 +
1.264 +#endif /* __T_FS_DATA_H__ */