|
1 /* |
|
2 * Copyright (c) 2004-2008 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: Video call setting data |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include "CVtEngSettings.h" |
|
22 #include <cvtlogger.h> |
|
23 #include "MVtEngSettingObserver.h" |
|
24 #include "VtEngUtils.h" |
|
25 #include "VtEngPanic.h" |
|
26 #include <telincallvolcntrlcrkeys.h> |
|
27 #include <rphcltserver.h> |
|
28 #include <cphcltimagehandler.h> |
|
29 #include <videotelephonyinternalcrkeys.h> |
|
30 #include <LogsDomainCRKeys.h> |
|
31 #include <settingsinternalcrkeys.h> |
|
32 #include <videotelephonyvariant.hrh> |
|
33 |
|
34 // CONSTANTS |
|
35 // Granularity for observer array. |
|
36 const TInt KVtEngObserverArrayGranularity = 2; |
|
37 |
|
38 // Volume default level. |
|
39 const TInt KVtEngVolumeDefaultLevel = 4; |
|
40 |
|
41 // Video quality frame rate configuration buffer size |
|
42 const TInt KVtEngVQFRBufferSize = 32; |
|
43 |
|
44 // ============================ MEMBER FUNCTIONS =============================== |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CVtEngSettings::CVtEngSettings |
|
48 // C++ default constructor can NOT contain any code, that |
|
49 // might leave. |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CVtEngSettings::CVtEngSettings() : |
|
53 iVariantReadOnlyValues( KErrNotReady ) |
|
54 { |
|
55 iCLI.iValid = EFalse; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CVtEngSettings::ConstructL |
|
60 // Symbian 2nd phase constructor can leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 void CVtEngSettings::ConstructL() |
|
64 { |
|
65 __VTPRINTENTER( "Settings.ConstructL" ) |
|
66 iSelectVolumeIdle = CIdle::NewL( CActive::EPriorityHigh ); |
|
67 iObserverItems = new ( ELeave ) |
|
68 CArrayFixFlat<TObserverItem>( KVtEngObserverArrayGranularity ); |
|
69 |
|
70 // Ear volume CR listener. |
|
71 iCRProxy = &CVtEngUtility::CRProxy(); |
|
72 CreateDataObserverL( this, KCRUidInCallVolume, KTelIncallEarVolume, |
|
73 CCenRepNotifyHandler::EIntKey ); |
|
74 |
|
75 // IHF volume listener. |
|
76 CreateDataObserverL( |
|
77 this, KCRUidInCallVolume, KTelIncallLoudspeakerVolume, |
|
78 CCenRepNotifyHandler::EIntKey ); |
|
79 |
|
80 // Call duration listener. |
|
81 CreateDataObserverL( this, KCRUidLogs, KLogsShowCallDuration, |
|
82 CCenRepNotifyHandler::EIntKey ); |
|
83 |
|
84 // Still image listener. |
|
85 CreateDataObserverL( this, KCRUidTelephonySettings, KSettingsVTStillImage, |
|
86 CCenRepNotifyHandler::EIntKey ); |
|
87 |
|
88 // Still image path listener. |
|
89 CreateDataObserverL( |
|
90 this, KCRUidTelephonySettings, KSettingsVTStillImagePath, |
|
91 CCenRepNotifyHandler::EStringKey ); |
|
92 |
|
93 ReadVariationsL(); |
|
94 ResetAll(); |
|
95 |
|
96 |
|
97 TInt validImage( 0 ); |
|
98 TInt err = iCRProxy->Get( KCRUidTelephonySettings, |
|
99 KSettingsVTStillImage, validImage ); |
|
100 __VTPRINT3( DEBUG_DETAIL, "Settings.ConL: use image", err, validImage ) |
|
101 if ( !err && validImage ) |
|
102 { |
|
103 __VTPRINT( DEBUG_DETAIL, "Settings.ConL: VALID" ) |
|
104 iConfig.iVideo.iImageIsValid = ETrue; |
|
105 } |
|
106 |
|
107 TInt value( 0 ); // not shown |
|
108 err = iCRProxy->Get( KCRUidLogs, KLogsShowCallDuration, value ); |
|
109 if ( err == KErrNone ) |
|
110 { |
|
111 iConfig.iCallTimerOn = ( value == 1 ) ? ETrue : EFalse; |
|
112 } |
|
113 |
|
114 // Initialize the volume levels. |
|
115 // If value retrieval fails, use defaults. |
|
116 if ( iCRProxy->Get( KCRUidInCallVolume, |
|
117 KTelIncallEarVolume, iConfig.iAudio.iVolume.iHandsetVolume ) |
|
118 != KErrNone ) |
|
119 { |
|
120 iConfig.iAudio.iVolume.iHandsetVolume = KVtEngVolumeDefaultLevel; |
|
121 } |
|
122 |
|
123 if ( iCRProxy->Get( KCRUidInCallVolume, KTelIncallLoudspeakerVolume, |
|
124 iConfig.iAudio.iVolume.iHandsfreeVolume ) != KErrNone ) |
|
125 { |
|
126 iConfig.iAudio.iVolume.iHandsfreeVolume = KVtEngVolumeDefaultLevel; |
|
127 } |
|
128 |
|
129 // Open connection to phone server |
|
130 RPhCltServer phoneClient; |
|
131 User::LeaveIfError( phoneClient.Connect() ); |
|
132 CleanupClosePushL( phoneClient ); |
|
133 |
|
134 CPhCltImageHandler* stillH; |
|
135 stillH = CPhCltImageHandler::NewL(); |
|
136 CleanupStack::PushL( stillH ); |
|
137 |
|
138 // Load images |
|
139 RFile file; |
|
140 TInt res = stillH->OpenDefaultVtImage( file ); |
|
141 file.Close(); |
|
142 iDefaultStillImageDefined = ( res == KErrNone ) ? ETrue : EFalse; |
|
143 // Cleanup |
|
144 CleanupStack::PopAndDestroy( 2 ); // phoneClient, stillH, imageParams |
|
145 |
|
146 __VTPRINTEXIT( "Settings.ConstructL" ) |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CVtEngSettings::NewL |
|
151 // Two-phased constructor. |
|
152 // ----------------------------------------------------------------------------- |
|
153 // |
|
154 CVtEngSettings* CVtEngSettings::NewL() |
|
155 { |
|
156 CVtEngSettings* self = new( ELeave ) CVtEngSettings; |
|
157 CleanupStack::PushL( self ); |
|
158 self->ConstructL(); |
|
159 CleanupStack::Pop(); |
|
160 return self; |
|
161 } |
|
162 |
|
163 // ----------------------------------------------------------------------------- |
|
164 // CVtEngSettings::~CVtEngSettings |
|
165 // Destructor. |
|
166 // ----------------------------------------------------------------------------- |
|
167 // |
|
168 CVtEngSettings::~CVtEngSettings() |
|
169 { |
|
170 __VTPRINTENTER( "Settings.~" ) |
|
171 delete iSelectVolumeIdle; |
|
172 delete iObserverItems; |
|
173 delete iDataportInfo; |
|
174 __VTPRINTEXIT( "Settings.~" ) |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CVtEngSettings::Config |
|
179 // Returns configuration. |
|
180 // ----------------------------------------------------------------------------- |
|
181 // |
|
182 const CVtEngSettings::TVtEngVideoCallConfig& CVtEngSettings::Config() const |
|
183 { |
|
184 return iConfig; |
|
185 } |
|
186 |
|
187 // ----------------------------------------------------------------------------- |
|
188 // CVtEngSettings::SetCurrentVolume |
|
189 // ----------------------------------------------------------------------------- |
|
190 // |
|
191 void CVtEngSettings::SetCurrentVolume( TBool aVolume ) |
|
192 { |
|
193 TBool old = iConfig.iAudio.iCurrentVolume; |
|
194 iConfig.iAudio.iCurrentVolume = aVolume; |
|
195 |
|
196 if ( iSelectVolumeObserver && ( !old && aVolume ) || ( old && !aVolume ) ) |
|
197 { |
|
198 iSelectVolumeIdle->Cancel(); |
|
199 iSelectVolumeIdle->Start( |
|
200 TCallBack( DoInformSelectVolumeObserver, this ) ); |
|
201 } |
|
202 } |
|
203 |
|
204 // ----------------------------------------------------------------------------- |
|
205 // CVtEngSettings::CurrentVolume |
|
206 // ----------------------------------------------------------------------------- |
|
207 // |
|
208 TBool CVtEngSettings::CurrentVolume() const |
|
209 { |
|
210 return iConfig.iAudio.iCurrentVolume; |
|
211 } |
|
212 |
|
213 // ----------------------------------------------------------------------------- |
|
214 // CVtEngSettings::SetVolume |
|
215 // Sets output volue setting. |
|
216 // ----------------------------------------------------------------------------- |
|
217 // |
|
218 TInt CVtEngSettings::SetVolume( |
|
219 const TInt aHandsetVolume, |
|
220 const TInt aHandsfreeVolume, |
|
221 const TBool aInternal ) |
|
222 { |
|
223 __VTPRINTENTER( "Settings.SetVolume" ) |
|
224 __VTPRINT3( DEBUG_DETAIL, "Settings:SetVolume hs=%d, ihf=%d", |
|
225 aHandsetVolume, aHandsfreeVolume ) |
|
226 __VTPRINT2( DEBUG_DETAIL, "Settings:Internal=%d", aInternal ) |
|
227 |
|
228 TInt volume ( 0 ); |
|
229 |
|
230 TInt res( KErrNone ); |
|
231 if ( aInternal ) |
|
232 { |
|
233 if ( iConfig.iAudio.iVolume.iHandsfreeVolume != aHandsfreeVolume ) |
|
234 { |
|
235 iConfig.iAudio.iVolume.iHandsfreeVolume = |
|
236 ValidVolume( aHandsfreeVolume ); |
|
237 } |
|
238 if ( iConfig.iAudio.iVolume.iHandsetVolume != aHandsetVolume ) |
|
239 { |
|
240 iConfig.iAudio.iVolume.iHandsetVolume = |
|
241 ValidVolume( aHandsetVolume ); |
|
242 } |
|
243 } |
|
244 else |
|
245 { |
|
246 iCRProxy->Get( KCRUidInCallVolume, |
|
247 KTelIncallEarVolume, volume ); |
|
248 if ( volume != aHandsetVolume ) |
|
249 { |
|
250 iCRProxy->Set( KCRUidInCallVolume, |
|
251 KTelIncallEarVolume, aHandsetVolume ); |
|
252 } |
|
253 |
|
254 iCRProxy->Get( KCRUidInCallVolume, |
|
255 KTelIncallLoudspeakerVolume, volume ); |
|
256 if ( volume != aHandsfreeVolume ) |
|
257 { |
|
258 iCRProxy->Set( KCRUidInCallVolume, |
|
259 KTelIncallLoudspeakerVolume, aHandsfreeVolume ); |
|
260 } |
|
261 } |
|
262 __VTPRINTEXITR( "Settings.SetVolume res=%d", res ) |
|
263 return res; |
|
264 } |
|
265 |
|
266 // ----------------------------------------------------------------------------- |
|
267 // CVtEngSettings::GetVolume |
|
268 // Gets audio volume. |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 TInt CVtEngSettings::GetVolume( |
|
272 TInt& aVolume, |
|
273 const TBool aHandsfree, |
|
274 const TBool aInternal ) const |
|
275 { |
|
276 __VTPRINTEXIT( "Settings.GetVolume" ) |
|
277 TInt res( KErrNone ); |
|
278 if ( aInternal ) |
|
279 { |
|
280 if ( aHandsfree ) |
|
281 { |
|
282 aVolume = iConfig.iAudio.iVolume.iHandsfreeVolume; |
|
283 } |
|
284 else |
|
285 { |
|
286 aVolume = iConfig.iAudio.iVolume.iHandsetVolume; |
|
287 } |
|
288 } |
|
289 else |
|
290 { |
|
291 if ( aHandsfree ) |
|
292 { |
|
293 res = iCRProxy->Get( KCRUidInCallVolume, |
|
294 KTelIncallLoudspeakerVolume, aVolume ); |
|
295 } |
|
296 else |
|
297 { |
|
298 res = iCRProxy->Get( KCRUidInCallVolume, |
|
299 KTelIncallEarVolume, aVolume ); |
|
300 } |
|
301 } |
|
302 __VTPRINTEXITR( "Settings.GetVolume res=%d", res ) |
|
303 return res; |
|
304 } |
|
305 |
|
306 // ----------------------------------------------------------------------------- |
|
307 // CVtEngSettings::SetRouting |
|
308 // Sets audio routing setting. |
|
309 // ----------------------------------------------------------------------------- |
|
310 // |
|
311 void CVtEngSettings::SetRouting( |
|
312 const MVtEngAudio::TVtEngRoutingSetting& aState ) |
|
313 { |
|
314 iConfig.iAudio.iRouting = aState; |
|
315 } |
|
316 |
|
317 // ----------------------------------------------------------------------------- |
|
318 // CVtEngSettings::SetVideoEnabled |
|
319 // Sets video enabled setting. |
|
320 // ----------------------------------------------------------------------------- |
|
321 // |
|
322 void CVtEngSettings::SetVideoEnabled( const TBool aEnabled ) |
|
323 { |
|
324 __VTPRINT2( DEBUG_GEN , "Settings.SVE",aEnabled ) |
|
325 iConfig.iVideo.iVideoEnabled = aEnabled; |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // CVtEngSettings::SetConnectReady |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 void CVtEngSettings::SetConnectReady() |
|
333 { |
|
334 iConfig.iReadyForConnect = ETrue; |
|
335 } |
|
336 |
|
337 // ----------------------------------------------------------------------------- |
|
338 // CVtEngSettings::SetDataportLoaned |
|
339 // Sets dataport loaning status |
|
340 // |
|
341 // ----------------------------------------------------------------------------- |
|
342 // |
|
343 void CVtEngSettings::SetDataportLoaned( TBool aLoaned ) |
|
344 { |
|
345 __VTPRINTENTER( "Settings.SetDataportLoaned" ) |
|
346 iConfig.iIsDataportLoaned = aLoaned; |
|
347 __VTPRINTEXIT( "Settings.SetDataportLoaned" ) |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CVtEngSettings::ResetAll |
|
352 // Reset all settings. |
|
353 // ----------------------------------------------------------------------------- |
|
354 // |
|
355 void CVtEngSettings::ResetAll() |
|
356 { |
|
357 __VTPRINT( DEBUG_GEN , "Settings.RA" ) |
|
358 iConfig.iAudio.iRouting = KVtEngDefaultAudioRouting; |
|
359 iConfig.iVideo.iVideoEnabled = ETrue; |
|
360 iConfig.iReadyForConnect = EFalse; |
|
361 iConfig.iIsDataportLoaned = EFalse; |
|
362 // call duration setting not cleared |
|
363 } |
|
364 |
|
365 // ----------------------------------------------------------------------------- |
|
366 // CVtEngSettings::NotifyChangeL |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 void CVtEngSettings::NotifyChangeL( |
|
370 TSettingId aId, |
|
371 MVtEngSettingObserver& aObserver ) |
|
372 { |
|
373 __VTPRINTENTER( "Settings.NotifyChangeL" ) |
|
374 __VTPRINT2( DEBUG_GEN, "Settings.NC id %d", aId ) |
|
375 switch ( aId ) |
|
376 { |
|
377 case ESelectVolume: |
|
378 iSelectVolumeObserver = &aObserver; |
|
379 break; |
|
380 case EDataportInfo: |
|
381 iDataportObserver = &aObserver; |
|
382 break; |
|
383 // others are CenRep items |
|
384 default: |
|
385 { |
|
386 const TInt count( iObserverItems->Count() ); |
|
387 for ( TInt index = 0; index < count; index++ ) |
|
388 { |
|
389 TObserverItem& item = iObserverItems->At( index ); |
|
390 if ( item.iId == aId && item.iObserver == &aObserver ) |
|
391 { |
|
392 __VTPRINT( DEBUG_GEN, "Settings.NC.already" ) |
|
393 __VTPRINTEXIT( "Settings.NotifyChangeL" ) |
|
394 return; |
|
395 } |
|
396 } |
|
397 |
|
398 TObserverItem item; |
|
399 item.iId = aId; |
|
400 switch ( aId ) |
|
401 { |
|
402 case EStillImage: |
|
403 item.iIntKey = KSettingsVTStillImage; |
|
404 item.iUid = KCRUidTelephonySettings; |
|
405 break; |
|
406 case EStillImagePath: |
|
407 item.iIntKey = KSettingsVTStillImagePath; |
|
408 item.iUid = KCRUidTelephonySettings; |
|
409 break; |
|
410 case ECallTimer: |
|
411 item.iIntKey = KLogsShowCallDuration; |
|
412 item.iUid = KCRUidLogs; |
|
413 break; |
|
414 case EHandsetVolume: |
|
415 item.iIntKey = KTelIncallEarVolume; |
|
416 item.iUid = KCRUidInCallVolume; |
|
417 break; |
|
418 case EHandsfreeVolume: |
|
419 item.iIntKey = KTelIncallLoudspeakerVolume; |
|
420 item.iUid = KCRUidInCallVolume; |
|
421 break; |
|
422 default: |
|
423 break; |
|
424 } |
|
425 item.iObserver = &aObserver; |
|
426 iObserverItems->AppendL( item ); |
|
427 } |
|
428 } |
|
429 __VTPRINTEXIT( "Settings.NotifyChangeL" ) |
|
430 } |
|
431 |
|
432 // ----------------------------------------------------------------------------- |
|
433 // CVtEngSettings::CancelNotifyChange |
|
434 // Cancels receiving change events. |
|
435 // ----------------------------------------------------------------------------- |
|
436 // |
|
437 void CVtEngSettings::CancelNotifyChange( |
|
438 TSettingId aId, const MVtEngSettingObserver& aObserver ) |
|
439 { |
|
440 __VTPRINTENTER( "Settings.CancelNotifyChange" ) |
|
441 if ( aId == ESelectVolume ) |
|
442 { |
|
443 if ( &aObserver == iSelectVolumeObserver ) |
|
444 { |
|
445 iSelectVolumeObserver = NULL; |
|
446 } |
|
447 } |
|
448 else if ( &aObserver == iDataportObserver ) |
|
449 { |
|
450 iDataportObserver = NULL; |
|
451 // also free space used for dataport info |
|
452 delete iDataportInfo; |
|
453 iDataportInfo = NULL; |
|
454 } |
|
455 else |
|
456 { |
|
457 TInt count( iObserverItems->Count() ); |
|
458 while ( count-- ) |
|
459 { |
|
460 const TObserverItem& item = iObserverItems->At( count ); |
|
461 if ( item.iId == aId && |
|
462 item.iObserver == &aObserver ) |
|
463 { |
|
464 iObserverItems->Delete( count ); |
|
465 count = 0; // breaks loop |
|
466 } |
|
467 } |
|
468 } |
|
469 __VTPRINTEXIT( "Settings.CancelNotifyChange" ) |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CVtEngSettings::HandleNotifyInt |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 void CVtEngSettings::HandleNotifyInt( const TUid aUid, |
|
477 const TUint32 aId, TInt aNewValue ) |
|
478 { |
|
479 TBool informObserver = ETrue; |
|
480 if ( aUid == KCRUidInCallVolume ) |
|
481 { |
|
482 switch ( aId ) |
|
483 { |
|
484 case KTelIncallLoudspeakerVolume: |
|
485 { |
|
486 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HF volume" ) |
|
487 if ( iConfig.iAudio.iVolume.iHandsfreeVolume == aNewValue ) |
|
488 { |
|
489 informObserver = EFalse; |
|
490 } |
|
491 else |
|
492 { |
|
493 iConfig.iAudio.iVolume.iHandsfreeVolume = aNewValue; |
|
494 } |
|
495 } |
|
496 break; |
|
497 case KTelIncallEarVolume: |
|
498 { |
|
499 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: HandsetVolume" ) |
|
500 if ( iConfig.iAudio.iVolume.iHandsetVolume == aNewValue ) |
|
501 { |
|
502 informObserver = EFalse; |
|
503 } |
|
504 else |
|
505 { |
|
506 iConfig.iAudio.iVolume.iHandsetVolume = aNewValue; |
|
507 } |
|
508 } |
|
509 break; |
|
510 default: |
|
511 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" ); |
|
512 break; |
|
513 } |
|
514 } |
|
515 else if ( aUid == KCRUidLogs ) |
|
516 { |
|
517 switch ( aId ) |
|
518 { |
|
519 case KLogsShowCallDuration: |
|
520 { |
|
521 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: call duration" ) |
|
522 iConfig.iCallTimerOn = aNewValue > 0 ? ETrue : EFalse; |
|
523 } |
|
524 break; |
|
525 default: |
|
526 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" ); |
|
527 break; |
|
528 } |
|
529 } |
|
530 else if ( aUid == KCRUidTelephonySettings ) |
|
531 { |
|
532 switch ( aId ) |
|
533 { |
|
534 case KSettingsVTStillImage: |
|
535 { |
|
536 __VTPRINT( DEBUG_GEN, "HandleNotifyInt still" ) |
|
537 if ( aNewValue == 0 ) |
|
538 { |
|
539 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt disabled") |
|
540 // still image disabled in settings |
|
541 iConfig.iVideo.iStillImageFile.Zero(); |
|
542 iConfig.iVideo.iImageIsValid = EFalse; |
|
543 } |
|
544 else |
|
545 { |
|
546 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt enabled") |
|
547 iConfig.iVideo.iImageIsValid = ETrue; |
|
548 } |
|
549 } |
|
550 break; |
|
551 default: |
|
552 __VTPRINT( DEBUG_GEN, "Settings.HandleNotifyInt: Non-ordered" ); |
|
553 break; |
|
554 } |
|
555 } |
|
556 |
|
557 TObserverItem* item = FindItem( aUid, aId ); |
|
558 if ( informObserver && item && item->iObserver ) |
|
559 { |
|
560 // The observer does not need the new value |
|
561 // Plain notification is all. |
|
562 TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, KNullDesC16 ) ); |
|
563 } |
|
564 } |
|
565 |
|
566 // ----------------------------------------------------------------------------- |
|
567 // CVtEngSettings::HandleNotifyReal |
|
568 // |
|
569 // |
|
570 // ----------------------------------------------------------------------------- |
|
571 // |
|
572 void CVtEngSettings::HandleNotifyReal( const TUid /*aUid*/, |
|
573 const TUint32 /*aId*/ , TReal /* aNewValue*/ ) |
|
574 { |
|
575 } |
|
576 |
|
577 // ----------------------------------------------------------------------------- |
|
578 // CVtEngSettings::HandleNotifyString |
|
579 // |
|
580 // |
|
581 // ----------------------------------------------------------------------------- |
|
582 // |
|
583 void CVtEngSettings::HandleNotifyString( const TUid aUid, const TUint32 aId, |
|
584 const TDesC16& aNewValue ) |
|
585 { |
|
586 __VTPRINTENTER( "Settings.HN" ) |
|
587 if ( aNewValue.Compare( iConfig.iVideo.iStillImageFile ) != 0 ) |
|
588 { |
|
589 if( aId == KSettingsVTStillImagePath ) |
|
590 { |
|
591 __VTPRINT( DEBUG_GEN, "Settings.HN KGSVTStillImagePath" ) |
|
592 iConfig.iVideo.iStillImageFile.Copy( aNewValue ); |
|
593 } |
|
594 } |
|
595 TObserverItem* item = FindItem( aUid, aId ); |
|
596 if ( item && item->iObserver ) |
|
597 { |
|
598 TRAP_IGNORE( item->iObserver->HandleSettingChangedL( item->iId, aNewValue ) ); |
|
599 } |
|
600 __VTPRINTEXIT( "Settings.HN" ) |
|
601 } |
|
602 |
|
603 // ----------------------------------------------------------------------------- |
|
604 // CVtEngSettings::FindItem |
|
605 // Finds observer item. |
|
606 // ----------------------------------------------------------------------------- |
|
607 // |
|
608 CVtEngSettings::TObserverItem* CVtEngSettings::FindItem( |
|
609 const TUid& aUid, |
|
610 const TDesC& aKey ) const |
|
611 { |
|
612 TInt count( iObserverItems->Count() ); |
|
613 TObserverItem* item = NULL; |
|
614 TBool found( EFalse ); |
|
615 while ( count-- && !found ) |
|
616 { |
|
617 item = &iObserverItems->At( count ); |
|
618 if ( item->iUid == aUid && |
|
619 item->iKey.Compare( aKey ) == 0 ) |
|
620 { |
|
621 found = ETrue; |
|
622 } |
|
623 } |
|
624 |
|
625 // Just NULL the item if not found |
|
626 if( !found ) |
|
627 { |
|
628 item = NULL; |
|
629 } |
|
630 return item; |
|
631 } |
|
632 |
|
633 // ----------------------------------------------------------------------------- |
|
634 // CVtEngSettings::FindItem |
|
635 // Finds observer item. |
|
636 // ----------------------------------------------------------------------------- |
|
637 // |
|
638 CVtEngSettings::TObserverItem* CVtEngSettings::FindItem( |
|
639 const TUid& aUid,const TInt& aKey ) const |
|
640 { |
|
641 TInt count( iObserverItems->Count() ); |
|
642 TObserverItem* item = NULL; |
|
643 TBool found( EFalse ); |
|
644 while ( count-- && !found ) |
|
645 { |
|
646 item = &iObserverItems->At( count ); |
|
647 if ( item->iUid == aUid && |
|
648 item->iIntKey == aKey ) |
|
649 { |
|
650 found = ETrue; |
|
651 } |
|
652 } |
|
653 |
|
654 // Just NULL the item if not found |
|
655 if( !found ) |
|
656 { |
|
657 item = NULL; |
|
658 } |
|
659 return item; |
|
660 } |
|
661 |
|
662 // ----------------------------------------------------------------------------- |
|
663 // CVtEngSettings::SettingAsTInt |
|
664 // Returns setting as integer value. |
|
665 // ----------------------------------------------------------------------------- |
|
666 // |
|
667 TInt CVtEngSettings::SettingAsTInt( const TDesC& aValue ) |
|
668 { |
|
669 TInt value( 0 ); |
|
670 const TInt err = TLex( aValue ).Val( value ); |
|
671 if ( err != KErrNone ) |
|
672 { |
|
673 value = err; |
|
674 } |
|
675 return value; |
|
676 } |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CVtEngSettings::DoInformSelectVolumeObserver |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 TInt CVtEngSettings::DoInformSelectVolumeObserver( TAny* aAny ) |
|
683 { |
|
684 CVtEngSettings* self = static_cast< CVtEngSettings* >( aAny ); |
|
685 |
|
686 if ( self->iSelectVolumeObserver ) |
|
687 { |
|
688 TRAP_IGNORE( self->iSelectVolumeObserver->HandleSettingChangedL( |
|
689 ESelectVolume, |
|
690 KNullDesC ) ); |
|
691 } |
|
692 |
|
693 return KErrNone; |
|
694 } |
|
695 |
|
696 // ----------------------------------------------------------------------------- |
|
697 // CVtEngSettings::ReadVariationsL |
|
698 // Reads local variations. |
|
699 // ----------------------------------------------------------------------------- |
|
700 // |
|
701 void CVtEngSettings::ReadVariationsL() |
|
702 { |
|
703 __VTPRINTENTER( "Settings.ReadVariations" ) |
|
704 User::LeaveIfError( iCRProxy->Get( KCRUidVTVariation, |
|
705 KVTLocalVariationFlags, iVariantReadOnlyValues )); |
|
706 TBuf< KVtEngVQFRBufferSize > buffer; |
|
707 User::LeaveIfError( iCRProxy->Get( KCRUidVTConfiguration, |
|
708 KVTVideoFrameRates, buffer )); |
|
709 ParseFrameRates( iVQFRConfig, buffer ); |
|
710 __VTPRINTEXIT( "Settings.ReadVariations" ) |
|
711 } |
|
712 |
|
713 // ----------------------------------------------------------------------------- |
|
714 // CVtEngSettings::GetCameraOrientations |
|
715 // Reads camera orientations from CR |
|
716 // ----------------------------------------------------------------------------- |
|
717 // |
|
718 |
|
719 void CVtEngSettings::GetCameraOrientations( |
|
720 MVtEngMedia::TCameraOrientation& aPrimaryCameraOrientation, |
|
721 MVtEngMedia::TCameraOrientation& aSecondaryCameraOrientation ) const |
|
722 { |
|
723 /* |
|
724 * Defines layout (screen orientation) used by |
|
725 * Video Telephone application per active camera. |
|
726 * Each camera has one of the following values: |
|
727 * 1) "LS" = Landscape |
|
728 * 2) "PR" = Portrait |
|
729 * 3) "OL" = Obey layout in specific device mode (normal operation) |
|
730 * Camera values are: |
|
731 * 1) "C1" = VT primary camera (inwards) |
|
732 * 2) "C2" = VT secondary camera (outwards) |
|
733 * Example value (portrait for cam1, landscape for cam2): |
|
734 * C1:PR C2:LS |
|
735 */ |
|
736 |
|
737 __VTPRINTENTER( "Settings.GetCameraOrientations" ) |
|
738 const TInt KMaxKVTCameraLayoutValue = 11; |
|
739 const TInt KAbbreviationLength = 2; |
|
740 const TInt KSkipChars = 3; |
|
741 |
|
742 _LIT( KCameraOrientationLS, "LS" ); // landscape |
|
743 _LIT( KCameraOrientationPR, "PR" ); // portrait |
|
744 |
|
745 TBuf< KMaxKVTCameraLayoutValue > cameraOrientations; |
|
746 TInt err = iCRProxy->Get( KCRUidVTConfiguration, |
|
747 KVTCameraLayout, cameraOrientations ); |
|
748 |
|
749 // parse cenrep value |
|
750 if( cameraOrientations.Length() > 0 ) |
|
751 { |
|
752 TBuf<KAbbreviationLength> abbreviation; |
|
753 TLex lex( cameraOrientations ); |
|
754 lex.SkipAndMark(KSkipChars); |
|
755 abbreviation.Append( lex.Get() ); |
|
756 abbreviation.Append( lex.Get() ); |
|
757 |
|
758 // primary camera value |
|
759 if ( abbreviation.CompareF( KCameraOrientationLS ) == 0 ) |
|
760 { |
|
761 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:LS" ); |
|
762 aPrimaryCameraOrientation = MVtEngMedia::EOrientationLandscape; |
|
763 } |
|
764 else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0 ) |
|
765 { |
|
766 aPrimaryCameraOrientation = MVtEngMedia::EOrientationPortrait; |
|
767 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:PR" ); |
|
768 } |
|
769 else |
|
770 { |
|
771 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.prim:OL" ); |
|
772 aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch; |
|
773 } |
|
774 |
|
775 abbreviation.Zero(); |
|
776 lex.SkipSpace(); |
|
777 lex.SkipAndMark(KSkipChars); |
|
778 abbreviation.Append( lex.Get() ); |
|
779 abbreviation.Append( lex.Get() ); |
|
780 |
|
781 //secondary camera value |
|
782 if ( abbreviation.CompareF( KCameraOrientationLS ) == 0) |
|
783 { |
|
784 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:LS" ); |
|
785 aSecondaryCameraOrientation = MVtEngMedia::EOrientationLandscape; |
|
786 } |
|
787 else if ( abbreviation.CompareF( KCameraOrientationPR ) == 0) |
|
788 { |
|
789 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:PR" ); |
|
790 aSecondaryCameraOrientation = MVtEngMedia::EOrientationPortrait; |
|
791 } |
|
792 else |
|
793 { |
|
794 __VTPRINT( DEBUG_GEN, "Settings.GetCamOrient.sec:OL" ); |
|
795 aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch; |
|
796 } |
|
797 } |
|
798 else |
|
799 { |
|
800 // reading from cenrep failed |
|
801 // set default values for camera orientation |
|
802 aPrimaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch; |
|
803 aSecondaryCameraOrientation = MVtEngMedia::EOrientationObeyLayoutSwitch; |
|
804 } |
|
805 __VTPRINTEXIT( "Settings.ReadVariations" ) |
|
806 } |
|
807 |
|
808 // ----------------------------------------------------------------------------- |
|
809 // CVtEngSettings::CheckBit |
|
810 // Checks if a certain bit is turned on in locally variated features. |
|
811 // ----------------------------------------------------------------------------- |
|
812 // |
|
813 TBool CVtEngSettings::CheckBits( const TInt aBits ) |
|
814 { |
|
815 __VTPRINT2( DEBUG_GEN, "Settings.CheckBit: %d", aBits ) |
|
816 __VTPRINT2( DEBUG_GEN, "Settings.CheckBit=%d", |
|
817 iVariantReadOnlyValues & aBits ? 1 : 0 ) |
|
818 return iVariantReadOnlyValues & aBits; |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CVtEngSettings::VideoQualityFrameRateConfig |
|
823 // Returns video quality frame rate configuration. |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 const CVtEngSettings::TVtEngVideoQualityFrameRateConfig& |
|
827 CVtEngSettings::VideoQualityFrameRateConfig() const |
|
828 { |
|
829 __VTPRINTENTER( "Settings.VideoQualityFrameRateConfig" ) |
|
830 __VTPRINTEXIT( "Settings.VideoQualityFrameRateConfig" ) |
|
831 return iVQFRConfig; |
|
832 } |
|
833 |
|
834 // ----------------------------------------------------------------------------- |
|
835 // CVtEngSettings::CreateDataObserverL |
|
836 // Creates a shared data observer. Ownership transferred. |
|
837 // ----------------------------------------------------------------------------- |
|
838 // |
|
839 void CVtEngSettings::CreateDataObserverL( MVtEngCRSettingObserver* aObserver, |
|
840 TUid aUid, TUint32 aKey, CCenRepNotifyHandler::TCenRepKeyType aType ) |
|
841 { |
|
842 CVtEngCRObserverItem* item = CVtEngCRObserverItem::NewL( |
|
843 aObserver, aUid, aKey, aType ); |
|
844 CleanupStack::PushL( item ); |
|
845 iCRProxy->RegisterInterestedL( item ); |
|
846 CleanupStack::Pop( item ); |
|
847 } |
|
848 |
|
849 |
|
850 // ----------------------------------------------------------------------------- |
|
851 // CVtEngSettings::ParseFrameRates |
|
852 // Parses VQ frame rates read from cenrep. |
|
853 // ----------------------------------------------------------------------------- |
|
854 // |
|
855 void CVtEngSettings::ParseFrameRates( TVtEngVideoQualityFrameRateConfig& aVQFR, |
|
856 const TDesC& aBuffer ) |
|
857 { |
|
858 __VTPRINTENTER( "Settings.ParseFrameRates" ) |
|
859 Mem::FillZ( &aVQFR, sizeof( aVQFR ) ); |
|
860 if( aBuffer.Length() > 0 ) |
|
861 { |
|
862 TLex lex( aBuffer ); |
|
863 lex.Val( aVQFR.iDetail ); |
|
864 __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iDetail=%d", aVQFR.iDetail ); |
|
865 lex.SkipSpace(); |
|
866 lex.Val( aVQFR.iNormal ); |
|
867 __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iNormal=%d", aVQFR.iNormal ); |
|
868 lex.SkipSpace(); |
|
869 lex.Val( aVQFR.iMotion ); |
|
870 __VTPRINT2( DEBUG_GEN, "Settings.ParseFrameRates iMotion=%d", aVQFR.iMotion ); |
|
871 } |
|
872 __VTPRINTEXIT( "Settings.ParseFrameRates" ) |
|
873 } |
|
874 |
|
875 // ----------------------------------------------------------------------------- |
|
876 // CVtEngSettings::IsDefaultStillImageDefined |
|
877 // Checks if still image exists. |
|
878 // ----------------------------------------------------------------------------- |
|
879 // |
|
880 TBool CVtEngSettings::IsDefaultStillImageDefined() |
|
881 { |
|
882 __VTPRINTENTER( "Settings.IsDefaultStillImageDefined" ) |
|
883 __VTPRINTEXITR( "Settings.IsDefaultStillImageDefined%d",iDefaultStillImageDefined ) |
|
884 return iDefaultStillImageDefined; |
|
885 |
|
886 } |
|
887 |
|
888 // ----------------------------------------------------------------------------- |
|
889 // CVtEngSettings::SetCLI |
|
890 // |
|
891 // ----------------------------------------------------------------------------- |
|
892 // |
|
893 void CVtEngSettings::SetCLI( const MVtEngSessionInfo::TCLI& aCLI ) |
|
894 { |
|
895 __VTPRINTENTER( "Settings.SetCLI" ) |
|
896 iCLI.iCallId = aCLI.iCallId; |
|
897 iCLI.iName = aCLI.iName; |
|
898 iCLI.iVoiceCallPossible = aCLI.iVoiceCallPossible; |
|
899 iCLI.iValid = ETrue; |
|
900 iCLI.iCallNumber = aCLI.iCallNumber; |
|
901 __VTPRINT2( DEBUG_GEN, "iVoiceCallPossible=%d,", iCLI.iVoiceCallPossible ) |
|
902 __VTPRINTEXIT( "Settings.SetCLI" ) |
|
903 } |
|
904 |
|
905 // ----------------------------------------------------------------------------- |
|
906 // CVtEngSettings::GetCLI |
|
907 // |
|
908 // ----------------------------------------------------------------------------- |
|
909 // |
|
910 TBool CVtEngSettings::GetCLI( MVtEngSessionInfo::TCLI& aCLI ) const |
|
911 { |
|
912 aCLI.iCallId = iCLI.iCallId; |
|
913 aCLI.iVoiceCallPossible = iCLI.iVoiceCallPossible; |
|
914 aCLI.iName = iCLI.iName; |
|
915 aCLI.iCallNumber = iCLI.iCallNumber; |
|
916 return iCLI.iValid; |
|
917 } |
|
918 |
|
919 // ----------------------------------------------------------------------------- |
|
920 // CVtEngSettings::SetDataportInfoL |
|
921 // |
|
922 // ----------------------------------------------------------------------------- |
|
923 // |
|
924 void CVtEngSettings::SetDataportInfoL( const TDesC& aPortInfo ) |
|
925 { |
|
926 delete iDataportInfo; |
|
927 iDataportInfo = NULL; |
|
928 iDataportInfo = HBufC::NewL( aPortInfo.Length() ); |
|
929 *iDataportInfo = aPortInfo; |
|
930 SetConnectReady(); |
|
931 if ( iDataportObserver ) |
|
932 { |
|
933 iDataportObserver->HandleSettingChangedL( EDataportInfo, |
|
934 *iDataportInfo ); |
|
935 } |
|
936 } |
|
937 |
|
938 // ----------------------------------------------------------------------------- |
|
939 // CVtEngSettings::DataportInfo |
|
940 // |
|
941 // ----------------------------------------------------------------------------- |
|
942 // |
|
943 const TDesC* CVtEngSettings::DataportInfo() const |
|
944 { |
|
945 return iDataportInfo; |
|
946 } |
|
947 |
|
948 // End of File |