|
1 /* |
|
2 * Copyright (c) 2005 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 |
|
21 // INCLUDE FILES |
|
22 #include "CIptvServiceManagementSync.h" |
|
23 #include "CIptvServiceManagementClient.h" |
|
24 #include "CIptvTestUtilities.h" |
|
25 #include "CIptvService.h" |
|
26 #include "VCXTestLog.h" |
|
27 #include "CIptvTestTimer.h" |
|
28 #include "CIptvTestActiveWait.h" |
|
29 |
|
30 #include <f32file.h> |
|
31 #include <S32FILE.H> |
|
32 #include <BAUTILS.H> |
|
33 //#include <CIptvSmEvent.h> |
|
34 |
|
35 // ========================= MEMBER FUNCTIONS ================================== |
|
36 |
|
37 // ----------------------------------------------------------------------------- |
|
38 // CIptvServiceManagementSync::NewL() |
|
39 // Two-phased constructor. |
|
40 // ----------------------------------------------------------------------------- |
|
41 CIptvServiceManagementSync* CIptvServiceManagementSync::NewL() |
|
42 { |
|
43 VCXLOGLO1(">>>CIptvServiceManagementSync::NewL"); |
|
44 CIptvServiceManagementSync* self = new (ELeave) CIptvServiceManagementSync; |
|
45 |
|
46 CleanupStack::PushL( self ); |
|
47 self->ConstructL(); |
|
48 |
|
49 CleanupStack::Pop(); |
|
50 VCXLOGLO1("<<<CIptvServiceManagementSync::NewL"); |
|
51 return( self ) ; |
|
52 } |
|
53 |
|
54 // ----------------------------------------------------------------------------- |
|
55 // CIptvServiceManagementSync::ConstructL() |
|
56 // Symbian 2nd phase constructor can leave. |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 void CIptvServiceManagementSync::ConstructL() |
|
60 { |
|
61 VCXLOGLO1(">>>CIptvServiceManagementSync::ConstructL"); |
|
62 |
|
63 iActiveWait = CIptvTestActiveWait::NewL(); |
|
64 |
|
65 iIptvTestTimer = CIptvTestTimer::NewL( *this, 0 ); |
|
66 |
|
67 iIptvServiceManagementClient = CIptvServiceManagementClient::NewL(*this); |
|
68 |
|
69 TRAPD(err, iIptvTestUtilities = CIptvTestUtilities::NewL() ); |
|
70 if(err != KErrNone) |
|
71 { |
|
72 VCXLOGLO1("CIptvServiceManagementSync:: ** FAIL ** Creating CIptvTestUtilities failed! Leaving."); |
|
73 User::Leave(KErrGeneral); |
|
74 } |
|
75 |
|
76 |
|
77 VCXLOGLO1("<<<CIptvServiceManagementSync::ConstructL"); |
|
78 } |
|
79 |
|
80 // ----------------------------------------------------------------------------- |
|
81 // CIptvServiceManagementSync::CIptvServiceManagementSync() |
|
82 // C++ default constructor can NOT contain any code, that might leave. |
|
83 // ----------------------------------------------------------------------------- |
|
84 CIptvServiceManagementSync::CIptvServiceManagementSync() |
|
85 { |
|
86 VCXLOGLO1(">>>CIptvServiceManagementSync::CIptvServiceManagementSync"); |
|
87 |
|
88 VCXLOGLO1("<<<CIptvServiceManagementSync::CIptvServiceManagementSync"); |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CIptvServiceManagementSync::~CIptvServiceManagementSync() |
|
93 // Destructor. |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 CIptvServiceManagementSync::~CIptvServiceManagementSync() |
|
97 { |
|
98 VCXLOGLO1(">>>~CIptvServiceManagementSync()"); |
|
99 |
|
100 if(iServicesArray) |
|
101 { |
|
102 iServicesArray->Reset(); |
|
103 delete iServicesArray; |
|
104 iServicesArray = NULL; |
|
105 } |
|
106 |
|
107 delete iIptvServiceManagementClient; |
|
108 iIptvServiceManagementClient = NULL; |
|
109 |
|
110 delete iIptvTestTimer; |
|
111 iIptvTestTimer = NULL; |
|
112 |
|
113 delete iIptvTestUtilities; |
|
114 iIptvTestUtilities = NULL; |
|
115 |
|
116 delete iActiveWait; |
|
117 iActiveWait = NULL; |
|
118 |
|
119 VCXLOGLO1("<<<~CIptvServiceManagementSync()"); |
|
120 } |
|
121 |
|
122 // ----------------------------------------------------------------------------- |
|
123 // CIptvServiceManagementSync::CallAddService(TIptvSmTestConnection aConn, CIptvService& aService); |
|
124 // Adds a service to Service data base. |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 TRespStatus CIptvServiceManagementSync::CallAddService(TIptvSmTestConnection aConn, CIptvService& aService) |
|
128 { |
|
129 VCXLOGLO1(">>>CIptvServiceManagementSync::CallAddService()"); |
|
130 |
|
131 TInt err = KErrNone, err2 = KErrNone; |
|
132 |
|
133 err = PrepareForRequest(); |
|
134 if(err != KErrNone) |
|
135 { |
|
136 VCXLOGLO1("<<<CIptvServiceManagementSync::CallAddService."); |
|
137 return EGeneralError; |
|
138 } |
|
139 |
|
140 if(aConn == EIptvSmTestAsync) |
|
141 { |
|
142 VCXLOGLO1("Async service request"); |
|
143 |
|
144 while(iRequestRepeatCount-- > 0) |
|
145 { |
|
146 SetExpectedSmEvent(CIptvSmEvent::EServiceAdded, 1); |
|
147 |
|
148 TInt retryCount = 5; |
|
149 |
|
150 while(retryCount-- > 0) |
|
151 { |
|
152 TRAP(err2, err = iIptvServiceManagementClient->AddServiceReqL(aService) ); |
|
153 |
|
154 if(err2 == KErrNone && err == KErrNotReady) |
|
155 { |
|
156 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
157 iIptvTestTimer->After(1 * 1000000); |
|
158 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
159 } |
|
160 else |
|
161 { |
|
162 break; // request succeeded or there's an error |
|
163 } |
|
164 } |
|
165 |
|
166 if(err2 != KErrNone) |
|
167 { |
|
168 VCXLOGLO2("AddServiceReqL caused a leave: %d", err2); |
|
169 VCXLOGLO1("<<<CIptvServiceManagementSync::CallAddService"); |
|
170 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
171 return EGeneralError; |
|
172 } |
|
173 if(err != KErrNone) |
|
174 { |
|
175 VCXLOGLO2("AddServiceReqL returned error: %d", err); |
|
176 VCXLOGLO1("<<<CIptvServiceManagementSync::CallAddService"); |
|
177 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
178 return EGeneralError; |
|
179 } |
|
180 } |
|
181 |
|
182 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
183 { |
|
184 iIptvServiceManagementClient->CancelRequest(); |
|
185 VCXLOGLO1("Canceling request to server."); |
|
186 } |
|
187 else |
|
188 { |
|
189 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
190 if(WaitForSmEvent() != KErrNone) |
|
191 { |
|
192 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
193 } |
|
194 } |
|
195 } |
|
196 else |
|
197 { |
|
198 VCXLOGLO1("Sync service request"); |
|
199 TRespStatus rv = ESucceeded; |
|
200 |
|
201 while(iRequestRepeatCount-- > 0) |
|
202 { |
|
203 SetExpectedSmEvent(CIptvSmEvent::EServiceAdded, 1); |
|
204 |
|
205 TInt retryCount = 5; |
|
206 |
|
207 while(retryCount-- > 0) |
|
208 { |
|
209 TRAP(err2, err = iIptvServiceManagementClient->AddServiceL(aService, rv) ); |
|
210 |
|
211 if(err2 == KErrNone && err == KErrNotReady) |
|
212 { |
|
213 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
214 iIptvTestTimer->After(1 * 1000000); |
|
215 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
216 } |
|
217 else |
|
218 { |
|
219 break; // request succeeded or there's an error |
|
220 } |
|
221 } |
|
222 |
|
223 if(err2 != KErrNone) |
|
224 { |
|
225 VCXLOGLO2("AddServiceL caused a leave: %d", err2); |
|
226 rv = EGeneralError; |
|
227 } |
|
228 else |
|
229 if(err != KErrNone) |
|
230 { |
|
231 VCXLOGLO2("AddServiceL returned error: %d", err); |
|
232 rv = EGeneralError; |
|
233 } |
|
234 else |
|
235 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
236 { |
|
237 VCXLOGLO2("AddServiceL response error: %d", rv); |
|
238 } |
|
239 else |
|
240 if(WaitForSmEvent() != KErrNone) |
|
241 { |
|
242 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
243 } |
|
244 } |
|
245 |
|
246 iSyncReturnValue = rv; |
|
247 } |
|
248 |
|
249 FinishRequest(); |
|
250 |
|
251 VCXLOGLO1("<<<CIptvServiceManagementSync::CallAddService"); |
|
252 return iSyncReturnValue; |
|
253 } |
|
254 |
|
255 // ----------------------------------------------------------------------------- |
|
256 // CIptvServiceManagementSync::UpdateServiceReq() |
|
257 // Updates a service to Service data base. |
|
258 // ----------------------------------------------------------------------------- |
|
259 // |
|
260 TRespStatus CIptvServiceManagementSync::CallUpdateService(TIptvSmTestConnection aConn, CIptvService& aService, CIptvSmEvent::TEvent aExpectedEvent) |
|
261 { |
|
262 VCXLOGLO1(">>>CIptvServiceManagementSync::CallUpdateService()"); |
|
263 |
|
264 TInt err = KErrNone, err2 = KErrNone; |
|
265 |
|
266 err = PrepareForRequest(); |
|
267 if(err != KErrNone) |
|
268 { |
|
269 VCXLOGLO1("<<<CIptvServiceManagementSync::CallUpdateService."); |
|
270 return EGeneralError; |
|
271 } |
|
272 |
|
273 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
274 |
|
275 if(aConn == EIptvSmTestAsync) |
|
276 { |
|
277 VCXLOGLO1("Async service request"); |
|
278 |
|
279 while(iRequestRepeatCount-- > 0) |
|
280 { |
|
281 SetExpectedSmEvent(aExpectedEvent, 1); |
|
282 |
|
283 TInt retryCount = 5; |
|
284 |
|
285 while(retryCount-- > 0) |
|
286 { |
|
287 TRAP(err2, err = iIptvServiceManagementClient->UpdateServiceReqL(aService) ); |
|
288 |
|
289 if(err2 == KErrNone && err == KErrNotReady) |
|
290 { |
|
291 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
292 iIptvTestTimer->After(1 * 1000000); |
|
293 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
294 } |
|
295 else |
|
296 { |
|
297 break; // request succeeded or there's an error |
|
298 } |
|
299 } |
|
300 |
|
301 if(err2 != KErrNone) |
|
302 { |
|
303 VCXLOGLO2("UpdateServiceReqL caused a leave: %d", err2); |
|
304 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
305 VCXLOGLO1("<<<CIptvServiceManagementSync::CallUpdateService"); |
|
306 return EGeneralError; |
|
307 } |
|
308 if(err != KErrNone) |
|
309 { |
|
310 VCXLOGLO2("UpdateServiceReqL returned error: %d", err); |
|
311 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
312 VCXLOGLO1("<<<CIptvServiceManagementSync::CallUpdateService"); |
|
313 return EGeneralError; |
|
314 } |
|
315 } |
|
316 |
|
317 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
318 { |
|
319 iIptvServiceManagementClient->CancelRequest(); |
|
320 VCXLOGLO1("Canceling request to server."); |
|
321 } |
|
322 else |
|
323 { |
|
324 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // wait for the response from server |
|
325 if(WaitForSmEvent() != KErrNone) |
|
326 { |
|
327 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
328 } |
|
329 } |
|
330 |
|
331 } |
|
332 else |
|
333 { |
|
334 VCXLOGLO1("Sync service request"); |
|
335 TRespStatus rv = ESucceeded; |
|
336 |
|
337 while(iRequestRepeatCount-- > 0) |
|
338 { |
|
339 SetExpectedSmEvent(aExpectedEvent, 1); |
|
340 |
|
341 TInt retryCount = 5; |
|
342 |
|
343 while(retryCount-- > 0) |
|
344 { |
|
345 TRAP(err2, err = iIptvServiceManagementClient->UpdateServiceL(aService, rv) ); |
|
346 |
|
347 if(err2 == KErrNone && err == KErrNotReady) |
|
348 { |
|
349 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
350 iIptvTestTimer->After(1 * 1000000); |
|
351 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
352 } |
|
353 else |
|
354 { |
|
355 break; // request succeeded or there's an error |
|
356 } |
|
357 } |
|
358 |
|
359 if(err2 != KErrNone) |
|
360 { |
|
361 VCXLOGLO2("UpdateServiceL caused a leave: %d", err2); |
|
362 rv = EGeneralError; |
|
363 } |
|
364 else |
|
365 if(err != KErrNone) |
|
366 { |
|
367 VCXLOGLO2("UpdateServiceL returned error: %d", err); |
|
368 rv = EGeneralError; |
|
369 } |
|
370 else |
|
371 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
372 { |
|
373 VCXLOGLO2("UpdateServiceL response error: %d", rv); |
|
374 } |
|
375 else |
|
376 if(WaitForSmEvent() != KErrNone) |
|
377 { |
|
378 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
379 } |
|
380 |
|
381 } |
|
382 |
|
383 iSyncReturnValue = rv; |
|
384 } |
|
385 |
|
386 FinishRequest(); |
|
387 |
|
388 VCXLOGLO1("<<<CIptvServiceManagementSync::CallUpdateService() "); |
|
389 return iSyncReturnValue; |
|
390 } |
|
391 |
|
392 // ----------------------------------------------------------------------------- |
|
393 // CIptvServiceManagementSync::CallGetServices() |
|
394 // Gets service entries from Services database. |
|
395 // ----------------------------------------------------------------------------- |
|
396 // |
|
397 TRespStatus CIptvServiceManagementSync::CallGetServices( |
|
398 TIptvSmTestConnection aConn, |
|
399 TUint32 aStartId, |
|
400 TUint32 aEndId, |
|
401 CDesC8ArraySeg** aServicesArray |
|
402 ) |
|
403 { |
|
404 VCXLOGLO1(">>>CIptvServiceManagementSync::GetServicesReqSync()"); |
|
405 |
|
406 TInt err = KErrNone, err2 = KErrNone; |
|
407 |
|
408 // this should be always NULL, otherwise there probably has been an error and we still own this |
|
409 if(iServicesArray) |
|
410 { |
|
411 VCXLOGLO1("* ERROR * iServicesArray not NULL, error in previous GetServices request?"); |
|
412 iServicesArray->Reset(); |
|
413 delete iServicesArray; |
|
414 iServicesArray = NULL; |
|
415 } |
|
416 |
|
417 err = PrepareForRequest(); |
|
418 if(err != KErrNone) |
|
419 { |
|
420 VCXLOGLO1("<<<CIptvServiceManagementSync::GetServicesReqSync"); |
|
421 return EGeneralError; |
|
422 } |
|
423 |
|
424 if(aConn == EIptvSmTestAsync) |
|
425 { |
|
426 VCXLOGLO1("Async service request"); |
|
427 |
|
428 while(iRequestRepeatCount-- > 0) |
|
429 { |
|
430 |
|
431 TInt retryCount = 5; |
|
432 |
|
433 while(retryCount-- > 0) |
|
434 { |
|
435 TRAP(err2, err = iIptvServiceManagementClient->GetServicesReqL(aStartId, aEndId) ); |
|
436 |
|
437 if(err2 == KErrNone && err == KErrNotReady) |
|
438 { |
|
439 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
440 iIptvTestTimer->After(1 * 1000000); |
|
441 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
442 } |
|
443 else |
|
444 { |
|
445 break; // request succeeded or there's an error |
|
446 } |
|
447 } |
|
448 |
|
449 if(err2 != KErrNone) |
|
450 { |
|
451 VCXLOGLO2("GetServicesReqL caused a leave: %d", err2); |
|
452 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
453 VCXLOGLO1("<<<CIptvServiceManagementSync::GetServicesReqSync"); |
|
454 return EGeneralError; |
|
455 } |
|
456 if(err != KErrNone) |
|
457 { |
|
458 VCXLOGLO2("GetServicesReqL returned error: %d", err); |
|
459 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
460 VCXLOGLO1("<<<CIptvServiceManagementSync::GetServicesReqSync"); |
|
461 return EGeneralError; |
|
462 } |
|
463 |
|
464 } |
|
465 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
466 { |
|
467 iIptvServiceManagementClient->CancelRequest(); |
|
468 VCXLOGLO1("Canceling request to server."); |
|
469 } |
|
470 else |
|
471 { |
|
472 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
473 } |
|
474 } |
|
475 else |
|
476 { |
|
477 VCXLOGLO1("Sync service request"); |
|
478 TRespStatus rv = ESucceeded; |
|
479 |
|
480 while(iRequestRepeatCount-- > 0) |
|
481 { |
|
482 TInt retryCount = 5; |
|
483 |
|
484 while(retryCount-- > 0) |
|
485 { |
|
486 TRAP(err2, err = iIptvServiceManagementClient->GetServicesL(aStartId, aEndId, iServicesArray, rv) ); |
|
487 |
|
488 if(err2 == KErrNone && err == KErrNotReady) |
|
489 { |
|
490 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
491 iIptvTestTimer->After(1 * 1000000); |
|
492 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
493 } |
|
494 else |
|
495 { |
|
496 break; // request succeeded or there's an error |
|
497 } |
|
498 } |
|
499 |
|
500 if(err2 != KErrNone) |
|
501 { |
|
502 VCXLOGLO2("GetServicesL caused a leave: %d", err2); |
|
503 rv = EGeneralError; |
|
504 } |
|
505 else |
|
506 if(err != KErrNone) |
|
507 { |
|
508 VCXLOGLO2("GetServicesL returned error: %d", err); |
|
509 rv = EGeneralError; |
|
510 } |
|
511 else |
|
512 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
513 { |
|
514 VCXLOGLO2("GetServicesL response error: %d", rv); |
|
515 } |
|
516 } |
|
517 |
|
518 iSyncReturnValue = rv; |
|
519 } |
|
520 |
|
521 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
522 { |
|
523 if(iServicesArray == NULL) |
|
524 { |
|
525 iServicesArray = new (ELeave) CDesC8ArraySeg(10); |
|
526 } |
|
527 } |
|
528 |
|
529 FinishRequest(); |
|
530 |
|
531 *aServicesArray = iServicesArray; |
|
532 iServicesArray = NULL; // we don't need this anymore, ownership moves |
|
533 |
|
534 VCXLOGLO1("<<<CIptvServiceManagementSync::GetServicesReqSync()"); |
|
535 return iSyncReturnValue; |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // CIptvServiceManagementSync::GetAllSelectedServicesReq() |
|
540 // Requests all filtered services from the database. |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 TRespStatus CIptvServiceManagementSync::CallGetServicesFiltered( |
|
544 TUint32 aSearchLimitFlags, |
|
545 CIptvServiceManagementClient::TOrder aOrder, |
|
546 TIptvSmTestConnection aConn, |
|
547 CDesC8ArraySeg** aServicesArray |
|
548 ) |
|
549 { |
|
550 VCXLOGLO1(">>>CIptvServiceManagementSync::CallGetServicesFiltered()"); |
|
551 |
|
552 TInt err = KErrNone, err2 = KErrNone; |
|
553 |
|
554 // this should be always NULL, otherwise there probably has been an error and we still own this |
|
555 if(iServicesArray) |
|
556 { |
|
557 VCXLOGLO1("* ERROR * iServicesArray not NULL, error in previous GetServices request?"); |
|
558 iServicesArray->Reset(); |
|
559 delete iServicesArray; |
|
560 iServicesArray = NULL; |
|
561 } |
|
562 |
|
563 err = PrepareForRequest(); |
|
564 if(err != KErrNone) |
|
565 { |
|
566 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesFiltered"); |
|
567 return EGeneralError; |
|
568 } |
|
569 |
|
570 if(aConn == EIptvSmTestAsync) |
|
571 { |
|
572 VCXLOGLO1("Async service request"); |
|
573 |
|
574 while(iRequestRepeatCount-- > 0) |
|
575 { |
|
576 TInt retryCount = 5; |
|
577 |
|
578 while(retryCount-- > 0) |
|
579 { |
|
580 TRAP(err2, err = iIptvServiceManagementClient->GetServicesReqL(aSearchLimitFlags, aOrder) ); |
|
581 |
|
582 if(err2 == KErrNone && err == KErrNotReady) |
|
583 { |
|
584 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
585 iIptvTestTimer->After(1 * 1000000); |
|
586 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
587 } |
|
588 else |
|
589 { |
|
590 break; // request succeeded or there's an error |
|
591 } |
|
592 } |
|
593 |
|
594 if(err2 != KErrNone) |
|
595 { |
|
596 VCXLOGLO2("GetServicesReqL caused a leave: %d", err2); |
|
597 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
598 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesFiltered"); |
|
599 return EGeneralError; |
|
600 } |
|
601 if(err != KErrNone) |
|
602 { |
|
603 VCXLOGLO2("GetServicesReqL returned error: %d", err); |
|
604 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
605 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesFiltered"); |
|
606 return EGeneralError; |
|
607 } |
|
608 } |
|
609 |
|
610 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
611 { |
|
612 //removed: iIptvTestTimer->After(5 * 1000000); |
|
613 |
|
614 iIptvServiceManagementClient->CancelRequest(); |
|
615 VCXLOGLO1("Canceling request to server."); |
|
616 } |
|
617 else |
|
618 { |
|
619 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
620 } |
|
621 |
|
622 } |
|
623 else |
|
624 { |
|
625 VCXLOGLO1("Sync service request"); |
|
626 |
|
627 TRespStatus rv = ESucceeded; |
|
628 |
|
629 while(iRequestRepeatCount-- > 0) |
|
630 { |
|
631 TInt retryCount = 5; |
|
632 |
|
633 while(retryCount-- > 0) |
|
634 { |
|
635 TRAP(err2, err = iIptvServiceManagementClient->GetServicesL(aSearchLimitFlags, aOrder, iServicesArray, rv) ); |
|
636 |
|
637 if(err2 == KErrNone && err == KErrNotReady) |
|
638 { |
|
639 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
640 iIptvTestTimer->After(1 * 1000000); |
|
641 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
642 } |
|
643 else |
|
644 { |
|
645 break; // request succeeded or there's an error |
|
646 } |
|
647 } |
|
648 |
|
649 if(err2 != KErrNone) |
|
650 { |
|
651 VCXLOGLO2("GetServicesL caused a leave: %d", err2); |
|
652 rv = EGeneralError; |
|
653 } |
|
654 if(err != KErrNone) |
|
655 { |
|
656 VCXLOGLO2("GetServicesL returned error: %d", err); |
|
657 rv = EGeneralError; |
|
658 } |
|
659 } |
|
660 |
|
661 iSyncReturnValue = rv; |
|
662 } |
|
663 |
|
664 |
|
665 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
666 { |
|
667 if(iServicesArray == NULL) |
|
668 { |
|
669 iServicesArray = new (ELeave) CDesC8ArraySeg(10); |
|
670 } |
|
671 } |
|
672 |
|
673 *aServicesArray = iServicesArray; |
|
674 iServicesArray = NULL; // ownership moves |
|
675 |
|
676 FinishRequest(); |
|
677 |
|
678 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesFiltered()"); |
|
679 return iSyncReturnValue; |
|
680 } |
|
681 |
|
682 // ----------------------------------------------------------------------------- |
|
683 // CIptvServiceManagementSync::GetGetServicesByProviderId() |
|
684 // Requests all filtered services from the database. |
|
685 // ----------------------------------------------------------------------------- |
|
686 // |
|
687 TRespStatus CIptvServiceManagementSync::CallGetServicesByProviderId( |
|
688 TDesC& aProviderId, |
|
689 CIptvServices& aServices |
|
690 ) |
|
691 { |
|
692 VCXLOGLO1(">>>CIptvServiceManagementSync::CallGetServicesByProviderId()"); |
|
693 |
|
694 TInt err = KErrNone, err2 = KErrNone; |
|
695 |
|
696 err = PrepareForRequest(); |
|
697 if(err != KErrNone) |
|
698 { |
|
699 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesByProviderId"); |
|
700 return EGeneralError; |
|
701 } |
|
702 |
|
703 VCXLOGLO1("Sync service request"); |
|
704 |
|
705 TInt retryCount = 5; |
|
706 |
|
707 while(retryCount-- > 0) |
|
708 { |
|
709 TRAP(err2, err = iIptvServiceManagementClient->GetServicesL(aProviderId, aServices) ); |
|
710 |
|
711 if(err2 == KErrNone && err == KErrNotReady) |
|
712 { |
|
713 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
714 iIptvTestTimer->After(1 * 1000000); |
|
715 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
716 } |
|
717 else |
|
718 { |
|
719 break; // request succeeded or there's an error |
|
720 } |
|
721 } |
|
722 |
|
723 if(err2 != KErrNone) |
|
724 { |
|
725 VCXLOGLO2("CallGetServicesByProviderId caused a leave: %d", err2); |
|
726 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesByProviderId"); |
|
727 return EGeneralError; |
|
728 } |
|
729 if(err != KErrNone) |
|
730 { |
|
731 VCXLOGLO2("CallGetServicesByProviderId returned error: %d", err); |
|
732 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesByProviderId"); |
|
733 return EGeneralError; |
|
734 } |
|
735 |
|
736 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetServicesByProviderId()"); |
|
737 |
|
738 FinishRequest(); |
|
739 |
|
740 return iSyncReturnValue; |
|
741 } |
|
742 |
|
743 |
|
744 // ----------------------------------------------------------------------------- |
|
745 // CIptvServiceManagementSync::CallDeleteService() |
|
746 // Deletes a service from the database. |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 TRespStatus CIptvServiceManagementSync::CallDeleteService(TIptvSmTestConnection aConn, TUint32 aId) |
|
750 { |
|
751 VCXLOGLO1(">>>CIptvServiceManagementSync::CallDeleteService()"); |
|
752 |
|
753 TInt err = KErrNone, err2 = KErrNone; |
|
754 |
|
755 err = PrepareForRequest(); |
|
756 if(err != KErrNone) |
|
757 { |
|
758 VCXLOGLO1("<<<CIptvServiceManagementSync::CallDeleteService"); |
|
759 return EGeneralError; |
|
760 } |
|
761 |
|
762 if(aConn == EIptvSmTestAsync) |
|
763 { |
|
764 VCXLOGLO1("Async service request"); |
|
765 |
|
766 while(iRequestRepeatCount-- > 0) |
|
767 { |
|
768 TInt retryCount = 5; |
|
769 |
|
770 while(retryCount-- > 0) |
|
771 { |
|
772 SetExpectedSmEvent(CIptvSmEvent::EServiceDeleted, 1); |
|
773 TRAP(err2, err = iIptvServiceManagementClient->DeleteServiceReqL(aId) ); |
|
774 iIptvTestTimer->After(2 * 1000000); |
|
775 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
776 |
|
777 if(err2 == KErrNone && err == KErrNotReady) |
|
778 { |
|
779 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
780 iIptvTestTimer->After(1 * 1000000); |
|
781 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
782 } |
|
783 else |
|
784 { |
|
785 break; // request succeeded or there's an error |
|
786 } |
|
787 } |
|
788 |
|
789 if(err2 != KErrNone) |
|
790 { |
|
791 VCXLOGLO2("DeleteServiceReqL caused a leave: %d", err2); |
|
792 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
793 VCXLOGLO1("<<<CIptvServiceManagementSync::CallDeleteService"); |
|
794 return EGeneralError; |
|
795 } |
|
796 if(err != KErrNone) |
|
797 { |
|
798 VCXLOGLO2("DeleteServiceReqL returned error: %d", err); |
|
799 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // don't just leave, wait possible request from server to end |
|
800 VCXLOGLO1("<<<CIptvServiceManagementSync::CallDeleteService"); |
|
801 return EGeneralError; |
|
802 } |
|
803 } |
|
804 |
|
805 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
806 { |
|
807 iIptvServiceManagementClient->CancelRequest(); |
|
808 VCXLOGLO1("Canceling request to server."); |
|
809 } |
|
810 else |
|
811 { |
|
812 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); // wait for the response from server |
|
813 if(WaitForSmEvent() != KErrNone) |
|
814 { |
|
815 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
816 } |
|
817 } |
|
818 } |
|
819 else |
|
820 { |
|
821 VCXLOGLO1("Sync service request"); |
|
822 TRespStatus rv = ESucceeded; |
|
823 |
|
824 while(iRequestRepeatCount-- > 0) |
|
825 { |
|
826 SetExpectedSmEvent(CIptvSmEvent::EServiceDeleted, 1); |
|
827 |
|
828 TInt retryCount = 5; |
|
829 |
|
830 while(retryCount-- > 0) |
|
831 { |
|
832 TRAP(err2, err = iIptvServiceManagementClient->DeleteServiceL(aId + iRequestRepeatCount, rv) ); |
|
833 |
|
834 VCXLOGLO1("Request done."); |
|
835 |
|
836 if(err2 == KErrNone && err == KErrNotReady) |
|
837 { |
|
838 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
839 iIptvTestTimer->After(1 * 1000000); |
|
840 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
841 } |
|
842 else |
|
843 { |
|
844 break; // request succeeded or there's an error |
|
845 } |
|
846 } |
|
847 |
|
848 VCXLOGLO1("Checking errors."); |
|
849 |
|
850 if(err2 != KErrNone) |
|
851 { |
|
852 VCXLOGLO2("DeleteServiceL caused a leave: %d", err2); |
|
853 rv = EGeneralError; |
|
854 } |
|
855 else |
|
856 if(err != KErrNone) |
|
857 { |
|
858 VCXLOGLO2("DeleteServiceL returned error: %d", err); |
|
859 rv = EGeneralError; |
|
860 } |
|
861 else |
|
862 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
863 { |
|
864 VCXLOGLO2("DeleteServiceL response error: %d", rv); |
|
865 } |
|
866 else |
|
867 if(WaitForSmEvent() != KErrNone) |
|
868 { |
|
869 iSyncReturnValue = MIptvServiceManagementClientObserver::EGeneralError; |
|
870 } |
|
871 } |
|
872 iSyncReturnValue = rv; |
|
873 } |
|
874 |
|
875 FinishRequest(); |
|
876 |
|
877 VCXLOGLO1("<<<CIptvServiceManagementSync::CallDeleteService()"); |
|
878 return iSyncReturnValue; |
|
879 } |
|
880 |
|
881 // ----------------------------------------------------------------------------- |
|
882 // CIptvServiceManagementSync::CallShutdownServer() |
|
883 // Requests server to shutdown itself. |
|
884 // ----------------------------------------------------------------------------- |
|
885 // |
|
886 TRespStatus CIptvServiceManagementSync::CallShutdownServer(TIptvSmTestConnection aConn ) |
|
887 { |
|
888 VCXLOGLO1(">>>CIptvServiceManagementSync::CallShutdownServer()"); |
|
889 |
|
890 TInt err = KErrNone; |
|
891 |
|
892 if(aConn == EIptvSmTestAsync) |
|
893 { |
|
894 VCXLOGLO1("Async service request"); |
|
895 err = iIptvServiceManagementClient->ServerShutdownReq(); |
|
896 if(err != KErrNone) |
|
897 { |
|
898 VCXLOGLO2("ServerShutdownReq returned error: %d", err); |
|
899 VCXLOGLO1("<<<CIptvServiceManagementSync::CallShutdownServer"); |
|
900 return EGeneralError; |
|
901 } |
|
902 |
|
903 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
904 { |
|
905 iIptvServiceManagementClient->CancelRequest(); |
|
906 VCXLOGLO1("Canceling request to server."); |
|
907 } |
|
908 else |
|
909 { |
|
910 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
911 } |
|
912 |
|
913 } |
|
914 else |
|
915 { |
|
916 VCXLOGLO1("Sync service request"); |
|
917 TRespStatus rv = ESucceeded; |
|
918 err = iIptvServiceManagementClient->ServerShutdown(rv); |
|
919 if(err != KErrNone) |
|
920 { |
|
921 VCXLOGLO2("ServerShutdown returned error: %d", err); |
|
922 rv = EGeneralError; |
|
923 } |
|
924 else |
|
925 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
926 { |
|
927 VCXLOGLO2("ServerShutdown response error: %d", rv); |
|
928 } |
|
929 |
|
930 iSyncReturnValue = rv; |
|
931 } |
|
932 VCXLOGLO1("<<<CIptvServiceManagementSync::CallShutdownServer()"); |
|
933 |
|
934 return iSyncReturnValue; |
|
935 } |
|
936 |
|
937 // ----------------------------------------------------------------------------- |
|
938 // CIptvServiceManagementSync::CallSetUsedIap() |
|
939 // Sets used Iap |
|
940 // ----------------------------------------------------------------------------- |
|
941 // |
|
942 TRespStatus CIptvServiceManagementSync::CallSetUsedIap(TUint32 aIapId, |
|
943 TUint32 aServiceId, |
|
944 TBool aSetToDefaultForService |
|
945 ) |
|
946 { |
|
947 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetUsedIap()"); |
|
948 TRespStatus rv = ESucceeded; |
|
949 CIptvNetworkSelection::TRespStatus status = CIptvNetworkSelection::ESucceeded; |
|
950 |
|
951 TInt err = KErrNone; |
|
952 |
|
953 err = PrepareForRequest(); |
|
954 if(err != KErrNone) |
|
955 { |
|
956 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetUsedIap()"); |
|
957 return EGeneralError; |
|
958 } |
|
959 |
|
960 VCXLOGLO1("Sync service request"); |
|
961 |
|
962 TInt timeOut = 30; |
|
963 |
|
964 if(iRequestRepeatCount <= 0) |
|
965 iRequestRepeatCount = 1; // do once if repeat not set |
|
966 else |
|
967 timeOut = 0; // don't wait server to get ready if repeat is set |
|
968 |
|
969 while(iRequestRepeatCount-- > 0) |
|
970 { |
|
971 |
|
972 do // try again if server busy |
|
973 { |
|
974 |
|
975 TInt retryCount = 5; |
|
976 |
|
977 while(retryCount-- > 0) |
|
978 { |
|
979 TRAP(err, iIptvServiceManagementClient->SetUsedIapL(aIapId, aServiceId, aSetToDefaultForService, status) ); |
|
980 |
|
981 if(err == KErrNotReady) |
|
982 { |
|
983 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
984 iIptvTestTimer->After(1 * 1000000); |
|
985 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
986 } |
|
987 else |
|
988 { |
|
989 break; // request succeeded or there's an error |
|
990 } |
|
991 } |
|
992 |
|
993 if(err == KErrNone || err != KErrNotReady) break; // request ok |
|
994 |
|
995 timeOut -= 2; |
|
996 } |
|
997 while (timeOut > 0); |
|
998 |
|
999 if(err != KErrNone) |
|
1000 { |
|
1001 VCXLOGLO2("SetUsedIapL caused a leave: %d", err); |
|
1002 rv = EGeneralError; |
|
1003 if(err == KErrNotReady) |
|
1004 { |
|
1005 VCXLOGLO1(" - previous request still on server. Not ready"); |
|
1006 } |
|
1007 } |
|
1008 else |
|
1009 if(CIptvNetworkSelection::ESucceeded != status) |
|
1010 { |
|
1011 VCXLOGLO2("SetUsedIapL response error: %d", status); |
|
1012 rv = EGeneralError; |
|
1013 } |
|
1014 } |
|
1015 |
|
1016 // network selection api specific return values!! |
|
1017 |
|
1018 FinishRequest(); |
|
1019 |
|
1020 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetUsedIap()"); |
|
1021 return rv; |
|
1022 } |
|
1023 |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // CIptvServiceManagementSync::CallClearUsedIap() |
|
1026 // Sets used Iap |
|
1027 // ----------------------------------------------------------------------------- |
|
1028 // |
|
1029 TRespStatus CIptvServiceManagementSync::CallClearUsedIap() |
|
1030 { |
|
1031 VCXLOGLO1("<<<CIptvServiceManagementSync::CallClearUsedIap()"); |
|
1032 TRespStatus rv = ESucceeded; |
|
1033 |
|
1034 TInt err = KErrNone; |
|
1035 |
|
1036 err = PrepareForRequest(); |
|
1037 if(err != KErrNone) |
|
1038 { |
|
1039 VCXLOGLO1("<<<CIptvServiceManagementSync::CallClearUsedIap()"); |
|
1040 return EGeneralError; |
|
1041 } |
|
1042 |
|
1043 VCXLOGLO1("Sync service request"); |
|
1044 |
|
1045 if(iRequestRepeatCount <= 0) |
|
1046 iRequestRepeatCount = 1; // do once if repeat not set |
|
1047 |
|
1048 while(iRequestRepeatCount-- > 0) |
|
1049 { |
|
1050 |
|
1051 TInt retryCount = 5; |
|
1052 |
|
1053 while(retryCount-- > 0) |
|
1054 { |
|
1055 err = iIptvServiceManagementClient->ClearUsedIap(); |
|
1056 |
|
1057 if(err == KErrNotReady) |
|
1058 { |
|
1059 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1060 iIptvTestTimer->After(1 * 1000000); |
|
1061 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1062 } |
|
1063 else |
|
1064 { |
|
1065 break; // request succeeded or there's an error |
|
1066 } |
|
1067 } |
|
1068 |
|
1069 if(err != KErrNone) |
|
1070 { |
|
1071 VCXLOGLO2("ClearUsedIap returned error: %d", err); |
|
1072 rv = EGeneralError; |
|
1073 } |
|
1074 } |
|
1075 |
|
1076 FinishRequest(); |
|
1077 |
|
1078 VCXLOGLO1("<<<CIptvServiceManagementSync::CallClearUsedIap()"); |
|
1079 return rv; |
|
1080 } |
|
1081 |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // CIptvServiceManagementSync::CallGetUsedIap() |
|
1084 // Gets used iap |
|
1085 // ----------------------------------------------------------------------------- |
|
1086 // |
|
1087 TRespStatus CIptvServiceManagementSync::CallGetUsedIap( |
|
1088 TIptvSmTestConnection aConn, |
|
1089 TUint32 aServiceId, |
|
1090 TUint32& aIapId |
|
1091 ) |
|
1092 { |
|
1093 VCXLOGLO1(">>>CIptvServiceManagementSync::CallGetUsedIap()"); |
|
1094 |
|
1095 TInt err = KErrNone; |
|
1096 |
|
1097 err = PrepareForRequest(); |
|
1098 if(err != KErrNone) |
|
1099 { |
|
1100 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetUsedIap()"); |
|
1101 return EGeneralError; |
|
1102 } |
|
1103 |
|
1104 |
|
1105 TRespStatus rv = ESucceeded; |
|
1106 TBuf<256> iapName; |
|
1107 CIptvNetworkSelection::TRespStatus status = CIptvNetworkSelection::ESucceeded; |
|
1108 CIptvNetworkSelection::TConnectionPermission connectionPermission; |
|
1109 |
|
1110 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
1111 |
|
1112 // network selection api specific return values!! |
|
1113 if(aConn == EIptvSmTestAsync) |
|
1114 { |
|
1115 |
|
1116 VCXLOGLO1("Async service request"); |
|
1117 |
|
1118 while(iRequestRepeatCount-- > 0) |
|
1119 { |
|
1120 |
|
1121 TInt retryCount = 5; |
|
1122 |
|
1123 while(retryCount-- > 0) |
|
1124 { |
|
1125 TRAP(err, iIptvServiceManagementClient->GetUsedIapReqL(aServiceId) ); |
|
1126 |
|
1127 if(err == KErrNotReady) |
|
1128 { |
|
1129 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1130 iIptvTestTimer->After(1 * 1000000); |
|
1131 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1132 } |
|
1133 else |
|
1134 { |
|
1135 break; // request succeeded or there's an error |
|
1136 } |
|
1137 } |
|
1138 |
|
1139 if(err != KErrNone) |
|
1140 { |
|
1141 VCXLOGLO2("GetUsedIapReqL caused a leave: %d", err); |
|
1142 rv = EGeneralError; |
|
1143 iSyncReturnValue = rv; |
|
1144 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1145 return rv; |
|
1146 } |
|
1147 } |
|
1148 |
|
1149 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
1150 { |
|
1151 iIptvServiceManagementClient->CancelRequest(); |
|
1152 VCXLOGLO1("Canceling request to server."); |
|
1153 } |
|
1154 else |
|
1155 { |
|
1156 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1157 } |
|
1158 |
|
1159 aIapId = iIapId; |
|
1160 } |
|
1161 else |
|
1162 { |
|
1163 VCXLOGLO1("Sync service request"); |
|
1164 TRespStatus rv = ESucceeded; |
|
1165 |
|
1166 while(iRequestRepeatCount-- > 0) |
|
1167 { |
|
1168 TInt retryCount = 5; |
|
1169 |
|
1170 while(retryCount-- > 0) |
|
1171 { |
|
1172 TRAP(err, iIptvServiceManagementClient->GetUsedIapL(aServiceId, |
|
1173 aIapId, |
|
1174 iapName , |
|
1175 connectionPermission, |
|
1176 status) ); |
|
1177 |
|
1178 |
|
1179 if(err == KErrNotReady) |
|
1180 { |
|
1181 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1182 iIptvTestTimer->After(1 * 1000000); |
|
1183 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1184 } |
|
1185 else |
|
1186 { |
|
1187 break; // request succeeded or there's an error |
|
1188 } |
|
1189 } |
|
1190 |
|
1191 if(err != KErrNone) |
|
1192 { |
|
1193 VCXLOGLO2("GetUsedIapL caused a leave: %d", err); |
|
1194 rv = EGeneralError; |
|
1195 } |
|
1196 else |
|
1197 if(CIptvNetworkSelection::ESucceeded != status) |
|
1198 { |
|
1199 VCXLOGLO2("GetUsedIapL response error: %d", status); |
|
1200 rv = EGeneralError; |
|
1201 } |
|
1202 } |
|
1203 |
|
1204 iSyncReturnValue = rv; |
|
1205 } |
|
1206 |
|
1207 if(iSyncReturnValue == ESucceeded) |
|
1208 { |
|
1209 VCXLOGLO2("aIapId = %d",aIapId); |
|
1210 VCXLOGLO2("iapName = %S",&iapName); |
|
1211 VCXLOGLO2("connectionPermission = %d",connectionPermission); |
|
1212 VCXLOGLO2("status = %d",status); |
|
1213 } |
|
1214 |
|
1215 FinishRequest(); |
|
1216 |
|
1217 VCXLOGLO1("<<<CIptvServiceManagementSync::CallGetUsedIap()"); |
|
1218 return iSyncReturnValue; |
|
1219 } |
|
1220 |
|
1221 // ----------------------------------------------------------------------------- |
|
1222 // CIptvServiceManagementSync::CallSetAllIaps() |
|
1223 // Sets iaplist to all services |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 // |
|
1226 TRespStatus CIptvServiceManagementSync::CallSetAllIaps( |
|
1227 TIptvSmTestConnection aConn, |
|
1228 CIptvIapList& aIapList, |
|
1229 TBool aIgnoreReadOnlyFlag |
|
1230 ) |
|
1231 { |
|
1232 VCXLOGLO1(">>>CIptvServiceManagementSync::CallSetAllIaps()"); |
|
1233 |
|
1234 TInt err = KErrNone; |
|
1235 |
|
1236 err = PrepareForRequest(); |
|
1237 if(err != KErrNone) |
|
1238 { |
|
1239 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetAllIaps"); |
|
1240 return EGeneralError; |
|
1241 } |
|
1242 |
|
1243 |
|
1244 TRespStatus rv = ESucceeded; |
|
1245 TBuf<255> iapName; |
|
1246 |
|
1247 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
1248 |
|
1249 // network selection api specific return values!! |
|
1250 if(aConn == EIptvSmTestAsync) |
|
1251 { |
|
1252 VCXLOGLO1("Async service request"); |
|
1253 |
|
1254 while(iRequestRepeatCount-- > 0) |
|
1255 { |
|
1256 TInt retryCount = 5; |
|
1257 |
|
1258 while(retryCount-- > 0) |
|
1259 { |
|
1260 TRAP(err, iIptvServiceManagementClient->SetAllIapsReqL(aIapList, aIgnoreReadOnlyFlag) ); |
|
1261 |
|
1262 if(err == KErrNotReady) |
|
1263 { |
|
1264 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1265 iIptvTestTimer->After(1 * 1000000); |
|
1266 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1267 } |
|
1268 else |
|
1269 { |
|
1270 break; // request succeeded or there's an error |
|
1271 } |
|
1272 } |
|
1273 |
|
1274 if(err != KErrNone) |
|
1275 { |
|
1276 VCXLOGLO2("SetAllIapsReqL caused a leave: %d", err); |
|
1277 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetAllIaps"); |
|
1278 rv = EGeneralError; |
|
1279 iSyncReturnValue = rv; |
|
1280 return EGeneralError; |
|
1281 } |
|
1282 |
|
1283 if(iSpecialAction == EIptvSmCancelNextAsyncRequest) |
|
1284 { |
|
1285 iIptvServiceManagementClient->CancelRequest(); |
|
1286 VCXLOGLO1("Canceling request to server."); |
|
1287 } |
|
1288 else |
|
1289 { |
|
1290 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1291 } |
|
1292 } |
|
1293 |
|
1294 } |
|
1295 else |
|
1296 { |
|
1297 VCXLOGLO1("Sync service request"); |
|
1298 TRespStatus rv = ESucceeded; |
|
1299 |
|
1300 while(iRequestRepeatCount-- > 0) |
|
1301 { |
|
1302 TInt retryCount = 5; |
|
1303 |
|
1304 while(retryCount-- > 0) |
|
1305 { |
|
1306 TRAP(err, iIptvServiceManagementClient->SetAllIapsL(aIapList, |
|
1307 aIgnoreReadOnlyFlag, |
|
1308 rv) ); |
|
1309 |
|
1310 if(err == KErrNotReady) |
|
1311 { |
|
1312 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1313 iIptvTestTimer->After(1 * 1000000); |
|
1314 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1315 } |
|
1316 else |
|
1317 { |
|
1318 break; // request succeeded or there's an error |
|
1319 } |
|
1320 } |
|
1321 |
|
1322 if(err != KErrNone) |
|
1323 { |
|
1324 VCXLOGLO2("SetAllIapsL caused a leave: %d", err); |
|
1325 rv = EGeneralError; |
|
1326 } |
|
1327 else |
|
1328 if(MIptvServiceManagementClientObserver::ESucceeded != rv) |
|
1329 { |
|
1330 VCXLOGLO2("SetAllIapsL response error: %d", rv); |
|
1331 rv = EGeneralError; |
|
1332 } |
|
1333 } |
|
1334 |
|
1335 iSyncReturnValue = rv; |
|
1336 } |
|
1337 |
|
1338 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetAllIaps()"); |
|
1339 |
|
1340 FinishRequest(); |
|
1341 |
|
1342 return iSyncReturnValue; |
|
1343 } |
|
1344 |
|
1345 // ----------------------------------------------------------------------------- |
|
1346 // CIptvServiceManagementSync::CallSetConnectionAllowed() |
|
1347 // ----------------------------------------------------------------------------- |
|
1348 // |
|
1349 TRespStatus CIptvServiceManagementSync::CallSetConnectionAllowed(TBool aConnectionAllowed, |
|
1350 TUint32 aIapId) |
|
1351 { |
|
1352 VCXLOGLO1(">>>CIptvServiceManagementSync::CallSetConnectionAllowed"); |
|
1353 |
|
1354 TInt err = KErrNone; |
|
1355 |
|
1356 err = PrepareForRequest(); |
|
1357 if(err != KErrNone) |
|
1358 { |
|
1359 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetConnectionAllowed."); |
|
1360 return EGeneralError; |
|
1361 } |
|
1362 |
|
1363 TRespStatus rv = ESucceeded; |
|
1364 TBuf<255> iapName; |
|
1365 CIptvNetworkSelection::TRespStatus status = CIptvNetworkSelection::ESucceeded; |
|
1366 |
|
1367 |
|
1368 VCXLOGLO1("Sync service request"); |
|
1369 |
|
1370 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
1371 |
|
1372 while(iRequestRepeatCount-- > 0) |
|
1373 { |
|
1374 TInt retryCount = 5; |
|
1375 |
|
1376 while(retryCount-- > 0) |
|
1377 { |
|
1378 TRAP(err, iIptvServiceManagementClient->SetConnectionAllowedL(aConnectionAllowed, aIapId, status) ); |
|
1379 |
|
1380 if(err == KErrNotReady) |
|
1381 { |
|
1382 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1383 iIptvTestTimer->After(1 * 1000000); |
|
1384 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1385 } |
|
1386 else |
|
1387 { |
|
1388 break; // request succeeded or there's an error |
|
1389 } |
|
1390 } |
|
1391 |
|
1392 if(err != KErrNone) |
|
1393 { |
|
1394 VCXLOGLO2("SetConnectionAllowedL caused a leave: %d", err); |
|
1395 rv = EGeneralError; |
|
1396 } |
|
1397 else |
|
1398 if(CIptvNetworkSelection::ESucceeded != status) |
|
1399 { |
|
1400 VCXLOGLO2("SetConnectionAllowedL response error: %d", status); |
|
1401 rv = EGeneralError; |
|
1402 } |
|
1403 } |
|
1404 |
|
1405 iSyncReturnValue = rv; |
|
1406 |
|
1407 FinishRequest(); |
|
1408 |
|
1409 VCXLOGLO1("<<<CIptvServiceManagementSync::CallSetConnectionAllowed()"); |
|
1410 return iSyncReturnValue; |
|
1411 } |
|
1412 |
|
1413 // ----------------------------------------------------------------------------- |
|
1414 // CIptvServiceManagementSync::CallIsConnectionAllowed() |
|
1415 // ----------------------------------------------------------------------------- |
|
1416 // |
|
1417 TRespStatus CIptvServiceManagementSync::CallIsConnectionAllowed(CIptvNetworkSelection::TConnectionPermission &aPermission, |
|
1418 TUint32 aIapId) |
|
1419 { |
|
1420 VCXLOGLO1(">>>CIptvServiceManagementSync::CallIsConnectionAllowed"); |
|
1421 |
|
1422 TInt err = KErrNone; |
|
1423 |
|
1424 err = PrepareForRequest(); |
|
1425 if(err != KErrNone) |
|
1426 { |
|
1427 VCXLOGLO1("<<<CIptvServiceManagementSync::CallIsConnectionAllowed()"); |
|
1428 return EGeneralError; |
|
1429 } |
|
1430 |
|
1431 TRespStatus rv = ESucceeded; |
|
1432 TBuf<255> iapName; |
|
1433 CIptvNetworkSelection::TRespStatus status = CIptvNetworkSelection::ESucceeded; |
|
1434 |
|
1435 VCXLOGLO1("Sync service request"); |
|
1436 |
|
1437 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
1438 |
|
1439 while(iRequestRepeatCount-- > 0) |
|
1440 { |
|
1441 TInt retryCount = 5; |
|
1442 |
|
1443 while(retryCount-- > 0) |
|
1444 { |
|
1445 TRAP(err, iIptvServiceManagementClient->IsConnectionAllowedL(aIapId, aPermission, status) ); |
|
1446 |
|
1447 if(err == KErrNotReady) |
|
1448 { |
|
1449 VCXLOGLO1("Server not ready, waiting a second before retry."); |
|
1450 iIptvTestTimer->After(1 * 1000000); |
|
1451 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1452 } |
|
1453 else |
|
1454 { |
|
1455 break; // request succeeded or there's an error |
|
1456 } |
|
1457 } |
|
1458 |
|
1459 if(err != KErrNone) |
|
1460 { |
|
1461 VCXLOGLO2("IsConnectionAllowedL caused a leave: %d", err); |
|
1462 rv = EGeneralError; |
|
1463 } |
|
1464 else |
|
1465 if(CIptvNetworkSelection::ESucceeded != status) |
|
1466 { |
|
1467 VCXLOGLO2("IsConnectionAllowedL response error: %d", status); |
|
1468 rv = EGeneralError; |
|
1469 } |
|
1470 } |
|
1471 iSyncReturnValue = rv; |
|
1472 |
|
1473 FinishRequest(); |
|
1474 |
|
1475 VCXLOGLO1("<<<CIptvServiceManagementSync::CallIsConnectionAllowed()"); |
|
1476 return iSyncReturnValue; |
|
1477 } |
|
1478 |
|
1479 // ----------------------------------------------------------------------------- |
|
1480 // CIptvServiceManagementSync::CancelRequest() |
|
1481 // Cancels an outstanding request. |
|
1482 // ----------------------------------------------------------------------------- |
|
1483 // |
|
1484 /*void CIptvServiceManagementSync::CancelRequest() |
|
1485 { |
|
1486 Cancel() ; // Causes call to DoCancel() |
|
1487 } |
|
1488 */ |
|
1489 |
|
1490 /*****************************************************/ |
|
1491 /*************** Utilities ******************/ |
|
1492 /*****************************************************/ |
|
1493 |
|
1494 |
|
1495 // ----------------------------------------------------------------------------- |
|
1496 // CIptvServiceManagementApiTest::ResponseStatus() |
|
1497 // |
|
1498 // ----------------------------------------------------------------------------- |
|
1499 // |
|
1500 TInt CIptvServiceManagementSync::ResponseStatus(TUint8 aStatus) |
|
1501 { |
|
1502 VCXLOGLO1(">>>CIptvServiceManagementApiTest::ResponseStatus"); |
|
1503 VCXLOGLO2("aStatus = %d", aStatus); |
|
1504 iSyncReturnValue = static_cast<TRespStatus>(aStatus); |
|
1505 VCXLOGLO1("<<<CIptvServiceManagementApiTest::ResponseStatus"); |
|
1506 return KErrNone; |
|
1507 } |
|
1508 |
|
1509 /*****************************************************/ |
|
1510 /*************** Callbacks ******************/ |
|
1511 /*****************************************************/ |
|
1512 |
|
1513 |
|
1514 // ----------------------------------------------------------------------------- |
|
1515 // CIptvVodContentApiTest::TimerComplete |
|
1516 // ?implementation_description |
|
1517 // (other items were commented in a header). |
|
1518 // ----------------------------------------------------------------------------- |
|
1519 // |
|
1520 void CIptvServiceManagementSync::TimerComplete(TInt aTimerId, TInt aError) |
|
1521 { |
|
1522 VCXLOGLO1(">>>CIptvServiceManagementSync::TimerComplete"); |
|
1523 VCXLOGLO2("aTimerId = %d", aTimerId); |
|
1524 VCXLOGLO2("aError = %d", aError); |
|
1525 |
|
1526 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1527 VCXLOGLO1("<<<CIptvServiceManagementSync::TimerComplete"); |
|
1528 } |
|
1529 |
|
1530 // ----------------------------------------------------------------------------- |
|
1531 // CIptvServiceManagementSync::AddServiceResp() |
|
1532 // iptv_client_api.dll calls this as a response to AddServiceReq() |
|
1533 // ----------------------------------------------------------------------------- |
|
1534 // |
|
1535 void CIptvServiceManagementSync::AddServiceResp(TRespStatus aRespStatus) |
|
1536 { |
|
1537 VCXLOGLO1(">>>CIptvServiceManagementSync::AddServiceResp"); |
|
1538 //Callback ready |
|
1539 |
|
1540 ResponseStatus(aRespStatus); |
|
1541 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1542 VCXLOGLO1("<<<CIptvServiceManagementSync::AddServiceResp"); |
|
1543 } |
|
1544 |
|
1545 // ----------------------------------------------------------------------------- |
|
1546 // CIptvServiceManagementSync::UpdateServiceResp() |
|
1547 // iptv_client_api.dll calls this as a response to UpdateServiceReq() |
|
1548 // ----------------------------------------------------------------------------- |
|
1549 // |
|
1550 void CIptvServiceManagementSync::UpdateServiceResp(TRespStatus aRespStatus) |
|
1551 { |
|
1552 VCXLOGLO1(">>>CIptvServiceManagementSync::UpdateServiceResp"); |
|
1553 //Callback ready |
|
1554 |
|
1555 ResponseStatus(aRespStatus); |
|
1556 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1557 VCXLOGLO1("<<<CIptvServiceManagementSync::UpdateServiceResp"); |
|
1558 } |
|
1559 |
|
1560 // ----------------------------------------------------------------------------- |
|
1561 // CIptvServiceManagementSync::DeleteServiceResp() |
|
1562 // iptv_client_api.dll calls this as a response to DeleteServiceReq() |
|
1563 // ----------------------------------------------------------------------------- |
|
1564 // |
|
1565 void CIptvServiceManagementSync::DeleteServiceResp(TRespStatus aRespStatus) |
|
1566 { |
|
1567 VCXLOGLO1(">>>CIptvServiceManagementSync::DeleteServiceResp"); |
|
1568 //Callback ready |
|
1569 |
|
1570 ResponseStatus(aRespStatus); |
|
1571 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1572 VCXLOGLO1("<<<CIptvServiceManagementSync::DeleteServiceResp"); |
|
1573 } |
|
1574 |
|
1575 // ----------------------------------------------------------------------------- |
|
1576 // CIptvServiceManagementSync::GetServicesResp() |
|
1577 // iptv_client_api.dll calls this as a response to GetServicesReq() |
|
1578 // ----------------------------------------------------------------------------- |
|
1579 // |
|
1580 void CIptvServiceManagementSync::GetServicesResp(TRespStatus aRespStatus, CDesC8ArraySeg* aServicesArray) |
|
1581 { |
|
1582 VCXLOGLO1(">>>CIptvServiceManagementSync::GetServicesResp"); |
|
1583 |
|
1584 // check this |
|
1585 ResponseStatus(aRespStatus); |
|
1586 iServicesArray = aServicesArray; |
|
1587 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1588 VCXLOGLO1("<<<CIptvServiceManagementSync::GetServicesResp"); |
|
1589 } |
|
1590 |
|
1591 // ----------------------------------------------------------------------------- |
|
1592 // CIptvServiceManagementSync::ServerShutdownResp() |
|
1593 // iptv_client_api.dll calls this as a response to ServerShutdownResp() |
|
1594 // ----------------------------------------------------------------------------- |
|
1595 // |
|
1596 void CIptvServiceManagementSync::ServerShutdownResp(TRespStatus aRespStatus) |
|
1597 { |
|
1598 VCXLOGLO1(">>>CIptvServiceManagementSync::ServerShutdownResp"); |
|
1599 //Callback ready |
|
1600 ResponseStatus(aRespStatus); |
|
1601 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1602 VCXLOGLO1("<<<CIptvServiceManagementSync::ServerShutdownResp"); |
|
1603 } |
|
1604 |
|
1605 // ----------------------------------------------------------------------------- |
|
1606 // CIptvServiceManagementSync::GetUsedIapResp() |
|
1607 // iptv_client_api.dll calls this as a response to GetUsedIapResp() |
|
1608 // ----------------------------------------------------------------------------- |
|
1609 // |
|
1610 void CIptvServiceManagementSync::GetUsedIapResp(TUint32 aIapId, |
|
1611 const TDesC& aIapName, |
|
1612 CIptvNetworkSelection::TConnectionPermission aConnectionPermission, |
|
1613 TBool aWlanWhenGPRS, |
|
1614 CIptvNetworkSelection::TRespStatus aRespStatus) |
|
1615 { |
|
1616 VCXLOGLO1(">>>CIptvServiceManagementSync::GetUsedIapResp"); |
|
1617 //Callback ready |
|
1618 |
|
1619 VCXLOGLO2("aRespStatus = %d", aRespStatus); |
|
1620 VCXLOGLO2("aWlanWhenGPRS = %d", aWlanWhenGPRS); |
|
1621 TRespStatus respStatus = ESucceeded; |
|
1622 |
|
1623 if(CIptvNetworkSelection::ESucceeded != aRespStatus) |
|
1624 { |
|
1625 respStatus = EGeneralError; |
|
1626 iIapId = 0; |
|
1627 } |
|
1628 else |
|
1629 { |
|
1630 respStatus = ESucceeded; |
|
1631 iIapId = aIapId; |
|
1632 VCXLOGLO2("aIapId = %d",aIapId); |
|
1633 VCXLOGLO2("iapName = %S",&aIapName); |
|
1634 VCXLOGLO2("connectionPermission = %d",aConnectionPermission); |
|
1635 } |
|
1636 |
|
1637 ResponseStatus(respStatus); |
|
1638 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1639 |
|
1640 VCXLOGLO1("<<<CIptvServiceManagementSync::GetUsedIapResp"); |
|
1641 } |
|
1642 |
|
1643 // ----------------------------------------------------------------------------- |
|
1644 // CIptvServiceManagementSync::SetSpecialAction() |
|
1645 // ----------------------------------------------------------------------------- |
|
1646 // |
|
1647 void CIptvServiceManagementSync::SetSpecialAction(TInt aSpecialAction) |
|
1648 { |
|
1649 switch(aSpecialAction) |
|
1650 { |
|
1651 case EIptvSmNoSpecialAction: |
|
1652 default: |
|
1653 break; |
|
1654 |
|
1655 case EIptvSmWaitNoEvents: |
|
1656 iWaitNoEvents = ETrue; |
|
1657 break; |
|
1658 |
|
1659 case EIptvSmCancelNextAsyncRequest: |
|
1660 iSpecialAction = static_cast<TIptvSmSpecialAction>(aSpecialAction); |
|
1661 break; |
|
1662 } |
|
1663 } |
|
1664 |
|
1665 // ----------------------------------------------------------------------------- |
|
1666 // CIptvServiceManagementSync::WaitForProvisioningEvents() |
|
1667 // ----------------------------------------------------------------------------- |
|
1668 // |
|
1669 void CIptvServiceManagementSync::WaitForProvisioningEvents() |
|
1670 { |
|
1671 VCXLOGLO1(">>>CIptvServiceManagementSync::WaitForProvisioningEvents"); |
|
1672 |
|
1673 iProvisioningWaitGoing = ETrue; |
|
1674 do |
|
1675 { |
|
1676 iProvisioningEventReceived = EFalse; |
|
1677 |
|
1678 iIptvTestTimer->CancelTimer(); |
|
1679 iIptvTestTimer->After(1000000); |
|
1680 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1681 } |
|
1682 while (iProvisioningEventReceived); |
|
1683 iProvisioningWaitGoing = EFalse; |
|
1684 |
|
1685 VCXLOGLO1("<<<CIptvServiceManagementSync::WaitForProvisioningEvents"); |
|
1686 } |
|
1687 |
|
1688 // ----------------------------------------------------------------------------- |
|
1689 // CIptvServiceManagementSync::RepeatNextRequest() |
|
1690 // ----------------------------------------------------------------------------- |
|
1691 // |
|
1692 void CIptvServiceManagementSync::RepeatNextRequest(TBool aRequestRepeatCount) |
|
1693 { |
|
1694 iRequestRepeatCount = aRequestRepeatCount; |
|
1695 } |
|
1696 |
|
1697 // ----------------------------------------------------------------------------- |
|
1698 // CIptvServiceManagementSync::GetRepeatNextRequestCount() |
|
1699 // ----------------------------------------------------------------------------- |
|
1700 // |
|
1701 TUint CIptvServiceManagementSync::GetRepeatNextRequestCount() |
|
1702 { |
|
1703 if(iRequestRepeatCount < 0) iRequestRepeatCount = 1; |
|
1704 return iRequestRepeatCount; |
|
1705 } |
|
1706 |
|
1707 // ----------------------------------------------------------------------------- |
|
1708 // CIptvServiceManagementSync::SetExpectedSmEvent() |
|
1709 // -----------------------------------------------------------------------------// |
|
1710 void CIptvServiceManagementSync::SetExpectedSmEvent(CIptvSmEvent::TEvent aEvent, TInt aEventCount) |
|
1711 { |
|
1712 VCXLOGLO1(">>>CIptvServiceManagementSync::SetExpectedSmEvent"); |
|
1713 iEventReceived = EFalse; |
|
1714 |
|
1715 if(iIgnoreEvents) |
|
1716 { |
|
1717 iWaitingForEvent = EFalse; |
|
1718 VCXLOGLO1("Not waiting event flag is set for next request."); |
|
1719 } |
|
1720 else |
|
1721 { |
|
1722 VCXLOGLO1("******************************************************************"); |
|
1723 switch(aEvent) |
|
1724 { |
|
1725 case CIptvSmEvent::EServiceAdded: |
|
1726 { |
|
1727 VCXLOGLO1("Event: EServiceAdded"); |
|
1728 break; |
|
1729 } |
|
1730 |
|
1731 case CIptvSmEvent::EServiceModified: |
|
1732 { |
|
1733 VCXLOGLO1("Event: EServiceModified"); |
|
1734 break; |
|
1735 } |
|
1736 |
|
1737 case CIptvSmEvent::EServiceDeleted: |
|
1738 { |
|
1739 VCXLOGLO1("Event: EServiceDeleted"); |
|
1740 break; |
|
1741 } |
|
1742 |
|
1743 case CIptvSmEvent::EServiceScheduleModified: |
|
1744 { |
|
1745 VCXLOGLO1("Event: EServiceScheduleModified"); |
|
1746 break; |
|
1747 } |
|
1748 |
|
1749 default: |
|
1750 VCXLOGLO2("Unexpected event: %d", aEvent); |
|
1751 break; |
|
1752 } |
|
1753 |
|
1754 if( iExpectedEventCount > 0 ) |
|
1755 { |
|
1756 VCXLOGLO3("Already expecting %d events, adding %d to count.", iExpectedEventCount, aEventCount); |
|
1757 iExpectedEventCount += aEventCount; |
|
1758 } |
|
1759 else |
|
1760 { |
|
1761 iExpectedEventCount = aEventCount; |
|
1762 } |
|
1763 VCXLOGLO2("Expected count: %d", iExpectedEventCount); |
|
1764 |
|
1765 iWaitingForEvent = ETrue; |
|
1766 iExpectedSmEvent = aEvent; |
|
1767 } |
|
1768 VCXLOGLO1("<<<CIptvServiceManagementSync::SetExpectedSmEvent"); |
|
1769 } |
|
1770 |
|
1771 // ----------------------------------------------------------------------------- |
|
1772 // CIptvServiceManagementSync::HandleSmEvent() |
|
1773 // ----------------------------------------------------------------------------- |
|
1774 // |
|
1775 void CIptvServiceManagementSync::HandleSmEvent(CIptvSmEvent& aEvent) |
|
1776 { |
|
1777 VCXLOGLO1(">>>CIptvServiceManagementSync::HandleSmEvent"); |
|
1778 VCXLOGLO1("**********************************************************"); |
|
1779 VCXLOGLO2("CIptvServiceManagementSync:: iEvent: %d", aEvent.iEvent); |
|
1780 VCXLOGLO2("CIptvServiceManagementSync:: iServiceId: %d", aEvent.iServiceId); |
|
1781 |
|
1782 switch(aEvent.iEvent) |
|
1783 { |
|
1784 case CIptvSmEvent::EServiceAdded: |
|
1785 { |
|
1786 VCXLOGLO1("Event: EServiceAdded"); |
|
1787 } |
|
1788 break; |
|
1789 |
|
1790 case CIptvSmEvent::EServiceModified: |
|
1791 { |
|
1792 VCXLOGLO1("Event: EServiceModified"); |
|
1793 } |
|
1794 break; |
|
1795 |
|
1796 case CIptvSmEvent::EServiceDeleted: |
|
1797 { |
|
1798 VCXLOGLO1("Event: EServiceDeleted"); |
|
1799 } |
|
1800 break; |
|
1801 |
|
1802 case CIptvSmEvent::EServiceScheduleModified: |
|
1803 { |
|
1804 VCXLOGLO1("Event: EServiceScheduleModified"); |
|
1805 } |
|
1806 break; |
|
1807 |
|
1808 case CIptvSmEvent::EServiceSelectionModified: |
|
1809 { |
|
1810 VCXLOGLO1("Event: EServiceSelectionModified"); |
|
1811 } |
|
1812 break; |
|
1813 |
|
1814 default: |
|
1815 VCXLOGLO1("CIptvServiceManagementSync:: Unexpected event!"); |
|
1816 break; |
|
1817 } |
|
1818 |
|
1819 if(iProvisioningWaitGoing) |
|
1820 { |
|
1821 VCXLOGLO1("Wait for provisioning events going."); |
|
1822 iProvisioningEventReceived = ETrue; |
|
1823 VCXLOGLO1("<<<CIptvServiceManagementSync::HandleSmEvent"); |
|
1824 return; |
|
1825 } |
|
1826 |
|
1827 if(iIgnoreEvents) |
|
1828 { |
|
1829 VCXLOGLO1("Ignoring the event."); |
|
1830 VCXLOGLO1("<<<CIptvServiceManagementSync::HandleSmEvent"); |
|
1831 return; |
|
1832 } |
|
1833 |
|
1834 if(iWaitingForEvent) |
|
1835 { |
|
1836 iEventReceived = ETrue; |
|
1837 |
|
1838 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStop); |
|
1839 if(iIptvTestTimer) |
|
1840 { |
|
1841 iIptvTestTimer->CancelTimer(); |
|
1842 } |
|
1843 |
|
1844 if(aEvent.iEvent != iExpectedSmEvent) |
|
1845 { |
|
1846 // We let modified event go for added event |
|
1847 if( !(iExpectedSmEvent == CIptvSmEvent::EServiceAdded && (aEvent.iEvent == CIptvSmEvent::EServiceModified |
|
1848 || aEvent.iEvent == CIptvSmEvent::EServiceSelectionModified) ) ) |
|
1849 { |
|
1850 VCXLOGLO2("* ERROR * Received an unexpected event, was waiting for %d. Leaving!", iExpectedSmEvent); |
|
1851 User::Leave(KErrUnknown); |
|
1852 } |
|
1853 else |
|
1854 { |
|
1855 VCXLOGLO1("Correct event received."); |
|
1856 } |
|
1857 } |
|
1858 |
|
1859 --iExpectedEventCount; |
|
1860 |
|
1861 if( iExpectedEventCount <= 0) |
|
1862 { |
|
1863 // stop the possible wait for event |
|
1864 iWaitingForEvent = EFalse; |
|
1865 } |
|
1866 } |
|
1867 else |
|
1868 { |
|
1869 VCXLOGLO1("* ERROR * Received an event when not waiting for one. Leaving!"); |
|
1870 User::Leave(KErrUnknown); |
|
1871 } |
|
1872 |
|
1873 VCXLOGLO1("<<<CIptvServiceManagementSync::HandleSmEvent"); |
|
1874 } |
|
1875 |
|
1876 void CIptvServiceManagementSync::IncreaseExpectedEventCount( TInt aAmount ) |
|
1877 { |
|
1878 iExpectedEventCount += aAmount; |
|
1879 VCXLOGLO3("Increasing expected event count by %d, now waiting for %d events.", aAmount, iExpectedEventCount); |
|
1880 } |
|
1881 |
|
1882 // ----------------------------------------------------------------------------- |
|
1883 // CIptvServiceManagementSync::WaitForSmEvent() |
|
1884 // ----------------------------------------------------------------------------- |
|
1885 // |
|
1886 TInt CIptvServiceManagementSync::WaitForSmEvent() |
|
1887 { |
|
1888 if(iIgnoreEvents) return KErrNone; |
|
1889 |
|
1890 VCXLOGLO1(">>>CIptvServiceManagementSync::WaitForSmEvent"); |
|
1891 VCXLOGLO1("--------------------------------------------------"); |
|
1892 |
|
1893 if(!iWaitingForEvent) |
|
1894 { |
|
1895 if(!iEventReceived) |
|
1896 { |
|
1897 VCXLOGLO1("* ERROR * Not waiting for an event and no event received. Test code logic error."); |
|
1898 VCXLOGLO1("<<<CIptvServiceManagementSync::WaitForSmEvent"); |
|
1899 return KErrUnknown; |
|
1900 } |
|
1901 else |
|
1902 { |
|
1903 // we got the event before call to this method so no need to wait |
|
1904 VCXLOGLO1("Event received before this method call."); |
|
1905 VCXLOGLO1("<<<CIptvServiceManagementSync::WaitForSmEvent"); |
|
1906 return KErrNone; |
|
1907 } |
|
1908 } |
|
1909 |
|
1910 iIptvTestTimer->After(4 * 1000000); |
|
1911 iActiveWait->ActiveWait(CIptvTestActiveWait::EActiveWaitStart); |
|
1912 |
|
1913 if(!iEventReceived) |
|
1914 { |
|
1915 VCXLOGLO2("* ERROR * Did not receive expected event: %d", iExpectedSmEvent); |
|
1916 VCXLOGLO1("<<<CIptvServiceManagementSync::WaitForSmEvent"); |
|
1917 // return KErrUnknown; |
|
1918 } |
|
1919 |
|
1920 VCXLOGLO2("Event received ok. %d", iExpectedSmEvent); |
|
1921 VCXLOGLO1("<<<CIptvServiceManagementSync::WaitForSmEvent"); |
|
1922 return KErrNone; |
|
1923 } |
|
1924 |
|
1925 |
|
1926 // ----------------------------------------------------------------------------- |
|
1927 // CIptvServiceManagementSync::PrepareForRequest() |
|
1928 // ----------------------------------------------------------------------------- |
|
1929 // |
|
1930 TInt CIptvServiceManagementSync::PrepareForRequest() |
|
1931 { |
|
1932 VCXLOGLO1(">>>CIptvServiceManagementSync::PrepareForRequest"); |
|
1933 |
|
1934 if(iWaitNoEvents) |
|
1935 { |
|
1936 // special action set and we ignore all events for this request |
|
1937 iIgnoreEvents = ETrue; |
|
1938 iWaitNoEvents = EFalse; |
|
1939 } |
|
1940 else |
|
1941 { |
|
1942 // for default we check the events |
|
1943 iIgnoreEvents = EFalse; |
|
1944 } |
|
1945 |
|
1946 if(iRequestRepeatCount <= 0) iRequestRepeatCount = 1; |
|
1947 |
|
1948 TInt rv = KErrNone; |
|
1949 |
|
1950 VCXLOGLO1("<<<CIptvServiceManagementSync::PrepareForRequest"); |
|
1951 return rv; |
|
1952 } |
|
1953 |
|
1954 // ----------------------------------------------------------------------------- |
|
1955 // CIptvServiceManagementSync::FinishRequest() |
|
1956 // ----------------------------------------------------------------------------- |
|
1957 // |
|
1958 TInt CIptvServiceManagementSync::FinishRequest() |
|
1959 { |
|
1960 VCXLOGLO1(">>>CIptvServiceManagementSync::FinishRequest"); |
|
1961 |
|
1962 iIgnoreEvents = ETrue; |
|
1963 iWaitNoEvents = EFalse; |
|
1964 |
|
1965 iSpecialAction = EIptvSmNoSpecialAction; |
|
1966 |
|
1967 VCXLOGLO1("<<<CIptvServiceManagementSync::FinishRequest"); |
|
1968 return KErrNone; |
|
1969 } |
|
1970 |
|
1971 |
|
1972 // End of File |