504 |
504 |
505 return; |
505 return; |
506 } |
506 } |
507 } |
507 } |
508 |
508 |
|
509 // Initialise the attributes to null. |
|
510 TTime invalidTime( 0 ); |
|
511 iTimeAttributes->iDstOffset = TTimeIntervalMinutes( 0 ); |
|
512 iTimeAttributes->iTimeZoneOffset = TTimeIntervalMinutes( 0 ); |
|
513 iTimeAttributes->iUtcDateTime = invalidTime.DateTime(); |
509 // Get all the information related to the plugin. |
514 // Get all the information related to the plugin. |
510 // The UTC time. |
515 // The UTC time. |
511 TRAP_IGNORE( aPluginImpl.GetTimeInformationL( EUTCTime, iTimeAttributes ) ); |
516 TRAP_IGNORE( aPluginImpl.GetTimeInformationL( EUTCTime, iTimeAttributes ) ); |
512 // The default offset. |
517 // The default offset. |
513 TRAP_IGNORE( aPluginImpl.GetTimeInformationL( ETZOffset, iTimeAttributes ) ); |
518 TRAP_IGNORE( aPluginImpl.GetTimeInformationL( ETZOffset, iTimeAttributes ) ); |
521 { |
526 { |
522 __PRINTS( "We have already recieved the MCC" ); |
527 __PRINTS( "We have already recieved the MCC" ); |
523 |
528 |
524 // Try to resolve the timezone id with the data that we have recieved. |
529 // Try to resolve the timezone id with the data that we have recieved. |
525 TInt timezoneId; |
530 TInt timezoneId; |
526 TInt errorVal; |
531 TInt errorVal = 0; |
527 TRAP_IGNORE( errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, iMcc, timezoneId ) ); |
532 TRAP_IGNORE( errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, iMcc, timezoneId ) ); |
528 |
533 |
529 __PRINT( "CClkSrvImpl::NotifyTimeChangeL - timeZoneId: %d", timezoneId ); |
534 __PRINT( "CClkSrvImpl::NotifyTimeChangeL - timeZoneId: %d", timezoneId ); |
530 |
535 |
531 __PRINT( "NotifyTimeChangeL::timezoneId : %d", timezoneId); |
536 __PRINT( "NotifyTimeChangeL::timezoneId : %d", timezoneId); |
591 // 1. Use the plugin data and set the time. |
596 // 1. Use the plugin data and set the time. |
592 // 2. Use the offset in the plugindata or any available to deduce the timezone id. |
597 // 2. Use the offset in the plugindata or any available to deduce the timezone id. |
593 |
598 |
594 // Try to resolve the timezone id with the data that we have recieved. |
599 // Try to resolve the timezone id with the data that we have recieved. |
595 TInt timezoneId; |
600 TInt timezoneId; |
596 TInt errorVal; |
601 TInt errorVal = 0; |
597 const TBuf< 4 > invalidMCC( KInvalidMCC ); |
602 const TBuf< 4 > invalidMCC( KInvalidMCC ); |
598 TRAP_IGNORE( errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, invalidMCC, timezoneId ) ); |
603 TRAP_IGNORE( errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, invalidMCC, timezoneId ) ); |
599 |
604 |
600 if( KErrNone == errorVal ) |
605 if( KErrNone == errorVal ) |
601 { |
606 { |
669 |
674 |
670 // We have atleast one protocol active. |
675 // We have atleast one protocol active. |
671 // Lets see if we can narrow down to a single timezone with the MCC recieved. |
676 // Lets see if we can narrow down to a single timezone with the MCC recieved. |
672 RArray< CTzId > tzIdArray; |
677 RArray< CTzId > tzIdArray; |
673 |
678 |
674 // Try and fetch the timezone ID using the MCC recieved. |
679 // This parte of code introduced due to error ID EASH-82DPPC(3G Tests for NITZ and GPRS Interaction) |
675 TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) ); |
680 // Fix is bascially to narrowing down to single timezone id if NITZ packet is received prior to MCC. |
|
681 // In first IF state we are trying to narrowdown to single timezone ID, if not possible try to use MCC to get timezone |
|
682 // In second IF , we are using MCC to narrow down to single timezone ID directly as dont have NITZ info. |
|
683 if( iTimeAttributes ) |
|
684 { |
|
685 __PRINTS("timeatrrtibutes has value"); |
|
686 |
|
687 TTime invalidTime(0); |
|
688 if( iTimeAttributes->iDstOffset != TTimeIntervalMinutes( 0 ) && |
|
689 iTimeAttributes->iTimeZoneOffset != TTimeIntervalMinutes( 0 ) && |
|
690 iTimeAttributes->iUtcDateTime.Year() != invalidTime.DateTime().Year() ) |
|
691 { |
|
692 // Try to resolve the timezone id with the data that we have recieved. |
|
693 TInt timezoneId; |
|
694 TRAP_IGNORE( TInt errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, iMcc, timezoneId ) ); |
|
695 |
|
696 __PRINT("TIMEZONE ID %d", timezoneId ); |
|
697 |
|
698 // Append the timezone id to array. |
|
699 |
|
700 CTzId* matchingDSTZoneId = CTzId::NewL( timezoneId ); |
|
701 CleanupStack::PushL( matchingDSTZoneId ); |
|
702 |
|
703 tzIdArray.AppendL( *matchingDSTZoneId ); |
|
704 |
|
705 CleanupStack::PopAndDestroy( matchingDSTZoneId ); |
|
706 |
|
707 matchingDSTZoneId = NULL; |
|
708 } |
|
709 else |
|
710 { |
|
711 __PRINTS("NOT ABLE TO NARROW DOWN TO TIMEZONE ID WITH RECEIVED NITZ HENCE TRY WITH MCC"); |
|
712 // Not able to narrow down to single timezone id with received NITZ packet hence try with MCC. |
|
713 TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) ); |
|
714 } |
|
715 } |
|
716 else |
|
717 { |
|
718 __PRINTS("NO NITZ INFO HENCE TRY WITH MCC"); |
|
719 // No NITZ info hecne try with MCC to get the time zone Id. |
|
720 TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) ); |
|
721 } |
676 |
722 |
677 // A single matching timezone was found. Set it as the default one. |
723 // A single matching timezone was found. Set it as the default one. |
678 if( KSingleZone == tzIdArray.Count() ) |
724 if( KSingleZone == tzIdArray.Count() ) |
679 { |
725 { |
680 RTz tz; |
726 RTz tz; |
706 TRAP_IGNORE( tz.SetTimeZoneL( *newTzId ) ); |
752 TRAP_IGNORE( tz.SetTimeZoneL( *newTzId ) ); |
707 } |
753 } |
708 CleanupStack::PopAndDestroy( newTzId ); |
754 CleanupStack::PopAndDestroy( newTzId ); |
709 } |
755 } |
710 CleanupStack::PopAndDestroy( currentCTzId ); |
756 CleanupStack::PopAndDestroy( currentCTzId ); |
711 CleanupStack::PopAndDestroy( &tz ); |
757 CleanupStack::PopAndDestroy( &tz ); |
712 } |
758 |
|
759 } |
|
760 |
|
761 // Set the time on device and set the attributes to null so that we avoid setting old value. |
|
762 if( iTimeAttributes ) |
|
763 { |
|
764 // Time sent by nw is UTC |
|
765 TTime nwUtcTime( iTimeAttributes->iUtcDateTime); |
|
766 |
|
767 // Set the UTC time only. This is being done because with the UTC time, |
|
768 // before the time is being set, the dst properties for the timezone are being checked. |
|
769 // If its not the first boot, then set the time. |
|
770 __PRINTS( "Setting the UTC time." ); |
|
771 |
|
772 TRAP_IGNORE( User::SetUTCTime( nwUtcTime ) ); |
|
773 |
|
774 // Setting the attributes to null again as we dont trust on |
|
775 // previous NITZ data recevied by device.If device receive |
|
776 // NITZ data again attributes would get filled with actual value. |
|
777 // Has been kept outside because this statement is valid for |
|
778 // first boot also. |
|
779 |
|
780 iTimeAttributes->iDstOffset = TTimeIntervalMinutes( 0 ); |
|
781 iTimeAttributes->iTimeZoneOffset = TTimeIntervalMinutes( 0 ); |
|
782 TTime invalidTime( 0 ); |
|
783 iTimeAttributes->iUtcDateTime = invalidTime.DateTime(); |
|
784 } |
713 } |
785 } |
714 |
786 |
715 // Notify the sessions about the change in mcc. |
787 // Notify the sessions about the change in mcc. |
716 iClkSrv->NotifyAboutChange( EComponentMcc, 0, KErrNone ); |
788 iClkSrv->NotifyAboutChange( EComponentMcc, 0, KErrNone ); |
717 |
789 |