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