equal
deleted
inserted
replaced
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 |
20 |
21 #include <mmtsy_names.h> |
21 #include <mmtsy_names.h> |
22 |
22 |
23 #include "DRMClock.h" |
23 #include "DRMClock.h" |
24 #include "DRMLog.h" |
24 #include "drmlog.h" |
25 #include "DRMEventTimeChange.h" |
25 #include "DRMEventTimeChange.h" |
26 #include "wmdrmfileserverclient.h" |
26 #include "wmdrmfileserverclient.h" |
27 |
27 |
28 #include <DRMNotifier.h> |
28 #include <DRMNotifier.h> |
29 #include <s32strm.h> |
29 #include <s32strm.h> |
30 #include <s32file.h> |
30 #include <s32file.h> |
31 #include <e32property.h> |
31 #include <e32property.h> |
32 #include <e32keys.h> |
32 #include <e32keys.h> |
33 |
33 |
34 #ifdef RD_MULTIPLE_DRIVE |
34 #ifdef RD_MULTIPLE_DRIVE |
35 #include <DriveInfo.h> |
35 #include <driveinfo.h> |
36 #endif |
36 #endif |
37 |
37 |
38 #include "DRMNitzObserver.h" |
38 #include "DRMNitzObserver.h" |
|
39 #include "GPSWatcher.h" |
39 |
40 |
40 // EXTERNAL DATA STRUCTURES |
41 // EXTERNAL DATA STRUCTURES |
41 |
42 |
42 // EXTERNAL FUNCTION PROTOTYPES |
43 // EXTERNAL FUNCTION PROTOTYPES |
43 |
44 |
83 // ----------------------------------------------------------------------------- |
84 // ----------------------------------------------------------------------------- |
84 // |
85 // |
85 void CDRMClock::ConstructL() |
86 void CDRMClock::ConstructL() |
86 { |
87 { |
87 DRMLOG( _L( "DRM Clock Starting: " ) ); |
88 DRMLOG( _L( "DRM Clock Starting: " ) ); |
|
89 TInt error = KErrNone; |
88 |
90 |
89 // Create a notifier instance |
91 // Create a notifier instance |
90 iNotifier = CDRMNotifier::NewL(); |
92 iNotifier = CDRMNotifier::NewL(); |
91 |
93 |
92 #ifndef __WINS__ |
94 #ifndef __WINS__ |
93 ConnectToPhoneL(); |
95 ConnectToPhoneL(); |
94 |
96 |
95 iObserver = CDRMNitzObserver::NewL( iPhone, const_cast<CDRMClock*>(this)); |
97 iObserver = CDRMNitzObserver::NewL( iPhone, const_cast<CDRMClock*>(this)); |
96 |
98 |
97 iObserver->Start(); |
99 iObserver->Start(); |
|
100 |
|
101 TRAP( error, iGpsWatcher = CGPSWatcher::NewL( const_cast<CDRMClock*>(this) )); |
|
102 DRMLOG2( _L("DRMClock: GPS watcher started: %d"), error ); |
98 #endif |
103 #endif |
99 |
|
100 |
104 |
101 DRMLOG( _L( "DRM Clock started" ) ); |
105 DRMLOG( _L( "DRM Clock started" ) ); |
102 }; |
106 }; |
103 |
107 |
104 // ----------------------------------------------------------------------------- |
108 // ----------------------------------------------------------------------------- |
156 { |
160 { |
157 iObserver->Cancel(); |
161 iObserver->Cancel(); |
158 delete iObserver; |
162 delete iObserver; |
159 iObserver = 0; |
163 iObserver = 0; |
160 } |
164 } |
|
165 |
|
166 if( iGpsWatcher ) |
|
167 { |
|
168 iGpsWatcher->Cancel(); |
|
169 delete iGpsWatcher; |
|
170 iGpsWatcher = 0; |
|
171 } |
161 #endif // __WINS__ |
172 #endif // __WINS__ |
162 }; |
173 }; |
163 |
174 |
164 // ----------------------------------------------------------------------------- |
175 // ----------------------------------------------------------------------------- |
165 // CDRMClock::GetSecureTime |
176 // CDRMClock::GetSecureTime |
187 ( KMinuteInMicroseconds* KTimeZoneIncrement ); |
198 ( KMinuteInMicroseconds* KTimeZoneIncrement ); |
188 |
199 |
189 |
200 |
190 aTime.UniversalTime(); |
201 aTime.UniversalTime(); |
191 |
202 |
192 aSecurityLevel = DRMClock::KInsecure; |
203 aSecurityLevel = DRMClock::KInsecure; |
193 |
204 |
194 DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) ); |
205 DRMLOG( _L( "CDRMClock::GetSecureTime: DRMClock is Insecure" ) ); |
195 } |
206 } |
196 else |
207 else |
197 { |
208 { |
306 CleanupStack::PopAndDestroy(); |
317 CleanupStack::PopAndDestroy(); |
307 |
318 |
308 DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) ); |
319 DRMLOG( _L( "CDRMClock::ResetSecureTimeL ok" ) ); |
309 }; |
320 }; |
310 |
321 |
|
322 // --------------------------------------------------------- |
|
323 // CDRMClock::Notify |
|
324 // Notify DRM clock about an event |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 void CDRMClock::Notify( TInt aNotify ) |
|
328 { |
|
329 switch( aNotify ) |
|
330 { |
|
331 case ENotifyGPSTimeReceived: |
|
332 // GPS time received, listen again after the next boot, destroy GPS watcher: |
|
333 DRMLOG(_L("Notify: ENotifyGPSTimeReceived, Deleting GPS watcher")); |
|
334 delete iGpsWatcher; |
|
335 iGpsWatcher = NULL; |
|
336 DRMLOG(_L("Notify: GPS Watcher deleted")); |
|
337 break; |
|
338 case ENotifyNone: |
|
339 default: |
|
340 break; // Do nothing |
|
341 } |
|
342 } |
|
343 |
|
344 |
|
345 |
|
346 |
311 |
347 |
312 // --------------------------------------------------------- |
348 // --------------------------------------------------------- |
313 // CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime) |
349 // CDRMClock::ConnectToPhoneL(const TDateTime& aDateTime) |
314 // Gets the nitz time from iNitzInfo |
350 // Gets the nitz time from iNitzInfo |
315 // --------------------------------------------------------- |
351 // --------------------------------------------------------- |