diff -r e16d72588c28 -r 8a03a285ab14 omadrm/drmengine/drmclock/Src/DRMClock.cpp --- a/omadrm/drmengine/drmclock/Src/DRMClock.cpp Fri Mar 12 15:43:46 2010 +0200 +++ b/omadrm/drmengine/drmclock/Src/DRMClock.cpp Mon Mar 15 12:41:43 2010 +0200 @@ -21,7 +21,7 @@ #include #include "DRMClock.h" -#include "DRMLog.h" +#include "drmlog.h" #include "DRMEventTimeChange.h" #include "wmdrmfileserverclient.h" @@ -32,10 +32,11 @@ #include #ifdef RD_MULTIPLE_DRIVE -#include +#include #endif #include "DRMNitzObserver.h" +#include "GPSWatcher.h" // EXTERNAL DATA STRUCTURES @@ -85,6 +86,7 @@ void CDRMClock::ConstructL() { DRMLOG( _L( "DRM Clock Starting: " ) ); + TInt error = KErrNone; // Create a notifier instance iNotifier = CDRMNotifier::NewL(); @@ -95,9 +97,11 @@ iObserver = CDRMNitzObserver::NewL( iPhone, const_cast(this)); iObserver->Start(); + + TRAP( error, iGpsWatcher = CGPSWatcher::NewL( const_cast(this) )); + DRMLOG2( _L("DRMClock: GPS watcher started: %d"), error ); #endif - DRMLOG( _L( "DRM Clock started" ) ); }; @@ -158,6 +162,13 @@ delete iObserver; iObserver = 0; } + + if( iGpsWatcher ) + { + iGpsWatcher->Cancel(); + delete iGpsWatcher; + iGpsWatcher = 0; + } #endif // __WINS__ }; @@ -189,7 +200,7 @@ aTime.UniversalTime(); - aSecurityLevel = DRMClock::KInsecure; + aSecurityLevel = DRMClock::KInsecure; DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) ); } @@ -308,6 +319,31 @@ DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) ); }; +// --------------------------------------------------------- +// CDRMClock::Notify +// Notify DRM clock about an event +// --------------------------------------------------------- +// +void CDRMClock::Notify( TInt aNotify ) + { + switch( aNotify ) + { + case ENotifyGPSTimeReceived: + // GPS time received, listen again after the next boot, destroy GPS watcher: + DRMLOG(_L("Notify: ENotifyGPSTimeReceived, Deleting GPS watcher")); + delete iGpsWatcher; + iGpsWatcher = NULL; + DRMLOG(_L("Notify: GPS Watcher deleted")); + break; + case ENotifyNone: + default: + break; // Do nothing + } + } + + + + // --------------------------------------------------------- // CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime)