|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Central repository data base class |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CLogsSharedData.h" |
|
22 #include "MLogsObserver.h" |
|
23 #include "LogsUID.h" |
|
24 #include "LogsConstants.hrh" |
|
25 //For ring duation feature |
|
26 #include "LogsVariant.hrh" |
|
27 #include <LogsDomainCRKeys.h> //Logs Central Repository keys for logging |
|
28 //voice and VoIP call duration counters. |
|
29 //PhoneApp uses the same to write the values. |
|
30 #include <settingsinternalcrkeys.h> //PhoneApp's Central Repository keys |
|
31 |
|
32 #include <dclcrkeys.h> //DataConnectionLogger's Central Repository keys |
|
33 //for logging GPRS/WLAN counters |
|
34 #include <cenrepnotifyhandler.h> |
|
35 #include <AvkonInternalCRKeys.h> |
|
36 #include <featmgr.h> |
|
37 |
|
38 // CONSTANTS |
|
39 // Dynamic VoIP off |
|
40 const TInt KVoIPOFF = 0; |
|
41 |
|
42 // MACROS |
|
43 |
|
44 // LOCAL CONSTANTS AND MACROS |
|
45 |
|
46 // MODULE DATA STRUCTURES |
|
47 |
|
48 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
49 //////////////////////////////////////CLogsSharedDataListener////////////////////////////////////// |
|
50 //CLogsSharedDataListener is helper class to provide wrapup objects to provide information |
|
51 //from which instance of CCenRepNotifyHandler we have got notification. This can be removed and |
|
52 //replaced by better implementation when notifications provide this information directly |
|
53 class CLogsSharedDataListener : public CBase, public MCenRepNotifyHandlerCallback |
|
54 { |
|
55 public: |
|
56 static CLogsSharedDataListener* NewL( TUid aCategory, |
|
57 CLogsSharedData& aCallback, |
|
58 CRepository& aSession); |
|
59 |
|
60 ~CLogsSharedDataListener(); |
|
61 |
|
62 //From MCenRepNotifyHandlerCallback: Handle integer key value change |
|
63 void HandleNotifyInt(TUint32 aKey, TInt aNewValue ); |
|
64 |
|
65 void HandleNotifyError(TUint32 aId, TInt error, CCenRepNotifyHandler* aHandler); |
|
66 void HandleNotifyGeneric(TUint32 aId); |
|
67 |
|
68 private: |
|
69 CLogsSharedDataListener( TUid aCategory, CLogsSharedData& aCallback, |
|
70 CRepository& aSession); |
|
71 void ConstructL(); |
|
72 |
|
73 private: // data |
|
74 TUid iCategory; |
|
75 CRepository& iSession; |
|
76 CLogsSharedData& iCallback; |
|
77 CCenRepNotifyHandler* iNotifyHandler; |
|
78 |
|
79 }; |
|
80 //////////////////////////////////////CLogsSharedDataListener////////////////////////////////////// |
|
81 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
82 |
|
83 |
|
84 // LOCAL FUNCTION PROTOTYPES |
|
85 |
|
86 // ================= MEMBER FUNCTIONS ======================= |
|
87 |
|
88 |
|
89 // ---------------------------------------------------------------------------- |
|
90 // CLogsSharedData::CLogsSharedData |
|
91 // ---------------------------------------------------------------------------- |
|
92 // |
|
93 CLogsSharedData::CLogsSharedData(): |
|
94 iState( EStateUndefined ) |
|
95 { |
|
96 } |
|
97 |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // CLogsSharedData::ConstructL |
|
101 // ---------------------------------------------------------------------------- |
|
102 // |
|
103 void CLogsSharedData::ConstructL() |
|
104 { |
|
105 //Repository sessions cannot be recycled, so each UID needs a separate repository session object. |
|
106 iRepository_Logs = CRepository::NewL( KCRUidLogs ); |
|
107 iRepository_Dcl = CRepository::NewL( KCRUidDCLLogs ); |
|
108 iRepository_Voip = CRepository::NewL( KCRUidTelephonySettings ); |
|
109 |
|
110 iNotifyHandler_Logs = CLogsSharedDataListener::NewL( KCRUidLogs, *this, *iRepository_Logs ); |
|
111 iNotifyHandler_Dcl = CLogsSharedDataListener::NewL( KCRUidDCLLogs, *this, *iRepository_Dcl ); |
|
112 iNotifyHandler_Voip = CLogsSharedDataListener::NewL( KCRUidTelephonySettings, *this, *iRepository_Voip ); |
|
113 |
|
114 CheckShowRingDurationL(); //Read the ring duration key for showing/not showing ring duration for missed calls |
|
115 CheckMSKEnabledInPlatformL(); |
|
116 CheckVoIPEnabledInPlatform(); |
|
117 } |
|
118 |
|
119 |
|
120 // ---------------------------------------------------------------------------- |
|
121 // CLogsSharedData::CheckMSKEnabledInPlatform |
|
122 // |
|
123 // Checks if the MSK support is enabled in the platform and stores the |
|
124 // result in iMSKEnabledInPlatform. |
|
125 // --------------------------------------------------------------------------- |
|
126 // |
|
127 void CLogsSharedData::CheckMSKEnabledInPlatformL() |
|
128 { |
|
129 // Check if the MSK support is enabled in the platform and store the |
|
130 // result in iMSKEnabledInPlatform |
|
131 CRepository* cenRep = NULL; |
|
132 TRAPD(err, cenRep = CRepository::NewL( KCRUidAvkon )); |
|
133 if (!err) |
|
134 { |
|
135 err = cenRep->Get( KAknMiddleSoftkeyEnabled, iMSKEnabledInPlatform ); |
|
136 delete cenRep; |
|
137 } |
|
138 User::LeaveIfError( err ); |
|
139 } |
|
140 |
|
141 // ---------------------------------------------------------------------------- |
|
142 // CLogsSharedData::CheckVoIPEnabledInPlatform |
|
143 // |
|
144 // Checks if the VoIP support is enabled in the platform and stores the |
|
145 // result in iVoIPEnabledInPlatform. |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CLogsSharedData::CheckVoIPEnabledInPlatform() |
|
149 { |
|
150 if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) |
|
151 { |
|
152 TInt VoIPSupported( KVoIPOFF ); |
|
153 iRepository_Voip->Get( KDynamicVoIP, VoIPSupported ); |
|
154 iVoIPEnabledInPlatform = KVoIPOFF != VoIPSupported; |
|
155 } |
|
156 } |
|
157 |
|
158 // ---------------------------------------------------------------------------- |
|
159 // CLogsSharedData::IsMSKEnabledInPlatform |
|
160 // ---------------------------------------------------------------------------- |
|
161 // |
|
162 TBool CLogsSharedData::IsMSKEnabledInPlatform() |
|
163 { |
|
164 return iMSKEnabledInPlatform; |
|
165 } |
|
166 |
|
167 // ---------------------------------------------------------------------------- |
|
168 // CLogsSharedData::IsVoIPEnabledInPlatform |
|
169 // ---------------------------------------------------------------------------- |
|
170 // |
|
171 TBool CLogsSharedData::IsVoIPEnabledInPlatform() |
|
172 { |
|
173 return iVoIPEnabledInPlatform; |
|
174 } |
|
175 |
|
176 // ---------------------------------------------------------------------------- |
|
177 // CLogsSharedData::NewL |
|
178 // ---------------------------------------------------------------------------- |
|
179 // |
|
180 CLogsSharedData* CLogsSharedData::NewL() |
|
181 { |
|
182 CLogsSharedData* self = new (ELeave) CLogsSharedData; |
|
183 CleanupStack::PushL( self ); |
|
184 self->ConstructL(); |
|
185 CleanupStack::Pop(); |
|
186 return self; |
|
187 } |
|
188 |
|
189 // ---------------------------------------------------------------------------- |
|
190 // CLogsSharedData::CLogsSharedData |
|
191 // ---------------------------------------------------------------------------- |
|
192 // |
|
193 CLogsSharedData::~CLogsSharedData() |
|
194 { |
|
195 delete iNotifyHandler_Logs; |
|
196 delete iNotifyHandler_Dcl; |
|
197 delete iNotifyHandler_Voip; |
|
198 |
|
199 // Closing connections: |
|
200 delete iRepository_Logs; |
|
201 delete iRepository_Dcl; |
|
202 delete iRepository_Voip; |
|
203 } |
|
204 |
|
205 // ---------------------------------------------------------------------------- |
|
206 // CLogsSharedData::LastCallTimer |
|
207 // |
|
208 // Get the Last Call Timer's value. |
|
209 // ---------------------------------------------------------------------------- |
|
210 // |
|
211 TInt CLogsSharedData::LastCallTimer( TAlsEnum aWhatLine, TVoipEnum aVoip ) |
|
212 { |
|
213 TInt getValue( 0 ); |
|
214 |
|
215 if( aWhatLine == ELineOne ) //Retrieve last time of a specified line type: |
|
216 { |
|
217 iRepository_Logs->Get( KLogsLastCallTimerLine1, getValue); // - Last call time line1 |
|
218 } |
|
219 else if( aWhatLine == ELineTwo ) |
|
220 { |
|
221 iRepository_Logs->Get( KLogsLastCallTimerLine2, getValue); // - Last call time line2 |
|
222 } |
|
223 else if( aWhatLine == EAllLines && aVoip == EVoipIncluded ) |
|
224 { |
|
225 iRepository_Logs->Get( KLogsActualLastCallTimer, getValue ); // - Last call time line1, line2 or voip |
|
226 } |
|
227 else if( aWhatLine == EVoiceLinesExcluded && aVoip == EVoipIncluded ) |
|
228 { |
|
229 iRepository_Logs->Get( KLogsLastCallTimerVoIP, getValue); // - Last call time voip (SettingsInternalCRKeys.h) |
|
230 } |
|
231 //FIXME: In the case below we don't have cellular-only timer available for last call, so we have to use |
|
232 //instead a timer for line1 or line2 if actual last call was a voip call. |
|
233 else if( aWhatLine == EAllLines && aVoip == EVoipExcluded ) |
|
234 { // - Last call time line1 or line2 only |
|
235 TInt comparisonValue( 0 ); |
|
236 iRepository_Logs->Get( KLogsActualLastCallTimer, getValue ); |
|
237 iRepository_Logs->Get( KLogsLastCallTimerVoIP, comparisonValue ); |
|
238 |
|
239 if( getValue == comparisonValue ) //Last call was voip. We need to use line1 or line2 value instead |
|
240 { |
|
241 iRepository_Logs->Get( KLogsLastCallTimerLine1, getValue); |
|
242 |
|
243 if( getValue == 0 ) |
|
244 { |
|
245 iRepository_Logs->Get( KLogsLastCallTimerLine2, getValue ); |
|
246 } |
|
247 } |
|
248 } |
|
249 |
|
250 return getValue; |
|
251 } |
|
252 |
|
253 // ---------------------------------------------------------------------------- |
|
254 // CLogsSharedData::DialledCallsTimer |
|
255 // |
|
256 // Get the Dialled Call Timer's value |
|
257 // ---------------------------------------------------------------------------- |
|
258 // |
|
259 TInt CLogsSharedData::DialledCallsTimer( TAlsEnum aWhatLine, TVoipEnum aVoip ) |
|
260 { |
|
261 TInt getValue( 0 ); |
|
262 TInt tempValue( 0 ); |
|
263 |
|
264 //First voice lines (if requested) |
|
265 if( aWhatLine == EAllLines ) |
|
266 { |
|
267 //Voice line1 |
|
268 iRepository_Logs->Get( KLogsDialledCallsTimerLine1, tempValue); |
|
269 getValue = tempValue; |
|
270 //Voice line2 |
|
271 tempValue = 0; |
|
272 iRepository_Logs->Get( KLogsDialledCallsTimerLine2, tempValue ); |
|
273 getValue += tempValue; |
|
274 } |
|
275 else if( aWhatLine == ELineOne ) |
|
276 { |
|
277 //Voice line1 |
|
278 iRepository_Logs->Get( KLogsDialledCallsTimerLine1, tempValue); |
|
279 getValue = tempValue; |
|
280 } |
|
281 else if( aWhatLine == ELineTwo ) |
|
282 { |
|
283 //Voice line2 |
|
284 iRepository_Logs->Get( KLogsDialledCallsTimerLine2, tempValue ); |
|
285 getValue += tempValue; |
|
286 } |
|
287 |
|
288 //Then voip (if requested) |
|
289 if( aVoip == EVoipIncluded ) |
|
290 { |
|
291 //Voip |
|
292 tempValue = 0; |
|
293 iRepository_Logs->Get( KLogsDialledCallsTimerVoIP, tempValue ); //SettingsInternalCRKeys.h |
|
294 getValue += tempValue; |
|
295 } |
|
296 |
|
297 return getValue; |
|
298 } |
|
299 // ---------------------------------------------------------------------------- |
|
300 // CLogsSharedData::ReceivedCallsTimer |
|
301 // |
|
302 // Get the Received Call Timer's value |
|
303 // ---------------------------------------------------------------------------- |
|
304 // |
|
305 TInt CLogsSharedData::ReceivedCallsTimer( TAlsEnum aWhatLine, TVoipEnum aVoip ) |
|
306 { |
|
307 TInt getValue( 0 ); |
|
308 TInt tempValue( 0 ); |
|
309 |
|
310 //First voice lines (if requested) |
|
311 if( aWhatLine == EAllLines ) |
|
312 { |
|
313 //Voice line1 |
|
314 iRepository_Logs->Get( KLogsReceivedCallsTimerLine1, tempValue); |
|
315 getValue = tempValue; |
|
316 //Voice line2 |
|
317 tempValue = 0; |
|
318 iRepository_Logs->Get( KLogsReceivedCallsTimerLine2, tempValue); |
|
319 getValue += tempValue; |
|
320 } |
|
321 else if( aWhatLine == ELineOne ) |
|
322 { |
|
323 //Voice line1 |
|
324 iRepository_Logs->Get( KLogsReceivedCallsTimerLine1, tempValue); |
|
325 getValue = tempValue; |
|
326 } |
|
327 else if( aWhatLine == ELineTwo ) |
|
328 { |
|
329 //Voice line2 |
|
330 iRepository_Logs->Get( KLogsReceivedCallsTimerLine2, tempValue); |
|
331 getValue += tempValue; |
|
332 } |
|
333 |
|
334 //Then voip (if requested) |
|
335 if( aVoip == EVoipIncluded ) |
|
336 { |
|
337 //Voip |
|
338 tempValue = 0; |
|
339 iRepository_Logs->Get( KLogsReceivedCallsTimerVoIP, tempValue ); //SettingsInternalCRKeys.h |
|
340 getValue += tempValue; |
|
341 } |
|
342 |
|
343 return getValue; |
|
344 } |
|
345 |
|
346 // ---------------------------------------------------------------------------- |
|
347 // CLogsSharedData::AllCallsTimer |
|
348 // |
|
349 // Get the All Calls Timer's value |
|
350 // ---------------------------------------------------------------------------- |
|
351 // |
|
352 TInt CLogsSharedData::AllCallsTimer( TAlsEnum aWhatLine, TVoipEnum aVoip ) |
|
353 { |
|
354 return DialledCallsTimer( aWhatLine, aVoip ) + ReceivedCallsTimer( aWhatLine, aVoip ); |
|
355 } |
|
356 |
|
357 // ---------------------------------------------------------------------------- |
|
358 // CLogsSharedData::ClearCallTimers |
|
359 // |
|
360 // Clears all Call Timers |
|
361 // ---------------------------------------------------------------------------- |
|
362 // |
|
363 void CLogsSharedData::ClearCallTimers() |
|
364 { |
|
365 //Last calls |
|
366 iRepository_Logs->Set( KLogsActualLastCallTimer, 0 ); |
|
367 iRepository_Logs->Set( KLogsLastCallTimerLine1, 0 ); |
|
368 iRepository_Logs->Set( KLogsLastCallTimerLine2, 0 ); |
|
369 iRepository_Logs->Set( KLogsLastCallTimerVoIP, 0 ); |
|
370 //Received calls |
|
371 iRepository_Logs->Set( KLogsReceivedCallsTimerLine1, 0 ); |
|
372 iRepository_Logs->Set( KLogsReceivedCallsTimerLine2, 0 ); |
|
373 iRepository_Logs->Set( KLogsReceivedCallsTimerVoIP, 0 ); |
|
374 //Dialled calls |
|
375 iRepository_Logs->Set( KLogsDialledCallsTimerLine1, 0 ); |
|
376 iRepository_Logs->Set( KLogsDialledCallsTimerLine2, 0 ); |
|
377 iRepository_Logs->Set( KLogsDialledCallsTimerVoIP, 0 ); |
|
378 } |
|
379 |
|
380 // ---------------------------------------------------------------------------- |
|
381 // CLogsSharedData::SetLoggingEnabled |
|
382 // |
|
383 // Sets the Logging ON/OFF in the Central repository |
|
384 // ---------------------------------------------------------------------------- |
|
385 // |
|
386 void CLogsSharedData::SetLoggingEnabled( TBool aLogging ) |
|
387 { |
|
388 if( aLogging ) |
|
389 { |
|
390 if (IsLoggingEnabled() == EFalse) |
|
391 { |
|
392 // If turning Logging ON from OFF state, reset the |
|
393 // new missed calls counter as the missed calls events during EILU-757CLC |
|
394 // the time logging was OFF were lost anyway but the |
|
395 // counter kept increasing. We only display the counter when |
|
396 // logging is enabled. |
|
397 // (see CLogsSubAppListControlContainer::CreateListBoxContentsL) |
|
398 // |
|
399 iRepository_Logs->Set( KLogsNewMissedCalls, 0); |
|
400 } |
|
401 iRepository_Logs->Set( KLogsLoggingEnabled, 1); |
|
402 } |
|
403 else |
|
404 { |
|
405 // Also reset the new missed calls counter when turning Logging EILU-757CLC |
|
406 // off to clear the missed calls indicator |
|
407 // |
|
408 iRepository_Logs->Set( KLogsNewMissedCalls, 0); |
|
409 |
|
410 iRepository_Logs->Set( KLogsLoggingEnabled, 0); |
|
411 } |
|
412 } |
|
413 |
|
414 // ---------------------------------------------------------------------------- |
|
415 // CLogsSharedData::IsLoggingEnabled |
|
416 // |
|
417 // Returns the Logging ON/OFF in the Central repository |
|
418 // ---------------------------------------------------------------------------- |
|
419 // |
|
420 TBool CLogsSharedData::IsLoggingEnabled() |
|
421 { |
|
422 TBool loggingEnabled; |
|
423 iRepository_Logs->Get( KLogsLoggingEnabled, loggingEnabled); |
|
424 |
|
425 return loggingEnabled; |
|
426 } |
|
427 |
|
428 // ---------------------------------------------------------------------------- |
|
429 // CLogsSharedData::NewMissedCalls |
|
430 // |
|
431 // Read and optionally also clear the count of missed calls. |
|
432 // ---------------------------------------------------------------------------- |
|
433 // |
|
434 TInt CLogsSharedData::NewMissedCalls( const TBool aClearMissedCallCounter ) |
|
435 { |
|
436 TInt tempNewMissedCalls( 0 ); |
|
437 |
|
438 iRepository_Logs->Get( KLogsNewMissedCalls, tempNewMissedCalls ); |
|
439 if( aClearMissedCallCounter ) |
|
440 { |
|
441 iRepository_Logs->Set( KLogsNewMissedCalls, 0); |
|
442 } |
|
443 |
|
444 return tempNewMissedCalls; |
|
445 } |
|
446 |
|
447 // ---------------------------------------------------------------------------- |
|
448 // CLogsSharedData::GprsSentCounter |
|
449 // |
|
450 // Read value of Gprs Sent Data Counter (provided by Data Connection Logger) |
|
451 // ---------------------------------------------------------------------------- |
|
452 // |
|
453 TInt64 CLogsSharedData::GprsSentCounter() |
|
454 { |
|
455 TInt64 sent = MAKE_TINT64( 0, 0 ); |
|
456 TBuf<50> buffer; |
|
457 |
|
458 iRepository_Dcl->Get( KLogsGPRSSentCounter, buffer ); |
|
459 TLex lex( buffer ); |
|
460 TInt error = lex.Val( sent ); |
|
461 |
|
462 if ( error == KErrNone ) |
|
463 { |
|
464 return sent; |
|
465 } |
|
466 else |
|
467 { |
|
468 return MAKE_TINT64( 0, 0 ); //0; |
|
469 } |
|
470 } |
|
471 |
|
472 // ---------------------------------------------------------------------------- |
|
473 // CLogsSharedData::GprsReceivedCounter |
|
474 // |
|
475 // Read value of Gprs Received Data Counter (provided by Data Connection Logger) |
|
476 // ---------------------------------------------------------------------------- |
|
477 // |
|
478 TInt64 CLogsSharedData::GprsReceivedCounter() |
|
479 { |
|
480 TInt64 rec = MAKE_TINT64( 0, 0 ); |
|
481 TBuf<50> buffer; |
|
482 |
|
483 iRepository_Dcl->Get( KLogsGPRSReceivedCounter, buffer ); |
|
484 TLex lex( buffer ); |
|
485 TInt error = lex.Val( rec ); |
|
486 |
|
487 if ( error == KErrNone ) |
|
488 { |
|
489 return rec; |
|
490 } |
|
491 else |
|
492 { |
|
493 return MAKE_TINT64( 0, 0 ); //0; |
|
494 } |
|
495 } |
|
496 |
|
497 // ---------------------------------------------------------------------------- |
|
498 // CLogsSharedData::ClearGprsCounters |
|
499 // |
|
500 // ClearGprsCounters of Data Connection Logger |
|
501 // ---------------------------------------------------------------------------- |
|
502 // |
|
503 void CLogsSharedData::ClearGprsCounters() |
|
504 { |
|
505 TBuf<50> buffer; |
|
506 buffer.Num( 0 ); |
|
507 iRepository_Dcl->Set( KLogsGPRSSentCounter, buffer); |
|
508 iRepository_Dcl->Set( KLogsGPRSReceivedCounter, buffer); |
|
509 } |
|
510 |
|
511 // ---------------------------------------------------------------------------- |
|
512 // CLogsSharedData::ShowCallDurationLogsL |
|
513 // |
|
514 // Read Logs Local Variation Flag to check do we need to show active call duration in Logs Timers view. |
|
515 //(in Logs application, does not apply to Phone application) |
|
516 // ---------------------------------------------------------------------------- |
|
517 // |
|
518 TBool CLogsSharedData::ShowCallDurationLogsL() |
|
519 { |
|
520 TInt setting; |
|
521 TBool ret = EFalse; //By default we don't show active call duration in Logs |
|
522 |
|
523 CRepository* repository = NULL; |
|
524 TInt err; |
|
525 TRAP(err, repository = CRepository::NewL( KCRUidLogsLV ) ); //Leaves,if KCRUidLogsLV not in centrep |
|
526 |
|
527 if( err != KErrNone) |
|
528 { |
|
529 return EFalse; //By default we don' show active call duration in Logs |
|
530 } |
|
531 |
|
532 CleanupStack::PushL( repository ); |
|
533 |
|
534 if ( repository->Get( KLogsActiveCallDuration, setting ) == KErrNone ) |
|
535 { |
|
536 if ( setting > 0 ) // values: see keys_logs.xls |
|
537 { |
|
538 ret = ETrue; |
|
539 } |
|
540 } |
|
541 |
|
542 CleanupStack::PopAndDestroy( repository ); // Close connection |
|
543 return ret; |
|
544 } |
|
545 |
|
546 // ---------------------------------------------------------------------------- |
|
547 // CLogsSharedData::ShowRingDuration |
|
548 // |
|
549 // For ring duation feature |
|
550 // ---------------------------------------------------------------------------- |
|
551 // |
|
552 TBool CLogsSharedData::ShowRingDuration() const |
|
553 { |
|
554 return iShowRingDuration; |
|
555 } |
|
556 |
|
557 // ---------------------------------------------------------------------------- |
|
558 // CLogsSharedData::CheckShowRingDurationL |
|
559 // ---------------------------------------------------------------------------- |
|
560 // |
|
561 void CLogsSharedData::CheckShowRingDurationL() |
|
562 { |
|
563 iShowRingDuration = EFalse; // initialize the value |
|
564 |
|
565 CRepository* repository = CRepository::NewL( KCRUidLogsLV ); |
|
566 CleanupStack::PushL( repository ); |
|
567 |
|
568 TInt setting = 0; |
|
569 if ( repository->Get( KLogsLVFlags, setting ) == KErrNone ) |
|
570 { |
|
571 // if bit 0 of local variation flag is set, ring duration feature is ON |
|
572 if ( setting & KLogsLVFlagShowRingDuration ) |
|
573 { |
|
574 iShowRingDuration = ETrue; |
|
575 } |
|
576 |
|
577 } |
|
578 CleanupStack::PopAndDestroy( repository ); // Close connection |
|
579 } |
|
580 |
|
581 /******************************************************************************* |
|
582 FIXME: Toolbar is currently always on - keeping the toolbar visibility handling |
|
583 sources in comments for now - remove later. |
|
584 |
|
585 // ---------------------------------------------------------------------------- |
|
586 // CLogsSharedData::ToolbarVisibility |
|
587 // |
|
588 // Get touch UI Toolbar ON/OFF setting |
|
589 // ---------------------------------------------------------------------------- |
|
590 // |
|
591 TInt CLogsSharedData::ToolbarVisibility() const |
|
592 { |
|
593 TInt setting = 0; |
|
594 iRepository_Logs->Get( KLogsShowToolbar, setting ); |
|
595 return setting; //setting;//1; |
|
596 } |
|
597 |
|
598 // ---------------------------------------------------------------------------- |
|
599 // CLogsSharedData::SetToolbarVisibility |
|
600 // |
|
601 // Set touch UI Toolbar ON/OFF |
|
602 // ---------------------------------------------------------------------------- |
|
603 // |
|
604 void CLogsSharedData::SetToolbarVisibility( TInt aToolbarVisibility ) |
|
605 { |
|
606 iRepository_Logs->Set( KLogsShowToolbar, aToolbarVisibility ); |
|
607 } |
|
608 |
|
609 *******************************************************************************/ |
|
610 |
|
611 // ---------------------------------------------------------------------------- |
|
612 // CLogsSharedData::HandleNotifyInt |
|
613 // |
|
614 // Called from CLogsSharedDataListener. |
|
615 // Handle integer key value change |
|
616 // ---------------------------------------------------------------------------- |
|
617 // |
|
618 void CLogsSharedData::HandleNotifyInt( TUid aCategory, TUint32 aKey, TInt /*aNewValue*/ ) |
|
619 { |
|
620 InformObserver( aCategory, aKey ); |
|
621 } |
|
622 |
|
623 // ---------------------------------------------------------------------------- |
|
624 // CLogsSharedData::InformObserver |
|
625 // |
|
626 // If an integer key value we are interested in has been changed, we'll inform it observer. |
|
627 // ---------------------------------------------------------------------------- |
|
628 // |
|
629 void CLogsSharedData::InformObserver( TUid aCategory, TUint32 aKey ) |
|
630 { |
|
631 //1. Update state for events that need not to be informed explicitly |
|
632 if( aCategory == KCRUidTelephonySettings ) |
|
633 { |
|
634 switch ( aKey ) |
|
635 { |
|
636 case KDynamicVoIP: |
|
637 CheckVoIPEnabledInPlatform(); |
|
638 break; |
|
639 } |
|
640 } |
|
641 |
|
642 //2. Process events that need immediately informed to observer |
|
643 if( iObserver ) |
|
644 { |
|
645 if( aCategory == KCRUidLogs ) |
|
646 { |
|
647 switch ( aKey ) |
|
648 { |
|
649 //From KCRUidLogs we are interested only in changes in these keys (LogsInternalCRKeys.h) |
|
650 case KLogsNewMissedCalls: |
|
651 case KLogsActualLastCallTimer: //This timer is updated every time a call is ended. However, this does not serve also as |
|
652 //notification for some other call timer below because it might be updated slightly later. |
|
653 case KLogsLastCallTimerLine1: // (so we have to listen separately to them too) |
|
654 case KLogsLastCallTimerLine2: |
|
655 case KLogsLastCallTimerLineVoIP: |
|
656 |
|
657 case KLogsReceivedCallsTimerLine1: |
|
658 case KLogsReceivedCallsTimerLine2: |
|
659 case KLogsReceivedCallsTimerLineVoIP: |
|
660 |
|
661 case KLogsDialledCallsTimerLine1: |
|
662 case KLogsDialledCallsTimerLine2: |
|
663 case KLogsDialledCallsTimerLineVoIP: |
|
664 { |
|
665 TInt err; |
|
666 TRAP( err, iObserver->StateChangedL( NULL ) ); |
|
667 break; |
|
668 } |
|
669 case KLogsLoggingEnabled: |
|
670 { |
|
671 iState = EStateLogEnableChanged; |
|
672 TInt err; |
|
673 TRAP( err, iObserver->StateChangedL( this ) ); |
|
674 break; |
|
675 } |
|
676 } |
|
677 } |
|
678 |
|
679 if( aCategory == KCRUidDCLLogs ) |
|
680 { |
|
681 switch ( aKey ) |
|
682 { |
|
683 // From KCRUidDCLLogs we are interested only in changes in these keys (DclInternalKeys.h) |
|
684 case KLogsGPRSReceivedCounter: |
|
685 case KLogsGPRSSentCounter: |
|
686 //case KLogsWLANSentCounter: |
|
687 //case KLogsWLANReceivedCounter: |
|
688 { |
|
689 TInt err; |
|
690 TRAP( err, iObserver->StateChangedL( NULL ) ); |
|
691 } |
|
692 } |
|
693 } |
|
694 } |
|
695 } |
|
696 |
|
697 // ---------------------------------------------------------------------------- |
|
698 // CLogsSharedData::HandleNotifyGeneric |
|
699 // |
|
700 // Called from CLogsSharedDataListener |
|
701 // ---------------------------------------------------------------------------- |
|
702 // |
|
703 void CLogsSharedData::HandleNotifyGeneric( TUid aCategory, TUint32 aKey) |
|
704 { |
|
705 if ( aKey == NCentralRepositoryConstants::KUnspecifiedKey ) |
|
706 { |
|
707 //Repository wide reset (e.g more than one setting has changed simultaneously) has |
|
708 //caused generic notification. |
|
709 |
|
710 //1. Update state for events that need not to be informed explicitly |
|
711 CheckVoIPEnabledInPlatform(); |
|
712 |
|
713 //2. Inform observer it needs fetch all the keys it is interested in. |
|
714 if( iObserver ) |
|
715 { |
|
716 TInt err; |
|
717 TRAP( err, iObserver->StateChangedL( NULL ) ); |
|
718 } |
|
719 } |
|
720 else |
|
721 { |
|
722 //In this case we know the key so we can call InformObserver |
|
723 InformObserver( aCategory, aKey ); |
|
724 } |
|
725 } |
|
726 |
|
727 // ---------------------------------------------------------------------------- |
|
728 // CLogsSharedData::SetObserver |
|
729 // ---------------------------------------------------------------------------- |
|
730 // |
|
731 void CLogsSharedData::SetObserver( MLogsObserver* aObserver ) |
|
732 { |
|
733 iObserver = aObserver; |
|
734 } |
|
735 |
|
736 |
|
737 TLogsState CLogsSharedData::State() const |
|
738 { |
|
739 return iState; |
|
740 } |
|
741 |
|
742 |
|
743 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
744 //////////////////////////////////////CLogsSharedDataListener////////////////////////////////////// |
|
745 //CLogsSharedDataListener is a helper class to provide wrapup objects to provide information |
|
746 //from which instance of CCenRepNotifyHandler we have got notification. This can be removed and |
|
747 //replaced by better implementation when notifications provide this information directly |
|
748 |
|
749 // ---------------------------------------------------------------------------- |
|
750 // CLogsSharedDataListener::NewL |
|
751 // ---------------------------------------------------------------------------- |
|
752 // |
|
753 CLogsSharedDataListener* CLogsSharedDataListener::NewL( TUid aCategory, |
|
754 CLogsSharedData& aCallback, |
|
755 CRepository& aSession) |
|
756 { |
|
757 CLogsSharedDataListener* self = new (ELeave) CLogsSharedDataListener( aCategory, |
|
758 aCallback, |
|
759 aSession) ; |
|
760 CleanupStack::PushL( self ); |
|
761 self->ConstructL(); |
|
762 CleanupStack::Pop(); |
|
763 return self; |
|
764 } |
|
765 |
|
766 // ---------------------------------------------------------------------------- |
|
767 // CLogsSharedDataListener::CLogsSharedDataListener |
|
768 // ---------------------------------------------------------------------------- |
|
769 // |
|
770 CLogsSharedDataListener::CLogsSharedDataListener( TUid aCategory, |
|
771 CLogsSharedData& aCallback, |
|
772 CRepository& aSession ) |
|
773 : iCategory( aCategory ), iSession(aSession), iCallback(aCallback) |
|
774 { |
|
775 } |
|
776 |
|
777 // ---------------------------------------------------------------------------- |
|
778 // CLogsSharedDataListener::ConstructL |
|
779 // ---------------------------------------------------------------------------- |
|
780 // |
|
781 void CLogsSharedDataListener::ConstructL() |
|
782 { |
|
783 //We dont't provide separate handlers for keys we are intrested in this category (KLogsNewMissedCalls, |
|
784 //KLogsActualLastCallTimer, KLogsGPRSReceivedCounter etc) but just listen changes of any key. |
|
785 iNotifyHandler = CCenRepNotifyHandler::NewL( *this, iSession ); |
|
786 iNotifyHandler->StartListeningL(); |
|
787 } |
|
788 |
|
789 // ---------------------------------------------------------------------------- |
|
790 // CLogsSharedDataListener::~CLogsSharedDataListener |
|
791 // ---------------------------------------------------------------------------- |
|
792 // |
|
793 CLogsSharedDataListener::~CLogsSharedDataListener() |
|
794 { |
|
795 if ( iNotifyHandler ) |
|
796 { |
|
797 iNotifyHandler->StopListening(); |
|
798 } |
|
799 delete iNotifyHandler; |
|
800 } |
|
801 |
|
802 // ---------------------------------------------------------------------------- |
|
803 // CLogsSharedDataListener::HandleNotifyInt |
|
804 // |
|
805 // From MCenRepNotifyHandlerCallback |
|
806 // Handle integer key value change. We just add category id and forward the call. |
|
807 // ---------------------------------------------------------------------------- |
|
808 // |
|
809 void CLogsSharedDataListener::HandleNotifyInt(TUint32 aKey, TInt aNewValue ) |
|
810 { |
|
811 iCallback.HandleNotifyInt( iCategory, aKey, aNewValue ); |
|
812 } |
|
813 |
|
814 // ---------------------------------------------------------------------------- |
|
815 // CLogsSharedDataListener::HandleNotifyGeneric |
|
816 // |
|
817 // From MCenRepNotifyHandlerCallback. We just add category id and forward the call. |
|
818 // ---------------------------------------------------------------------------- |
|
819 // |
|
820 void CLogsSharedDataListener::HandleNotifyGeneric( TUint32 aKey ) |
|
821 { |
|
822 iCallback.HandleNotifyGeneric( iCategory, aKey ); |
|
823 } |
|
824 |
|
825 // ---------------------------------------------------------------------------- |
|
826 // CLogsSharedDataListener::HandleNotifyError |
|
827 // |
|
828 // From MCenRepNotifyHandlerCallback |
|
829 // ---------------------------------------------------------------------------- |
|
830 // |
|
831 void CLogsSharedDataListener::HandleNotifyError( TUint32 //aId |
|
832 ,TInt //error |
|
833 ,CCenRepNotifyHandler* //aHandler |
|
834 ) |
|
835 { |
|
836 // No need to handle notify errors |
|
837 // RDebug::Print(_L("Handler: %d, error for key: %d, error: %d"), aHandler, aId, error); |
|
838 } |
|
839 |
|
840 //////////////////////////////////////CLogsSharedDataListener////////////////////////////////////// |
|
841 /////////////////////////////////////////////////////////////////////////////////////////////////// |
|
842 |
|
843 |
|
844 // End of File |