|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Idle state |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CVtEngStateIdle.h" |
|
21 #include <cvtlogger.h> |
|
22 |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CVtEngStateIdle::CVtEngStateIdle |
|
28 // C++ constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 CVtEngStateIdle::CVtEngStateIdle( |
|
33 CVtEngStateManager& aStateManager, |
|
34 CVtEngEventManager& aEventManager ) |
|
35 : CVtEngStateBase( aStateManager, aEventManager ) |
|
36 { |
|
37 } |
|
38 |
|
39 // Destructor |
|
40 CVtEngStateIdle::~CVtEngStateIdle() |
|
41 { |
|
42 __VTPRINT( DEBUG_DESTRUCT, "~Stateidl") |
|
43 } |
|
44 |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // CVtEngStateIdle::UpdateL |
|
48 // Updates state |
|
49 // (other items were commented in a header). |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 void CVtEngStateIdle::UpdateL() |
|
53 { |
|
54 __VTPRINTENTER( "StateIdle.Update") |
|
55 |
|
56 const MVtCtlCallControl::TVtCtlState state = SessionHandler().RealState(); |
|
57 CVtEngStateBase* newState = NULL; |
|
58 |
|
59 if( iStateManager.PreviousSessionState() == MVtEngSessionInfo::EUnknown ) |
|
60 { |
|
61 switch ( state ) |
|
62 { |
|
63 case MVtCtlCallControl::EInitializing: |
|
64 newState = NewStateL( MVtEngSessionInfo::EInitializing ); |
|
65 break; |
|
66 case MVtCtlCallControl::EAlerting: |
|
67 newState = NewStateL( MVtEngSessionInfo::ERemoteAlerting ); |
|
68 break; |
|
69 case MVtCtlCallControl::ERinging: |
|
70 newState = NewStateL( MVtEngSessionInfo::EReceiving ); |
|
71 break; |
|
72 case MVtCtlCallControl::EConnected: |
|
73 newState = NegotiatingOrConnectedStateL(); |
|
74 break; |
|
75 default: |
|
76 break; |
|
77 } |
|
78 if ( newState ) |
|
79 { |
|
80 CVtEngUtility* utils = CVtEngUtility::EngineUtils(); |
|
81 |
|
82 // Notify UI about initial autolock state. UI must have this |
|
83 // information early enough to deduce if it is allowed to |
|
84 // go to foreground. |
|
85 utils->NotifyLockState(); |
|
86 utils->StartSATListenL(); |
|
87 newState->OpenL( this ); |
|
88 } |
|
89 } |
|
90 else |
|
91 { |
|
92 __VTPRINT( DEBUG_GEN, "StateIdle.Update wrong previous state, ignoring") |
|
93 } |
|
94 __VTPRINTEXIT( "StateIdle.Update") |
|
95 } |
|
96 |
|
97 // ----------------------------------------------------------------------------- |
|
98 // CVtEngStateIdle::OpenL |
|
99 // State transition to idle. |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 void CVtEngStateIdle::DoOpenL() |
|
104 { |
|
105 __VTPRINTENTER( "StateIdle.Open") |
|
106 // Reset settings |
|
107 CVtEngSettings& settings = CVtEngUtility::Settings(); |
|
108 settings.ResetAll(); |
|
109 |
|
110 NotifyStateChange( MVtEngSessionInfo::EIdle ); |
|
111 __VTPRINTEXIT( "StateIdle.Open") |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CVtEngStateIdle::ValidateCommand |
|
116 // Returns if a command is valid in idle state. |
|
117 // |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 TBool CVtEngStateIdle::ValidateCommand( |
|
121 const TVtEngCommandId aCommandId ) |
|
122 { |
|
123 __VTPRINT( DEBUG_DETAIL | DEBUG_GEN, "StateIdle.Validate") |
|
124 TBool okToPerform( EFalse ); |
|
125 switch ( aCommandId ) |
|
126 { |
|
127 case KVtEngPrepareViewFinder: |
|
128 case KVtEngPrepareRemoteRenderDSA: |
|
129 case KVtEngPrepareRemoteRenderDP: |
|
130 case KVtEngPrepareRemoteRender: |
|
131 case KVtEngPrepareRemoteRenderNGA: |
|
132 okToPerform = ETrue; |
|
133 break; |
|
134 default: |
|
135 okToPerform = CVtEngStateBase::ValidateCommand( aCommandId ); |
|
136 break; |
|
137 } |
|
138 return okToPerform; |
|
139 } |
|
140 |
|
141 // ----------------------------------------------------------------------------- |
|
142 // CVtEngStateIdle::State |
|
143 // Returns session state. |
|
144 // |
|
145 // ----------------------------------------------------------------------------- |
|
146 // |
|
147 MVtEngSessionInfo::TSessionState CVtEngStateIdle::State() const |
|
148 { |
|
149 return MVtEngSessionInfo::EIdle; |
|
150 } |
|
151 |
|
152 |
|
153 // End of File |