clock2/clockengines/clockserver/server/src/clockserverimpl.cpp
branchRCL_3
changeset 20 21239b3bcd78
parent 0 f979ecb2b13e
child 21 9711e452b5e9
equal deleted inserted replaced
19:1984aceb8774 20:21239b3bcd78
   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();
       
   514 		
       
   515 	
   509 	// Get all the information related to the plugin.
   516 	// Get all the information related to the plugin.
   510 	// The UTC time.
   517 	// The UTC time.
   511 	TRAP_IGNORE( aPluginImpl.GetTimeInformationL( EUTCTime, iTimeAttributes ) );	
   518 	TRAP_IGNORE( aPluginImpl.GetTimeInformationL( EUTCTime, iTimeAttributes ) );	
   512 	// The default offset.
   519 	// The default offset.
   513 	TRAP_IGNORE( aPluginImpl.GetTimeInformationL( ETZOffset, iTimeAttributes ) );
   520 	TRAP_IGNORE( aPluginImpl.GetTimeInformationL( ETZOffset, iTimeAttributes ) );
   695 		
   702 		
   696 		// We have atleast one protocol active.
   703 		// We have atleast one protocol active.
   697 		// Lets see if we can narrow down to a single timezone with the MCC recieved.
   704 		// Lets see if we can narrow down to a single timezone with the MCC recieved.
   698 		RArray< CTzId > tzIdArray;
   705 		RArray< CTzId > tzIdArray;
   699 		
   706 		
   700 		// Try and fetch the timezone ID using the MCC recieved.
   707 		// This parte of code introduced due to error ID EASH-82DPPC(3G Tests for NITZ and GPRS Interaction)
   701 		TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );
   708 		// Fix is bascially to narrowing down to single timezone id if NITZ packet is received prior to MCC.
   702 		
   709 		// In first IF state we are trying to narrowdown to single timezone ID, if not possible try to use MCC to get timezone
       
   710 		// In second IF , we are using MCC to narrow down to single timezone ID directly as dont have NITZ info.
       
   711 		if( iTimeAttributes )
       
   712 		{
       
   713 			TTime invalidTime(0);
       
   714 			if( iTimeAttributes->iDstOffset != TTimeIntervalMinutes( 0 ) &&
       
   715 			iTimeAttributes->iTimeZoneOffset != TTimeIntervalMinutes( 0 ) &&
       
   716 			iTimeAttributes->iUtcDateTime.Year() != invalidTime.DateTime().Year() )
       
   717 			{
       
   718 				// Try to resolve the timezone id with the data that we have recieved.
       
   719 				TInt timezoneId;
       
   720 				TRAP_IGNORE( TInt errorVal = iTzResolver->GetTimeZoneL( *iTimeAttributes, iMcc, timezoneId ) );
       
   721 				
       
   722 				__PRINT("TIMEZONE ID %d", timezoneId );
       
   723 
       
   724 				// Append the timezone id to array.
       
   725 
       
   726 				CTzId* matchingDSTZoneId = CTzId::NewL( timezoneId );
       
   727 				CleanupStack::PushL( matchingDSTZoneId );
       
   728 
       
   729 				tzIdArray.AppendL( *matchingDSTZoneId );
       
   730 
       
   731 				CleanupStack::PopAndDestroy( matchingDSTZoneId );
       
   732 
       
   733 				matchingDSTZoneId = NULL;
       
   734 			}
       
   735 			else
       
   736 			{
       
   737 				__PRINTS("NOT ABLE TO NARROW DOWN TO TIMEZONE ID WITH RECEIVED NITZ HENCE TRY WITH MCC");
       
   738 				// Not able to narrow down to single timezone id with received NITZ packet hence try with MCC.
       
   739 				TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );	
       
   740 			}
       
   741 		}
       
   742 		else
       
   743 		{
       
   744 			__PRINTS("NO NITZ INFO HENCE TRY WITH MCC");
       
   745 			// No NITZ info hecne try with MCC to get the time zone Id.
       
   746 			TRAP_IGNORE( iTzResolver->TzIdFromMccL( iMcc, tzIdArray, KInvalidTimeZoneId ) );
       
   747 		}
   703 		// Code to check if its the first boot.
   748 		// Code to check if its the first boot.
   704 		// Get the first boot status from cenrep. If it is the first boot, clockserver will not update the time.
   749 		// Get the first boot status from cenrep. If it is the first boot, clockserver will not update the time.
   705 		TBool staleBoot( EFalse );
   750 		TBool staleBoot( EFalse );
   706 		
   751 		
   707 		CRepository* cenRep( NULL );
   752 		CRepository* cenRep( NULL );
   753 					}
   798 					}
   754 				CleanupStack::PopAndDestroy( newTzId );
   799 				CleanupStack::PopAndDestroy( newTzId );
   755 				}
   800 				}
   756 			CleanupStack::PopAndDestroy( currentCTzId );
   801 			CleanupStack::PopAndDestroy( currentCTzId );
   757 			CleanupStack::PopAndDestroy( &tz );
   802 			CleanupStack::PopAndDestroy( &tz );
       
   803 			
       
   804 			// Setting the attributes to null again as we dont trust on
       
   805 			// previous NITZ data recevied by device.If device receive
       
   806 			// NITZ data again attributes would get filled with actual value.
       
   807 			// Has been kept outside because this statement is valid for
       
   808 			// first boot also.
       
   809 			if( iTimeAttributes )
       
   810 			{
       
   811 				iTimeAttributes->iDstOffset = TTimeIntervalMinutes( 0 );
       
   812 				iTimeAttributes->iTimeZoneOffset =  TTimeIntervalMinutes( 0 );
       
   813 				TTime invalidTime( 0 );
       
   814 				iTimeAttributes->iUtcDateTime = invalidTime.DateTime();	
       
   815 			}
       
   816 			
   758 			}
   817 			}
   759 		}
   818 		}
   760 	
   819 	
   761 	// Notify the sessions about the change in mcc.
   820 	// Notify the sessions about the change in mcc.
   762 	iClkSrv->NotifyAboutChange( EComponentMcc, 0, KErrNone );
   821 	iClkSrv->NotifyAboutChange( EComponentMcc, 0, KErrNone );