|
1 /* |
|
2 * Copyright (c) 2009 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 * CPDConfigurationListenerForHDMI class implementation. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <tvoutconfig.h> |
|
22 #include <centralrepository.h> |
|
23 #include <accessoriescrkeys.h> |
|
24 |
|
25 #include "edidhandler.h" |
|
26 #include "pdeconstants.h" |
|
27 #include "multifinitestatemachine.h" |
|
28 #include "tvoutconfigforcomposite.h" |
|
29 #include "myasynconeshottimer.h" |
|
30 #include "trace.h" |
|
31 |
|
32 // EXTERNAL DATA STRUCTURES |
|
33 |
|
34 // EXTERNAL FUNCTION PROTOTYPES |
|
35 |
|
36 // CONSTANTS |
|
37 |
|
38 // MACROS |
|
39 |
|
40 // LOCAL CONSTANTS AND MACROS |
|
41 |
|
42 //Default progressive sequence |
|
43 const TTvSettings::TScanMode KDefaultScan = TTvSettings::EInterlacedScan; |
|
44 |
|
45 //Default output type |
|
46 const TTvSettings::TOutput KDefaultOutput = TTvSettings::ECompositeVideo; |
|
47 |
|
48 //Default detection mode |
|
49 const TTvSettings::TDetectionType KDefaultDetectionMode = |
|
50 TTvSettings::EAutoDetectOff; |
|
51 |
|
52 // Pixel Aspect Ratio parameters |
|
53 //PAL 4:3 |
|
54 const TUint8 KPxlAspect4d3PalNumerator = 255; // 768 but scaled to 8-bit value |
|
55 const TUint8 KPxlAspect4d3PalDenominator = 233; // 702 but scaled to 8-bit value |
|
56 //PAL 16:9 |
|
57 const TUint8 KPxlAspect16d9PalNumerator = 255; // 1024 but scaled to 8-bit value |
|
58 const TUint8 KPxlAspect16d9PalDenominator= 175; // 702 but scaled to 8-bit value |
|
59 //NTSC 4:3 |
|
60 const TUint8 KPxlAspect4d3NtscNumerator = 232; // 647 but scaled to 8-bit value |
|
61 const TUint8 KPxlAspect4d3NtscDenominator = 255; // 711 but scaled to 8-bit value |
|
62 //NTSC 16:9 |
|
63 const TUint8 KPxlAspect16d9NtscNumerator = 255; // 863 but scaled to 8-bit value |
|
64 const TUint8 KPxlAspect16d9NtscDenominator = 210; // 711 but scaled to 8-bit value |
|
65 |
|
66 // MODULE DATA STRUCTURES |
|
67 |
|
68 // LOCAL FUNCTION PROTOTYPES |
|
69 |
|
70 // FORWARD DECLARATIONS |
|
71 |
|
72 |
|
73 // ============================= LOCAL FUNCTIONS =============================== |
|
74 |
|
75 // ============================ MEMBER FUNCTIONS =============================== |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 // Two-phased constructor. |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 // ---------------------------------------------------------------------------- |
|
83 // CTVOutConfigForComposite::NewL |
|
84 // |
|
85 // ---------------------------------------------------------------------------- |
|
86 // |
|
87 CTVOutConfigForComposite* CTVOutConfigForComposite::NewL( MFSMForBody& aFSM ) |
|
88 { |
|
89 FUNC_LOG; |
|
90 |
|
91 CTVOutConfigForComposite* self = new(ELeave) CTVOutConfigForComposite( aFSM ); |
|
92 CleanupStack::PushL( self ); |
|
93 self->ConstructL(); |
|
94 CleanupStack::Pop( self ); |
|
95 |
|
96 return self; |
|
97 } |
|
98 |
|
99 // ---------------------------------------------------------------------------- |
|
100 // CTVOutConfigForComposite::CTVOutConfigForComposite |
|
101 // |
|
102 // ---------------------------------------------------------------------------- |
|
103 // |
|
104 CTVOutConfigForComposite::CTVOutConfigForComposite( MFSMForBody& aFSM ): |
|
105 CActive( CActive::EPriorityLow ), |
|
106 iFSM( aFSM ) |
|
107 { |
|
108 FUNC_LOG; |
|
109 |
|
110 // Nothing |
|
111 } |
|
112 |
|
113 // ---------------------------------------------------------------------------- |
|
114 // CTVOutConfigForComposite::SetConfig |
|
115 // |
|
116 // ---------------------------------------------------------------------------- |
|
117 // |
|
118 void CTVOutConfigForComposite::SetConfig( TBool aSettingAfterCableConnected ) |
|
119 { |
|
120 FUNC_LOG; |
|
121 |
|
122 iSettingAfterCableConnected = aSettingAfterCableConnected; |
|
123 iStatus = KRequestPending; |
|
124 iNextOpt = EOptSetting; |
|
125 SetActive(); |
|
126 TRequestStatus* status = &iStatus; |
|
127 User::RequestComplete( status, KErrNone ); |
|
128 } |
|
129 |
|
130 // ---------------------------------------------------------------------------- |
|
131 // CTVOutConfigForHDMI::ListenSettingsChanges |
|
132 // |
|
133 // ---------------------------------------------------------------------------- |
|
134 // |
|
135 void CTVOutConfigForComposite::ListenSettingsChanges() |
|
136 { |
|
137 FUNC_LOG; |
|
138 Cancel(); |
|
139 iNextOpt = EOptStartListenForSettingsChanges; |
|
140 iStatus = KRequestPending; |
|
141 SetActive(); |
|
142 TRequestStatus* status = &iStatus; |
|
143 User::RequestComplete( status, KErrNone ); |
|
144 |
|
145 } |
|
146 |
|
147 // ---------------------------------------------------------------------------- |
|
148 // CTVOutConfigForHDMI::GetTvOutConfig |
|
149 // |
|
150 // ---------------------------------------------------------------------------- |
|
151 // |
|
152 CTvOutConfig* CTVOutConfigForComposite::GetTvOutConfig() |
|
153 { |
|
154 FUNC_LOG; |
|
155 return iTvOutConfig; |
|
156 } |
|
157 |
|
158 |
|
159 // ---------------------------------------------------------------------------- |
|
160 // CTVOutConfigForComposite::Enable |
|
161 // |
|
162 // ---------------------------------------------------------------------------- |
|
163 // |
|
164 void CTVOutConfigForComposite::Enable() |
|
165 { |
|
166 FUNC_LOG; |
|
167 |
|
168 iStatus = KRequestPending; |
|
169 iNextOpt = EOptEnableTv; |
|
170 SetActive(); |
|
171 TRequestStatus* status = &iStatus; |
|
172 User::RequestComplete( status, KErrNone ); |
|
173 } |
|
174 |
|
175 // ---------------------------------------------------------------------------- |
|
176 // CTVOutConfigForComposite::Disable |
|
177 // |
|
178 // ---------------------------------------------------------------------------- |
|
179 // |
|
180 void CTVOutConfigForComposite::Disable() |
|
181 { |
|
182 FUNC_LOG; |
|
183 |
|
184 iStatus = KRequestPending; |
|
185 iNextOpt = EOptDisableTv; |
|
186 SetActive(); |
|
187 TRequestStatus* status = &iStatus; |
|
188 User::RequestComplete( status, KErrNone ); |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // CTVOutConfigForComposite::InitializeDriverL |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TInt CTVOutConfigForComposite::InitializeDriverL() |
|
196 { |
|
197 FUNC_LOG; |
|
198 |
|
199 TTvSettings settings; |
|
200 TInt value = 0; |
|
201 TInt err = KErrNone; |
|
202 |
|
203 value = TvSystemL(); |
|
204 ConvertTvSystem( value ); |
|
205 settings.iTvSystem = ( TTvSettings::TSystem ) value; |
|
206 |
|
207 value = AspectRatioL(); |
|
208 ConvertAspectRatio( value ); |
|
209 settings.iRatio = ( TTvSettings::TAspectRatio ) value; |
|
210 |
|
211 settings.iScanMode = KDefaultScan; |
|
212 settings.iOutput = KDefaultOutput; |
|
213 settings.iAutoDetection = KDefaultDetectionMode; |
|
214 |
|
215 value = FlickerFilterL(); |
|
216 ConvertFlickerFilter( value ); |
|
217 settings.iFlickerFilter = ( TTvSettings::TFlickerFilterType ) value; |
|
218 |
|
219 TInt hOverscan = 0; |
|
220 TInt vOverscan = 0; |
|
221 err = iRepository->Get( KSettingsTvoutHorizontalOverscan, hOverscan ); |
|
222 if( err != KErrNone ) |
|
223 { |
|
224 hOverscan = 0; |
|
225 } |
|
226 err = iRepository->Get( KSettingsTvoutVerticalOverscan, vOverscan ); |
|
227 if( err != KErrNone ) |
|
228 { |
|
229 vOverscan = 0; |
|
230 } |
|
231 settings.iHorizontalOverScan = hOverscan; |
|
232 settings.iVerticalOverScan = vOverscan; |
|
233 |
|
234 // Update the PAR |
|
235 UpdatePixelAspectRatio( settings ); |
|
236 |
|
237 if ( err == KErrNone ) |
|
238 { |
|
239 RArray<THdmiDviTimings> newHdmiSettingsArray; |
|
240 CleanupClosePushL( newHdmiSettingsArray ); |
|
241 RArray<TTvSettings> newTvSettingsArray; |
|
242 CleanupClosePushL( newTvSettingsArray ); |
|
243 |
|
244 err = newTvSettingsArray.Append( settings ); |
|
245 INFO_1( "Settings.iTvSystem %i", settings.iTvSystem ); |
|
246 INFO_1( "Settings.iRatio %i", settings.iRatio ); |
|
247 INFO_1( "Settings.iScanMode %i", settings.iScanMode ); |
|
248 INFO_1( "Settings.iOutput %i", settings.iOutput ); |
|
249 INFO_1( "Settings.iFlickerFilter %i", settings.iFlickerFilter ); |
|
250 INFO_1( "Settings.iAutoDetection %i", settings.iAutoDetection ); |
|
251 INFO_1( "Settings.iHorizontalOverScan %i", settings.iHorizontalOverScan ); |
|
252 INFO_1( "Settings.iVerticalOverScan %i", settings.iVerticalOverScan ); |
|
253 iTvOutConfig->SetAvailableTvConfigList( newTvSettingsArray, newHdmiSettingsArray ); |
|
254 CleanupStack::PopAndDestroy( &newTvSettingsArray ); |
|
255 CleanupStack::PopAndDestroy( &newHdmiSettingsArray ); |
|
256 |
|
257 iSettingAfterCableConnected = EFalse; |
|
258 } |
|
259 |
|
260 return err; |
|
261 } |
|
262 |
|
263 // ----------------------------------------------------------------------------- |
|
264 // CTVOutConfigForComposite::TvSystem |
|
265 // ----------------------------------------------------------------------------- |
|
266 // |
|
267 TInt CTVOutConfigForComposite::TvSystemL() |
|
268 { |
|
269 FUNC_LOG; |
|
270 |
|
271 TInt value = 0; |
|
272 User::LeaveIfError( iRepository->Get( KSettingsTvSystemInfo, value ) ); |
|
273 |
|
274 return value; |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CTVOutConfigForComposite::AspectRatioL |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 TInt CTVOutConfigForComposite::AspectRatioL() |
|
282 { |
|
283 FUNC_LOG; |
|
284 |
|
285 TInt value = 0; |
|
286 User::LeaveIfError( iRepository->Get( KSettingsTvAspectRatio, value ) ); |
|
287 |
|
288 return value; |
|
289 } |
|
290 |
|
291 // ----------------------------------------------------------------------------- |
|
292 // CTVOutConfigForComposite::FlickerFilter |
|
293 // ----------------------------------------------------------------------------- |
|
294 // |
|
295 TInt CTVOutConfigForComposite::FlickerFilterL() |
|
296 { |
|
297 FUNC_LOG; |
|
298 |
|
299 TInt value = 0; |
|
300 User::LeaveIfError( iRepository->Get( KSettingsTvoutFlickerFilter, value ) ); |
|
301 |
|
302 return value; |
|
303 } |
|
304 |
|
305 // ---------------------------------------------------------------------------- |
|
306 // CTVOutConfigForComposite::ConvertFlickerFilter |
|
307 // ---------------------------------------------------------------------------- |
|
308 // |
|
309 void CTVOutConfigForComposite::ConvertFlickerFilter( TInt& aValue ) |
|
310 { |
|
311 FUNC_LOG; |
|
312 |
|
313 switch( aValue ) |
|
314 { |
|
315 case 0: // Off |
|
316 { |
|
317 aValue = TTvSettings::EFilterDisabled; |
|
318 break; |
|
319 } |
|
320 case 1: // On |
|
321 { |
|
322 aValue = TTvSettings::EFilterEnabled; |
|
323 break; |
|
324 } |
|
325 default: |
|
326 { |
|
327 aValue = TTvSettings::EUndefFlicker; |
|
328 break; |
|
329 } |
|
330 } |
|
331 } |
|
332 |
|
333 // ---------------------------------------------------------------------------- |
|
334 // CTVOutConfigForComposite::ConvertAspectRatio |
|
335 // |
|
336 // |
|
337 // ---------------------------------------------------------------------------- |
|
338 // |
|
339 void CTVOutConfigForComposite::ConvertAspectRatio( TInt& aValue ) |
|
340 { |
|
341 FUNC_LOG; |
|
342 |
|
343 switch( aValue ) |
|
344 { |
|
345 case 0: // 4:3 |
|
346 { |
|
347 aValue = TTvSettings::E4d3; |
|
348 break; |
|
349 } |
|
350 case 1: // 16:9 |
|
351 { |
|
352 aValue = TTvSettings::E16d9; |
|
353 break; |
|
354 } |
|
355 default: |
|
356 { |
|
357 aValue = TTvSettings::EUndefRatio; |
|
358 break; |
|
359 } |
|
360 } |
|
361 } |
|
362 |
|
363 // ---------------------------------------------------------------------------- |
|
364 // CTVOutConfigForComposite::ConvertTvSystem |
|
365 // |
|
366 // |
|
367 // ---------------------------------------------------------------------------- |
|
368 // |
|
369 void CTVOutConfigForComposite::ConvertTvSystem( TInt& aValue ) |
|
370 { |
|
371 FUNC_LOG; |
|
372 |
|
373 switch( aValue ) |
|
374 { |
|
375 case 0: // PAL |
|
376 { |
|
377 aValue = TTvSettings::EPAL; |
|
378 break; |
|
379 } |
|
380 case 1: // PALM |
|
381 { |
|
382 aValue = TTvSettings::EPALM; |
|
383 break; |
|
384 } |
|
385 case 2: // NTSC |
|
386 { |
|
387 aValue = TTvSettings::ENTSC; |
|
388 break; |
|
389 } |
|
390 default: |
|
391 { |
|
392 aValue = TTvSettings::EUndefSystem; |
|
393 break; |
|
394 } |
|
395 } |
|
396 } |
|
397 |
|
398 // ---------------------------------------------------------------------------- |
|
399 // CTVOutConfigForComposite::UpdatePixelAspectRatio |
|
400 // |
|
401 // ---------------------------------------------------------------------------- |
|
402 // |
|
403 void CTVOutConfigForComposite::UpdatePixelAspectRatio( TTvSettings& aSettings ) |
|
404 { |
|
405 FUNC_LOG; |
|
406 |
|
407 switch ( aSettings.iTvSystem ) |
|
408 { |
|
409 case TTvSettings::EPAL: |
|
410 case TTvSettings::EPALM: |
|
411 { |
|
412 if( aSettings.iRatio == TTvSettings::E16d9 ) |
|
413 { |
|
414 aSettings.iPixelAspectRatioNumerator = KPxlAspect16d9PalNumerator; |
|
415 aSettings.iPixelAspectRatioDenominator = KPxlAspect16d9PalDenominator; |
|
416 } |
|
417 else |
|
418 { |
|
419 aSettings.iPixelAspectRatioNumerator = KPxlAspect4d3PalNumerator; |
|
420 aSettings.iPixelAspectRatioDenominator = KPxlAspect4d3PalDenominator; |
|
421 } |
|
422 break; |
|
423 } |
|
424 case TTvSettings::ENTSC: |
|
425 { |
|
426 if( aSettings.iRatio == TTvSettings::E16d9 ) |
|
427 { |
|
428 aSettings.iPixelAspectRatioNumerator = KPxlAspect16d9NtscNumerator; |
|
429 aSettings.iPixelAspectRatioDenominator = KPxlAspect16d9NtscDenominator; |
|
430 } |
|
431 else |
|
432 { |
|
433 aSettings.iPixelAspectRatioNumerator = KPxlAspect4d3NtscNumerator; |
|
434 aSettings.iPixelAspectRatioDenominator = KPxlAspect4d3NtscDenominator; |
|
435 } |
|
436 break; |
|
437 } |
|
438 } |
|
439 } |
|
440 |
|
441 // ---------------------------------------------------------------------------- |
|
442 // CTVOutConfigForComposite::ConstructL |
|
443 // |
|
444 // ---------------------------------------------------------------------------- |
|
445 // |
|
446 void CTVOutConfigForComposite::ConstructL() |
|
447 { |
|
448 FUNC_LOG; |
|
449 |
|
450 iMyAsyncOneShotTimer = new (ELeave) CMyAsyncOneShotTimer( CActive::EPriorityLow, *this ); |
|
451 iRepository = CRepository::NewL( KCRUidTvoutSettings ); |
|
452 iTvOutConfig = CTvOutConfig::NewL(); |
|
453 |
|
454 CActiveScheduler::Add( this ); |
|
455 } |
|
456 |
|
457 // ---------------------------------------------------------------------------- |
|
458 // CTVOutConfigForComposite::~CTVOutConfigForComposite |
|
459 // |
|
460 // ---------------------------------------------------------------------------- |
|
461 // |
|
462 CTVOutConfigForComposite::~CTVOutConfigForComposite() |
|
463 { |
|
464 FUNC_LOG; |
|
465 |
|
466 if ( iTvOutConfig ) |
|
467 { |
|
468 Cancel(); |
|
469 delete iTvOutConfig; |
|
470 } |
|
471 if ( iMyAsyncOneShotTimer ) |
|
472 { |
|
473 if ( iMyAsyncOneShotTimer->IsActive() ) |
|
474 { |
|
475 iMyAsyncOneShotTimer->Cancel(); |
|
476 } |
|
477 delete iMyAsyncOneShotTimer; |
|
478 } |
|
479 delete iRepository; |
|
480 } |
|
481 |
|
482 // ---------------------------------------------------------------------------- |
|
483 // CTVOutConfigForComposite::DoCancel |
|
484 // |
|
485 // ---------------------------------------------------------------------------- |
|
486 // |
|
487 void CTVOutConfigForComposite::DoCancel() |
|
488 { |
|
489 FUNC_LOG; |
|
490 TInt err( KErrNone ); |
|
491 if ( iMyAsyncOneShotTimer->IsActive() ) |
|
492 { |
|
493 iMyAsyncOneShotTimer->Cancel(); |
|
494 } |
|
495 if ( iNextOpt == EOptListenForSettingsChanges ) |
|
496 { |
|
497 err = iTvOutConfig->SettingsChangedListenerCancel (); |
|
498 } |
|
499 if ( KErrNone != err ) |
|
500 { |
|
501 INFO_1("Error status %d", err); |
|
502 } |
|
503 iNextOpt = EOptIdle; |
|
504 } |
|
505 |
|
506 // ---------------------------------------------------------------------------- |
|
507 // CTVOutConfigForComposite::RunL |
|
508 // |
|
509 // ---------------------------------------------------------------------------- |
|
510 // |
|
511 void CTVOutConfigForComposite::RunL() |
|
512 { |
|
513 |
|
514 FUNC_LOG; |
|
515 |
|
516 switch ( iNextOpt ) |
|
517 { |
|
518 case EOptEnableTv: |
|
519 { |
|
520 INFO("EOptEnableTv"); |
|
521 TInt retVal = iTvOutConfig->Enable(); |
|
522 INFO_1("iTvOutConfig->Enable() retVal: %d", retVal); |
|
523 switch ( retVal ) |
|
524 { |
|
525 case KErrNone: |
|
526 case KErrAlreadyExists: |
|
527 { |
|
528 iNextOpt = EOptUndefined; |
|
529 iFSM.Input( |
|
530 EPDEIfTVOutConfig, |
|
531 EIfTVOutConfigEventEnabled ); |
|
532 } |
|
533 break; |
|
534 case KErrServerBusy: |
|
535 { |
|
536 iTimeOutReason = iNextOpt; |
|
537 iNextOpt = EOptIdle; |
|
538 iMyAsyncOneShotTimer->Call(); |
|
539 } |
|
540 break; |
|
541 case KErrNotSupported: |
|
542 case KErrNotReady: |
|
543 default: |
|
544 { |
|
545 iNextOpt = EOptUndefined; |
|
546 iFSM.Input( |
|
547 EPDEIfTVOutConfig, |
|
548 EIfTVOutConfigEventEnableFailed ); |
|
549 } |
|
550 break; |
|
551 } |
|
552 break; |
|
553 } |
|
554 case EOptDisableTv: |
|
555 { |
|
556 INFO("EOptDisableTv"); |
|
557 TInt retVal = iTvOutConfig->Disable(); |
|
558 INFO_1("iTvOutConfig->Disable() retVal: %d", retVal); |
|
559 switch ( retVal ) |
|
560 { |
|
561 case KErrNone: |
|
562 case KErrAlreadyExists: |
|
563 { |
|
564 iNextOpt = EOptUndefined; |
|
565 iFSM.Input( |
|
566 EPDEIfTVOutConfig, |
|
567 EIfTVOutConfigEventDisabled ); |
|
568 } |
|
569 break; |
|
570 case KErrServerBusy: |
|
571 { |
|
572 iTimeOutReason = iNextOpt; |
|
573 iNextOpt = EOptIdle; |
|
574 iMyAsyncOneShotTimer->Call(); |
|
575 } |
|
576 break; |
|
577 case KErrNotSupported: |
|
578 case KErrNotReady: |
|
579 default: |
|
580 { |
|
581 iNextOpt = EOptUndefined; |
|
582 iFSM.Input( |
|
583 EPDEIfTVOutConfig, |
|
584 EIfTVOutConfigEventDisableFailed ); |
|
585 } |
|
586 break; |
|
587 } |
|
588 break; |
|
589 } |
|
590 case EOptStartListenForSettingsChanges: |
|
591 { |
|
592 INFO("EOptStartListenForSettingsChanges"); |
|
593 iStatus = KRequestPending; |
|
594 TInt err = iTvOutConfig->SettingsChangedListener( iStatus ); |
|
595 INFO("EOptStartListenForSettingsChanges - Stage 1"); |
|
596 if ( KErrNone != err ) |
|
597 { |
|
598 INFO_1("iTvOutConfig->SettingsChangedListener( iStatus ) error status %i", err); |
|
599 iFSM.Input( |
|
600 EPDEIfTVOutConfig, |
|
601 EIfTVOutConfigEventSettingsChangesListenFailed ); |
|
602 } |
|
603 else |
|
604 { |
|
605 INFO("EOptStartListenForSettingsChanges - Stage 2"); |
|
606 iNextOpt = EOptListenForSettingsChanges; |
|
607 SetActive(); |
|
608 INFO("EOptStartListenForSettingsChanges - Stage 3"); |
|
609 iFSM.Input( |
|
610 EPDEIfTVOutConfig, |
|
611 EIfTVOutConfigEventSettingsChangesListenStarted ); |
|
612 INFO("EOptStartListenForSettingsChanges - Stage 4"); |
|
613 } |
|
614 break; |
|
615 } |
|
616 case EOptListenForSettingsChanges: |
|
617 { |
|
618 INFO("EOptListenForSettingsChanges"); |
|
619 iNextOpt = EOptIdle; |
|
620 TInt err( iStatus.Int() ); |
|
621 if ( KErrNone != err ) |
|
622 { |
|
623 INFO_1("Error status %d", err); |
|
624 iFSM.Input( |
|
625 EPDEIfTVOutConfig, |
|
626 EIfTVOutConfigEventSettingsChangesListenFailed ); |
|
627 } |
|
628 else |
|
629 { |
|
630 iFSM.Input( |
|
631 EPDEIfTVOutConfig, |
|
632 EIfTVOutConfigEventSettingsChanged ); |
|
633 } |
|
634 break; |
|
635 } |
|
636 case EOptSetting: |
|
637 { |
|
638 INFO("EOptSetting"); |
|
639 TInt retVal( KErrNone ); |
|
640 TRAP( retVal, InitializeDriverL() ); |
|
641 if (KErrNone != retVal ) |
|
642 { |
|
643 INFO_1( "InitializeDriverL() leaved with error code %i", retVal ); |
|
644 if ( ( KErrNotReady == retVal ) && |
|
645 ( !iDisabledOnceBeforeSetting ) ) |
|
646 { |
|
647 iDisabledOnceBeforeSetting = ETrue; |
|
648 iStatus = KRequestPending; |
|
649 iNextOpt = EOptDisableTVBeforeSetting; |
|
650 SetActive(); |
|
651 TRequestStatus* status = &iStatus; |
|
652 User::RequestComplete( status, KErrNone ); |
|
653 } |
|
654 else |
|
655 { |
|
656 iDisabledOnceBeforeSetting = EFalse; |
|
657 iSettingAfterCableConnected = EFalse; |
|
658 iFSM.Input( |
|
659 EPDEIfTVOutConfig, |
|
660 EIfTVOutConfigEventSetFailed ); |
|
661 } |
|
662 } |
|
663 else |
|
664 { |
|
665 iDisabledOnceBeforeSetting = EFalse; |
|
666 iSettingAfterCableConnected = EFalse; |
|
667 iNextOpt = EOptUndefined; |
|
668 iFSM.Input( |
|
669 EPDEIfTVOutConfig, |
|
670 EIfTVOutConfigEventSet ); |
|
671 } |
|
672 break; |
|
673 } |
|
674 case EOptDisableTVBeforeSetting: |
|
675 { |
|
676 INFO("EOptDisableTVBeforeSetting"); |
|
677 TInt retVal = iTvOutConfig->Disable(); |
|
678 INFO_1("iTvOutConfig->Disable() retVal: %d", retVal); |
|
679 switch ( retVal ) |
|
680 { |
|
681 case KErrNone: |
|
682 case KErrAlreadyExists: |
|
683 { |
|
684 iNextOpt = EOptUndefined; |
|
685 SetConfig( iSettingAfterCableConnected ); |
|
686 } |
|
687 break; |
|
688 case KErrServerBusy: |
|
689 { |
|
690 User::After( EWaitTimeInMsForTvOutConfigBusyServer ); |
|
691 iStatus = KRequestPending; |
|
692 iNextOpt = EOptDisableTVBeforeSetting; |
|
693 SetActive(); |
|
694 TRequestStatus* status = &iStatus; |
|
695 User::RequestComplete( status, KErrNone ); |
|
696 } |
|
697 break; |
|
698 case KErrNotSupported: |
|
699 case KErrNotReady: |
|
700 default: |
|
701 { |
|
702 iNextOpt = EOptUndefined; |
|
703 iFSM.Input( |
|
704 EPDEIfTVOutConfig, |
|
705 EIfTVOutConfigEventSetFailed ); |
|
706 } |
|
707 break; |
|
708 } |
|
709 break; |
|
710 } |
|
711 default: |
|
712 INFO_1("Default case, iNextOpt = %i", iNextOpt); |
|
713 break; |
|
714 } |
|
715 } |
|
716 |
|
717 // ---------------------------------------------------------------------------- |
|
718 // CTVOutConfigForComposite::OneShotTimeout |
|
719 // |
|
720 // ---------------------------------------------------------------------------- |
|
721 // |
|
722 void CTVOutConfigForComposite::OneShotTimeout() |
|
723 { |
|
724 FUNC_LOG; |
|
725 |
|
726 iNextOpt = iTimeOutReason; |
|
727 iTimeOutReason = EOptUndefined; |
|
728 RunL(); |
|
729 } |