57 const TInt KSingleCity( 1 ); |
57 const TInt KSingleCity( 1 ); |
58 const TInt KZero( 0 ); |
58 const TInt KZero( 0 ); |
59 const TInt KFirstBootDone( 1 ); |
59 const TInt KFirstBootDone( 1 ); |
60 const TInt KTimeFormatLength( 16 ); // "20070000:090000." |
60 const TInt KTimeFormatLength( 16 ); // "20070000:090000." |
61 const TInt KMaxMobileCountryCode( 4 ); |
61 const TInt KMaxMobileCountryCode( 4 ); |
62 |
62 const TInt KCDTQueryTimer( 2000000 ); // 2 seconds |
|
63 const TInt KAppBackgroundInterval( 2000000 ); // 2 seconds |
63 |
64 |
64 // Literals |
65 // Literals |
65 _LIT( KOneSpace, " " ); |
66 _LIT( KOneSpace, " " ); |
66 _LIT( KMobileCountryCode, "%d" ); |
67 _LIT( KMobileCountryCode, "%d" ); |
67 _LIT( KDefaultDateTimeValue, "20070000:090000." ); // YYYYMMDD:HHMMSS. |
68 _LIT( KDefaultDateTimeValue, "20070000:090000." ); // YYYYMMDD:HHMMSS. |
171 |
172 |
172 iPSObserver = CPsKeyObserver::NewL(KPSUidStartup, KPSStartupUiPhase, EStartupUiPhaseAllDone, this); |
173 iPSObserver = CPsKeyObserver::NewL(KPSUidStartup, KPSStartupUiPhase, EStartupUiPhaseAllDone, this); |
173 |
174 |
174 iIsRTCInvalidAndHiddenReset = EFalse; |
175 iIsRTCInvalidAndHiddenReset = EFalse; |
175 |
176 |
176 ActivateL(); |
177 iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh ); |
|
178 |
|
179 iNitzTimerActive = EFalse; |
|
180 |
|
181 ActivateL(); |
177 |
182 |
178 __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" ); |
183 __PRINTS( "CAdtUpdaterContainer::ConstructL - Exit" ); |
179 } |
184 } |
180 |
185 |
181 // --------------------------------------------------------- |
186 // --------------------------------------------------------- |
322 |
327 |
323 // Listener object which listens for a Nitz packet |
328 // Listener object which listens for a Nitz packet |
324 iListener = CAdtUpdaterListener::NewL( this ); |
329 iListener = CAdtUpdaterListener::NewL( this ); |
325 iListener->WaitForNitzInfoL(); |
330 iListener->WaitForNitzInfoL(); |
326 |
331 |
327 // A 40 seconds call back timer. |
332 // A 90 seconds call back timer. |
328 TCallBack timerCallBack( CallBackL, this ); |
333 TCallBack timerCallBack( CallBackL, this ); |
329 iPeriodic = CPeriodic::NewL( EPriorityAbsoluteHigh ); |
334 // Start the Nitz timer. |
330 // Start the timer |
|
331 iPeriodic->Start( KTimeout, KInterval, timerCallBack ); |
335 iPeriodic->Start( KTimeout, KInterval, timerCallBack ); |
|
336 iNitzTimerActive =ETrue; |
332 } |
337 } |
333 else if( IsFirstBoot()&& PredictiveTimeEnabled()) |
338 else if( IsFirstBoot()&& PredictiveTimeEnabled()) |
334 { |
339 { |
335 __PRINTS( "First boot, normal boot sequence" ); |
340 __PRINTS( "First boot, normal boot sequence" ); |
336 WaitToShowQueriesL(); |
341 WaitToShowQueriesL(); |
365 TInt CAdtUpdaterContainer::CallBackL( TAny* aPtr ) |
370 TInt CAdtUpdaterContainer::CallBackL( TAny* aPtr ) |
366 { |
371 { |
367 __PRINTS( "CAdtUpdaterContainer::CallBackL - Entry" ); |
372 __PRINTS( "CAdtUpdaterContainer::CallBackL - Entry" ); |
368 |
373 |
369 CAdtUpdaterContainer* selfObject = static_cast< CAdtUpdaterContainer* >( aPtr ); |
374 CAdtUpdaterContainer* selfObject = static_cast< CAdtUpdaterContainer* >( aPtr ); |
370 CAdtUpdaterListener* listenerObject = selfObject->Listener(); |
375 |
371 |
376 if(selfObject->iNitzTimerActive) |
372 // Callback after 40 seconds. If control reaches here, it means Nitz packet has |
|
373 // not yet arrived and we can continue with normal bootup sequence. |
|
374 |
|
375 // Buf before we do that, we can do a final check with the server, just to ensure |
|
376 // there weren't any missed notifications. |
|
377 TBool dataAvailable = listenerObject->ConfirmDataAvailabilityL(); |
|
378 |
|
379 if( dataAvailable ) |
|
380 { |
377 { |
381 __PRINTS( "NITZ info is available" ); |
378 CAdtUpdaterListener* listenerObject = selfObject->Listener(); |
382 |
379 |
383 // Update the status to EDataAvailable |
380 // Callback after 90 seconds. If control reaches here, it means Nitz packet has |
384 selfObject->iDataAvailability = EDataAvailable; |
381 // not yet arrived and we can continue with normal bootup sequence. |
385 |
382 |
386 // We have data from server. |
383 // Buf before we do that, we can do a final check with the server, just to ensure |
387 listenerObject->NitzInfoAvailableL(); |
384 // there weren't any missed notifications. |
388 } |
385 TBool dataAvailable = listenerObject->ConfirmDataAvailabilityL(); |
389 else |
386 |
|
387 if( dataAvailable ) |
|
388 { |
|
389 __PRINTS( "NITZ info is available" ); |
|
390 |
|
391 // Update the status to EDataAvailable |
|
392 selfObject->iDataAvailability = EDataAvailable; |
|
393 |
|
394 // We have data from server. |
|
395 listenerObject->NitzInfoAvailableL(); |
|
396 } |
|
397 else |
|
398 { |
|
399 __PRINTS( "NITZ info unavailable" ); |
|
400 |
|
401 // Update the status to EDataNotAvailable |
|
402 selfObject->iDataAvailability = EDataNotAvailable; |
|
403 |
|
404 // We don't have any data for sure. |
|
405 selfObject->NitzInfoNotAvailableL(); |
|
406 } |
|
407 } |
|
408 else//CDT Query timer is active. |
390 { |
409 { |
391 __PRINTS( "NITZ info unavailable" ); |
410 if(selfObject->iAdtUpdaterAppUi->IsHighPriorityWindowActive()) |
392 |
411 { |
393 // Update the status to EDataNotAvailable |
412 //If any high priority window is active, we push the CDT to background. |
394 selfObject->iDataAvailability = EDataNotAvailable; |
413 selfObject->iAdtUpdaterAppUi->ToggleAppViewL(EFalse); |
395 |
414 } |
396 // We don't have any data for sure. |
415 else if(selfObject->QueryDialogsInDisplay() && selfObject->iAdtUpdaterAppUi->IsAppInBackground() |
397 selfObject->NitzInfoNotAvailableL(); |
416 && !selfObject->iAdtUpdaterAppUi->IsHighPriorityWindowActive()) |
398 } |
417 { |
399 |
418 //For every 2 sec, until ADTUpdater exits, we will check whether app is in background |
|
419 //and bring to foreground. |
|
420 selfObject->iAdtUpdaterAppUi->ToggleAppViewL(ETrue); |
|
421 } |
|
422 } |
400 __PRINTS( "CAdtUpdaterContainer::CallBackL - Exit" ); |
423 __PRINTS( "CAdtUpdaterContainer::CallBackL - Exit" ); |
401 |
424 |
402 return KZero; |
425 return KZero; |
403 } |
426 } |
404 |
427 |
610 { |
634 { |
611 __PRINTS( "CAdtUpdaterContainer::ShowQueriesL - Entry" ); |
635 __PRINTS( "CAdtUpdaterContainer::ShowQueriesL - Entry" ); |
612 |
636 |
613 iPSObserver->Cancel(); |
637 iPSObserver->Cancel(); |
614 |
638 |
|
639 if(iPeriodic->IsActive()) |
|
640 { |
|
641 iPeriodic->Cancel(); |
|
642 } |
|
643 TCallBack timerCallBack( CallBackL, this ); |
|
644 // Start the CDT Query timer. |
|
645 iPeriodic->Start( KCDTQueryTimer, KAppBackgroundInterval, timerCallBack ); |
|
646 |
|
647 iNitzTimerActive = EFalse; |
|
648 |
615 if(iIsRTCInvalidAndHiddenReset) |
649 if(iIsRTCInvalidAndHiddenReset) |
616 { |
650 { |
617 ShowDateAndTimeQueriesL(); |
651 ShowDateAndTimeQueriesL(); |
618 } |
652 } |
619 else |
653 else |
635 void CAdtUpdaterContainer::DoContinueWithNormalBootL() |
669 void CAdtUpdaterContainer::DoContinueWithNormalBootL() |
636 { |
670 { |
637 __PRINTS( "CAdtUpdaterContainer::DoContinueWithNormalBootL - Entry" ); |
671 __PRINTS( "CAdtUpdaterContainer::DoContinueWithNormalBootL - Entry" ); |
638 |
672 |
639 // First bring the application to the foreground. |
673 // First bring the application to the foreground. |
640 iAdtUpdaterAppUi->ToggleAppViewL( ETrue ); |
674 if(!iAdtUpdaterAppUi->IsHighPriorityWindowActive()) |
|
675 { |
|
676 iAdtUpdaterAppUi->ToggleAppViewL( ETrue ); |
|
677 } |
641 // Show in FSW. |
678 // Show in FSW. |
642 iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse ); |
679 iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse ); |
643 // Hide the status pane. |
680 // Hide the status pane. |
644 iAdtUpdaterAppUi->HideStatusPane( ETrue ); |
681 iAdtUpdaterAppUi->HideStatusPane( ETrue ); |
645 |
682 |
684 // Show in FSW. |
721 // Show in FSW. |
685 iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse ); |
722 iAdtUpdaterAppUi->HideApplicationFromFSW( EFalse ); |
686 // Hide the status pane. |
723 // Hide the status pane. |
687 iAdtUpdaterAppUi->HideStatusPane( ETrue ); |
724 iAdtUpdaterAppUi->HideStatusPane( ETrue ); |
688 |
725 |
|
726 iQueryDialogsInDisplay = ETrue; |
689 // No first boot but RTCStatus is corrupted. Ask time and date" |
727 // No first boot but RTCStatus is corrupted. Ask time and date" |
690 |
728 |
691 // Showing Date query to user. |
729 // Showing Date query to user. |
692 ShowDateQueryL(); |
730 ShowDateQueryL(); |
693 |
731 |
694 // Showing Time query to user. |
732 // Showing Time query to user. |
695 ShowTimeQueryL(); |
733 ShowTimeQueryL(); |
696 |
734 iQueryDialogsInDisplay = EFalse; |
697 //Deactivate the plug-in as we are setting the date/time manually |
735 //Deactivate the plug-in as we are setting the date/time manually |
698 DeActivateNitzPlugin(); |
736 DeActivateNitzPlugin(); |
699 |
737 |
700 __PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Exit" ); |
738 __PRINTS( "CAdtUpdaterContainer::DoContinueWithRTCInvalidAndHiddenReset - Exit" ); |
701 } |
739 } |