|
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: Implementation of "Connected" state of Composite Cable Status FSM. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32def.h> |
|
21 #include <e32cmn.h> |
|
22 |
|
23 |
|
24 #include "pdeconstants.h" |
|
25 #include "compositecablestatusfsm.h" |
|
26 #include "compositecablestateconnected.h" |
|
27 #include "tvoutconfigforcomposite.h" |
|
28 #include "trace.h" |
|
29 #include <centralrepository.h> |
|
30 #include <accessoriescrkeys.h> |
|
31 #include <tvoutconfig.h> |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 // ======== LOCAL FUNCTIONS ======== |
|
37 |
|
38 |
|
39 // ======== MEMBER FUNCTIONS ======== |
|
40 |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 //Symbian two-phased constructor |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 CCompositeCableStateConnected* CCompositeCableStateConnected::NewL( |
|
47 MFSMForState& aFSMForState, |
|
48 CTVOutConfigForComposite& aTVOutConfigForComposite, |
|
49 CCompositeCableStatusFSM& aCompositeCableStatusFSM) |
|
50 { |
|
51 FUNC_LOG; |
|
52 CCompositeCableStateConnected* self = new ( ELeave ) CCompositeCableStateConnected( |
|
53 aFSMForState, aTVOutConfigForComposite, aCompositeCableStatusFSM); |
|
54 CleanupStack::PushL( self ); |
|
55 self->ConstructL(); |
|
56 CleanupStack::Pop( self ); |
|
57 return self; |
|
58 } |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Destructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CCompositeCableStateConnected::~CCompositeCableStateConnected() |
|
66 { |
|
67 FUNC_LOG; |
|
68 if ( iCRWatchForAspectRatio ) |
|
69 { |
|
70 iCRWatchForAspectRatio->Cancel(); |
|
71 delete iCRWatchForAspectRatio; |
|
72 } |
|
73 if ( iCRWatchForFlickerFilter ) |
|
74 { |
|
75 iCRWatchForFlickerFilter->Cancel(); |
|
76 delete iCRWatchForFlickerFilter; |
|
77 } |
|
78 if ( iCRWatchForTvSystem ) |
|
79 { |
|
80 iCRWatchForTvSystem->Cancel(); |
|
81 delete iCRWatchForTvSystem; |
|
82 } |
|
83 if ( iTVOutConfigForSettingChanges ) |
|
84 { |
|
85 iTVOutConfigForSettingChanges->Cancel(); |
|
86 delete iTVOutConfigForSettingChanges; |
|
87 } |
|
88 } |
|
89 |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // From MFSMState. |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 void CCompositeCableStateConnected::Enter( ) |
|
96 { |
|
97 FUNC_LOG; |
|
98 |
|
99 ClearAvailableTvOutConfig(); |
|
100 |
|
101 iTVOutConfigForSettingChanges->ListenSettingsChanges(); |
|
102 iSubState = ESubStateStartListenSettingsChanges; |
|
103 } |
|
104 |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // From MFSMState. |
|
108 // --------------------------------------------------------------------------- |
|
109 // |
|
110 void CCompositeCableStateConnected::Input( |
|
111 TFSMInterfaceId aInterfaceId , |
|
112 TFSMEventId aEvent ) |
|
113 { |
|
114 FUNC_LOG; |
|
115 if ( ESubStateEnabling == iSubState ) |
|
116 { |
|
117 SubStateEnablingInput( aInterfaceId, aEvent ); |
|
118 } |
|
119 else if ( ESubStateDisabling == iSubState ) |
|
120 { |
|
121 SubStateDisablingInput( aInterfaceId, aEvent ); |
|
122 } |
|
123 else if ( ESubStateSetting == iSubState ) |
|
124 { |
|
125 SubStateSettingInput( aInterfaceId, aEvent ); |
|
126 } |
|
127 else if ( ESubStateStartListenSettingsChanges == iSubState ) |
|
128 { |
|
129 SubStateStartListenConfigChangesInput( aInterfaceId, aEvent ); |
|
130 } |
|
131 else if ( ESubStateResettingDisable == iSubState ) |
|
132 { |
|
133 SubStateResettingDisableInput( aInterfaceId, aEvent ); |
|
134 } |
|
135 else if ( ESubStateResetting == iSubState ) |
|
136 { |
|
137 SubStateResettingInput( aInterfaceId, aEvent ); |
|
138 } |
|
139 else |
|
140 { |
|
141 SubStateEnabledInput( aInterfaceId, aEvent ); |
|
142 } |
|
143 |
|
144 } |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // From MFSMState. |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 TFSMState CCompositeCableStateConnected::Id() |
|
151 { |
|
152 FUNC_LOG; |
|
153 TFSMState tempStateId( ECompositeCableStateConnected ); |
|
154 INFO_1( "State's id: %i", tempStateId ); |
|
155 return tempStateId; |
|
156 } |
|
157 |
|
158 // --------------------------------------------------------------------------- |
|
159 // From MFSMState. |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 TPtrC CCompositeCableStateConnected::Name() |
|
163 { |
|
164 FUNC_LOG; |
|
165 TPtrC temp( KCompositeCableStateConnected ); |
|
166 INFO_1( "State's name: %s", temp.Ptr() ); |
|
167 return temp; |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // From MFSMState. |
|
172 // --------------------------------------------------------------------------- |
|
173 // |
|
174 TFSMState CCompositeCableStateConnected::SubId() |
|
175 { |
|
176 FUNC_LOG; |
|
177 INFO_1( "Substate's id: %i", iSubState ); |
|
178 return iSubState; |
|
179 } |
|
180 |
|
181 // --------------------------------------------------------------------------- |
|
182 // From MCentralRepositoryObserver. |
|
183 // --------------------------------------------------------------------------- |
|
184 // |
|
185 void CCompositeCableStateConnected::CentRepKeyChanged( |
|
186 TUid aRepositoryId, |
|
187 TUint32 aId ) |
|
188 { |
|
189 FUNC_LOG; |
|
190 if ( KCRUidTvoutSettings == aRepositoryId ) |
|
191 { |
|
192 if ( ( KSettingsTvAspectRatio == aId ) || |
|
193 ( KSettingsTvoutFlickerFilter == aId ) || |
|
194 ( KSettingsTvSystemInfo == aId ) ) |
|
195 { |
|
196 Input( EPDEIfCentralRepositoryWatch, EPDEIfCentralRepositoryWatchEventKeyChanged ); |
|
197 } |
|
198 else |
|
199 { |
|
200 INFO_1("Unexpected CR key ID, aId 0x%x", aId ); |
|
201 } |
|
202 } |
|
203 else |
|
204 { |
|
205 INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId); |
|
206 } |
|
207 } |
|
208 |
|
209 // --------------------------------------------------------------------------- |
|
210 // From MCentralRepositoryObserver. |
|
211 // --------------------------------------------------------------------------- |
|
212 // |
|
213 void CCompositeCableStateConnected::CentRepGetKeyValueFailed( |
|
214 TUid aRepositoryId, |
|
215 TUint32 aId, |
|
216 TInt aError ) |
|
217 { |
|
218 FUNC_LOG; |
|
219 // Make use of aError argument top get rid of compiler warning. |
|
220 TInt error( aError ); |
|
221 if ( ( KCRUidTvoutSettings == aRepositoryId ) && ( KErrNone != error ) ) |
|
222 { |
|
223 if ( KSettingsTvAspectRatio == aId ) |
|
224 { |
|
225 INFO_1(" Getting KSettingsTvAspectRatio from CR failed, aError %d", error ); |
|
226 } |
|
227 else if ( KSettingsTvoutFlickerFilter == aId ) |
|
228 { |
|
229 INFO_1(" Getting KSettingsTvoutFlickerFilter from CR failed, aError %d", error ); |
|
230 } |
|
231 else if ( KSettingsTvSystemInfo == aId ) |
|
232 { |
|
233 INFO_1(" Getting KSettingsTvSystemInfo from CR failed, aError %d", error ); |
|
234 } |
|
235 else |
|
236 { |
|
237 INFO_1("Unexpected CR key ID, aId 0x%x", aId ); |
|
238 } |
|
239 } |
|
240 else |
|
241 { |
|
242 INFO_1("Unexpected Central Repository ID, aRepositoryId 0x%x", aRepositoryId); |
|
243 } |
|
244 } |
|
245 |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // SubStateEnablingInput |
|
249 // --------------------------------------------------------------------------- |
|
250 // |
|
251 void CCompositeCableStateConnected::SubStateEnablingInput( |
|
252 TFSMInterfaceId aInterfaceId , |
|
253 TFSMEventId aEvent ) |
|
254 { |
|
255 FUNC_LOG; |
|
256 switch ( aInterfaceId ) |
|
257 { |
|
258 case EPDEIfAccessoryConnection: |
|
259 { |
|
260 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
261 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
262 { |
|
263 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
264 INFO( "Doing nothing, since already connected" ); |
|
265 } |
|
266 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
267 { |
|
268 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
269 // Store indication to be handled after enable completed |
|
270 iCableDisconnectedWhileEnabling = ETrue; |
|
271 } |
|
272 else |
|
273 { |
|
274 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
275 } |
|
276 break; |
|
277 } |
|
278 case EPDEIfTVOutConfig: |
|
279 { |
|
280 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
281 INFO( "Event: EIfTVOutConfigEventEnabled" ); |
|
282 if ( EIfTVOutConfigEventEnabled == aEvent ) |
|
283 { |
|
284 if ( !iCableDisconnectedWhileEnabling ) |
|
285 { |
|
286 iCRWatchForFlickerFilter->Watch(); |
|
287 iCRWatchForAspectRatio->Watch(); |
|
288 iCRWatchForTvSystem->Watch(); |
|
289 iSubState = ESubStateEnabled; |
|
290 } |
|
291 else |
|
292 { |
|
293 iCableDisconnectedWhileEnabling = EFalse; |
|
294 ClearAvailableTvOutConfig(); |
|
295 iTVOutConfigForComposite.Disable(); |
|
296 iSubState = ESubStateDisabling; |
|
297 } |
|
298 } |
|
299 else if ( EIfTVOutConfigEventEnableFailed == aEvent ) |
|
300 { |
|
301 INFO( "Event: EIfTVOutConfigEventEnableFailed" ); |
|
302 INFO( "Retreating back to <Idle>!" ); |
|
303 iCableDisconnectedWhileEnabling = EFalse; |
|
304 TransitStateIdle(); |
|
305 } |
|
306 else |
|
307 { |
|
308 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
309 } |
|
310 break; |
|
311 } |
|
312 default: |
|
313 { |
|
314 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
315 break; |
|
316 } |
|
317 } |
|
318 return; |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 // SubStateEnabledInput |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 void CCompositeCableStateConnected::SubStateEnabledInput( |
|
326 TFSMInterfaceId aInterfaceId , |
|
327 TFSMEventId aEvent ) |
|
328 { |
|
329 FUNC_LOG; |
|
330 switch ( aInterfaceId ) |
|
331 { |
|
332 case EPDEIfAccessoryConnection: |
|
333 { |
|
334 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
335 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
336 { |
|
337 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
338 INFO( "Doing nothing, since already connected" ); |
|
339 } |
|
340 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
341 { |
|
342 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
343 iCRWatchForFlickerFilter->Cancel(); |
|
344 iCRWatchForAspectRatio->Cancel(); |
|
345 iCRWatchForTvSystem->Cancel(); |
|
346 ClearAvailableTvOutConfig(); |
|
347 iTVOutConfigForComposite.Disable(); |
|
348 iSubState = ESubStateDisabling; |
|
349 } |
|
350 else |
|
351 { |
|
352 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
353 } |
|
354 break; |
|
355 } |
|
356 case EPDEIfCentralRepositoryWatch: |
|
357 { |
|
358 INFO( "Interface: EPDEIfCentralRepositoryWatch" ); |
|
359 if ( EPDEIfCentralRepositoryWatchEventKeyChanged == aEvent ) |
|
360 { |
|
361 INFO( "Event: EPDEIfCentralRepositoryWatchEventKeyChanged" ); |
|
362 iResettingInput = ETrue; |
|
363 Enter(); |
|
364 } |
|
365 else |
|
366 { |
|
367 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
368 } |
|
369 break; |
|
370 } |
|
371 default: |
|
372 { |
|
373 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
374 break; |
|
375 } |
|
376 } |
|
377 return; |
|
378 } |
|
379 |
|
380 // --------------------------------------------------------------------------- |
|
381 // SubStateDisablingInput |
|
382 // --------------------------------------------------------------------------- |
|
383 // |
|
384 void CCompositeCableStateConnected::SubStateDisablingInput( |
|
385 TFSMInterfaceId aInterfaceId , |
|
386 TFSMEventId aEvent ) |
|
387 { |
|
388 FUNC_LOG; |
|
389 switch ( aInterfaceId ) |
|
390 { |
|
391 case EPDEIfAccessoryConnection: |
|
392 { |
|
393 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
394 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
395 { |
|
396 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
397 // Store to be handled after disable has been completed. |
|
398 iCableConnectedWhileDisabling = ETrue; |
|
399 } |
|
400 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
401 { |
|
402 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
403 INFO( "Doing nothing, since already disconnecting" ); |
|
404 } |
|
405 else |
|
406 { |
|
407 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
408 } |
|
409 break; |
|
410 } |
|
411 case EPDEIfTVOutConfig: |
|
412 { |
|
413 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
414 if ( EIfTVOutConfigEventDisabled == aEvent ) |
|
415 { |
|
416 INFO( "Event: EIfTVOutConfigEventDisabled" ); |
|
417 if ( !iCableConnectedWhileDisabling ) |
|
418 { |
|
419 TransitStateIdle(); |
|
420 } |
|
421 else |
|
422 { |
|
423 iCableConnectedWhileDisabling = EFalse; |
|
424 // Back to the beginning of this state |
|
425 Enter(); |
|
426 } |
|
427 } |
|
428 else if ( EIfTVOutConfigEventDisableFailed == aEvent ) |
|
429 { |
|
430 INFO( "Event: EIfTVOutConfigEventDisableFailed" ); |
|
431 iCableConnectedWhileDisabling = EFalse; |
|
432 TransitStateIdle(); |
|
433 } |
|
434 else |
|
435 { |
|
436 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
437 } |
|
438 break; |
|
439 } |
|
440 default: |
|
441 { |
|
442 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
443 break; |
|
444 } |
|
445 } |
|
446 return; |
|
447 } |
|
448 |
|
449 // --------------------------------------------------------------------------- |
|
450 // SubStateResettingDisableInput |
|
451 // --------------------------------------------------------------------------- |
|
452 // |
|
453 void CCompositeCableStateConnected::SubStateResettingDisableInput( |
|
454 TFSMInterfaceId aInterfaceId , |
|
455 TFSMEventId aEvent ) |
|
456 { |
|
457 FUNC_LOG; |
|
458 switch ( aInterfaceId ) |
|
459 { |
|
460 case EPDEIfAccessoryConnection: |
|
461 { |
|
462 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
463 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
464 { |
|
465 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
466 // Store to be handled after disable has been completed. |
|
467 iCableDisconnectedWhileResettingDisable = ETrue; |
|
468 } |
|
469 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
470 { |
|
471 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
472 INFO( "Doing nothing, since already disconnecting" ); |
|
473 } |
|
474 else |
|
475 { |
|
476 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
477 } |
|
478 break; |
|
479 } |
|
480 case EPDEIfTVOutConfig: |
|
481 { |
|
482 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
483 if ( EIfTVOutConfigEventDisabled == aEvent ) |
|
484 { |
|
485 INFO( "Event: EIfTVOutConfigEventDisabled" ); |
|
486 if ( !iCableDisconnectedWhileResettingDisable ) |
|
487 { |
|
488 iSubState = ESubStateEnabling; |
|
489 iTVOutConfigForComposite.Enable(); |
|
490 } |
|
491 else |
|
492 { |
|
493 iCableDisconnectedWhileResettingDisable = EFalse; |
|
494 // Back to the beginning of this state |
|
495 Enter(); |
|
496 } |
|
497 } |
|
498 else if ( EIfTVOutConfigEventDisableFailed == aEvent ) |
|
499 { |
|
500 INFO( "Event: EIfTVOutConfigEventDisableFailed" ); |
|
501 iCableDisconnectedWhileResettingDisable = EFalse; |
|
502 TransitStateIdle(); |
|
503 } |
|
504 else |
|
505 { |
|
506 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
507 } |
|
508 break; |
|
509 } |
|
510 default: |
|
511 { |
|
512 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
513 break; |
|
514 } |
|
515 } |
|
516 } |
|
517 |
|
518 // --------------------------------------------------------------------------- |
|
519 // SubStateStartListenConfigChangesInput |
|
520 // --------------------------------------------------------------------------- |
|
521 // |
|
522 void CCompositeCableStateConnected::SubStateStartListenConfigChangesInput( |
|
523 TFSMInterfaceId aInterfaceId , |
|
524 TFSMEventId aEvent ) |
|
525 { |
|
526 FUNC_LOG; |
|
527 switch ( aInterfaceId ) |
|
528 { |
|
529 case EPDEIfAccessoryConnection: |
|
530 { |
|
531 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
532 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
533 { |
|
534 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
535 INFO( "Doing nothing, since already connected" ); |
|
536 } |
|
537 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
538 { |
|
539 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
540 // Store to be handled after disable has been completed. |
|
541 iCableDisconnectedWhileListening = ETrue; |
|
542 } |
|
543 else |
|
544 { |
|
545 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
546 } |
|
547 break; |
|
548 } |
|
549 case EPDEIfTVOutConfig: |
|
550 { |
|
551 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
552 if ( EIfTVOutConfigEventSettingsChangesListenStarted == aEvent ) |
|
553 { |
|
554 INFO( "Event: EIfTVOutConfigEventSettingsChangesListenStarted" ); |
|
555 if ( !iCableDisconnectedWhileListening ) |
|
556 { |
|
557 if(iResettingInput) |
|
558 { |
|
559 iTVOutConfigForComposite.SetConfig( EFalse ); |
|
560 iSubState = ESubStateResetting; |
|
561 iResettingInput = EFalse; |
|
562 } |
|
563 else |
|
564 { |
|
565 iTVOutConfigForComposite.SetConfig( ETrue ); |
|
566 iSubState = ESubStateSetting; |
|
567 } |
|
568 } |
|
569 else |
|
570 { |
|
571 INFO( "Retreating back to <Idle> since cable was disconnected while not listening!" ); |
|
572 iTVOutConfigForSettingChanges->Cancel(); |
|
573 iCableDisconnectedWhileListening = EFalse; |
|
574 |
|
575 if(iResettingInput) |
|
576 { |
|
577 iCRWatchForFlickerFilter->Cancel(); |
|
578 iCRWatchForAspectRatio->Cancel(); |
|
579 iCRWatchForTvSystem->Cancel(); |
|
580 iResettingInput = EFalse; |
|
581 } |
|
582 |
|
583 TransitStateIdle(); |
|
584 } |
|
585 } |
|
586 else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent ) |
|
587 { |
|
588 INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" ); |
|
589 INFO( "Going to state <Idle> since TV Out Settings Change listening failed!" ); |
|
590 iCableDisconnectedWhileListening = EFalse; |
|
591 |
|
592 if(iResettingInput) |
|
593 { |
|
594 iCRWatchForFlickerFilter->Cancel(); |
|
595 iCRWatchForAspectRatio->Cancel(); |
|
596 iCRWatchForTvSystem->Cancel(); |
|
597 iResettingInput = EFalse; |
|
598 } |
|
599 |
|
600 TransitStateIdle(); |
|
601 } |
|
602 else |
|
603 { |
|
604 INFO_1( "Unknown/unexpected Event Id: %i", aEvent ); |
|
605 } |
|
606 break; |
|
607 } |
|
608 } |
|
609 } |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // SubStateSettingInput |
|
613 // --------------------------------------------------------------------------- |
|
614 // |
|
615 void CCompositeCableStateConnected::SubStateSettingInput( |
|
616 TFSMInterfaceId aInterfaceId , |
|
617 TFSMEventId aEvent ) |
|
618 { |
|
619 FUNC_LOG; |
|
620 switch ( aInterfaceId ) |
|
621 { |
|
622 case EPDEIfAccessoryConnection: |
|
623 { |
|
624 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
625 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
626 { |
|
627 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
628 INFO( "Doing nothing, since already connected" ); |
|
629 } |
|
630 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
631 { |
|
632 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
633 // Store to be handled after disable has been completed. |
|
634 iCableDisconnectedWhileSetting = ETrue; |
|
635 } |
|
636 else |
|
637 { |
|
638 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
639 } |
|
640 break; |
|
641 } |
|
642 case EPDEIfTVOutConfig: |
|
643 { |
|
644 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
645 if ( EIfTVOutConfigEventSettingsChanged == aEvent ) |
|
646 { |
|
647 if ( !iCableDisconnectedWhileSetting ) |
|
648 { |
|
649 if ( iTVOutConfigForComposite.GetTvOutConfig()->Enabled() ) |
|
650 { |
|
651 ClearAvailableTvOutConfig(); |
|
652 iTVOutConfigForComposite.Disable(); |
|
653 iSubState = ESubStateResettingDisable; |
|
654 } |
|
655 else |
|
656 { |
|
657 iTVOutConfigForComposite.Enable(); |
|
658 iSubState = ESubStateEnabling; |
|
659 } |
|
660 } |
|
661 else |
|
662 { |
|
663 ClearAvailableTvOutConfig(); |
|
664 iTVOutConfigForComposite.Disable(); |
|
665 iCableDisconnectedWhileSetting = EFalse; |
|
666 iSubState = ESubStateDisabling; |
|
667 } |
|
668 } |
|
669 else if ( EIfTVOutConfigEventSetFailed == aEvent ) |
|
670 { |
|
671 INFO( "Event: EIfTVOutConfigEventSetFailed" ); |
|
672 iCableDisconnectedWhileSetting = EFalse; |
|
673 iClearConfig = EFalse; |
|
674 TransitStateIdle(); |
|
675 } |
|
676 else if ( EIfTVOutConfigEventSettingsChangesListenFailed == aEvent ) |
|
677 { |
|
678 INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" ); |
|
679 iCableDisconnectedWhileSetting = EFalse; |
|
680 TransitStateIdle(); |
|
681 } |
|
682 else if( EIfTVOutConfigEventSet == aEvent ) |
|
683 { |
|
684 INFO( "Event: EIfTVOutConfigEventSet" ); |
|
685 iClearConfig = ETrue; |
|
686 } |
|
687 else |
|
688 { |
|
689 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
690 } |
|
691 break; |
|
692 } |
|
693 default: |
|
694 { |
|
695 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
696 break; |
|
697 } |
|
698 } |
|
699 return; |
|
700 } |
|
701 |
|
702 // --------------------------------------------------------------------------- |
|
703 // SubStateResettingInput |
|
704 // --------------------------------------------------------------------------- |
|
705 // |
|
706 void CCompositeCableStateConnected::SubStateResettingInput( |
|
707 TFSMInterfaceId aInterfaceId , |
|
708 TFSMEventId aEvent ) |
|
709 { |
|
710 FUNC_LOG; |
|
711 switch ( aInterfaceId ) |
|
712 { |
|
713 case EPDEIfAccessoryConnection: |
|
714 { |
|
715 INFO( "Interface: EPDEIfAccessoryConnection" ); |
|
716 if ( EPDEIfAccessoryConnectionEventCableConnected == aEvent ) |
|
717 { |
|
718 INFO( "Event: EPDEIfAccessoryConnectionEventCableConnected" ); |
|
719 INFO( "Doing nothing, since already connected" ); |
|
720 } |
|
721 else if ( EPDEIfAccessoryConnectionEventCableDisconnected == aEvent ) |
|
722 { |
|
723 INFO( "Event: EPDEIfAccessoryConnectionEventCableDisconnected" ); |
|
724 // Store to be handled after disable has been completed. |
|
725 iCableDisconnectedWhileResetting = ETrue; |
|
726 } |
|
727 else |
|
728 { |
|
729 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
730 } |
|
731 break; |
|
732 } |
|
733 case EPDEIfTVOutConfig: |
|
734 { |
|
735 INFO( "Interface: EPDEIfTVOutConfig" ); |
|
736 |
|
737 if ( EIfTVOutConfigEventSettingsChanged == aEvent ) |
|
738 { |
|
739 if ( !iCableDisconnectedWhileResetting ) |
|
740 { |
|
741 if ( iTVOutConfigForComposite.GetTvOutConfig()->Enabled() ) |
|
742 { |
|
743 iTVOutConfigForComposite.Disable(); |
|
744 iSubState = ESubStateResettingDisable; |
|
745 } |
|
746 else |
|
747 { |
|
748 iTVOutConfigForComposite.Enable(); |
|
749 iSubState = ESubStateEnabling; |
|
750 } |
|
751 } |
|
752 else |
|
753 { |
|
754 iCableDisconnectedWhileResetting = EFalse; |
|
755 ClearAvailableTvOutConfig(); |
|
756 iTVOutConfigForComposite.Disable(); |
|
757 iSubState = ESubStateDisabling; |
|
758 } |
|
759 |
|
760 iCRWatchForFlickerFilter->Cancel(); |
|
761 iCRWatchForAspectRatio->Cancel(); |
|
762 iCRWatchForTvSystem->Cancel(); |
|
763 } |
|
764 else if ( EIfTVOutConfigEventSetFailed == aEvent ) |
|
765 { |
|
766 INFO( "Event: EIfTVOutConfigEventSetFailed" ); |
|
767 iCableDisconnectedWhileResetting = EFalse; |
|
768 iClearConfig = EFalse; |
|
769 // Lets continue with old settings. |
|
770 iSubState = ESubStateEnabled; |
|
771 } |
|
772 else if(EIfTVOutConfigEventSettingsChangesListenFailed == aEvent) |
|
773 { |
|
774 INFO( "Event: EIfTVOutConfigEventSettingsChangesListenFailed" ); |
|
775 iCableDisconnectedWhileResetting = EFalse; |
|
776 // Lets continue with old settings. |
|
777 iSubState = ESubStateEnabled; |
|
778 } |
|
779 else if( EIfTVOutConfigEventSet == aEvent ) |
|
780 { |
|
781 INFO( "Event: EIfTVOutConfigEventSet" ); |
|
782 iClearConfig = ETrue; |
|
783 } |
|
784 else |
|
785 { |
|
786 INFO_1( "Unknown Event Id: %i", aEvent ); |
|
787 } |
|
788 break; |
|
789 } |
|
790 default: |
|
791 { |
|
792 INFO_2( "Event from unexpected interface. if Id, event id: %i", aInterfaceId, aEvent ); |
|
793 break; |
|
794 } |
|
795 } |
|
796 return; |
|
797 } |
|
798 |
|
799 // --------------------------------------------------------------------------- |
|
800 // ClearAvailableConfig |
|
801 // --------------------------------------------------------------------------- |
|
802 // |
|
803 void CCompositeCableStateConnected::ClearAvailableTvOutConfig() |
|
804 { |
|
805 FUNC_LOG; |
|
806 |
|
807 if( iClearConfig ) |
|
808 { |
|
809 if( iTVOutConfigForComposite.GetTvOutConfig() ) |
|
810 { |
|
811 RArray<THdmiDviTimings> HdmiSettingsArray; |
|
812 RArray<TTvSettings> TvSettingsArray; |
|
813 |
|
814 TInt err = iTVOutConfigForComposite.GetTvOutConfig()->SetAvailableTvConfigList( TvSettingsArray, HdmiSettingsArray ); |
|
815 iClearConfig = EFalse; |
|
816 |
|
817 HdmiSettingsArray.Close(); |
|
818 TvSettingsArray.Close(); |
|
819 } |
|
820 } |
|
821 } |
|
822 |
|
823 // --------------------------------------------------------------------------- |
|
824 // TransitStateIdle |
|
825 // --------------------------------------------------------------------------- |
|
826 // |
|
827 void CCompositeCableStateConnected::TransitStateIdle() |
|
828 { |
|
829 FUNC_LOG; |
|
830 |
|
831 ClearAvailableTvOutConfig(); |
|
832 iFSMForState.Transit( ECompositeCableStateIdle ); |
|
833 } |
|
834 |
|
835 // --------------------------------------------------------------------------- |
|
836 // ConstructL |
|
837 // --------------------------------------------------------------------------- |
|
838 // |
|
839 void CCompositeCableStateConnected::ConstructL() |
|
840 { |
|
841 FUNC_LOG; |
|
842 // Create Central Repository Watchers |
|
843 iCRWatchForAspectRatio = CCentralRepositoryWatch::NewL(*this, KCRUidTvoutSettings, KSettingsTvAspectRatio ); |
|
844 iCRWatchForFlickerFilter = CCentralRepositoryWatch::NewL(*this, KCRUidTvoutSettings, KSettingsTvoutFlickerFilter ); |
|
845 iCRWatchForTvSystem = CCentralRepositoryWatch::NewL(*this, KCRUidTvoutSettings, KSettingsTvSystemInfo ); |
|
846 iTVOutConfigForSettingChanges = CTVOutConfigForComposite::NewL(iCompositeCableStatusFSM); |
|
847 iResettingInput = EFalse; |
|
848 } |
|
849 |
|
850 |
|
851 // --------------------------------------------------------------------------- |
|
852 // C++ constructor |
|
853 // --------------------------------------------------------------------------- |
|
854 // |
|
855 CCompositeCableStateConnected::CCompositeCableStateConnected( |
|
856 MFSMForState& aFSMForState, |
|
857 CTVOutConfigForComposite& aTVOutConfigForComposite, |
|
858 CCompositeCableStatusFSM& aCompositeCableStatusFSM) |
|
859 : iFSMForState( aFSMForState ), |
|
860 iTVOutConfigForComposite( aTVOutConfigForComposite ), |
|
861 iCompositeCableStatusFSM( aCompositeCableStatusFSM ) |
|
862 { |
|
863 FUNC_LOG; |
|
864 } |
|
865 |
|
866 |
|
867 // ======== GLOBAL FUNCTIONS ======== |
|
868 |