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 * |
|
16 */ |
|
17 |
|
18 #include <mpsetdivertobs.h> |
|
19 #include <mphcltemergencycallobserver.h> |
|
20 #include <mmlist.h> |
|
21 #include "psetcalldivertingwrapper_p.h" |
|
22 #include "logging.h" |
|
23 |
|
24 /*! |
|
25 PSetCallDivertingWrapperPrivate::PSetCallDivertingWrapperPrivate |
|
26 */ |
|
27 PSetCallDivertingWrapperPrivate::PSetCallDivertingWrapperPrivate( |
|
28 PSetCallDivertingWrapper &owner) : |
|
29 m_Owner(owner) |
|
30 { |
|
31 DPRINT; |
|
32 } |
|
33 |
|
34 /*! |
|
35 PSetCallDivertingWrapperPrivate::~PSetCallDivertingWrapperPrivate |
|
36 */ |
|
37 PSetCallDivertingWrapperPrivate::~PSetCallDivertingWrapperPrivate() |
|
38 { |
|
39 DPRINT; |
|
40 while (!m_DivertingStatusList.empty()) { |
|
41 DPRINT << "m_DivertingStatusList item to be deleted"; |
|
42 delete m_DivertingStatusList.takeFirst(); |
|
43 } |
|
44 } |
|
45 |
|
46 /*! |
|
47 PSetCallDivertingWrapperPrivate::HandleDivertingChangedL |
|
48 */ |
|
49 void PSetCallDivertingWrapperPrivate::HandleDivertingChangedL( |
|
50 const TCallDivertSetting& aSetting, TBool aPlural) |
|
51 { |
|
52 DPRINT << ": IN "; |
|
53 |
|
54 m_callDivertingSetting.iCondition = convert(aSetting.iCondition); |
|
55 m_callDivertingSetting.iStatus = convert(aSetting.iStatus); |
|
56 m_callDivertingSetting.iSetting = |
|
57 static_cast<PsCallDivertingSetting>(aSetting.iSetting); |
|
58 m_callDivertingSetting.iServiceGroup = convert(aSetting.iServiceGroup); |
|
59 m_callDivertingSetting.iNumber = |
|
60 QString::fromUtf16(aSetting.iNumber.Ptr(), aSetting.iNumber.Length()); |
|
61 m_callDivertingSetting.iNoReplyTimer = aSetting.iNoReplyTimer; |
|
62 QT_TRYCATCH_LEAVING( |
|
63 emit m_Owner.handleDivertingChanged(m_callDivertingSetting, aPlural)); |
|
64 |
|
65 DPRINT << ": OUT "; |
|
66 } |
|
67 |
|
68 /*! |
|
69 PSetCallDivertingWrapperPrivate::HandleDivertingStatusL |
|
70 */ |
|
71 void PSetCallDivertingWrapperPrivate::HandleDivertingStatusL( |
|
72 CMobilePhoneCFList& aSetting, TBool aPlural) |
|
73 { |
|
74 DPRINT << ": IN "; |
|
75 |
|
76 // reset list |
|
77 while (!m_DivertingStatusList.empty()) { |
|
78 PSCallDivertingStatus* divertingStatus = |
|
79 m_DivertingStatusList.takeFirst(); |
|
80 DPRINT << ": delete : " << divertingStatus; |
|
81 delete divertingStatus; |
|
82 } |
|
83 TInt entries = aSetting.Enumerate(); |
|
84 TInt numberOfBscs = 0; |
|
85 RMobilePhone::TMobilePhoneCFInfoEntryV1 cfInfo; |
|
86 while (entries > numberOfBscs) { |
|
87 cfInfo = aSetting.GetEntryL(numberOfBscs); |
|
88 PSCallDivertingStatus* divertingStatus = |
|
89 new (ELeave) PSCallDivertingStatus(); |
|
90 divertingStatus->iCondition = convert(cfInfo.iCondition); |
|
91 divertingStatus->iServiceGroup = convert(cfInfo.iServiceGroup); |
|
92 divertingStatus->iStatus = convert(cfInfo.iStatus); |
|
93 divertingStatus->iNumber = QString::fromUtf16( |
|
94 cfInfo.iNumber.iTelNumber.Ptr(), |
|
95 cfInfo.iNumber.iTelNumber.Length()); |
|
96 divertingStatus->iTimeout = cfInfo.iTimeout; |
|
97 m_DivertingStatusList.append(divertingStatus); |
|
98 numberOfBscs++; |
|
99 } |
|
100 |
|
101 QT_TRYCATCH_LEAVING( |
|
102 emit m_Owner.handleDivertingStatus(m_DivertingStatusList,aPlural)); |
|
103 |
|
104 DPRINT << ": OUT"; |
|
105 } |
|
106 |
|
107 /*! |
|
108 PSetCallDivertingWrapperPrivate::HandleDivertingErrorL |
|
109 */ |
|
110 void PSetCallDivertingWrapperPrivate::HandleDivertingErrorL(TInt aReason) |
|
111 { |
|
112 DPRINT << ": IN : aReason" << aReason; |
|
113 |
|
114 QT_TRYCATCH_LEAVING( |
|
115 emit m_Owner.handleDivertingError(aReason)); |
|
116 |
|
117 DPRINT << ": OUT "; |
|
118 } |
|
119 |
|
120 /*! |
|
121 PSetCallDivertingWrapperPrivate::HandleCFRequestingL |
|
122 */ |
|
123 void PSetCallDivertingWrapperPrivate::HandleCFRequestingL(TBool aOngoing, |
|
124 TBool aInterrupted) |
|
125 { |
|
126 DPRINT << ": IN "; |
|
127 |
|
128 QT_TRYCATCH_LEAVING( |
|
129 emit m_Owner.handleCFRequesting(aOngoing, aInterrupted)); |
|
130 |
|
131 DPRINT << ": OUT "; |
|
132 } |
|
133 |
|
134 /*! |
|
135 PSetCallDivertingWrapperPrivate::SetEngineContact |
|
136 */ |
|
137 void PSetCallDivertingWrapperPrivate::SetEngineContact( |
|
138 MPsetCallDiverting* aDivertEngine) |
|
139 { |
|
140 DPRINT << ": IN "; |
|
141 |
|
142 Q_UNUSED(aDivertEngine); |
|
143 |
|
144 DPRINT << ": OUT "; |
|
145 } |
|
146 |
|
147 /*! |
|
148 PSetCallDivertingWrapperPrivate::HandleEmergencyDialL |
|
149 */ |
|
150 void PSetCallDivertingWrapperPrivate::HandleEmergencyDialL(const TInt aStatus) |
|
151 { |
|
152 DPRINT << ": IN "; |
|
153 |
|
154 Q_UNUSED(aStatus); |
|
155 |
|
156 DPRINT << ": OUT "; |
|
157 } |
|
158 |
|
159 /*! |
|
160 PSetCallDivertingWrapperPrivate::RequestComplete |
|
161 */ |
|
162 void PSetCallDivertingWrapperPrivate::RequestComplete() |
|
163 { |
|
164 DPRINT << ": IN "; |
|
165 QT_TRYCATCH_LEAVING( |
|
166 emit m_Owner.requestDone()); |
|
167 DPRINT << ": OUT "; |
|
168 } |
|
169 |
|
170 /*! |
|
171 PSetCallDivertingWrapperPrivate::RequestStatusChanged |
|
172 */ |
|
173 void PSetCallDivertingWrapperPrivate::RequestStatusChanged(TInt aNewStatus) |
|
174 { |
|
175 DPRINT << ": IN "; |
|
176 Q_UNUSED(aNewStatus); |
|
177 DPRINT << ": OUT "; |
|
178 } |
|
179 |
|
180 /*! |
|
181 PSetCallDivertingWrapperPrivate::convert |
|
182 */ |
|
183 PsCallDivertingCondition PSetCallDivertingWrapperPrivate::convert( |
|
184 TCallDivertingCondition type) |
|
185 { |
|
186 switch (type) { |
|
187 case EDivertConditionUnconditional: |
|
188 return DivertConditionUnconditional; |
|
189 case EDivertConditionBusy: |
|
190 return DivertConditionBusy; |
|
191 case EDivertConditionNoReply: |
|
192 return DivertConditionNoReply; |
|
193 case EDivertConditionNotReachable: |
|
194 return DivertConditionNotReachable; |
|
195 case EDivertConditionAllCalls: |
|
196 return DivertConditionAllCalls; |
|
197 case EDivertConditionAllConditionalCases: |
|
198 return DivertConditionAllConditionalCases; |
|
199 default: |
|
200 break; |
|
201 } |
|
202 return DivertConditionUnknown; |
|
203 } |
|
204 |
|
205 /*! |
|
206 PSetCallDivertingWrapperPrivate::convert |
|
207 */ |
|
208 TCallDivertingCondition PSetCallDivertingWrapperPrivate::convert( |
|
209 PsCallDivertingCondition type) |
|
210 { |
|
211 switch (type) { |
|
212 case DivertConditionUnconditional: |
|
213 return EDivertConditionUnconditional; |
|
214 case DivertConditionBusy: |
|
215 return EDivertConditionBusy; |
|
216 case DivertConditionNoReply: |
|
217 return EDivertConditionNoReply; |
|
218 case DivertConditionNotReachable: |
|
219 return EDivertConditionNotReachable; |
|
220 case DivertConditionAllCalls: |
|
221 return EDivertConditionAllCalls; |
|
222 case DivertConditionAllConditionalCases: |
|
223 return EDivertConditionAllConditionalCases; |
|
224 default: |
|
225 break; |
|
226 } |
|
227 return EDivertConditionUnconditional; |
|
228 } |
|
229 |
|
230 /*! |
|
231 PSetCallDivertingWrapperPrivate::convert |
|
232 */ |
|
233 PsCallDivertingCondition PSetCallDivertingWrapperPrivate::convert( |
|
234 RMobilePhone::TMobilePhoneCFCondition type) |
|
235 { |
|
236 switch (type) { |
|
237 case RMobilePhone::ECallForwardingUnconditional: |
|
238 return DivertConditionUnconditional; |
|
239 case RMobilePhone::ECallForwardingBusy: |
|
240 return DivertConditionBusy; |
|
241 case RMobilePhone::ECallForwardingNoReply: |
|
242 return DivertConditionNoReply; |
|
243 case RMobilePhone::ECallForwardingNotReachable: |
|
244 return DivertConditionNotReachable; |
|
245 case RMobilePhone::ECallForwardingAllCases: |
|
246 return DivertConditionAllCalls; |
|
247 case RMobilePhone::ECallForwardingAllConditionalCases: |
|
248 return DivertConditionAllConditionalCases; |
|
249 default: |
|
250 break; |
|
251 } |
|
252 return DivertConditionUnknown; |
|
253 } |
|
254 |
|
255 /*! |
|
256 PSetCallDivertingWrapperPrivate::convert |
|
257 */ |
|
258 PsCallDivertingStatus PSetCallDivertingWrapperPrivate::convert( |
|
259 TDivertingStatus type) |
|
260 { |
|
261 switch (type) { |
|
262 case EDivertingStatusActive: |
|
263 return DivertingStatusActive; |
|
264 case EDivertingStatusInactive: |
|
265 return DivertingStatusInactive; |
|
266 case EDivertingStatusNotRegistered: |
|
267 return DivertingStatusNotRegistered; |
|
268 case EDivertingStatusNotProvisioned: |
|
269 return DivertingStatusNotProvisioned; |
|
270 default: |
|
271 break; |
|
272 } |
|
273 return DivertingStatusUnknown; |
|
274 } |
|
275 |
|
276 /*! |
|
277 PSetCallDivertingWrapperPrivate::convert |
|
278 */ |
|
279 TDivertingStatus PSetCallDivertingWrapperPrivate::convert( |
|
280 PsCallDivertingStatus type) |
|
281 { |
|
282 switch (type) { |
|
283 case DivertingStatusActive: |
|
284 return EDivertingStatusActive; |
|
285 case DivertingStatusInactive: |
|
286 return EDivertingStatusInactive; |
|
287 case DivertingStatusNotRegistered: |
|
288 return EDivertingStatusNotRegistered; |
|
289 case DivertingStatusNotProvisioned: |
|
290 return EDivertingStatusNotProvisioned; |
|
291 default: |
|
292 break; |
|
293 } |
|
294 return EDivertingStatusUnknown; |
|
295 } |
|
296 |
|
297 /*! |
|
298 PSetCallDivertingWrapperPrivate::convert |
|
299 */ |
|
300 PsCallDivertingStatus PSetCallDivertingWrapperPrivate::convert( |
|
301 RMobilePhone::TMobilePhoneCFStatus type) |
|
302 { |
|
303 switch (type) { |
|
304 case RMobilePhone::ECallForwardingStatusActive: |
|
305 return DivertingStatusActive; |
|
306 case RMobilePhone::ECallForwardingStatusNotActive: |
|
307 return DivertingStatusInactive; |
|
308 case RMobilePhone::ECallForwardingStatusNotRegistered: |
|
309 return DivertingStatusNotRegistered; |
|
310 case RMobilePhone::ECallForwardingStatusNotProvisioned: |
|
311 return DivertingStatusNotProvisioned; |
|
312 default: |
|
313 break; |
|
314 } |
|
315 return DivertingStatusUnknown; |
|
316 } |
|
317 |
|
318 /*! |
|
319 PSetCallDivertingWrapperPrivate::convert |
|
320 */ |
|
321 PsServiceGroup PSetCallDivertingWrapperPrivate::convert(TServiceGroup type) |
|
322 { |
|
323 PsServiceGroup ret(ServiceGroupAllTeleservices); |
|
324 ret &= type; |
|
325 return ret; |
|
326 } |
|
327 |
|
328 /*! |
|
329 PSetCallDivertingWrapperPrivate::convert |
|
330 */ |
|
331 TServiceGroup PSetCallDivertingWrapperPrivate::convert(PsServiceGroup type) |
|
332 { |
|
333 const int tmp = type; |
|
334 TServiceGroup ret = (TServiceGroup)tmp; |
|
335 return ret; |
|
336 } |
|
337 |
|
338 /*! |
|
339 PSetCallDivertingWrapperPrivate::convert |
|
340 */ |
|
341 TDivertingSetting PSetCallDivertingWrapperPrivate::convert( |
|
342 PsCallDivertingSetting type) |
|
343 { |
|
344 switch(type){ |
|
345 case ActivateDiverting: |
|
346 return EActivateDiverting; |
|
347 case CancelDiverting: |
|
348 return ECancelDiverting; |
|
349 case RegisterDiverting: |
|
350 return ERegisterDiverting; |
|
351 case EraseDiverting: |
|
352 return EEraseDiverting; |
|
353 case CheckStatus: |
|
354 default: |
|
355 return ECheckStatus; |
|
356 } |
|
357 } |
|
358 |
|
359 /*! |
|
360 PSetCallDivertingWrapperPrivate::convert |
|
361 */ |
|
362 PsServiceGroup PSetCallDivertingWrapperPrivate::convert( |
|
363 RMobilePhone::TMobileService service ) |
|
364 { |
|
365 PsServiceGroup ret(0); |
|
366 switch (service) { |
|
367 case RMobilePhone::EAllServices: |
|
368 ret |= ServiceGroupData; |
|
369 ret |= ServiceGroupVoice; |
|
370 ret |= ServiceGroupFax; |
|
371 break; |
|
372 case RMobilePhone::EAllTele: |
|
373 case RMobilePhone::EAllTeleExcSms: |
|
374 ret |= ServiceGroupVoice; |
|
375 ret |= ServiceGroupFax; |
|
376 break; |
|
377 case RMobilePhone::ECircuitDataService: |
|
378 case RMobilePhone::EPacketDataService: |
|
379 case RMobilePhone::EAllDataExSms: |
|
380 case RMobilePhone::ESyncData: |
|
381 case RMobilePhone::EAsyncData: |
|
382 case RMobilePhone::EPacketData: |
|
383 case RMobilePhone::EAllGprsBearer: |
|
384 case RMobilePhone::EAllPlmnBearer: |
|
385 case RMobilePhone::EPlmnBearerServ1: |
|
386 case RMobilePhone::EPlmnBearerServ2: |
|
387 case RMobilePhone::EPlmnBearerServ3: |
|
388 case RMobilePhone::EPlmnBearerServ4: |
|
389 case RMobilePhone::EPlmnBearerServ5: |
|
390 case RMobilePhone::EPlmnBearerServ6: |
|
391 case RMobilePhone::EPlmnBearerServ7: |
|
392 case RMobilePhone::EPlmnBearerServ8: |
|
393 case RMobilePhone::EPlmnBearerServ9: |
|
394 case RMobilePhone::EPlmnBearerServA: |
|
395 case RMobilePhone::EPlmnBearerServB: |
|
396 case RMobilePhone::EPlmnBearerServC: |
|
397 case RMobilePhone::EPlmnBearerServD: |
|
398 case RMobilePhone::EPlmnBearerServE: |
|
399 case RMobilePhone::EPlmnBearerServF: |
|
400 case RMobilePhone::EAllBearer: |
|
401 case RMobilePhone::EPadAccess: |
|
402 case RMobilePhone::EAllAsync: |
|
403 case RMobilePhone::EAllSync: |
|
404 ret |= ServiceGroupData; |
|
405 break; |
|
406 case RMobilePhone::ETelephony: |
|
407 case RMobilePhone::EVoiceService: |
|
408 case RMobilePhone::EAuxVoiceService: |
|
409 case RMobilePhone::EAllPlmnTele: |
|
410 case RMobilePhone::EPlmnTele1: |
|
411 case RMobilePhone::EPlmnTele2: |
|
412 case RMobilePhone::EPlmnTele3: |
|
413 case RMobilePhone::EPlmnTele4: |
|
414 case RMobilePhone::EPlmnTele5: |
|
415 case RMobilePhone::EPlmnTele6: |
|
416 case RMobilePhone::EPlmnTele7: |
|
417 case RMobilePhone::EPlmnTele8: |
|
418 case RMobilePhone::EPlmnTele9: |
|
419 case RMobilePhone::EPlmnTeleA: |
|
420 case RMobilePhone::EPlmnTeleB: |
|
421 case RMobilePhone::EPlmnTeleC: |
|
422 case RMobilePhone::EPlmnTeleD: |
|
423 case RMobilePhone::EPlmnTeleE: |
|
424 case RMobilePhone::EPlmnTeleF: |
|
425 case RMobilePhone::EAltTele: |
|
426 ret |= ServiceGroupVoice; |
|
427 break; |
|
428 case RMobilePhone::EAllDataTele: |
|
429 case RMobilePhone::EFaxService: |
|
430 ret |= ServiceGroupFax; |
|
431 break; |
|
432 case RMobilePhone::EVoiceGroupCall: |
|
433 case RMobilePhone::EVoiceBroadcast: |
|
434 case RMobilePhone::EShortMessageService: |
|
435 case RMobilePhone::EServiceUnspecified: |
|
436 default: |
|
437 // Not supported, skip |
|
438 break; |
|
439 } |
|
440 return ret; |
|
441 } |
|
442 |
|
443 TVmbxType PSetCallDivertingWrapperPrivate::convert( |
|
444 PsService aService) |
|
445 { |
|
446 TVmbxType ret = EVmbxNone; |
|
447 switch (aService) { |
|
448 case ServiceGroupVoice: |
|
449 ret = EVmbxVoice; |
|
450 break; |
|
451 case ServiceGroupData: |
|
452 ret = EVmbxVideo; |
|
453 break; |
|
454 case ServiceGroupAllTeleservices: |
|
455 case ServiceGroupFax: |
|
456 case ServiceGroupUnknown: |
|
457 default: |
|
458 ret = EVmbxNone; |
|
459 break; |
|
460 } |
|
461 return ret; |
|
462 } |
|
463 |
|
464 // end of file |
|