|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Object to offer some common utility functions to Iptv engine testing* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32Base.h> |
|
22 #include "mmf/common/mmfcontrollerpluginresolver.h" |
|
23 #include "CIptvTestUtilities.h" |
|
24 #include "CIptvTestSMApiUtil.h" |
|
25 #include "CIptvTestMVApiUtil.h" |
|
26 #include "CIptvTestVCApiUtil.h" |
|
27 #include "CIptvTestVerifyData.h" |
|
28 #include "CIptvService.h" |
|
29 #include "TestUtilConnectionWaiter.h" |
|
30 #include "VCXTestLog.h" |
|
31 #include <tz.h> |
|
32 #include <badesca.h> |
|
33 |
|
34 #include "CIptvVodContentCategoryBriefDetails.h" |
|
35 #include "CIptvVodContentContentFullDetails.h" |
|
36 #include "CIptvVodContentContentBriefDetails.h" |
|
37 #include "CIptvMediaContent.h" |
|
38 #include "CIptvMyVideosVideoFullDetails.h" |
|
39 #include "CIptvTestVodContentAllDetails.h" |
|
40 |
|
41 #include "VCXTestCommon.h" |
|
42 |
|
43 // EXTERNAL DATA STRUCTURES |
|
44 |
|
45 // EXTERNAL FUNCTION PROTOTYPES |
|
46 |
|
47 // CONSTANTS |
|
48 |
|
49 // MACROS |
|
50 |
|
51 // LOCAL CONSTANTS AND MACROS |
|
52 const TUint32 KReservedSpaceForDriveCInPercentage(10); |
|
53 _LIT(KDummyfilePathFormat, "%S:\\data\\temp"); |
|
54 _LIT(KDummyfileFormat, "%d.dat"); |
|
55 _LIT(KDoubleBacklash, "\\"); |
|
56 |
|
57 // MODULE DATA STRUCTURES |
|
58 |
|
59 // LOCAL FUNCTION PROTOTYPES |
|
60 |
|
61 // FORWARD DECLARATIONS |
|
62 |
|
63 // ============================= LOCAL FUNCTIONS =============================== |
|
64 |
|
65 // ============================ MEMBER FUNCTIONS =============================== |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CIptvTestUtilities::CIptvTestUtilities |
|
69 // C++ default constructor can NOT contain any code, that |
|
70 // might leave. |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 CIptvTestUtilities::CIptvTestUtilities() |
|
74 { |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CIptvTestUtilities::ConstructL |
|
79 // Symbian 2nd phase constructor can leave. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void CIptvTestUtilities::ConstructL() |
|
83 { |
|
84 VCXLOGLO1(">>>CIptvTestUtilities::ConstructL"); |
|
85 |
|
86 User::LeaveIfError( iFs.Connect() ); |
|
87 |
|
88 PrintIaps(); |
|
89 |
|
90 iIptvTestSMApiUtil = CIptvTestSMApiUtil::NewL(); |
|
91 iIptvTestMVApiUtil = CIptvTestMVApiUtil::NewL(); |
|
92 iIptvTestVCApiUtil = CIptvTestVCApiUtil::NewL(); |
|
93 iIptvVerifyData = CIptvTestVerifyData::NewL(); |
|
94 |
|
95 iVideoCreator = CIptvTestVideoCreator::NewL(); |
|
96 |
|
97 iVcxCommon = CVCXTestCommon::NewL(); |
|
98 |
|
99 VCXLOGLO1("<<<CIptvTestUtilities::ConstructL"); |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CIptvServicesFromFile::NewL |
|
104 // Two-phased constructor. |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C CIptvTestUtilities* CIptvTestUtilities::NewL() |
|
108 { |
|
109 VCXLOGLO1(">>>CIptvTestUtilities::NewL"); |
|
110 CIptvTestUtilities* self = new( ELeave ) CIptvTestUtilities; |
|
111 |
|
112 CleanupStack::PushL( self ); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop(); |
|
115 VCXLOGLO1("<<<CIptvTestUtilities::NewL"); |
|
116 return self; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CIptvServicesFromFile::~CIptvTestUtilities |
|
121 // Destructor |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 CIptvTestUtilities::~CIptvTestUtilities() |
|
125 { |
|
126 VCXLOGLO1(">>>CIptvTestUtilities::~CIptvTestUtilities"); |
|
127 |
|
128 delete iIptvTestSMApiUtil; |
|
129 iIptvTestSMApiUtil=NULL; |
|
130 |
|
131 delete iIptvTestMVApiUtil; |
|
132 iIptvTestMVApiUtil=NULL; |
|
133 |
|
134 delete iIptvTestVCApiUtil; |
|
135 iIptvTestVCApiUtil = NULL; |
|
136 |
|
137 delete iIptvVerifyData; |
|
138 iIptvVerifyData = NULL; |
|
139 |
|
140 delete iVideoCreator; |
|
141 iVideoCreator = NULL; |
|
142 |
|
143 iFs.Close(); |
|
144 |
|
145 delete iVcxCommon; |
|
146 iVcxCommon = NULL; |
|
147 |
|
148 VCXLOGLO1("<<<CIptvTestUtilities::~CIptvTestUtilities"); |
|
149 } |
|
150 |
|
151 // ----------------------------------------------------------------------------- |
|
152 // CIptvTestUtilities::PrintIptvService() |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 EXPORT_C void CIptvTestUtilities::PrintIptvService(CIptvService *aIptvService) |
|
156 { |
|
157 VCXLOGLO1(">>>CIptvTestUtilities::PrintIptvService"); |
|
158 TUint8 i; |
|
159 |
|
160 VCXLOGLO1(""); |
|
161 VCXLOGLO1("---- CIptvService Print ----"); |
|
162 VCXLOGLO2("Service ID: %d", aIptvService->GetId()); |
|
163 VCXLOGLO2("Service groupID: %d", aIptvService->GetGroupId()); |
|
164 VCXLOGLO2("Service name: %S", &aIptvService->GetName()); |
|
165 VCXLOGLO2("Service address: %S", &aIptvService->GetAddress()); |
|
166 VCXLOGLO2("Service search url: %S", &aIptvService->SearchUrl()); |
|
167 VCXLOGLO2("Service icon path: %S", &aIptvService->GetIconPath()); |
|
168 VCXLOGLO2("Service EPG plugin UID: %x", aIptvService->GetEpgPluginUid()); |
|
169 VCXLOGLO2("Service VOD plugin UID: %x", aIptvService->GetVodPluginUid()); |
|
170 VCXLOGLO2("Service IPTV Plugin UID: %x", aIptvService->GetIptvPluginUid()); |
|
171 VCXLOGLO2("Service Type: %d", aIptvService->GetType()); |
|
172 VCXLOGLO2("Service provider id: %S", &aIptvService->GetProviderId()); |
|
173 VCXLOGLO2("Service account management url: %S", &aIptvService->GetAccountManagementUrl()); |
|
174 |
|
175 CIptvIapList& iapList = aIptvService->GetIapList(); |
|
176 //TIptvIapList iapList; |
|
177 //iapList.SetL(aIptvService->GetIapList()); |
|
178 |
|
179 TIptvIap iap; |
|
180 |
|
181 VCXLOGLO2("Service AP count: %d", iapList.Count()); |
|
182 |
|
183 for(i = 0; i < iapList.Count(); i++) |
|
184 { |
|
185 TInt err = iapList.GetIap(i, iap); |
|
186 VCXLOGLO2("GetIap ret: %d", err); |
|
187 VCXLOGLO4("AP %d: ID %d PRIO: %d", i, iap.iId, iap.iPriority); |
|
188 } |
|
189 |
|
190 VCXLOGLO2("Service user name: %S", &aIptvService->GetUserName()); |
|
191 VCXLOGLO2("Service password: %S", &aIptvService->GetPassword()); |
|
192 VCXLOGLO2("Service desc: %S", &aIptvService->GetDesc()); |
|
193 |
|
194 VCXLOGLO2("ESelected Flag = %d", aIptvService->GetFlags() & 1); |
|
195 VCXLOGLO2("EReadOnly Flag = %d", (aIptvService->GetFlags() & 2)>>1); |
|
196 VCXLOGLO2("EMainService Flag = %d", (aIptvService->GetFlags() & 4)>>2); |
|
197 VCXLOGLO2("EConnectionApproved Flag = %d", (aIptvService->GetFlags() & 8)>>3); |
|
198 |
|
199 VCXLOGLO2("Service application uid: %d", aIptvService->GetApplicationUid()); |
|
200 VCXLOGLO2("Service display order: %d", aIptvService->GetDisplayOrder()); |
|
201 |
|
202 |
|
203 TTime time = aIptvService->GetEpgUpdateTimeL(); |
|
204 |
|
205 _LIT(KDateTimeString,"%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%H%:1%T%:2%S%.%*C2%:3%-B"); |
|
206 TBuf<256> timeString; |
|
207 |
|
208 time.FormatL(timeString, KDateTimeString); |
|
209 VCXLOGLO2("Service EPG update: %S", &timeString); |
|
210 |
|
211 VCXLOGLO2("Service update time: %S", &timeString); |
|
212 |
|
213 TUint scheduleDlTime = aIptvService->ScheduleDlTime(); |
|
214 VCXLOGLO2("ScheduleDlTime: %d", scheduleDlTime); |
|
215 |
|
216 TUint scheduleDlType = aIptvService->ScheduleDlType(); |
|
217 VCXLOGLO2("ScheduleDlType: %d", scheduleDlType); |
|
218 |
|
219 TUint scheduleDlNetwork = aIptvService->ScheduleDlNetwork(); |
|
220 VCXLOGLO2("ScheduleDlNetwork: %d", scheduleDlNetwork); |
|
221 |
|
222 time = aIptvService->GetScheduledLastDownloadTime(); |
|
223 time.FormatL(timeString, KDateTimeString); |
|
224 VCXLOGLO2("Service scheduled last download time: %S", &timeString); |
|
225 |
|
226 |
|
227 VCXLOGLO1("<<<CIptvTestUtilities::PrintIptvService"); |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CIptvTestUtilities::PrintIptvService() |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 EXPORT_C void CIptvTestUtilities::WriteVerifyIptvService(TDes& aCaseId, CIptvService *aIptvService) |
|
235 { |
|
236 VCXLOGLO1(">>>CIptvTestUtilities::WriteVerifyIptvService"); |
|
237 TUint8 i; |
|
238 |
|
239 |
|
240 WriteVerifyData(aCaseId, _L("---- CIptvService Print ----")); |
|
241 WriteVerifyData(aCaseId, _L("----------------------------")); |
|
242 WriteVerifyData(aCaseId, _L("Service ID: %d"), aIptvService->GetId()); |
|
243 WriteVerifyData(aCaseId, _L("Service groupID: %d"), aIptvService->GetGroupId()); |
|
244 WriteVerifyData(aCaseId, _L("Service name: %S"), &aIptvService->GetName()); |
|
245 WriteVerifyData(aCaseId, _L("Service address: %S"), &aIptvService->GetAddress()); |
|
246 WriteVerifyData(aCaseId, _L("Service search url: %S"), &aIptvService->SearchUrl()); |
|
247 WriteVerifyData(aCaseId, _L("Service icon path: %S"), &aIptvService->GetIconPath()); |
|
248 WriteVerifyData(aCaseId, _L("Service EPG plugin UID: %x"), aIptvService->GetEpgPluginUid()); |
|
249 WriteVerifyData(aCaseId, _L("Service VOD plugin UID: %x"), aIptvService->GetVodPluginUid()); |
|
250 WriteVerifyData(aCaseId, _L("Service IPTV Plugin UID: %x"), aIptvService->GetIptvPluginUid()); |
|
251 WriteVerifyData(aCaseId, _L("Service Type: %d"), aIptvService->GetType()); |
|
252 WriteVerifyData(aCaseId, _L("Service provider id: %S"), &aIptvService->GetProviderId()); |
|
253 WriteVerifyData(aCaseId, _L("Service account management url: %S"), &aIptvService->GetAccountManagementUrl()); |
|
254 |
|
255 CIptvIapList& iapList = aIptvService->GetIapList(); |
|
256 //TIptvIapList iapList; |
|
257 //iapList.SetL(aIptvService->GetIapList()); |
|
258 |
|
259 TIptvIap iap; |
|
260 |
|
261 WriteVerifyData(aCaseId, _L("Service AP count: %d"), iapList.Count()); |
|
262 |
|
263 for(i = 0; i < iapList.Count(); i++) |
|
264 { |
|
265 iapList.GetIap(i, iap); |
|
266 WriteVerifyData(aCaseId, _L("AP %d: ID %d PRIO: %d"), i, iap.iId, iap.iPriority); |
|
267 } |
|
268 |
|
269 |
|
270 WriteVerifyData(aCaseId, _L("Service user name: %S"), &aIptvService->GetUserName()); |
|
271 WriteVerifyData(aCaseId, _L("Service password: %S"), &aIptvService->GetPassword()); |
|
272 WriteVerifyData(aCaseId, _L("Service desc: %S"), &aIptvService->GetDesc()); |
|
273 |
|
274 WriteVerifyData(aCaseId, _L("ESelected Flag = %d"), aIptvService->GetFlags() & 1); |
|
275 WriteVerifyData(aCaseId, _L("EReadOnly Flag = %d"), (aIptvService->GetFlags() & 2)>>1); |
|
276 WriteVerifyData(aCaseId, _L("EMainService Flag = %d"), (aIptvService->GetFlags() & 4)>>2); |
|
277 WriteVerifyData(aCaseId, _L("EConnectionApproved Flag = %d"), (aIptvService->GetFlags() & 8)>>3); |
|
278 |
|
279 WriteVerifyData(aCaseId, _L("Service application uid: %d"), aIptvService->GetApplicationUid()); |
|
280 WriteVerifyData(aCaseId, _L("Service display order: %d"), aIptvService->GetDisplayOrder()); |
|
281 |
|
282 WriteVerifyData(aCaseId, _L("---- CIptvService Print ----")); |
|
283 |
|
284 VCXLOGLO1("<<<CIptvTestUtilities::WriteVerifyIptvService"); |
|
285 } |
|
286 |
|
287 |
|
288 // ----------------------------------------------------------------------------- |
|
289 // CIptvTestUtilities::CreateIptvServiceInstanceL() |
|
290 // Creates CIptvServiceInstance from parameters |
|
291 // returns CIptvService* and the ownership is moved to caller |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 EXPORT_C CIptvService* CIptvTestUtilities::CreateIptvServiceInstanceL( |
|
295 CIptvServiceInfo& aService |
|
296 ) |
|
297 { |
|
298 |
|
299 VCXLOGLO1(">>>CIptvTestUtilities::CreateIptvServiceInstanceL"); |
|
300 CIptvService* iptvService = CIptvService::NewL(); |
|
301 |
|
302 TUint32 flags(0); |
|
303 |
|
304 TInt err = KErrNone; |
|
305 |
|
306 iptvService->SetId(0); //new id is generated anyways in DB, no matter what this is |
|
307 |
|
308 iptvService->SetName(aService.iName); |
|
309 |
|
310 iptvService->SetAddress(aService.iAddress); |
|
311 iptvService->SetIconPath(aService.iIconPath); |
|
312 |
|
313 iptvService->SetEpgPluginUid(aService.iEpgPluginUid); |
|
314 |
|
315 iptvService->SetVodPluginUid(aService.iVodPluginUid); |
|
316 |
|
317 iptvService->SetIptvPluginUid(aService.iIptvPluginUid); |
|
318 |
|
319 iptvService->SetType(aService.iServiceType); |
|
320 |
|
321 if(aService.iIapList) |
|
322 { |
|
323 err = iptvService->SetIapListL(*aService.iIapList); |
|
324 |
|
325 if(err != KErrNone) |
|
326 { |
|
327 delete iptvService; |
|
328 User::Leave(err); |
|
329 } |
|
330 } |
|
331 |
|
332 iptvService->SetUserName(aService.iUserName); |
|
333 iptvService->SetPassword(aService.iPassWord); |
|
334 |
|
335 iptvService->SetDesc(aService.iDesc); |
|
336 |
|
337 iptvService->SetProviderId(aService.iProviderId); |
|
338 |
|
339 iptvService->SetAccountManagementUrl(aService.iAccountManagementUrl); |
|
340 |
|
341 //flags |
|
342 if(aService.iSelectedFlag) |
|
343 { |
|
344 flags = flags | CIptvService::ESelected; |
|
345 } |
|
346 if(aService.iReadOnlyFlag) |
|
347 { |
|
348 flags = flags | CIptvService::EReadOnly; |
|
349 } |
|
350 if(aService.iMainServiceFlag) |
|
351 { |
|
352 flags = flags | CIptvService::EMainService; |
|
353 } |
|
354 if(aService.iConnectionApprovedFlag) |
|
355 { |
|
356 flags = flags | CIptvService::EConnectionApproved; |
|
357 } |
|
358 |
|
359 iptvService->SetFlags(flags); |
|
360 |
|
361 iptvService->SetApplicationUid(aService.iApplicationUid); |
|
362 |
|
363 iptvService->SetDisplayOrder(aService.iDisplayOrder); |
|
364 |
|
365 |
|
366 VCXLOGLO1("<<<CIptvTestUtilities::CreateIptvServiceInstanceL"); |
|
367 return iptvService; |
|
368 } |
|
369 // ----------------------------------------------------------------------------- |
|
370 // CIptvTestUtilities::VerifyServices |
|
371 // Creates CIptvServiceInstance from parameters |
|
372 // returns TRUE if services are equal, othervise false |
|
373 // ----------------------------------------------------------------------------- |
|
374 // |
|
375 EXPORT_C TBool CIptvTestUtilities::VerifyServices(CIptvService& aS1, CIptvService& aS2) |
|
376 { |
|
377 VCXLOGLO1(">>>CIptvTestUtilities::VerifyServices"); |
|
378 TBool rv(TRUE); |
|
379 TUint8 i(0); |
|
380 |
|
381 VCXLOGLO3("Comparing services: ID: %d - %d", aS1.GetId(), aS2.GetId()); |
|
382 VCXLOGLO3(" - Name: %S - %S", &aS1.GetName(), &aS2.GetName() ); |
|
383 |
|
384 //ids can't be verified now |
|
385 /*if(aS1.GetId() != aS2.GetId()) |
|
386 { |
|
387 rv = FALSE; |
|
388 VCXLOGLO3("Id doesn't match: id1 = %d, id2 = %d", aS1.GetId(), aS2.GetId() ); |
|
389 }*/ |
|
390 |
|
391 if(aS1.GetName() != aS2.GetName()) |
|
392 { |
|
393 rv = FALSE; |
|
394 VCXLOGLO3("Name doesn't match: name1 = %S, name2 = %S",&aS1.GetName(),&aS2.GetName()); |
|
395 } |
|
396 |
|
397 if(aS1.GetAddress() != aS2.GetAddress()) |
|
398 { |
|
399 rv = FALSE; |
|
400 VCXLOGLO3("Address doesn't match: address1 = %S, address2 = %S",&aS1.GetAddress(),&aS2.GetAddress()); |
|
401 } |
|
402 |
|
403 if(aS1.GetIconPath() != aS2.GetIconPath()) |
|
404 { |
|
405 rv = FALSE; |
|
406 VCXLOGLO3("IconPath doesn't match: IconPath1 = %S, IconPath2 = %S",&aS1.GetIconPath(),&aS2.GetIconPath()); |
|
407 } |
|
408 |
|
409 if(aS1.GetEpgPluginUid() != aS2.GetEpgPluginUid()) |
|
410 { |
|
411 rv = FALSE; |
|
412 VCXLOGLO3("EpgPluginUid doesn't match: EpgPluginUid1 = %d, EpgPluginUid2 = %d",aS1.GetEpgPluginUid(),aS2.GetEpgPluginUid()); |
|
413 } |
|
414 |
|
415 if(aS1.GetVodPluginUid() != aS2.GetVodPluginUid()) |
|
416 { |
|
417 rv = FALSE; |
|
418 VCXLOGLO3("VodPluginUid doesn't match: VodPluginUid1 = %d, VodPluginUid2 = %d",aS1.GetVodPluginUid(),aS2.GetVodPluginUid()); |
|
419 } |
|
420 |
|
421 if(aS1.GetIptvPluginUid() != aS2.GetIptvPluginUid()) |
|
422 { |
|
423 rv = FALSE; |
|
424 VCXLOGLO3("IptvPluginUid doesn't match: IptvPluginUid1 = %d, IptvPluginUid2 = %d",aS1.GetIptvPluginUid(),aS2.GetIptvPluginUid()); |
|
425 } |
|
426 |
|
427 if(aS1.GetType() != aS2.GetType()) |
|
428 { |
|
429 rv = FALSE; |
|
430 VCXLOGLO3("Type doesn't match: Type1 = %d Type2 = %d", aS1.GetType(), aS2.GetType()); |
|
431 } |
|
432 |
|
433 //iaplist |
|
434 //TIptvIapList iapListS1; |
|
435 //TIptvIapList iapListS2; |
|
436 CIptvIapList& iapListS1 = aS1.GetIapList(); |
|
437 CIptvIapList& iapListS2 = aS2.GetIapList(); |
|
438 TIptvIap iapS1; |
|
439 TIptvIap iapS2; |
|
440 |
|
441 // iapListS1 = aS1.GetIapList(); |
|
442 //iapListS2 = aS2.GetIapList(); |
|
443 |
|
444 if(iapListS1.Count() != iapListS2.Count()) |
|
445 { |
|
446 rv = FALSE; |
|
447 VCXLOGLO3("Count of iaps doesn't match: Service1 = %d Service2 = %d", iapListS1.Count(), iapListS2.Count()); |
|
448 } |
|
449 |
|
450 if(rv) // Same Count of iaps |
|
451 { |
|
452 for(i = 0; i < iapListS1.Count(); i++) |
|
453 { |
|
454 TInt err = iapListS1.GetIap(i, iapS1); |
|
455 VCXLOGLO2("GetIap ret: %d", err); |
|
456 User::LeaveIfError(err); |
|
457 |
|
458 err = iapListS2.GetIap(i, iapS2); |
|
459 VCXLOGLO2("GetIap ret: %d", err); |
|
460 User::LeaveIfError(err); |
|
461 |
|
462 if(iapS1.iId != iapS2.iId || iapS1.iPriority != iapS2.iPriority) |
|
463 { |
|
464 rv = FALSE; |
|
465 VCXLOGLO2("AP %d doesn't match", i); |
|
466 } |
|
467 } |
|
468 } |
|
469 |
|
470 if(aS1.GetUserName() != aS2.GetUserName()) |
|
471 { |
|
472 rv = FALSE; |
|
473 VCXLOGLO3("UserName doesn't match: UserName1 = %S, UserName2 = %S",&aS1.GetUserName() ,&aS2.GetUserName()); |
|
474 } |
|
475 |
|
476 if(aS1.GetPassword() != aS2.GetPassword()) |
|
477 { |
|
478 rv = FALSE; |
|
479 VCXLOGLO3("Password doesn't match:Password1 = %S, Password2 = %S",&aS1.GetPassword() ,&aS2.GetPassword()); |
|
480 } |
|
481 |
|
482 if(aS1.GetDesc() != aS2.GetDesc()) |
|
483 { |
|
484 rv = FALSE; |
|
485 VCXLOGLO3("Desription doesn't match: Desription1 = %S, Desription2 = %S",&aS1.GetDesc() ,&aS2.GetDesc()); |
|
486 } |
|
487 |
|
488 if(aS1.GetFlags() != aS2.GetFlags()) |
|
489 { |
|
490 rv = FALSE; |
|
491 VCXLOGLO3("Flags doesn't match: 0x%x & 0x%x", aS1.GetFlags(), aS2.GetFlags() ); |
|
492 |
|
493 VCXLOGLO1("Service1 flags: "); |
|
494 if(aS1.GetFlags() & CIptvService::ESelected) |
|
495 { |
|
496 VCXLOGLO1("ESelected"); |
|
497 } |
|
498 if(aS1.GetFlags() & CIptvService::EReadOnly) |
|
499 { |
|
500 VCXLOGLO1("EReadOnly"); |
|
501 } |
|
502 if(aS1.GetFlags() & CIptvService::EMainService) |
|
503 { |
|
504 VCXLOGLO1("EMainService"); |
|
505 } |
|
506 if(aS1.GetFlags() & CIptvService::EConnectionApproved) |
|
507 { |
|
508 VCXLOGLO1("EConnectionApproved"); |
|
509 } |
|
510 if(aS1.GetFlags() & CIptvService::EReadOnlyIaps) |
|
511 { |
|
512 VCXLOGLO1("EReadOnlyIaps"); |
|
513 } |
|
514 |
|
515 VCXLOGLO1("Service2 flags: "); |
|
516 if(aS2.GetFlags() & CIptvService::ESelected) |
|
517 { |
|
518 VCXLOGLO1("ESelected"); |
|
519 } |
|
520 if(aS2.GetFlags() & CIptvService::EReadOnly) |
|
521 { |
|
522 VCXLOGLO1("EReadOnly"); |
|
523 } |
|
524 if(aS2.GetFlags() & CIptvService::EMainService) |
|
525 { |
|
526 VCXLOGLO1("EMainService"); |
|
527 } |
|
528 if(aS2.GetFlags() & CIptvService::EConnectionApproved) |
|
529 { |
|
530 VCXLOGLO1("EConnectionApproved"); |
|
531 } |
|
532 if(aS2.GetFlags() & CIptvService::EReadOnlyIaps) |
|
533 { |
|
534 VCXLOGLO1("EReadOnlyIaps"); |
|
535 } |
|
536 |
|
537 } |
|
538 |
|
539 if(aS1.GetApplicationUid() != aS2.GetApplicationUid()) |
|
540 { |
|
541 rv = FALSE; |
|
542 VCXLOGLO1("Application uid doesn't match"); |
|
543 } |
|
544 |
|
545 /*if(aS1.GetDisplayOrder() != aS2.GetDisplayOrder()) |
|
546 { |
|
547 rv = FALSE; |
|
548 VCXLOGLO1("Display order doesn't match"); |
|
549 } |
|
550 */ |
|
551 if(aS1.GetProviderId() != aS2.GetProviderId()) |
|
552 { |
|
553 rv = FALSE; |
|
554 VCXLOGLO3("Provider id doesn't match: id1 = %S, id2 = %S", &aS1.GetProviderId(), &aS2.GetProviderId()); |
|
555 } |
|
556 |
|
557 if(aS1.GetAccountManagementUrl() != aS2.GetAccountManagementUrl()) |
|
558 { |
|
559 rv = FALSE; |
|
560 VCXLOGLO3("AccountManagementUrl doesn't match: url1 = %S, url2 = %S", &aS1.GetAccountManagementUrl(), &aS2.GetAccountManagementUrl()); |
|
561 } |
|
562 |
|
563 VCXLOGLO2("<<<CIptvTestUtilities::VerifyServices returns %d", rv); |
|
564 return rv; |
|
565 } |
|
566 |
|
567 // ----------------------------------------------------------------------------- |
|
568 // CIptvTestUtilities::GetServiceFromDb |
|
569 // Creates CIptvServiceInstance from parameters |
|
570 // returns pointer to service if succeeded, otherwise NULL |
|
571 // ----------------------------------------------------------------------------- |
|
572 // |
|
573 EXPORT_C CIptvService* CIptvTestUtilities::GetServiceFromDb(TInt aId) |
|
574 { |
|
575 return iIptvTestSMApiUtil->GetServiceFromDb(aId); |
|
576 } |
|
577 |
|
578 // ----------------------------------------------------------------------------- |
|
579 // CIptvTestUtilities::GetIapNameById |
|
580 // Gets iap name by id |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 EXPORT_C TBool CIptvTestUtilities::GetIapNameById(TDes& aIapName, TUint32 aIapId) |
|
584 { |
|
585 return iVcxCommon->GetIapNameById( aIapName, aIapId ); |
|
586 } |
|
587 |
|
588 // ----------------------------------------------------------------------------- |
|
589 // CIptvTestUtilities::PrintIaps |
|
590 // ----------------------------------------------------------------------------- |
|
591 // |
|
592 EXPORT_C void CIptvTestUtilities::PrintIaps() |
|
593 { |
|
594 iVcxCommon->PrintIaps(); |
|
595 } |
|
596 |
|
597 // ----------------------------------------------------------------------------- |
|
598 // CIptvTestUtilities::GetIapIdL |
|
599 // ----------------------------------------------------------------------------- |
|
600 // |
|
601 EXPORT_C TBool CIptvTestUtilities::GetIapIdL(const TDesC& aIapName, TUint32& aIapId) |
|
602 { |
|
603 return iVcxCommon->GetIapIdL( aIapName, aIapId ); |
|
604 } |
|
605 |
|
606 // ----------------------------------------------------------------------------- |
|
607 // CIptvTestUtilities::GetIapIdByNameL |
|
608 // ----------------------------------------------------------------------------- |
|
609 // |
|
610 EXPORT_C TBool CIptvTestUtilities::GetIapIdByNameL(const TDesC& aIapName, TUint32& aIapId) |
|
611 { |
|
612 return iVcxCommon->GetIapIdByNameL( aIapName, aIapId ); |
|
613 } |
|
614 |
|
615 // ----------------------------------------------------------------------------- |
|
616 // CIptvTestUtilities::GetIapIdByTypeL |
|
617 // ----------------------------------------------------------------------------- |
|
618 // |
|
619 EXPORT_C TBool CIptvTestUtilities::GetIapIdByTypeL(CVCXTestCommon::TIptvTestIapType aType, TUint32& aIapId, TInt aOrderNumber) |
|
620 { |
|
621 return iVcxCommon->GetIapIdByTypeL( aType, aIapId, aOrderNumber ); |
|
622 } |
|
623 |
|
624 // ----------------------------------------------------------------------------- |
|
625 // CIptvTestUtilities::GetUsedIap |
|
626 // ----------------------------------------------------------------------------- |
|
627 // |
|
628 EXPORT_C TBool CIptvTestUtilities::GetUsedIap(TUint32 aServiceId, TUint32& aIapId,TDes& aIapName) |
|
629 { |
|
630 VCXLOGLO1(">>>CIptvTestUtilities::GetUsedIap"); |
|
631 TBool rv = TRUE; |
|
632 |
|
633 rv = iIptvTestSMApiUtil->GetUsedIap(aServiceId, aIapId, aIapName); |
|
634 |
|
635 VCXLOGLO1("<<<CIptvTestUtilities::GetUsedIap"); |
|
636 return rv; |
|
637 } |
|
638 |
|
639 // ----------------------------------------------------------------------------- |
|
640 // CIptvTestUtilities::GetVideoInfo |
|
641 // ----------------------------------------------------------------------------- |
|
642 // |
|
643 TBool CIptvTestUtilities::GetVideoInfo(CIptvMyVideosGlobalFileId& aFileId, TUint32& aServiceId, TDes& aVideoName,TDes& aFileName) |
|
644 { |
|
645 VCXLOGLO1(">>>CIptvTestUtilities::GetVideoInfo"); |
|
646 TBool rv = FALSE; |
|
647 |
|
648 rv = iIptvTestMVApiUtil->GetVideoInfo(aFileId,aServiceId,aVideoName,aFileName); |
|
649 |
|
650 VCXLOGLO1("<<<CIptvTestUtilities::GetVideoInfo"); |
|
651 return rv; |
|
652 } |
|
653 |
|
654 // ----------------------------------------------------------------------------- |
|
655 // CIptvTestUtilities::GetFileSize |
|
656 // ----------------------------------------------------------------------------- |
|
657 // |
|
658 EXPORT_C TBool CIptvTestUtilities::GetFileSize(TDesC& aFullPath, TUint32& aFileSize) |
|
659 { |
|
660 return iVcxCommon->GetFileSize( aFullPath, aFileSize ); |
|
661 } |
|
662 |
|
663 // ----------------------------------------------------------------------------- |
|
664 // CIptvTestUtilities::GetContentIdsL |
|
665 // returns all content ids from service |
|
666 // ----------------------------------------------------------------------------- |
|
667 // |
|
668 EXPORT_C TBool CIptvTestUtilities::GetContentIdsL(TIptvServiceId aServiceId, TUint32 aIapId, RArray<TIptvContentId>& aContentIdArray, TUint32 aMaxSize, TUint32 aMaxPlaytime) |
|
669 { |
|
670 VCXLOGLO1(">>>CIptvTestUtilities::GetContentIdsL"); |
|
671 TBool rv = iIptvTestVCApiUtil->GetContentIdsL(aServiceId, aIapId, aContentIdArray, aMaxSize, aMaxPlaytime); |
|
672 VCXLOGLO1("<<<CIptvTestUtilities::GetContentIdsL"); |
|
673 return rv; |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CIptvTestUtilities::GetServicesFromDbL |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 EXPORT_C TBool CIptvTestUtilities::GetServicesFromDbL(RPointerArray<CIptvService>& aServicesArray, TUint32 aFlagsFilter, CIptvServiceManagementClient::TOrder aOrder) |
|
681 { |
|
682 VCXLOGLO1(">>>CIptvTestUtilities::GetServicesFromDbL"); |
|
683 TBool rv = iIptvTestSMApiUtil->GetServicesFromDbL(aServicesArray, aFlagsFilter, aOrder); |
|
684 VCXLOGLO1("<<<CIptvTestUtilities::GetServicesFromDbL"); |
|
685 return rv; |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CIptvTestUtilities::GetServicesFromDbL |
|
690 // ----------------------------------------------------------------------------- |
|
691 // |
|
692 EXPORT_C TBool CIptvTestUtilities::GetServicesFromDbL(RPointerArray<CIptvService>& aServicesArray) |
|
693 { |
|
694 VCXLOGLO1(">>>CIptvTestUtilities::GetServicesFromDbL"); |
|
695 TBool rv = iIptvTestSMApiUtil->GetServicesFromDbL(aServicesArray); |
|
696 VCXLOGLO1("<<<CIptvTestUtilities::GetServicesFromDbL"); |
|
697 return rv; |
|
698 } |
|
699 |
|
700 // ----------------------------------------------------------------------------- |
|
701 // CIptvTestUtilities::GetServiceIdByNameL |
|
702 // ----------------------------------------------------------------------------- |
|
703 // |
|
704 EXPORT_C TInt CIptvTestUtilities::GetServiceIdByNameL(TDesC& aServiceName, TInt& aId) |
|
705 { |
|
706 VCXLOGLO1(">>>CIptvTestUtilities::GetServiceIdByNameL"); |
|
707 |
|
708 RPointerArray<CIptvService> services; |
|
709 |
|
710 CleanupResetAndDestroyPushL(services); |
|
711 |
|
712 aId = -1; |
|
713 |
|
714 TInt rv = KErrNone; |
|
715 |
|
716 if( GetServicesFromDbL(services) ) |
|
717 { |
|
718 TInt i; |
|
719 // Newest are back |
|
720 for(i=services.Count()-1; i>= 0; i--) |
|
721 { |
|
722 if(services[i]->GetName() == aServiceName) |
|
723 { |
|
724 aId = services[i]->GetId(); |
|
725 break; |
|
726 } |
|
727 } |
|
728 if( services.Count() == 0 ) |
|
729 { |
|
730 VCXLOGLO1("Service count 0"); |
|
731 rv = KErrNotFound; |
|
732 } |
|
733 } |
|
734 else |
|
735 { |
|
736 VCXLOGLO1("GetServicesFromDbL failed."); |
|
737 rv = KErrGeneral; |
|
738 } |
|
739 |
|
740 CleanupStack::PopAndDestroy(&services); |
|
741 |
|
742 VCXLOGLO1("<<<CIptvTestUtilities::GetServiceIdByNameL"); |
|
743 return rv; |
|
744 } |
|
745 |
|
746 // ----------------------------------------------------------------------------- |
|
747 // CIptvTestVerifyData::CreateVerifyData |
|
748 // ----------------------------------------------------------------------------- |
|
749 // |
|
750 EXPORT_C TInt CIptvTestUtilities::CreateVerifyData(TDesC& aVerifyId, TBool aAppend) |
|
751 { |
|
752 return iVcxCommon->CreateVerifyData( aVerifyId, aAppend ); |
|
753 } |
|
754 |
|
755 // ----------------------------------------------------------------------------- |
|
756 // CIptvTestVerifyData::WriteVerifyData |
|
757 // ----------------------------------------------------------------------------- |
|
758 // |
|
759 EXPORT_C TInt CIptvTestUtilities::WriteVerifyData(TDesC& aVerifyId, TDesC& aVerifyData) |
|
760 { |
|
761 return iVcxCommon->WriteVerifyData( aVerifyId, aVerifyData ); |
|
762 } |
|
763 |
|
764 // ----------------------------------------------------------------------------- |
|
765 // CIptvTestVerifyData::WriteVerifyData |
|
766 // ----------------------------------------------------------------------------- |
|
767 // |
|
768 EXPORT_C TInt CIptvTestUtilities::WriteVerifyData(TDesC& aVerifyId, TRefByValue<const TDesC> aFmt, ... ) |
|
769 { |
|
770 //VCXLOGLO1(">>>CIptvTestUtilities::WriteVerifyData(formatted)"); |
|
771 |
|
772 VA_LIST argptr; //pointer to argument list |
|
773 VA_START( argptr, aFmt ); |
|
774 |
|
775 HBufC* str; |
|
776 str = HBufC::NewLC(1024*3); |
|
777 |
|
778 str->Des().FormatList(aFmt, argptr); |
|
779 |
|
780 TInt result = KErrNone; |
|
781 TRAPD(err, result = iVcxCommon->WriteVerifyData(aVerifyId, *str)); |
|
782 |
|
783 CleanupStack::PopAndDestroy(str); |
|
784 |
|
785 if(err != KErrNone) |
|
786 { |
|
787 VCXLOGLO2("iVcxCommon::WriteVerifyDataL caused a leave. %d", err); |
|
788 result = err; |
|
789 } |
|
790 |
|
791 //VCXLOGLO1("<<<CIptvTestUtilities::WriteVerifyData(formatted)"); |
|
792 return result; |
|
793 } |
|
794 |
|
795 // ----------------------------------------------------------------------------- |
|
796 // CIptvTestVerifyData::VerifyData |
|
797 // ----------------------------------------------------------------------------- |
|
798 // |
|
799 EXPORT_C TInt CIptvTestUtilities::VerifyData(TDesC& aVerifyId, CIptvTestVerifyData::TVerifyResult& aVerifyResult) |
|
800 { |
|
801 return iVcxCommon->VerifyData( aVerifyId, aVerifyResult ); |
|
802 } |
|
803 |
|
804 // ----------------------------------------------------------------------------- |
|
805 // CIptvTestVerifyData::VerifyData |
|
806 // ----------------------------------------------------------------------------- |
|
807 // |
|
808 EXPORT_C void CIptvTestUtilities::EnableVerifyTimestamps( TBool aUseTimestamps ) |
|
809 { |
|
810 iVcxCommon->EnableVerifyTimestamps( aUseTimestamps ); |
|
811 } |
|
812 |
|
813 // ----------------------------------------------------------------------------- |
|
814 // CIptvTestUtilities::GetVodContentContentDetailsL |
|
815 // ----------------------------------------------------------------------------- |
|
816 // |
|
817 EXPORT_C TInt CIptvTestUtilities::GetVodContentContentDetailsL(TUint32 aServiceId, TUint32 aContentId, CIptvVodContentContentFullDetails& aContentDetails) |
|
818 { |
|
819 return iIptvTestVCApiUtil->GetVodContentContentDetailsL(aServiceId, aContentId, aContentDetails); |
|
820 } |
|
821 |
|
822 // ----------------------------------------------------------------------------- |
|
823 // CIptvTestUtilities::GetVodEcgCategoryListL |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 EXPORT_C void CIptvTestUtilities::GetVodEcgCategoryListL(TUint32 aServiceId, TUint32 aParentCategoryId, RPointerArray<CIptvVodContentCategoryBriefDetails>& aCategoryList) |
|
827 { |
|
828 iIptvTestVCApiUtil->GetEcgCategoryListL( aServiceId, aParentCategoryId, aCategoryList ); |
|
829 } |
|
830 |
|
831 // ----------------------------------------------------------------------------- |
|
832 // CIptvTestUtilities::GetVodEcgListL |
|
833 // ----------------------------------------------------------------------------- |
|
834 // |
|
835 EXPORT_C void CIptvTestUtilities::GetVodEcgListL(TUint32 aServiceId, TUint32 aCategoryId, RPointerArray<CIptvVodContentContentBriefDetails>& aEcgList) |
|
836 { |
|
837 iIptvTestVCApiUtil->GetEcgListL( aServiceId, aCategoryId, aEcgList ); |
|
838 } |
|
839 |
|
840 // ----------------------------------------------------------------------------- |
|
841 // CIptvTestUtilities::GetVodContentAllDetailsListL |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 EXPORT_C void CIptvTestUtilities::GetVodContentAllDetailsListL( TUint32 aServiceId, RPointerArray<CIptvTestVodContentAllDetails>& aDetailsList ) |
|
845 { |
|
846 iIptvTestVCApiUtil->GetVodContentAllDetailsListL( aServiceId, aDetailsList ); |
|
847 } |
|
848 |
|
849 // ----------------------------------------------------------------------------- |
|
850 // CIptvTestUtilities::GetContentAccessListL |
|
851 // ----------------------------------------------------------------------------- |
|
852 // |
|
853 EXPORT_C TInt CIptvTestUtilities::GetContentAccessListL(TUint32 aServiceId, TUint32 aContentId, RPointerArray<CIptvMediaContent>& aCAList) |
|
854 { |
|
855 return iIptvTestVCApiUtil->GetContentAccessListL(aServiceId, aContentId, aCAList); |
|
856 } |
|
857 |
|
858 // ----------------------------------------------------------------------------- |
|
859 // CIptvTestUtilities::GetMyVideosVideoDetailsL |
|
860 // ----------------------------------------------------------------------------- |
|
861 // |
|
862 EXPORT_C TInt CIptvTestUtilities::GetMyVideosVideoDetailsL(CIptvMyVideosGlobalFileId& aFileId, CIptvMyVideosVideoFullDetails& aVideoDetails) |
|
863 { |
|
864 return iIptvTestMVApiUtil->GetMyVideosVideoDetailsL(aFileId, aVideoDetails); |
|
865 } |
|
866 |
|
867 // ----------------------------------------------------------------------------- |
|
868 // CIptvTestUtilities::CreateBadIapL |
|
869 // Creates a not working, crappy iap with given name. |
|
870 // Use with caution, because there is no easy way of removing created iaps |
|
871 // |
|
872 // @param aName name of the iap to be created |
|
873 // @return iapId new iap's id. |
|
874 // ----------------------------------------------------------------------------- |
|
875 // |
|
876 EXPORT_C TUint32 CIptvTestUtilities::CreateBadIapL(TDesC& aName) |
|
877 { |
|
878 return iVcxCommon->CreateBadIapL( aName ); |
|
879 } |
|
880 |
|
881 // ----------------------------------------------------------------------------- |
|
882 // CIptvTestUtilities::ReallycleanL() |
|
883 // Clean up MyVideos |
|
884 // ----------------------------------------------------------------------------- |
|
885 // |
|
886 EXPORT_C TInt CIptvTestUtilities::ReallycleanL() |
|
887 { |
|
888 return iIptvTestMVApiUtil->ReallycleanL(); |
|
889 } |
|
890 |
|
891 // ----------------------------------------------------------------------------- |
|
892 // CIptvTestUtilities::DeleteVideoL() |
|
893 // Delete specified video, calls directly |
|
894 // ----------------------------------------------------------------------------- |
|
895 // |
|
896 EXPORT_C TInt CIptvTestUtilities::DeleteVideoL(CIptvMyVideosGlobalFileId& aFileId) |
|
897 { |
|
898 return iIptvTestMVApiUtil->DeleteVideoL(aFileId); |
|
899 } |
|
900 |
|
901 // ----------------------------------------------------------------------------- |
|
902 // CIptvTestUtilities::ParseIntFromString |
|
903 // ----------------------------------------------------------------------------- |
|
904 EXPORT_C TInt CIptvTestUtilities::ParseIntFromString(TInt& aInt, TDesC& aString) |
|
905 { |
|
906 VCXLOGLO1(">>>CIptvTestUtilities::ParseIntFromString"); |
|
907 |
|
908 TLex lex(aString); |
|
909 TInt err = lex.Val(aInt); |
|
910 |
|
911 VCXLOGLO1("<<<CIptvTestUtilities::ParseIntFromString"); |
|
912 return err; |
|
913 } |
|
914 |
|
915 // ----------------------------------------------------------------------------- |
|
916 // CIptvTestUtilities::AdvanceSystemTime1Second |
|
917 // ----------------------------------------------------------------------------- |
|
918 // |
|
919 EXPORT_C TInt CIptvTestUtilities::AdvanceSystemTime1Second() |
|
920 { |
|
921 VCXLOGLO1(">>>CIptvTestUtilities::AdvanceSystemTime1Second"); |
|
922 |
|
923 TTime now; |
|
924 now.HomeTime(); |
|
925 |
|
926 TTimeIntervalSeconds second(1); |
|
927 now += second; |
|
928 |
|
929 TInt err = CIptvTestUtilities::SetSystemTime(now); |
|
930 |
|
931 VCXLOGLO1("<<<CIptvTestUtilities::AdvanceSystemTime1Second"); |
|
932 |
|
933 return err; |
|
934 } |
|
935 |
|
936 // ----------------------------------------------------------------------------- |
|
937 // CIptvTestUtilities::SetSystemTime() |
|
938 // ----------------------------------------------------------------------------- |
|
939 // |
|
940 EXPORT_C TInt CIptvTestUtilities::SetSystemTime(TTime aTime) |
|
941 { |
|
942 VCXLOGLO1(">>>CIptvTestUtilities::SetSystemTime"); |
|
943 |
|
944 TTime noDST(aTime); |
|
945 RTz tz; |
|
946 TInt err = tz.Connect(); |
|
947 if(err != KErrNone) |
|
948 { |
|
949 VCXLOGLO2("RTz::Connect failed: %d", err); |
|
950 VCXLOGLO1("<<<CIptvTestUtilities::SetSystemTime"); |
|
951 return err; |
|
952 } |
|
953 CleanupClosePushL(tz); |
|
954 err = tz.SetHomeTime(noDST); |
|
955 if(err != KErrNone) |
|
956 { |
|
957 VCXLOGLO2("RTz::SetHomeTime failed: %d", err); |
|
958 VCXLOGLO1("<<<CIptvTestUtilities::SetSystemTime"); |
|
959 CleanupStack::PopAndDestroy(&tz); |
|
960 return err; |
|
961 } |
|
962 |
|
963 CleanupStack::PopAndDestroy(&tz); |
|
964 |
|
965 VCXLOGLO1("<<<CIptvTestUtilities::SetSystemTime"); |
|
966 |
|
967 return err; |
|
968 } |
|
969 |
|
970 // ----------------------------------------------------------------------------- |
|
971 // CIptvTestUtilities::SetTimeZone() |
|
972 // ----------------------------------------------------------------------------- |
|
973 // |
|
974 EXPORT_C TInt CIptvTestUtilities::SetTimeZone(TDesC& aTimeZone) |
|
975 { |
|
976 VCXLOGLO1(">>>CIptvTestUtilities::SetTimeZone"); |
|
977 |
|
978 RTz tz; |
|
979 TInt err = tz.Connect(); |
|
980 if(err != KErrNone) |
|
981 { |
|
982 VCXLOGLO2("RTz::Connect failed: %d", err); |
|
983 VCXLOGLO1("<<<CIptvTestUtilities::SetTimeZone"); |
|
984 return err; |
|
985 } |
|
986 CleanupClosePushL(tz); |
|
987 |
|
988 TBuf8<256> timezone; |
|
989 timezone.Copy( aTimeZone ); // Conversion |
|
990 |
|
991 CTzId* tzId = CTzId::NewL( timezone ); |
|
992 CleanupStack::PushL(tzId); |
|
993 |
|
994 TRAP(err, tz.SetTimeZoneL( *tzId ) ); |
|
995 CleanupStack::PopAndDestroy(tzId); |
|
996 CleanupStack::PopAndDestroy(&tz); |
|
997 |
|
998 if(err != KErrNone) |
|
999 { |
|
1000 VCXLOGLO2("RTz::SetTimeZone failed: %d", err); |
|
1001 VCXLOGLO1("<<<CIptvTestUtilities::SetTimeZone"); |
|
1002 return err; |
|
1003 } |
|
1004 |
|
1005 VCXLOGLO1("<<<CIptvTestUtilities::SetTimeZone"); |
|
1006 |
|
1007 return err; |
|
1008 } |
|
1009 |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // CIptvTestUtilities::SetUsedIap() |
|
1012 // |
|
1013 // Sets default iap for a service, and set connecting allowed for the iap. |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // |
|
1016 EXPORT_C TInt CIptvTestUtilities::SetUsedIap(TUint32 aServiceId, TUint32 aIapId) |
|
1017 { |
|
1018 VCXLOGLO1(">>>CIptvTestUtilities::SetUsedIap"); |
|
1019 |
|
1020 TInt err = iIptvTestSMApiUtil->SetUsedIap(aServiceId, aIapId); |
|
1021 |
|
1022 VCXLOGLO1("<<<CIptvTestUtilities::SetUsedIap"); |
|
1023 return err; |
|
1024 } |
|
1025 |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // CIptvTestUtilities::CreateVideoFileL() |
|
1028 // |
|
1029 // Creates a video file to file system. |
|
1030 // ----------------------------------------------------------------------------- |
|
1031 // |
|
1032 EXPORT_C void CIptvTestUtilities::CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aVideoType, TDesC& aFileName, TInt aSize ) |
|
1033 { |
|
1034 VCXLOGLO1(">>>CIptvTestUtilities::CreateVideoFileL"); |
|
1035 iVideoCreator->CreateVideoL( aVideoType, aFileName, aSize ); |
|
1036 VCXLOGLO1("<<<CIptvTestUtilities::CreateVideoFileL"); |
|
1037 } |
|
1038 |
|
1039 // ----------------------------------------------------------------------------- |
|
1040 // CIptvTestUtilities::CreateVideoFilesL() |
|
1041 // ----------------------------------------------------------------------------- |
|
1042 // |
|
1043 EXPORT_C void CIptvTestUtilities::CreateVideoFilesL( CIptvTestVideoCreator::TIptvTestVideoType aVideoType, TDesC& aFileName, TInt aCount, RPointerArray<HBufC>& aFileArray ) |
|
1044 { |
|
1045 VCXLOGLO1(">>>CIptvTestUtilities::CreateVideoFilesL"); |
|
1046 iVideoCreator->CreateVideosL( aVideoType, aFileName, aCount, aFileArray ); |
|
1047 VCXLOGLO1("<<<CIptvTestUtilities::CreateVideoFilesL"); |
|
1048 } |
|
1049 |
|
1050 // ----------------------------------------------------------------------------- |
|
1051 // CIptvTestUtilities::SetDriveFreeSpaceL() |
|
1052 // ----------------------------------------------------------------------------- |
|
1053 // |
|
1054 EXPORT_C void CIptvTestUtilities::SetDriveFreeSpaceL( TInt aDriveNumber, TUint aDesiredFreeSpace ) |
|
1055 { |
|
1056 |
|
1057 VCXLOGLO1(">>>CIptvTestUtilities::SetDriveFreeSpaceL"); |
|
1058 |
|
1059 const TInt KIptvTest1KB = 1024; |
|
1060 const TInt KIptvTest1MB = KIptvTest1KB*KIptvTest1KB; |
|
1061 |
|
1062 DeleteDummyFilesL( aDriveNumber ); |
|
1063 |
|
1064 #ifdef __WINSCW__ |
|
1065 // We don't want to fill the windows disk |
|
1066 if(aDriveNumber == EDriveC) |
|
1067 { |
|
1068 VCXLOGLO1("<<<CIptvTestUtilities::SetDriveFreeSpaceL"); |
|
1069 return; |
|
1070 } |
|
1071 #endif |
|
1072 |
|
1073 TInt64 spaceToReserve = 0; |
|
1074 TInt64 freeSpace = 0; |
|
1075 TInt64 usableSpace = 0; |
|
1076 CalculateSpaceToReserveL(iFs, aDriveNumber, aDesiredFreeSpace, spaceToReserve, freeSpace, usableSpace); |
|
1077 if( spaceToReserve <= 0 ) |
|
1078 { |
|
1079 VCXLOGLO1("CIptvTestUtilities:: Already less than wanted space."); |
|
1080 VCXLOGLO1("<<<CIptvTestUtilities::SetDriveFreeSpaceL"); |
|
1081 return; |
|
1082 } |
|
1083 |
|
1084 TChar driveLetter; |
|
1085 RFs::DriveToChar( aDriveNumber, driveLetter ); |
|
1086 |
|
1087 TBuf<KIptvMaxPath> path; |
|
1088 path.Format(KDummyfilePathFormat, &driveLetter); |
|
1089 path.Append(KDoubleBacklash); |
|
1090 |
|
1091 BaflUtils::EnsurePathExistsL(iFs, path); |
|
1092 |
|
1093 // Create files of 256 MB size. |
|
1094 TInt64 dummyFileSize = 256 * KIptvTest1MB; |
|
1095 TInt count = 0; |
|
1096 for( ; spaceToReserve > 0; spaceToReserve -= (dummyFileSize) ) |
|
1097 { |
|
1098 // Check that there's still enough free space for the dummyfile |
|
1099 TInt64 newSpaceToReserve = 0; |
|
1100 CalculateSpaceToReserveL(iFs, aDriveNumber, aDesiredFreeSpace, newSpaceToReserve, freeSpace, usableSpace); |
|
1101 if( newSpaceToReserve <= 0 ) |
|
1102 { |
|
1103 VCXLOGLO1("CIptvTestUtilities:: Nothing to reserve anymore."); |
|
1104 break; |
|
1105 } |
|
1106 |
|
1107 // Not enough space. Start using 1 MB dummy files, or fill the memory at once if there's less than 1 MB free |
|
1108 if(dummyFileSize >= usableSpace) |
|
1109 { |
|
1110 dummyFileSize = KIptvTest1MB; |
|
1111 spaceToReserve = newSpaceToReserve; |
|
1112 |
|
1113 // If there's still not enough space, fill all at once and leave the loop |
|
1114 if(dummyFileSize >= usableSpace) |
|
1115 { |
|
1116 dummyFileSize = newSpaceToReserve; |
|
1117 spaceToReserve = 0; |
|
1118 } |
|
1119 } |
|
1120 |
|
1121 TBuf<256> filePath(path); |
|
1122 TInt64 fileSize = dummyFileSize; |
|
1123 RFile file; |
|
1124 |
|
1125 count++; |
|
1126 filePath.AppendFormat(KDummyfileFormat, count); |
|
1127 VCXLOGLO3("Creating %Ld b dummyfile to '%S'", fileSize, &filePath); |
|
1128 TInt err = file.Replace(iFs, filePath, EFileWrite); |
|
1129 if(err != KErrNone) |
|
1130 { |
|
1131 VCXLOGLO2("file.Replace fail: %d", err); |
|
1132 } |
|
1133 User::LeaveIfError(err); |
|
1134 err = file.SetSize(fileSize); |
|
1135 if(err != KErrNone) |
|
1136 { |
|
1137 VCXLOGLO2("file.SetSize fail: %d", err); |
|
1138 } |
|
1139 User::LeaveIfError(err); |
|
1140 file.Close(); |
|
1141 } |
|
1142 |
|
1143 VCXLOGLO1("<<<CIptvTestUtilities::SetDriveFreeSpaceL"); |
|
1144 } |
|
1145 |
|
1146 // ----------------------------------------------------------------------------- |
|
1147 // CIptvTestUtilities::CalculateSpaceToReserve |
|
1148 // ----------------------------------------------------------------------------- |
|
1149 // |
|
1150 void CIptvTestUtilities::CalculateSpaceToReserveL( RFs &aFs, TInt aDriveNumber, TInt aDesiredSpace, TInt64& aSpaceToReserve, TInt64& aDriveFreeSpace, TInt64& aUsableSpace ) |
|
1151 { |
|
1152 TVolumeInfo volumeInfo; |
|
1153 User::LeaveIfError(aFs.Volume(volumeInfo, aDriveNumber)); |
|
1154 |
|
1155 TInt reservedPercentage = 0; |
|
1156 if(aDriveNumber == EDriveC) |
|
1157 { |
|
1158 reservedPercentage = KReservedSpaceForDriveCInPercentage; |
|
1159 } |
|
1160 TInt64 driveSize = volumeInfo.iSize; |
|
1161 TInt64 reservedSpace = driveSize / 100 * reservedPercentage; |
|
1162 |
|
1163 aDriveFreeSpace = volumeInfo.iFree; |
|
1164 aUsableSpace = aDriveFreeSpace - reservedSpace; |
|
1165 |
|
1166 aSpaceToReserve = aUsableSpace - aDesiredSpace; |
|
1167 |
|
1168 // Have to leave little space, else setting filesize will fail. |
|
1169 if(aDesiredSpace < 1024*5 && aDriveNumber != EDriveC) |
|
1170 { |
|
1171 aSpaceToReserve -= (1024*5 - aDesiredSpace); |
|
1172 } |
|
1173 |
|
1174 VCXLOGLO2("CIptvTestUtilities: driveSize = %Ld", driveSize); |
|
1175 VCXLOGLO2("CIptvTestUtilities: reservedSpace = %Ld", reservedSpace); |
|
1176 VCXLOGLO2("CIptvTestUtilities: freeSpace = %Ld", aDriveFreeSpace); |
|
1177 VCXLOGLO2("CIptvTestUtilities: usableSpace = %Ld", aUsableSpace); |
|
1178 VCXLOGLO2("CIptvTestUtilities: desiredSpace = %d", aDesiredSpace); |
|
1179 VCXLOGLO2("CIptvTestUtilities: spaceToReserve = %Ld", aSpaceToReserve); |
|
1180 |
|
1181 if (aDesiredSpace > aUsableSpace) |
|
1182 { |
|
1183 aSpaceToReserve = 0; |
|
1184 VCXLOGLO1("CIptvTestUtilities:: Disk has less space than wanted to set free!"); |
|
1185 } |
|
1186 } |
|
1187 |
|
1188 // ----------------------------------------------------------------------------- |
|
1189 // CIptvTestUtilities::DeleteDummyFilesL() |
|
1190 // ----------------------------------------------------------------------------- |
|
1191 // |
|
1192 EXPORT_C void CIptvTestUtilities::DeleteDummyFilesL( TInt aDriveNumber ) |
|
1193 { |
|
1194 VCXLOGLO1(">>>CIptvTestUtilities::DeleteDummyFilesL"); |
|
1195 |
|
1196 CFileMan* fileMan = CFileMan::NewL(iFs); |
|
1197 CleanupStack::PushL(fileMan); |
|
1198 |
|
1199 TBuf<3> driveLetter; |
|
1200 TChar driveChar; |
|
1201 RFs::DriveToChar( aDriveNumber, driveChar ); |
|
1202 driveLetter.Append(driveChar); |
|
1203 |
|
1204 TBuf<KIptvMaxPath>path; |
|
1205 |
|
1206 path.Format( KDummyfilePathFormat, &driveLetter ); |
|
1207 path.Append(KDoubleBacklash); |
|
1208 fileMan->RmDir(path); |
|
1209 |
|
1210 CleanupStack::PopAndDestroy(fileMan); |
|
1211 |
|
1212 VCXLOGLO1("<<<CIptvTestUtilities::DeleteDummyFilesL"); |
|
1213 } |
|
1214 |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // CIptvTestUtilities::EnsureFileIsNotInUse() |
|
1217 // ----------------------------------------------------------------------------- |
|
1218 // |
|
1219 EXPORT_C TInt CIptvTestUtilities::EnsureFileIsNotInUse( const TPtrC& aFileName ) |
|
1220 { |
|
1221 TInt error( KErrNone ); |
|
1222 RFile file; |
|
1223 // MDS or someone else could have the file in exclusive use. Try 5 times in 1 second intervals. |
|
1224 for(TInt retry = 0; retry < 5; retry++) |
|
1225 { |
|
1226 error = file.Open(iFs, aFileName, EFileShareExclusive); |
|
1227 if(error == KErrInUse) |
|
1228 { |
|
1229 User::After(1000000); |
|
1230 } |
|
1231 else |
|
1232 { |
|
1233 break; |
|
1234 } |
|
1235 } |
|
1236 |
|
1237 file.Close(); |
|
1238 VCXLOGLO2("CIptvTestUtilities::EnsureFileIsNotInUse: %d", error); |
|
1239 return error; |
|
1240 } |
|
1241 |
|
1242 // ----------------------------------------------------------------------------- |
|
1243 // CIptvTestUtilities::RefreshService(TUint32 aServiceId, TTime aLastDownloadTime) |
|
1244 // |
|
1245 // Loads old service, creates a new duplicate and finally delete old. |
|
1246 // ----------------------------------------------------------------------------- |
|
1247 // |
|
1248 EXPORT_C TInt CIptvTestUtilities::RefreshService(TUint32 aServiceId, TTime aLastDownloadTime) |
|
1249 { |
|
1250 VCXLOGLO1(">>>CIptvTestUtilities::RefreshService"); |
|
1251 |
|
1252 TInt err = iIptvTestSMApiUtil->RefreshService(aServiceId, aLastDownloadTime); |
|
1253 |
|
1254 VCXLOGLO1("<<<CIptvTestUtilities::RefreshService"); |
|
1255 return err; |
|
1256 } |
|
1257 |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // CIptvServiceInfo::NewL() |
|
1260 // ----------------------------------------------------------------------------- |
|
1261 EXPORT_C CIptvServiceInfo* CIptvServiceInfo::NewL() |
|
1262 { |
|
1263 VCXLOGLO1(">>>CIptvServiceInfo::NewL"); |
|
1264 CIptvServiceInfo* self = new( ELeave ) CIptvServiceInfo; |
|
1265 |
|
1266 CleanupStack::PushL( self ); |
|
1267 self->ConstructL(NULL); |
|
1268 CleanupStack::Pop(); |
|
1269 VCXLOGLO1("<<<CIptvServiceInfo::NewL"); |
|
1270 return self; |
|
1271 } |
|
1272 |
|
1273 // ----------------------------------------------------------------------------- |
|
1274 // CIptvServiceInfo::NewL() |
|
1275 // ----------------------------------------------------------------------------- |
|
1276 EXPORT_C CIptvServiceInfo* CIptvServiceInfo::NewL(CIptvServiceInfo& aServiceInfo) |
|
1277 { |
|
1278 VCXLOGLO1(">>>CIptvServiceInfo::NewL"); |
|
1279 CIptvServiceInfo* self = new( ELeave ) CIptvServiceInfo; |
|
1280 |
|
1281 CleanupStack::PushL( self ); |
|
1282 self->ConstructL(&aServiceInfo); |
|
1283 |
|
1284 |
|
1285 |
|
1286 CleanupStack::Pop(); |
|
1287 VCXLOGLO1("<<<CIptvServiceInfo::NewL"); |
|
1288 return self; |
|
1289 } |
|
1290 |
|
1291 // ----------------------------------------------------------------------------- |
|
1292 // CIptvServiceInfo::NewL() |
|
1293 // ----------------------------------------------------------------------------- |
|
1294 EXPORT_C CIptvServiceInfo::~CIptvServiceInfo() |
|
1295 { |
|
1296 if(iIapList) |
|
1297 { |
|
1298 delete iIapList; |
|
1299 iIapList = NULL; |
|
1300 } |
|
1301 } |
|
1302 |
|
1303 // ----------------------------------------------------------------------------- |
|
1304 // CIptvServiceInfo::CIptvServiceInfo() |
|
1305 // ----------------------------------------------------------------------------- |
|
1306 CIptvServiceInfo::CIptvServiceInfo() |
|
1307 { |
|
1308 |
|
1309 } |
|
1310 |
|
1311 // ----------------------------------------------------------------------------- |
|
1312 // CIptvServiceInfo::ConstructL() |
|
1313 // ----------------------------------------------------------------------------- |
|
1314 void CIptvServiceInfo::ConstructL(CIptvServiceInfo* aServiceInfo) |
|
1315 { |
|
1316 if(aServiceInfo) |
|
1317 { |
|
1318 iId = aServiceInfo->iId; |
|
1319 iName = aServiceInfo->iName; |
|
1320 iAddress = aServiceInfo->iAddress; |
|
1321 iIconPath = aServiceInfo->iIconPath; |
|
1322 iEpgPluginUid = aServiceInfo->iEpgPluginUid; |
|
1323 iVodPluginUid = aServiceInfo->iVodPluginUid; |
|
1324 iIptvPluginUid = aServiceInfo->iIptvPluginUid; |
|
1325 iServiceType = aServiceInfo->iServiceType; |
|
1326 |
|
1327 if(aServiceInfo->iIapList) |
|
1328 { |
|
1329 CIptvIapList* iapList = CIptvIapList::NewL(); |
|
1330 CleanupStack::PushL(iapList); |
|
1331 |
|
1332 for(TInt i=0; i<aServiceInfo->iIapList->Count(); i++) |
|
1333 { |
|
1334 TIptvIap iap; |
|
1335 User::LeaveIfError( aServiceInfo->iIapList->GetIap(i, iap) ); |
|
1336 iapList->AddIap(iap); |
|
1337 } |
|
1338 |
|
1339 iIapList = iapList; |
|
1340 |
|
1341 CleanupStack::Pop(iapList); |
|
1342 } |
|
1343 |
|
1344 iUserName = aServiceInfo->iUserName; |
|
1345 iPassWord = aServiceInfo->iPassWord; |
|
1346 iDesc = aServiceInfo->iDesc; |
|
1347 iSelectedFlag = aServiceInfo->iSelectedFlag; |
|
1348 iReadOnlyFlag = aServiceInfo->iReadOnlyFlag; |
|
1349 iMainServiceFlag = aServiceInfo->iMainServiceFlag; |
|
1350 iConnectionApprovedFlag = aServiceInfo->iConnectionApprovedFlag; |
|
1351 iApplicationUid = aServiceInfo->iApplicationUid; |
|
1352 iDisplayOrder = aServiceInfo->iDisplayOrder; |
|
1353 iProviderId = aServiceInfo->iProviderId; |
|
1354 iAccountManagementUrl = aServiceInfo->iAccountManagementUrl; |
|
1355 } |
|
1356 } |
|
1357 |
|
1358 // End of File |