|
1 /* |
|
2 * Copyright (c) 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 the License "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 #ifndef CVCXTestCommon_H |
|
21 #define CVCXTestCommon_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "CIptvTestVerifyData.h" |
|
25 #include "MTestUtilConnectionObserver.h" |
|
26 #include "CIptvTestVideoCreator.h" |
|
27 #include "VCXTestConstants.h" |
|
28 |
|
29 // MACROS |
|
30 // FORWARD DECLARATIONS |
|
31 |
|
32 // DATA TYPES |
|
33 |
|
34 // FUNCTION PROTOTYPES |
|
35 |
|
36 // CLASS DECLARATION |
|
37 |
|
38 /** |
|
39 * This class should have no depencies to any Video Center release! |
|
40 * Add functionality with depencies to IptvTestUtility. |
|
41 * |
|
42 * @since |
|
43 */ |
|
44 class CVCXTestCommon : public CBase, public MTestUtilConnectionObserver |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 enum TIptvTestIapType |
|
49 { |
|
50 EWlanIap, // Any WLAN AP |
|
51 EGprsIap, // Any GPRS AP |
|
52 }; |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 IMPORT_C static CVCXTestCommon* NewL(); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 virtual ~CVCXTestCommon(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Gets size of a file. |
|
68 * @since |
|
69 * @param |
|
70 */ |
|
71 IMPORT_C TBool GetFileSize(TDesC& aFullPath, TUint32& aFileSize); |
|
72 |
|
73 /** |
|
74 * Searches AP by name. |
|
75 * First searches if there's IAP matchin for the name. After that following rules are used: |
|
76 * If name is Internet tries to find first GPRS AP, Internet2 second GPRS AP |
|
77 * If name is Wlan tries to find first WLAN AP, Wlan2 second WLAN AP |
|
78 * If AP is not found returns on of the known APs, if one is found. |
|
79 */ |
|
80 IMPORT_C TBool GetIapIdL(const TDesC& aIapName, TUint32& aIapId); |
|
81 |
|
82 /** |
|
83 * Searches AP by name. |
|
84 */ |
|
85 IMPORT_C TBool GetIapIdByNameL(const TDesC& aIapName, TUint32& aIapId); |
|
86 |
|
87 /** |
|
88 * Searches for AP as defined in TIptvTestIapType. In emulator always returns "Ethernet with Daemon Dynamic IP" |
|
89 * @since |
|
90 * @param aType AP type which is wanted |
|
91 * @param aIapId id of found AP is written here |
|
92 * @param aOrderNumber return nTh AP of the specified type |
|
93 * @return KErrNotFound if no AP with the type is found, KErrNone if no errors, |
|
94 */ |
|
95 IMPORT_C TInt GetIapIdByTypeL(TIptvTestIapType aType, TUint32& aIapId, TInt aOrderNumber); |
|
96 |
|
97 /** |
|
98 * Returns a name of AP. |
|
99 */ |
|
100 IMPORT_C TBool GetIapNameById(TDes& aIapName, TUint32 aIapId); |
|
101 |
|
102 /** |
|
103 * Prints APs in COMMDB into debug output. |
|
104 */ |
|
105 IMPORT_C void PrintIaps(); |
|
106 |
|
107 /** |
|
108 * Initializes the verify file, deletes if the file exists |
|
109 * @since |
|
110 * @param aVerifyId An id to identify the file where verify data is written |
|
111 * @return Error code, KErrNone if no errors, |
|
112 */ |
|
113 IMPORT_C TInt CreateVerifyData(TDesC& aVerifyId, TBool aAppend); |
|
114 |
|
115 /** |
|
116 * Writes verify data to a file |
|
117 * @since |
|
118 * @param aVerifyId An id to identify the file where verify data is written |
|
119 * @param aVerifyData Data to write into the file |
|
120 * @return Error code, KErrNone if no errors, |
|
121 */ |
|
122 IMPORT_C TInt WriteVerifyData(TDesC& aVerifyId, TDesC& aVerifyData); |
|
123 |
|
124 /** |
|
125 * Writes verify data to a file |
|
126 * @since |
|
127 * @param aVerifyId An id to identify the file where verify data is written |
|
128 * @param aVerifyData Data to write into the file |
|
129 * @return Error code, KErrNone if no errors, |
|
130 */ |
|
131 IMPORT_C TInt WriteVerifyData(TDesC& aVerifyId, TRefByValue<const TDesC> aFmt, ... ); |
|
132 |
|
133 /** |
|
134 * |
|
135 * @since |
|
136 * @param aVerifyId An id to identify the files which are compared |
|
137 * @param aVerifyResult Result is written here |
|
138 * @return Error code, KErrNone if no errors, |
|
139 */ |
|
140 IMPORT_C TInt VerifyData(TDesC& aVerifyId, CIptvTestVerifyData::TVerifyResult& aVerifyResult); |
|
141 |
|
142 /** |
|
143 * Enables timestamp writing into the verify file. |
|
144 * @since |
|
145 * @param aUseTimestamps |
|
146 */ |
|
147 IMPORT_C void EnableVerifyTimestamps( TBool aUseTimestamps ); |
|
148 |
|
149 /** |
|
150 * Converts string to integer. |
|
151 * @param aInt parsed int is stored here |
|
152 * @param aString string containing the number |
|
153 * @return KErrNone if succeed, otherwise an error code |
|
154 */ |
|
155 IMPORT_C static TInt ParseIntFromString(TInt& aInt, TDesC& aString); |
|
156 |
|
157 /** |
|
158 * Creates bad iap for testing purposes |
|
159 * @param aName name of the iap to be created |
|
160 */ |
|
161 IMPORT_C TUint32 CreateBadIapL(TDesC& aName); |
|
162 |
|
163 /** |
|
164 * static TInt AdvanceSystemTimeSeconds(); |
|
165 * @return KErrNone if succeed, otherwise an error code |
|
166 */ |
|
167 IMPORT_C static TInt AdvanceSystemTimeSeconds( TInt aCount ); |
|
168 |
|
169 /** |
|
170 * static TInt AdvanceSystemTimeMinutes(); |
|
171 * @return KErrNone if succeed, otherwise an error code |
|
172 */ |
|
173 IMPORT_C static TInt AdvanceSystemTimeMinutes( TInt aCount ); |
|
174 |
|
175 /** |
|
176 * static TInt AdvanceSystemTimeHours(); |
|
177 * @return KErrNone if succeed, otherwise an error code |
|
178 */ |
|
179 IMPORT_C static TInt AdvanceSystemTimeHours( TInt aCount ); |
|
180 |
|
181 /** |
|
182 * static TInt SetSystemTime(); |
|
183 * @return KErrNone if succeed, otherwise an error code |
|
184 */ |
|
185 IMPORT_C static TInt SetSystemTime(TTime aTime); |
|
186 |
|
187 /** |
|
188 * static TInt SetTimeZone(); |
|
189 * @return KErrNone if succeed, otherwise an error code |
|
190 */ |
|
191 IMPORT_C static TInt SetTimeZone(TDesC& aTimeZone); |
|
192 |
|
193 /* |
|
194 * Creates a video file to the system. |
|
195 */ |
|
196 IMPORT_C void CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aVideoType, TDesC& aFileName, TInt aSize ); |
|
197 |
|
198 /* |
|
199 * Creates video files to the system. |
|
200 */ |
|
201 IMPORT_C void CreateVideoFilesL( CIptvTestVideoCreator::TIptvTestVideoType aVideoType, TDesC& aFileName, TInt aCount, RPointerArray<HBufC>& aFileArray ); |
|
202 |
|
203 /* |
|
204 * Sets free space for a drive. |
|
205 */ |
|
206 IMPORT_C void SetDriveFreeSpaceL( TInt aDriveNumber, TUint aDesiredFreeSpace ); |
|
207 |
|
208 /** |
|
209 * Deletes files created by SetDriveFreeSpaceL. Should be called by any test module which |
|
210 * has reserved disk space. |
|
211 */ |
|
212 IMPORT_C void DeleteDummyFilesL( TInt aDriveNumber ); |
|
213 |
|
214 /* |
|
215 * Returns KErrNone if file is not in use. |
|
216 */ |
|
217 IMPORT_C TInt EnsureFileIsNotInUse( const TPtrC& aFileName ); |
|
218 |
|
219 /* |
|
220 * CalculateSpaceToReserveL |
|
221 */ |
|
222 void CalculateSpaceToReserveL( RFs &aFs, TInt aDriveNumber, TInt aDesiredSpace, TInt64& aSpaceToReserve ); |
|
223 |
|
224 /** |
|
225 * PrintDriveInfo |
|
226 */ |
|
227 void PrintDriveInfo( const TPtrC& aDriveLetter ); |
|
228 |
|
229 /** |
|
230 * ListDir |
|
231 */ |
|
232 IMPORT_C TInt ListDir( const TDesC& aDir, TInt aLevel ); |
|
233 |
|
234 /** |
|
235 * Reads integer from P&S. |
|
236 * @return KErrNone if succeed, otherwise an error code |
|
237 */ |
|
238 IMPORT_C static TInt GetPSProperty( const TUid aCategory, const TUint aKey, TInt& aValue ); |
|
239 |
|
240 /** |
|
241 * Writes integer to P&S. |
|
242 * @return KErrNone if succeed, otherwise an error code |
|
243 */ |
|
244 IMPORT_C static TInt SetPSProperty( const TUid aCategory, const TUint aKey, const TInt aValue ); |
|
245 |
|
246 /** |
|
247 * Reads descriptor from P&S. |
|
248 * @return KErrNone if succeed, otherwise an error code |
|
249 */ |
|
250 IMPORT_C static TInt GetPSProperty( const TUid aCategory, const TUint aKey, TDes& aValue ); |
|
251 |
|
252 /** |
|
253 * Writes descriptor to P&S. |
|
254 * @return KErrNone if succeed, otherwise an error code |
|
255 */ |
|
256 IMPORT_C static TInt SetPSProperty( const TUid aCategory, const TUint aKey, const TDesC& aValue ); |
|
257 |
|
258 /** |
|
259 * Prints open files in the file session and which thread / process is keeping the files open. |
|
260 * @param aFs file session, for example CCoeEnv::Static()->FsSession() as param is good idea. |
|
261 */ |
|
262 IMPORT_C static void ListFilesProcessesAndThreadsL( RFs &aFs ); |
|
263 |
|
264 public: // From base classes |
|
265 |
|
266 void ConnectionCreated() {}; |
|
267 void ConnectionClosed() {}; |
|
268 void ConnectionFailed() {}; |
|
269 void ConnectionAlreadyExists() {}; |
|
270 void ConnectionTimeout() {}; |
|
271 |
|
272 private: |
|
273 |
|
274 /** |
|
275 * C++ default constructor. |
|
276 */ |
|
277 CVCXTestCommon(); |
|
278 |
|
279 /** |
|
280 * By default Symbian 2nd phase constructor is private. |
|
281 */ |
|
282 void ConstructL(); |
|
283 |
|
284 private: // Data |
|
285 CIptvTestVerifyData* iIptvVerifyData; |
|
286 CIptvTestVideoCreator* iVideoCreator; |
|
287 RFs iFs; |
|
288 }; |
|
289 |
|
290 |
|
291 #endif // CVCXTestCommon_H |
|
292 |
|
293 // End of File |