|
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: Incall indicator. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <ctsydomainpskeys.h> |
|
21 #include <AknIncallBubbleNotify.h> |
|
22 #include <avkon.hrh> |
|
23 |
|
24 #include "cphoneincallindicator.h" |
|
25 #include "cphonerecoverysystem.h" |
|
26 #include "tphonecmdparamboolean.h" |
|
27 #include "tphonecmdparamincallindicatordata.h" |
|
28 #include "phonelogger.h" |
|
29 #include "phonerssbase.h" |
|
30 #include "cphonepubsubproxy.h" |
|
31 |
|
32 // CONSTANTS |
|
33 |
|
34 // ============================ MEMBER FUNCTIONS =============================== |
|
35 |
|
36 // --------------------------------------------------------- |
|
37 // CPhoneIncallIndicator::CPhoneIncallIndicator |
|
38 // --------------------------------------------------------- |
|
39 // |
|
40 CPhoneIncallIndicator::CPhoneIncallIndicator() |
|
41 { |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------- |
|
45 // CPhoneIncallIndicator::~CPhoneIncallIndicator |
|
46 // --------------------------------------------------------- |
|
47 // |
|
48 CPhoneIncallIndicator::~CPhoneIncallIndicator() |
|
49 { |
|
50 CPhoneRecoverySystem::Remove( iUpdateRecoveryId ); |
|
51 |
|
52 delete iBubble; |
|
53 delete iUpdater; |
|
54 } |
|
55 |
|
56 // --------------------------------------------------------- |
|
57 // CPhoneIncallIndicator::NewL |
|
58 // --------------------------------------------------------- |
|
59 // |
|
60 CPhoneIncallIndicator* CPhoneIncallIndicator::NewL() |
|
61 { |
|
62 CPhoneIncallIndicator* self = new ( ELeave ) CPhoneIncallIndicator(); |
|
63 |
|
64 CleanupStack::PushL( self ); |
|
65 self->ConstructL(); |
|
66 CleanupStack::Pop( self ); |
|
67 |
|
68 return self; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CPhoneIncallIndicator::ConstructL |
|
73 // --------------------------------------------------------- |
|
74 // |
|
75 void CPhoneIncallIndicator::ConstructL() |
|
76 { |
|
77 iBubble = CAknIncallBubble::NewL(); |
|
78 iUpdater = CIdle::NewL( CActive::EPriorityHigh ); |
|
79 iUpdater->Start( TCallBack( DoUpdate, this ) ); |
|
80 |
|
81 iUpdateRecoveryId = CPhoneRecoverySystem::Instance()->AddL( |
|
82 TCallBack( DoRecoverUpdateL, this ), |
|
83 CTeleRecoverySystem::EPhonePriorityStandard, |
|
84 CTeleRecoverySystem::EPhoneStateIdle ); |
|
85 } |
|
86 |
|
87 // --------------------------------------------------------- |
|
88 // CPhoneIncallIndicator::Update |
|
89 // |
|
90 // Shows the incall indicator according to current call state. |
|
91 // --------------------------------------------------------- |
|
92 // |
|
93 void CPhoneIncallIndicator::Update( |
|
94 TPhoneCommandParam* aCommandParam ) |
|
95 { |
|
96 TPhoneCmdParamIncallIndicatorData* incallIndicatorParam = |
|
97 static_cast<TPhoneCmdParamIncallIndicatorData*>( aCommandParam ); |
|
98 |
|
99 iCallState = incallIndicatorParam->CallState(); |
|
100 iMode = incallIndicatorParam->Mode(); |
|
101 iMuted = incallIndicatorParam->Mute(); |
|
102 iCipheringOff = !incallIndicatorParam->Ciphering(); |
|
103 iCipheringIndicatorAllowed = |
|
104 incallIndicatorParam->CipheringIndicatorAllowed(); |
|
105 iEmergency = incallIndicatorParam->Emergency(); |
|
106 iLine2 = incallIndicatorParam->Line2(); |
|
107 iVisible = incallIndicatorParam->LittleBubbleVisible(); |
|
108 |
|
109 Update(); |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------- |
|
113 // CPhoneIncallIndicator::HandleMuteChange |
|
114 // --------------------------------------------------------- |
|
115 // |
|
116 void CPhoneIncallIndicator::HandleMuteChange( |
|
117 TPhoneCommandParam* aCommandParam ) |
|
118 { |
|
119 TPhoneCmdParamBoolean* booleanParam = |
|
120 static_cast<TPhoneCmdParamBoolean*>( aCommandParam ); |
|
121 |
|
122 iMuted = booleanParam->Boolean(); |
|
123 |
|
124 Update(); |
|
125 } |
|
126 |
|
127 // --------------------------------------------------------- |
|
128 // CPhoneIncallIndicator::HandleCipheringChange |
|
129 // --------------------------------------------------------- |
|
130 // |
|
131 void CPhoneIncallIndicator::HandleCipheringChange( |
|
132 TPhoneCommandParam* aCommandParam ) |
|
133 { |
|
134 TPhoneCmdParamBoolean* booleanParam = |
|
135 static_cast<TPhoneCmdParamBoolean*>( aCommandParam ); |
|
136 |
|
137 iCipheringOff = booleanParam->Boolean(); |
|
138 |
|
139 Update(); |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------- |
|
143 // CPhoneIncallIndicator::Update |
|
144 // |
|
145 // Updates incall indicator according to current call state. |
|
146 // --------------------------------------------------------- |
|
147 // |
|
148 void CPhoneIncallIndicator::Update() |
|
149 { |
|
150 TInt state = KPhoneIncallIndicatorDefaultValue; |
|
151 TBool sync = ETrue; |
|
152 |
|
153 // Put base value appropriate to the state. |
|
154 switch ( iCallState ) |
|
155 { |
|
156 case EPSCTsyCallStateDialling: |
|
157 state = EAknStatusBubbleActive; |
|
158 break; |
|
159 |
|
160 case EPSCTsyCallStateRinging: |
|
161 case EPSCTsyCallStateAlerting: |
|
162 case EPSCTsyCallStateAnswering: |
|
163 state = EAknStatusBubbleAlerting; |
|
164 sync = EFalse; |
|
165 break; |
|
166 |
|
167 case EPSCTsyCallStateConnected: |
|
168 state = EAknStatusBubbleActive; |
|
169 if ( iEmergency ) |
|
170 { |
|
171 state |= EAknStatusBubbleEmergency; |
|
172 } |
|
173 break; |
|
174 |
|
175 case EPSCTsyCallStateHold: // Held |
|
176 state = EAknStatusBubbleOnHold; |
|
177 break; |
|
178 |
|
179 case EPSCTsyCallStateDisconnecting: |
|
180 state = EAknStatusBubbleDisconnected; |
|
181 break; |
|
182 |
|
183 case EPSCTsyCallStateUninitialized: |
|
184 case EPSCTsyCallStateNone: |
|
185 iVisible = EFalse; |
|
186 break; |
|
187 |
|
188 default: |
|
189 break; |
|
190 } |
|
191 |
|
192 // Put call mode flag if necessary. |
|
193 switch ( iMode ) |
|
194 { |
|
195 case EPSCTsyCallTypeFax: |
|
196 state |= EAknStatusBubbleFax; |
|
197 break; |
|
198 |
|
199 case EPSCTsyCallTypeData: |
|
200 case EPSCTsyCallTypeHSCSD: |
|
201 state |= EAknStatusBubbleData; |
|
202 break; |
|
203 case EPSCTsyCallTypeH324Multimedia: |
|
204 state |= EAknStatusBubbleVideo; |
|
205 break; |
|
206 case EPSCTsyCallTypeVoIP: |
|
207 state |= EAknStatusBubbleVoIP; |
|
208 break; |
|
209 case EPSCTsyCallTypeNone: |
|
210 case EPSCTsyCallTypeCSVoice: |
|
211 default: |
|
212 break; |
|
213 } |
|
214 |
|
215 if ( iMuted ) |
|
216 { |
|
217 state |= EAknStatusBubbleMuted; |
|
218 } |
|
219 |
|
220 if ( iCipheringOff && iCipheringIndicatorAllowed ) |
|
221 { |
|
222 state |= EAknStatusBubbleNoCiphering; |
|
223 } |
|
224 |
|
225 if ( iLine2 ) |
|
226 { |
|
227 state |= EAknStatusBubbleLine2; |
|
228 } |
|
229 |
|
230 if ( iVisible ) |
|
231 { |
|
232 state |= EAknStatusBubbleVisible; |
|
233 } |
|
234 |
|
235 SetState( state, sync ); |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------- |
|
239 // CPhoneIncallIndicator::SetState |
|
240 // |
|
241 // Modify only if needed. |
|
242 // --------------------------------------------------------- |
|
243 // |
|
244 void CPhoneIncallIndicator::SetState( |
|
245 TInt aState, |
|
246 TBool aSync ) |
|
247 { |
|
248 if ( !aSync ) |
|
249 { |
|
250 if ( aState != iState ) |
|
251 { |
|
252 iState = aState; |
|
253 |
|
254 if ( !iUpdater->IsActive() ) |
|
255 { |
|
256 iUpdater->Start( TCallBack( DoUpdate, this ) ); |
|
257 } |
|
258 } |
|
259 } |
|
260 else |
|
261 { |
|
262 if ( aState != iState || iUpdater->IsActive() ) |
|
263 { |
|
264 iState = aState; |
|
265 UpdateWithRecovery(); |
|
266 iUpdater->Cancel(); |
|
267 } |
|
268 } |
|
269 } |
|
270 |
|
271 // --------------------------------------------------------- |
|
272 // CPhoneIncallIndicator::UpdateWithRecovery |
|
273 // --------------------------------------------------------- |
|
274 // |
|
275 void CPhoneIncallIndicator::UpdateWithRecovery() |
|
276 { |
|
277 CPhoneRecoverySystem::Instance()->RecoverNow( |
|
278 iUpdateRecoveryId, |
|
279 CTeleRecoverySystem::EPhonePriorityStandard ); |
|
280 } |
|
281 |
|
282 // --------------------------------------------------------- |
|
283 // CPhoneIncallIndicator::DoRecoverUpdateL |
|
284 // |
|
285 // Callback function. |
|
286 // --------------------------------------------------------- |
|
287 // |
|
288 TInt CPhoneIncallIndicator::DoRecoverUpdateL( TAny* aAny ) |
|
289 { |
|
290 CPhoneIncallIndicator* ind = static_cast<CPhoneIncallIndicator*>( aAny ); |
|
291 |
|
292 ind->iBubble->SetIncallBubbleFlagsL( ind->iState ); |
|
293 |
|
294 return KErrNone; |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------- |
|
298 // CPhoneIncallIndicator::DoUpdate |
|
299 // |
|
300 // Callback function. |
|
301 // --------------------------------------------------------- |
|
302 // |
|
303 TInt CPhoneIncallIndicator::DoUpdate( TAny* aAny ) |
|
304 { |
|
305 static_cast<CPhoneIncallIndicator*>( aAny )->UpdateWithRecovery(); |
|
306 |
|
307 return KErrNone; |
|
308 } |
|
309 |
|
310 // End of File |
|
311 |