diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp --- a/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMNitzObserver.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -20,11 +20,11 @@ // INCLUDE FILES #include "DRMNitzObserver.h" #include "DRMClock.h" -#include "DRMLog.h" +#include "drmlog.h" // EXTERNAL DATA STRUCTURES -// EXTERNAL FUNCTION PROTOTYPES +// EXTERNAL FUNCTION PROTOTYPES // CONSTANTS const TInt KTimeZoneValidBit(0x3F); // Time zone difference @@ -50,47 +50,47 @@ // CDRMNitzObserver::CDRMNitzObserver // Default Constructor // --------------------------------------------------------- -// +// CDRMNitzObserver::CDRMNitzObserver( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock) : CActive(EPriorityNormal) ,iDRMClock( aDRMClock ), iMobilePhone( &aMobilePhone ), iError( KErrNone ) - { + { } // --------------------------------------------------------- // CDRMNitzObserver::~CDRMNitzObserver // Destructor // --------------------------------------------------------- -// +// CDRMNitzObserver::~CDRMNitzObserver() { - Cancel(); - }; - - + Cancel(); + }; + + // --------------------------------------------------------- // CDRMNitzObserver::ConstructL // Two-phase Constructor // --------------------------------------------------------- -// +// void CDRMNitzObserver::ConstructL() { DRMLOG( _L("ConstructL ")); - + // Get the NITZ info on the creation, might not be available yet iError = iMobilePhone->GetNITZInfo(iNitzInfo); - - + + DRMLOG2( _L("ConstructL: Error = %d"), iError ); - + } - + // --------------------------------------------------------- // CDRMNitzObserver::NewL // Two-phase constructor // --------------------------------------------------------- -// +// CDRMNitzObserver* CDRMNitzObserver::NewL( RMobilePhone& aMobilePhone, CDRMClock* aDRMClock) { @@ -100,21 +100,21 @@ CleanupStack::Pop(); return self; } - + // --------------------------------------------------------- // CDRMNitzObserver::Start // Adds the active object into the ActiveScheduler // and sets the object active, makes sure RunL is called // atleast once // --------------------------------------------------------- -// -void CDRMNitzObserver::Start() +// +void CDRMNitzObserver::Start() { TRequestStatus* status = 0; - - DRMLOG2( _L("iError == %d "), iError ); - - if( iError == KErrNotSupported ) + + DRMLOG2( _L("iError == %d "), iError ); + + if( iError == KErrNotSupported ) { // NITZ never supported, kill the observer if( IsAdded() ) @@ -123,64 +123,64 @@ return; } return; - } - - if( !IsAdded() ) + } + + if( !IsAdded() ) { - CActiveScheduler::Add(this); + CActiveScheduler::Add(this); } - if ( !IsActive() ) + if ( !IsActive() ) { - SetActive(); + SetActive(); } status = &iStatus; User::RequestComplete(status,KErrNone); } - - -// Ignore the error: + + +// Ignore the error: TInt CDRMNitzObserver::RunError( TInt /*aError*/ ) { SetActive(); return KErrNone; } - - + + // --------------------------------------------------------- // CDRMNitzObserver::RunL // Active object RunL // --------------------------------------------------------- -// +// void CDRMNitzObserver::RunL() { TTime timeData; TInt timeZone( 0 ); - + // Check if the nitz has changed and is available, if so call update // otherwise just wait - - DRMLOG( _L("ObserverRunL Called\n\r ") ); + + DRMLOG( _L("ObserverRunL Called\n\r ") ); iStatus = KRequestPending; - + iMobilePhone->NotifyNITZInfoChange(iStatus, iNitzInfo); - - DRMLOG( _L("NotifyNITZInfoChange:")); + + DRMLOG( _L("NotifyNITZInfoChange:")); if( GetNitzTime( timeData, timeZone ) ) { - DRMLOG( _L("Resetting secure time from NITZ observer:")); + DRMLOG( _L("Resetting secure time from NITZ observer:")); TRAPD(error, iDRMClock->ResetSecureTimeL( timeData, timeZone ) ); if( error ) { - DRMLOG( _L("Resetting secure time from NITZ observer returned an error.")); + DRMLOG( _L("Resetting secure time from NITZ observer returned an error.")); } - DRMLOG( _L("Resetting secure time from NITZ observer successful.")); - + DRMLOG( _L("Resetting secure time from NITZ observer successful.")); + if( error != KErrArgument ) { if( error ) { - DRMLOG( _L("ObserverRunL Called error \n\r ") ); + DRMLOG( _L("ObserverRunL Called error \n\r ") ); } User::LeaveIfError( error ); } @@ -194,7 +194,7 @@ // CDRMNitzObserver::DoCancel // Cancels the active object // --------------------------------------------------------- -// +// void CDRMNitzObserver::DoCancel() { // cancel the notify change @@ -227,8 +227,8 @@ TBool CDRMNitzObserver::GetNitzTime(TTime& aNitzTime, TInt& aTimeZone) { TInt32 nitzCaps(iNitzInfo.iNitzFieldsUsed); - - if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable) + + if (nitzCaps & RMobilePhone::KCapsTimezoneAvailable) { TInt timezone(iNitzInfo.iTimeZone & KTimeZoneValidBit); @@ -237,30 +237,30 @@ // Changes sign timezone = - timezone; } - + // TimeZone info aTimeZone = timezone; } - - if (nitzCaps & RMobilePhone::KCapsTimeAvailable) + + if (nitzCaps & RMobilePhone::KCapsTimeAvailable) { TDateTime dateTime; TInt fourDigitYear(iNitzInfo.Year()); //Check if our TSY returns 2 digits in stead of 4 digits for the year value - if (fourDigitYear <= KMaximumTwoDigitValue) // The maximum year value in UI applications is 2060 - { + if (fourDigitYear <= KMaximumTwoDigitValue) // The maximum year value in UI applications is 2060 + { //The year received from TSY is 2 digits we make it 4 digits - fourDigitYear = fourDigitYear + KNitzYearOffset; // 2000 - } + fourDigitYear = fourDigitYear + KNitzYearOffset; // 2000 + } dateTime.Set(fourDigitYear, - TMonth(iNitzInfo.Month()), - iNitzInfo.Day(), - iNitzInfo.Hour(), - iNitzInfo.Minute(), - iNitzInfo.Second(), - iNitzInfo.MicroSecond()); + TMonth(iNitzInfo.Month()), + iNitzInfo.Day(), + iNitzInfo.Hour(), + iNitzInfo.Minute(), + iNitzInfo.Second(), + iNitzInfo.MicroSecond()); DRMLOG2( _L( "CDRMNitzObserver::GetNitzTime: DateTime: %d" ), fourDigitYear ); DRMLOG2( _L( ":%d" ), iNitzInfo.Month() ); @@ -273,11 +273,11 @@ { return EFalse; } - // Transfer the time into a TTime object, UTC + // Transfer the time into a TTime object, UTC aNitzTime = dateTime; return ETrue; } - + return EFalse; - + };