|
1 /* |
|
2 * Copyright (c) 2002-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: Holds transiently and stores one VoIP settings item. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <e32std.h> |
|
21 #include <WPVoIPAdapter.rsg> |
|
22 #include <charconv.h> |
|
23 #include <in_sock.h> // TInetAddr, TSockAddr |
|
24 #include <crcseprofileentry.h> |
|
25 #include <crcseprofileregistry.h> |
|
26 #include <crcseaudiocodecentry.h> |
|
27 #include <crcseaudiocodecregistry.h> |
|
28 #include <CWPCharacteristic.h> |
|
29 #include <sysutil.h> // For GetWlanMacAddressL. |
|
30 #include <wlaninternalpskeys.h> // For GetWlanMacAddressL. |
|
31 #include <centralrepository.h> |
|
32 #include <settingsinternalcrkeys.h> |
|
33 #include <coemain.h> // For GetPhoneModelL. |
|
34 #include <WPAdapterUtil.h> |
|
35 #include <sipmanagedprofile.h> |
|
36 #include <sipprofileregistryobserver.h> |
|
37 #include <sipmanagedprofileregistry.h> |
|
38 #include <spsettings.h> // for SPS |
|
39 #include <spentry.h> // for SPS |
|
40 #include <spproperty.h> // for SPS |
|
41 #include <spdefinitions.h> |
|
42 #include <cmmanagerext.h> |
|
43 #include <cmdestinationext.h> |
|
44 #include <cmconnectionmethodext.h> |
|
45 #include <cmconnectionmethoddef.h> |
|
46 #include <cmpluginwlandef.h> // For WLAN plugin UID, i.e. bearer type. |
|
47 #include <versit.h> |
|
48 #include <cvimpstsettingsstore.h> // For IM tone path |
|
49 #include <pathinfo.h> // For getting phone rom root path. |
|
50 |
|
51 #include "CWPVoIPItem.h" |
|
52 #include "CSIPProfileRegistryObserver.h" |
|
53 #include "cipappphoneutils.h" // For GetPhoneModelL, GetTerminalTypeL |
|
54 #include "cipapputilsaddressresolver.h" // For GetWlanMacAddressL |
|
55 |
|
56 // LOCAL CONSTANTS |
|
57 static const TInt32 KNotSaved( -1 ); |
|
58 static const TInt KMaxCharsInTUint32( 10 ); |
|
59 const TInt32 KCCHPresenceSubServicePlugId = 0x1027545A; |
|
60 _LIT8( KUserAgent, "User-Agent" ); |
|
61 _LIT8( KColonMark, ":" ); |
|
62 // Default IM message tone |
|
63 _LIT( KDefaultTone, "Message 2.aac" ); |
|
64 _LIT8( KSpaceMark, " " ); |
|
65 _LIT( KVoIPAdapterName, "WPVoIPAdapter"); |
|
66 _LIT( KOpenParenthesis, "(" ); |
|
67 _LIT( KClosedParenthesis, ")" ); |
|
68 const TInt KTwo( 2 ); |
|
69 const TInt KVmbxResubscribeDefault = 600; |
|
70 |
|
71 // IM related constants. |
|
72 const TUint32 KIMSubServicePluginId = 0x1027545A; // KSIPConnectivityPluginImplUid |
|
73 const TUint32 KIMLaunchUid = 0x200255D0; |
|
74 const TInt KIMSettingsId = 1; |
|
75 |
|
76 // Following lines are for enabling debug prints. |
|
77 #ifdef _DEBUG |
|
78 #define DBG_PRINT(p) RDebug::Print(_L(p)) |
|
79 #define DBG_PRINT2(p,a) RDebug::Print(_L(p),a) |
|
80 #else |
|
81 #define DBG_PRINT(p) |
|
82 #define DBG_PRINT2(p,a) |
|
83 #endif // _DEBUG |
|
84 |
|
85 // ================= MEMBER FUNCTIONS ======================= |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CWPVoIPItem::CWPVoIPItem |
|
89 // |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 CWPVoIPItem::CWPVoIPItem() |
|
93 { |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CWPVoIPItem::NewL |
|
98 // |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 CWPVoIPItem* CWPVoIPItem::NewL() |
|
102 { |
|
103 DBG_PRINT( "CWPVoIPItem::NewL - begin" ); |
|
104 CWPVoIPItem* self = new (ELeave) CWPVoIPItem; |
|
105 CleanupStack::PushL( self ); |
|
106 self->ConstructL(); |
|
107 CleanupStack::Pop( self ); |
|
108 DBG_PRINT( "CWPVoIPItem::NewL - end" ); |
|
109 return self; |
|
110 } |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // CWPVoIPItem::ConstructL() |
|
114 // |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void CWPVoIPItem::ConstructL() |
|
118 { |
|
119 // Initialization with empty string or KNotSaved or -1 or if default |
|
120 // value exists with default values. |
|
121 iItemId = TUint( KNotSaved ); |
|
122 TFileName fileName; |
|
123 Dll::FileName(fileName); |
|
124 |
|
125 // Default provider value read from the resource file. |
|
126 iProviderId = WPAdapterUtil::ReadHBufCL( fileName, |
|
127 KVoIPAdapterName, R_QTN_SM_PROVIDER_VOIP ); |
|
128 // Default name value read from the resource file. |
|
129 iName = WPAdapterUtil::ReadHBufCL( fileName, KVoIPAdapterName, |
|
130 R_QTN_SM_HEAD_VOIP ); |
|
131 |
|
132 iStartMediaPort = KNotSet; |
|
133 iEndMediaPort = KNotSet; |
|
134 iMediaQoS = KNotSet; |
|
135 iDTMFInBand = KNotSet; |
|
136 iDTMFOutBand = KNotSet; |
|
137 iSavedProfileId = HBufC8::NewL( 0 ); |
|
138 iSecureCallPref = KNotSet; |
|
139 iRTCP = KNotSet; |
|
140 iUAHTerminalType = KNotSet; |
|
141 iUAHWLANMAC = KNotSet; |
|
142 iUAHString = HBufC::NewL( 0 ); |
|
143 iProfileLockedToIAP = KNotSet; |
|
144 iVoIPPluginUid = KNotSet; |
|
145 iAllowVoIPOverWCDMA = KNotSet; |
|
146 iVoIPDigits = KNotSet; |
|
147 iDomainPartIgnoreRule = KNotSet; |
|
148 iAddUserPhoneToAllNumbers = KNotSet; |
|
149 iSIPConnTestAddress = HBufC::NewL( 0 ); |
|
150 iServiceProviderBookmark = HBufC::NewL( 0 ); |
|
151 iSIPMinSE = KNotSet; |
|
152 iSIPSessionExpires = KNotSet; |
|
153 iIPVoiceMailBoxURI = HBufC::NewL( 0 ); |
|
154 iVmbxListenAddress = HBufC::NewL( 0 ); |
|
155 iAutoAcceptBuddyRequest = KNotSet; |
|
156 iBrandingDataAddress = HBufC::NewL( 0 ); |
|
157 iToNapId = HBufC8::NewL( 0 ); |
|
158 iVoipUrisToAppRef = HBufC8::NewL( 0 ); |
|
159 iUsedNatProtocol = KNotSet; |
|
160 iAppRef = HBufC8::NewL( 0 ); |
|
161 iReSubscribeInterval = KVmbxResubscribeDefault; |
|
162 } |
|
163 |
|
164 // --------------------------------------------------------------------------- |
|
165 // CWPVoIPItem::~CWPVoIPItem |
|
166 // |
|
167 // --------------------------------------------------------------------------- |
|
168 // |
|
169 CWPVoIPItem::~CWPVoIPItem() |
|
170 { |
|
171 DBG_PRINT( "CWPVoIPItem::~CWPVoIPItem - begin" ); |
|
172 delete iProviderId; |
|
173 delete iName; |
|
174 iToAppRefs.ResetAndDestroy(); |
|
175 iToAppRefs.Close(); |
|
176 delete iSavedProfileId; |
|
177 delete iUAHString; |
|
178 delete iSIPConnTestAddress; |
|
179 delete iServiceProviderBookmark; |
|
180 delete iIPVoiceMailBoxURI; |
|
181 delete iVmbxListenAddress; |
|
182 delete iBrandingDataAddress; |
|
183 delete iToNapId; |
|
184 delete iVoipUrisToAppRef; |
|
185 delete iAppRef; |
|
186 |
|
187 iCodecs.ResetAndDestroy(); |
|
188 iCodecs.Close(); |
|
189 |
|
190 DBG_PRINT( "CWPVoIPItem::~CWPVoIPItem - end" ); |
|
191 //lint -e{1740} iNapDef is not owned |
|
192 } |
|
193 |
|
194 // --------------------------------------------------------------------------- |
|
195 // CWPVoIPItem::SetAppRefL |
|
196 // |
|
197 // --------------------------------------------------------------------------- |
|
198 // |
|
199 void CWPVoIPItem::SetAppRefL( const TDesC8& aAppRef ) |
|
200 { |
|
201 delete iAppRef; |
|
202 iAppRef = NULL; |
|
203 iAppRef = aAppRef.AllocL(); |
|
204 } |
|
205 |
|
206 // --------------------------------------------------------------------------- |
|
207 // CWPVoIPItem::SetProviderIdL |
|
208 // |
|
209 // --------------------------------------------------------------------------- |
|
210 // |
|
211 void CWPVoIPItem::SetProviderIdL( const TDesC& aPROVIDERID ) |
|
212 { |
|
213 delete iProviderId; |
|
214 iProviderId = NULL; |
|
215 iProviderId = aPROVIDERID.AllocL(); |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CWPVoIPItem::SetNameL |
|
220 // |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 void CWPVoIPItem::SetNameL( const TDesC& aNAME ) |
|
224 { |
|
225 delete iName; |
|
226 iName = NULL; |
|
227 iName = aNAME.AllocL(); |
|
228 } |
|
229 |
|
230 // --------------------------------------------------------------------------- |
|
231 // CWPVoIPItem::AddToAppRefL |
|
232 // |
|
233 // --------------------------------------------------------------------------- |
|
234 // |
|
235 void CWPVoIPItem::AddToAppRefL( const TDesC8& aToAppRef ) |
|
236 { |
|
237 // Dependencies to SIP, SCCP, NATFW and SNAP settings. |
|
238 |
|
239 // Must put string on cleanup stack in case memory alloc fails in AppendL. |
|
240 HBufC8* tmp = aToAppRef.AllocLC(); |
|
241 iToAppRefs.AppendL( tmp ); |
|
242 CleanupStack::Pop( tmp ); |
|
243 } |
|
244 |
|
245 // --------------------------------------------------------------------------- |
|
246 // CWPVoIPItem::SetStartMediaPort |
|
247 // |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 void CWPVoIPItem::SetStartMediaPort( TInt aStartMediaPort ) |
|
251 { |
|
252 iStartMediaPort = aStartMediaPort; |
|
253 } |
|
254 |
|
255 // --------------------------------------------------------------------------- |
|
256 // CWPVoIPItem::SetEndMediaPort |
|
257 // |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 void CWPVoIPItem::SetEndMediaPort( TInt aEndMediaPort ) |
|
261 { |
|
262 iEndMediaPort = aEndMediaPort; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // CWPVoIPItem::SetMediaQoS |
|
267 // |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 void CWPVoIPItem::SetMediaQoS( TInt aMediaQoS ) |
|
271 { |
|
272 iMediaQoS = aMediaQoS; |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // CWPVoIPItem::SetDTMFInBand |
|
277 // |
|
278 // --------------------------------------------------------------------------- |
|
279 // |
|
280 void CWPVoIPItem::SetDTMFInBand( TInt aDTMFInBand ) |
|
281 { |
|
282 iDTMFInBand = aDTMFInBand; |
|
283 } |
|
284 |
|
285 // --------------------------------------------------------------------------- |
|
286 // CWPVoIPItem::SetDTMFOutOfBand |
|
287 // |
|
288 // --------------------------------------------------------------------------- |
|
289 // |
|
290 void CWPVoIPItem::SetDTMFOutBand( TInt aDTMFOutBand ) |
|
291 { |
|
292 iDTMFOutBand = aDTMFOutBand; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CWPVoIPItem::AddCodec |
|
297 // |
|
298 // --------------------------------------------------------------------------- |
|
299 // |
|
300 void CWPVoIPItem::AddCodecL( const CWPVoIPCodec* aVoIPCodec ) |
|
301 { |
|
302 iCodecs.AppendL( aVoIPCodec ); |
|
303 } |
|
304 |
|
305 // --------------------------------------------------------------------------- |
|
306 // CWPVoIPItem::SetSecureCallPref |
|
307 // |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 void CWPVoIPItem::SetSecureCallPref( TInt aSecureCallPref ) |
|
311 { |
|
312 iSecureCallPref = aSecureCallPref; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // CWPVoIPItem::SetRTCP |
|
317 // |
|
318 // --------------------------------------------------------------------------- |
|
319 // |
|
320 void CWPVoIPItem::SetRTCP( TInt aRTCP ) |
|
321 { |
|
322 iRTCP = aRTCP; |
|
323 } |
|
324 |
|
325 // --------------------------------------------------------------------------- |
|
326 // CWPVoIPItem::SetUAHTerminalType |
|
327 // |
|
328 // --------------------------------------------------------------------------- |
|
329 // |
|
330 void CWPVoIPItem::SetUAHTerminalType( TInt aUAHTerminalType ) |
|
331 { |
|
332 iUAHTerminalType = aUAHTerminalType; |
|
333 } |
|
334 |
|
335 // --------------------------------------------------------------------------- |
|
336 // CWPVoIPItem::SetUAHWLANMAC |
|
337 // |
|
338 // --------------------------------------------------------------------------- |
|
339 // |
|
340 void CWPVoIPItem::SetUAHWLANMAC( TInt aUAHWLANMAC ) |
|
341 { |
|
342 iUAHWLANMAC = aUAHWLANMAC; |
|
343 } |
|
344 |
|
345 // --------------------------------------------------------------------------- |
|
346 // CWPVoIPItem::SetUAHStringL |
|
347 // |
|
348 // --------------------------------------------------------------------------- |
|
349 // |
|
350 void CWPVoIPItem::SetUAHStringL( const TDesC& aUAHString ) |
|
351 { |
|
352 delete iUAHString; |
|
353 iUAHString = NULL; |
|
354 iUAHString = aUAHString.AllocL(); |
|
355 } |
|
356 |
|
357 // --------------------------------------------------------------------------- |
|
358 // CWPVoIPItem::SetProfileLockedToIAP |
|
359 // |
|
360 // --------------------------------------------------------------------------- |
|
361 // |
|
362 void CWPVoIPItem::SetProfileLockedToIAP( TInt aProfileLockedToIAP ) |
|
363 { |
|
364 iProfileLockedToIAP = aProfileLockedToIAP; |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // CWPVoIPItem::SetVoIPPluginUid |
|
369 // |
|
370 // --------------------------------------------------------------------------- |
|
371 // |
|
372 void CWPVoIPItem::SetVoIPPluginUid( TInt aVoIPPluginUid ) |
|
373 { |
|
374 iVoIPPluginUid = aVoIPPluginUid; |
|
375 } |
|
376 |
|
377 // --------------------------------------------------------------------------- |
|
378 // CWPVoIPItem::SetAllowVoIPOverWCDMA |
|
379 // |
|
380 // --------------------------------------------------------------------------- |
|
381 // |
|
382 void CWPVoIPItem::SetAllowVoIPOverWCDMA( TInt aAllowVoIPOverWCDMA ) |
|
383 { |
|
384 iAllowVoIPOverWCDMA = aAllowVoIPOverWCDMA; |
|
385 } |
|
386 |
|
387 // --------------------------------------------------------------------------- |
|
388 // CWPVoIPItem::SetVoIPDigits |
|
389 // |
|
390 // --------------------------------------------------------------------------- |
|
391 // |
|
392 void CWPVoIPItem::SetVoIPDigits( TInt aVoIPDigits ) |
|
393 { |
|
394 iVoIPDigits = aVoIPDigits; |
|
395 } |
|
396 |
|
397 // --------------------------------------------------------------------------- |
|
398 // CWPVoIPItem::SetDomainPartIgnoreRule |
|
399 // |
|
400 // --------------------------------------------------------------------------- |
|
401 // |
|
402 void CWPVoIPItem::SetDomainPartIgnoreRule( TInt aDomainPartIgnoreRule ) |
|
403 { |
|
404 iDomainPartIgnoreRule = aDomainPartIgnoreRule; |
|
405 } |
|
406 |
|
407 // --------------------------------------------------------------------------- |
|
408 // CWPVoIPItem::SetAddUserPhone |
|
409 // |
|
410 // --------------------------------------------------------------------------- |
|
411 // |
|
412 void CWPVoIPItem::SetAddUserPhone( TInt32 aAddUserPhone ) |
|
413 { |
|
414 iAddUserPhoneToAllNumbers = aAddUserPhone; |
|
415 } |
|
416 |
|
417 // --------------------------------------------------------------------------- |
|
418 // CWPVoIPItem::SetSipConnTestAddress |
|
419 // |
|
420 // --------------------------------------------------------------------------- |
|
421 // |
|
422 void CWPVoIPItem::SetSipConnTestAddressL( const TDesC& aSIPConnTestAddress ) |
|
423 { |
|
424 delete iSIPConnTestAddress; |
|
425 iSIPConnTestAddress = NULL; |
|
426 iSIPConnTestAddress = aSIPConnTestAddress.AllocL(); |
|
427 } |
|
428 |
|
429 // --------------------------------------------------------------------------- |
|
430 // CWPVoIPItem::SetServiceProviderBookmarkL |
|
431 // |
|
432 // --------------------------------------------------------------------------- |
|
433 // |
|
434 void CWPVoIPItem::SetServiceProviderBookmarkL( |
|
435 const TDesC& aServiceProviderBookmark ) |
|
436 { |
|
437 delete iServiceProviderBookmark; |
|
438 iServiceProviderBookmark = NULL; |
|
439 iServiceProviderBookmark = aServiceProviderBookmark.AllocL(); |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 // CWPVoIPItem::SetSipMinSe |
|
444 // |
|
445 // --------------------------------------------------------------------------- |
|
446 // |
|
447 void CWPVoIPItem::SetSipMinSe( TInt32 aSIPMinSE ) |
|
448 { |
|
449 iSIPMinSE = aSIPMinSE; |
|
450 } |
|
451 |
|
452 // --------------------------------------------------------------------------- |
|
453 // CWPVoIPItem::SetSipSessionExpires |
|
454 // |
|
455 // --------------------------------------------------------------------------- |
|
456 // |
|
457 void CWPVoIPItem::SetSipSessionExpires( TInt32 aSIPSessionExpires ) |
|
458 { |
|
459 iSIPSessionExpires = aSIPSessionExpires; |
|
460 } |
|
461 |
|
462 // --------------------------------------------------------------------------- |
|
463 // CWPVoIPItem::SetIPVoiceMailBoxURIL |
|
464 // |
|
465 // --------------------------------------------------------------------------- |
|
466 void CWPVoIPItem::SetIPVoiceMailBoxURIL( const TDesC& aIPVoiceMailBoxURI ) |
|
467 { |
|
468 delete iIPVoiceMailBoxURI; |
|
469 iIPVoiceMailBoxURI = NULL; |
|
470 iIPVoiceMailBoxURI = aIPVoiceMailBoxURI.AllocL(); |
|
471 iVmbxSettingsExist = ETrue; |
|
472 } |
|
473 |
|
474 // --------------------------------------------------------------------------- |
|
475 // CWPVoIPItem::SetVoiceMailBoxListenURIL |
|
476 // |
|
477 // --------------------------------------------------------------------------- |
|
478 // |
|
479 void CWPVoIPItem::SetVoiceMailBoxListenURIL( const TDesC& aVmbxListenAddress ) |
|
480 { |
|
481 delete iVmbxListenAddress; |
|
482 iVmbxListenAddress = NULL; |
|
483 iVmbxListenAddress = aVmbxListenAddress.AllocL(); |
|
484 iVmbxSettingsExist = ETrue; |
|
485 } |
|
486 |
|
487 // --------------------------------------------------------------------------- |
|
488 // CWPVoIPItem::SetReSubscribeInterval |
|
489 // |
|
490 // --------------------------------------------------------------------------- |
|
491 // |
|
492 void CWPVoIPItem::SetReSubscribeInterval( TInt32 aReSubscribeInterval ) |
|
493 { |
|
494 iReSubscribeInterval = aReSubscribeInterval; |
|
495 iVmbxSettingsExist = ETrue; |
|
496 } |
|
497 |
|
498 // --------------------------------------------------------------------------- |
|
499 // CWPVoIPItem::SetBrandingDataAddressL |
|
500 // |
|
501 // --------------------------------------------------------------------------- |
|
502 // |
|
503 void CWPVoIPItem::SetBrandingDataAddressL( const TDesC& aBrandingDataAddress ) |
|
504 { |
|
505 delete iBrandingDataAddress; |
|
506 iBrandingDataAddress = NULL; |
|
507 iBrandingDataAddress = aBrandingDataAddress.AllocL(); |
|
508 } |
|
509 |
|
510 // --------------------------------------------------------------------------- |
|
511 // CWPVoIPItem::SetAutoAcceptBuddyRequest |
|
512 // |
|
513 // --------------------------------------------------------------------------- |
|
514 // |
|
515 void CWPVoIPItem::SetAutoAcceptBuddyRequest( TInt32 aAutoAcceptBuddyRequest ) |
|
516 { |
|
517 iAutoAcceptBuddyRequest = aAutoAcceptBuddyRequest; |
|
518 } |
|
519 |
|
520 // --------------------------------------------------------------------------- |
|
521 // CWPVoIPItem::SetAutoEnableService |
|
522 // |
|
523 // --------------------------------------------------------------------------- |
|
524 // |
|
525 void CWPVoIPItem::SetAutoEnableService( TInt32 aAutoEnableService ) |
|
526 { |
|
527 iAutoEnableService = aAutoEnableService; |
|
528 } |
|
529 |
|
530 // --------------------------------------------------------------------------- |
|
531 // CWPVoIPItem::SetNapDef |
|
532 // |
|
533 // --------------------------------------------------------------------------- |
|
534 // |
|
535 void CWPVoIPItem::SetNapDef( CWPCharacteristic* aNapDef ) |
|
536 { |
|
537 iNapDef = aNapDef; |
|
538 } |
|
539 |
|
540 // --------------------------------------------------------------------------- |
|
541 // CWPVoIPItem::SetToNapIdL |
|
542 // |
|
543 // --------------------------------------------------------------------------- |
|
544 void CWPVoIPItem::SetToNapIdL( const TDesC8& aToNapId ) |
|
545 { |
|
546 delete iToNapId; |
|
547 iToNapId = NULL; |
|
548 iToNapId = aToNapId.AllocL(); |
|
549 } |
|
550 |
|
551 // --------------------------------------------------------------------------- |
|
552 // CWPVoIPItem::SetIapId |
|
553 // |
|
554 // --------------------------------------------------------------------------- |
|
555 // |
|
556 void CWPVoIPItem::SetIapId( TUint32 aIapId ) |
|
557 { |
|
558 iVmbxIapId = aIapId; |
|
559 } |
|
560 |
|
561 // --------------------------------------------------------------------------- |
|
562 // CWPVoIPItem::SetStorageId |
|
563 // |
|
564 // --------------------------------------------------------------------------- |
|
565 // |
|
566 TBool CWPVoIPItem::SetStorageId( TSettingsType aProfileType, |
|
567 TUint32 aStorageId, const TDesC8& aAppRef ) |
|
568 { |
|
569 DBG_PRINT( "CWPVoIPItem::SetStorageId - begin" ); |
|
570 const TInt toAppRefCount = iToAppRefs.Count(); |
|
571 TInt counter( KErrNone ); |
|
572 |
|
573 //lint -e{961} No need for else statement here |
|
574 if ( ESIP == aProfileType ) |
|
575 { |
|
576 for ( counter = 0; counter < toAppRefCount; counter++ ) |
|
577 { |
|
578 if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) |
|
579 && !iSipIdSet ) |
|
580 { |
|
581 iSipId = aStorageId; |
|
582 iSipIdSet = ETrue; |
|
583 DBG_PRINT( "CWPVoIPItem::SetStorageId - SIP ID set; end" ); |
|
584 return ETrue; |
|
585 } |
|
586 } |
|
587 if ( KErrNone == iVoipUrisToAppRef->CompareF( aAppRef ) ) |
|
588 { |
|
589 iVmbxSipId = aStorageId; |
|
590 iVmbxSipIdSet = ETrue; |
|
591 DBG_PRINT( |
|
592 "CWPVoIPItem::SetStorageId - SIP ID for VMBX set; end" ); |
|
593 return ETrue; |
|
594 } |
|
595 } |
|
596 |
|
597 else if ( ESCCP == aProfileType ) |
|
598 { |
|
599 for ( counter = 0; counter < toAppRefCount; counter++ ) |
|
600 { |
|
601 if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) |
|
602 && !iSccpIdSet ) |
|
603 { |
|
604 iSccpId = aStorageId; |
|
605 iSccpIdSet = ETrue; |
|
606 DBG_PRINT( "CWPVoIPItem::SetStorageId - SCCP ID set; end" ); |
|
607 return ETrue; |
|
608 } |
|
609 } |
|
610 } |
|
611 |
|
612 else if ( ENATFW == aProfileType ) |
|
613 { |
|
614 for ( counter = 0; counter < toAppRefCount; counter++ ) |
|
615 { |
|
616 if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) |
|
617 && !iNatFwIdSet ) |
|
618 { |
|
619 iNatFwId = aStorageId; |
|
620 iNatFwIdSet = ETrue; |
|
621 DBG_PRINT( |
|
622 "CWPVoIPItem::SetStorageId - NAT/FW ID set; end" ); |
|
623 return ETrue; |
|
624 } |
|
625 } |
|
626 } |
|
627 |
|
628 else if ( EPresence == aProfileType ) |
|
629 { |
|
630 for ( counter = 0; counter < toAppRefCount; counter++ ) |
|
631 { |
|
632 if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) |
|
633 && !iPresenceIdSet ) |
|
634 { |
|
635 iPresenceId = aStorageId; |
|
636 iPresenceIdSet = ETrue; |
|
637 DBG_PRINT( |
|
638 "CWPVoIPItem::SetStorageId - Presence ID set; end" ); |
|
639 return ETrue; |
|
640 } |
|
641 } |
|
642 } |
|
643 |
|
644 else if ( ESNAP == aProfileType ) |
|
645 { |
|
646 for ( counter = 0; counter < toAppRefCount; counter++ ) |
|
647 { |
|
648 if ( KErrNone == iToAppRefs[counter]->CompareF( aAppRef ) |
|
649 && !iSnapIdSet ) |
|
650 { |
|
651 iSnapId = aStorageId; |
|
652 iSnapIdSet = ETrue; |
|
653 DBG_PRINT( "CWPVoIPItem::SetStorageId - SNAP ID set; end" ); |
|
654 return ETrue; |
|
655 } |
|
656 } |
|
657 } |
|
658 |
|
659 return EFalse; |
|
660 } |
|
661 |
|
662 // --------------------------------------------------------------------------- |
|
663 // CWPVoIPItem::SetVoipUrisToAppRefL |
|
664 // |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 void CWPVoIPItem::SetVoipUrisToAppRefL( const TDesC8& aToAppRef ) |
|
668 { |
|
669 // VMBX dependency to SIP settigns, VoIP dependency to Presence settings. |
|
670 delete iVoipUrisToAppRef; |
|
671 iVoipUrisToAppRef = NULL; |
|
672 iVoipUrisToAppRef = aToAppRef.AllocL(); |
|
673 } |
|
674 |
|
675 // --------------------------------------------------------------------------- |
|
676 // CWPVoIPItem::SetUsedNatProtocol |
|
677 // |
|
678 // --------------------------------------------------------------------------- |
|
679 // |
|
680 void CWPVoIPItem::SetUsedNatProtocol( TInt32 aUsedNatProtocol) |
|
681 { |
|
682 iUsedNatProtocol = aUsedNatProtocol; |
|
683 } |
|
684 |
|
685 // Getters |
|
686 |
|
687 // --------------------------------------------------------------------------- |
|
688 // CWPVoIPItem::Name |
|
689 // |
|
690 // --------------------------------------------------------------------------- |
|
691 // |
|
692 const TDesC& CWPVoIPItem::Name() const |
|
693 { |
|
694 return *iName; |
|
695 } |
|
696 |
|
697 // --------------------------------------------------------------------------- |
|
698 // CWPVoIPItem::UAHString |
|
699 // |
|
700 // --------------------------------------------------------------------------- |
|
701 // |
|
702 const TDesC& CWPVoIPItem::UAHString() const |
|
703 { |
|
704 return *iUAHString; |
|
705 } |
|
706 |
|
707 // --------------------------------------------------------------------------- |
|
708 // CWPVoIPItem::ToNapId |
|
709 // |
|
710 // --------------------------------------------------------------------------- |
|
711 // |
|
712 const TDesC8& CWPVoIPItem::ToNapId() const |
|
713 { |
|
714 return *iToNapId; |
|
715 } |
|
716 |
|
717 // --------------------------------------------------------------------------- |
|
718 // CWPVoIPItem::NapDef |
|
719 // |
|
720 // --------------------------------------------------------------------------- |
|
721 // |
|
722 CWPCharacteristic* CWPVoIPItem::NapDef() |
|
723 { |
|
724 return iNapDef; |
|
725 } |
|
726 |
|
727 // --------------------------------------------------------------------------- |
|
728 // CWPVoIPItem::VoipUrisToAppRef |
|
729 // |
|
730 // --------------------------------------------------------------------------- |
|
731 // |
|
732 const TDesC8& CWPVoIPItem::VoipUrisToAppRef() const |
|
733 { |
|
734 return *iVoipUrisToAppRef; |
|
735 } |
|
736 |
|
737 // --------------------------------------------------------------------------- |
|
738 // CWPVoIPItem::StoreL |
|
739 // 1) Set VoIP parameters into the VoIP profile entry. |
|
740 // 2) Save audio codecs and add their storage ids into the VoIP profile entry |
|
741 // and VoIP item. |
|
742 // 3) Save the VoIP profile entry. |
|
743 // SIP ID's, SIP profile specific data, SCCP ID & Presence ID are not stored |
|
744 // here, nor are VoIP settings belonging to SPS. They are all stored when the |
|
745 // SavingFinalized method is called because only then it is guaranteed that |
|
746 // the data needed is received and ready for saving. |
|
747 // --------------------------------------------------------------------------- |
|
748 // |
|
749 TUint CWPVoIPItem::StoreL() |
|
750 { |
|
751 DBG_PRINT( "CWPVoIPItem::StoreL - begin" ); |
|
752 // Save the VoIP profile. |
|
753 CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC(); // CS:1 |
|
754 cRCSEProfileEntry->iId = iItemId; |
|
755 cRCSEProfileEntry->iProviderName.Copy( iProviderId->Des() ); |
|
756 cRCSEProfileEntry->iSettingsName.Copy( iName->Des() ); |
|
757 |
|
758 // Saving the codecs and and storaging their ids in VoIP profile. |
|
759 typedef CRCSEAudioCodecEntry AudioCodecEntry; |
|
760 CRCSEAudioCodecRegistry* cRCSEAudioCodecRegistry = |
|
761 CRCSEAudioCodecRegistry::NewLC(); // CS:2 |
|
762 |
|
763 CWPVoIPCodec* tmpCodec = NULL; |
|
764 const TInt numberOfCodecs = iCodecs.Count(); |
|
765 |
|
766 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
|
767 { |
|
768 tmpCodec = iCodecs[codecIndex]; |
|
769 CRCSEAudioCodecEntry* cRCSEAudioCodecEntry = |
|
770 CRCSEAudioCodecEntry::NewLC(); // CS:3 |
|
771 |
|
772 // Codec initiated with it's default values. |
|
773 cRCSEAudioCodecEntry->SetDefaultCodecValueSet( tmpCodec-> |
|
774 iMediaSubtypeName->Des() ); |
|
775 |
|
776 cRCSEAudioCodecEntry->iMediaSubTypeName.Zero(); |
|
777 cRCSEAudioCodecEntry->iMediaSubTypeName.Copy( tmpCodec-> |
|
778 iMediaSubtypeName->Des() ); |
|
779 |
|
780 // Set codec values, take values only when they exist. |
|
781 |
|
782 // JitterBufferSize |
|
783 if ( KNotSet != tmpCodec->iJitterBufferSize ) |
|
784 { |
|
785 cRCSEAudioCodecEntry->iJitterBufferSize = |
|
786 tmpCodec->iJitterBufferSize; |
|
787 } |
|
788 |
|
789 // OctetAlign |
|
790 if ( KNotSet != tmpCodec->iOctetAlign ) |
|
791 { |
|
792 cRCSEAudioCodecEntry->iOctetAlign = |
|
793 static_cast<AudioCodecEntry::TOnOff> |
|
794 ( tmpCodec->iOctetAlign ); |
|
795 } |
|
796 |
|
797 // ModeSet |
|
798 TInt modeSetCount = iCodecs[codecIndex]->iModeSet.Count(); |
|
799 if ( modeSetCount > 0 ) |
|
800 { |
|
801 // Take off default values if some values are provisioned. |
|
802 cRCSEAudioCodecEntry->iModeSet.Reset(); |
|
803 for ( TInt modeSetIndex = 0; modeSetIndex < modeSetCount; |
|
804 modeSetIndex++ ) |
|
805 { |
|
806 cRCSEAudioCodecEntry->iModeSet.Append( iCodecs[codecIndex]-> |
|
807 iModeSet[modeSetIndex] ); |
|
808 }// for |
|
809 }// if |
|
810 |
|
811 // ModeChangePeriod |
|
812 if ( KNotSet != tmpCodec->iModeChangePeriod ) |
|
813 { |
|
814 cRCSEAudioCodecEntry->iModeChangePeriod = |
|
815 tmpCodec->iModeChangePeriod; |
|
816 } |
|
817 |
|
818 // ModeChangeNeighbor |
|
819 if ( KNotSet != tmpCodec->iModeChangeNeighbor ) |
|
820 { |
|
821 cRCSEAudioCodecEntry->iModeChangeNeighbor = |
|
822 static_cast<AudioCodecEntry::TOnOff> |
|
823 ( tmpCodec->iModeChangeNeighbor ); |
|
824 } |
|
825 |
|
826 // PTime |
|
827 if ( KNotSet != tmpCodec->iPTime ) |
|
828 { |
|
829 cRCSEAudioCodecEntry->iPtime = tmpCodec->iPTime; |
|
830 } |
|
831 |
|
832 // MaxPTime |
|
833 if ( KNotSet != tmpCodec->iMaxPTime ) |
|
834 { |
|
835 cRCSEAudioCodecEntry->iMaxptime = tmpCodec->iMaxPTime; |
|
836 } |
|
837 |
|
838 // VAD |
|
839 if ( KNotSet != tmpCodec->iVAD ) |
|
840 { |
|
841 cRCSEAudioCodecEntry->iVAD = |
|
842 static_cast<AudioCodecEntry::TOnOff>( tmpCodec->iVAD ); |
|
843 } |
|
844 |
|
845 // AnnexB |
|
846 if ( KNotSet != tmpCodec->iAnnexB ) |
|
847 { |
|
848 cRCSEAudioCodecEntry->iAnnexb = |
|
849 static_cast<AudioCodecEntry::TOnOff>( tmpCodec->iAnnexB ); |
|
850 } |
|
851 |
|
852 // MaxRed |
|
853 if ( KNotSet != tmpCodec->iMaxRed ) |
|
854 { |
|
855 cRCSEAudioCodecEntry->iMaxRed = tmpCodec->iMaxRed; |
|
856 } |
|
857 // Simple check, that there is at least media sub type name. |
|
858 // If not ok, then the codec is not saved. |
|
859 if ( tmpCodec->iMediaSubtypeName->Length() > 0 ) |
|
860 { |
|
861 // Store the codec entry and get the storage id. |
|
862 tmpCodec->iId = cRCSEAudioCodecRegistry->AddL( |
|
863 *cRCSEAudioCodecEntry ); |
|
864 }// if |
|
865 |
|
866 CleanupStack::PopAndDestroy( cRCSEAudioCodecEntry ); // CS:2 |
|
867 }// for |
|
868 |
|
869 CleanupStack::PopAndDestroy ( cRCSEAudioCodecRegistry ); // CS:1 |
|
870 |
|
871 if ( numberOfCodecs > 1 ) |
|
872 { |
|
873 // Sort the codec array into priority order (by PRIORITYINDEX). |
|
874 RArray<TInt> priorityArray; |
|
875 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
|
876 { |
|
877 priorityArray.Append( iCodecs[codecIndex]->iPriorityIndex ); |
|
878 } |
|
879 priorityArray.Sort(); |
|
880 RPointerArray<CWPVoIPCodec> tmpArray; |
|
881 |
|
882 for ( TInt priorityIndex = 0; priorityIndex < numberOfCodecs; |
|
883 priorityIndex++ ) |
|
884 { |
|
885 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; |
|
886 codecIndex++ ) |
|
887 { |
|
888 if ( priorityArray[priorityIndex] == |
|
889 iCodecs[codecIndex]->iPriorityIndex ) |
|
890 |
|
891 { |
|
892 tmpArray.Append( iCodecs[codecIndex] ); |
|
893 } |
|
894 } |
|
895 } |
|
896 |
|
897 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
|
898 { |
|
899 iCodecs[codecIndex] = tmpArray[codecIndex]; |
|
900 } |
|
901 tmpArray.Close(); |
|
902 priorityArray.Close(); |
|
903 } // if |
|
904 |
|
905 // Set the priority list of codecs. |
|
906 for ( TInt codecIndex = 0; codecIndex < numberOfCodecs; codecIndex++ ) |
|
907 { |
|
908 cRCSEProfileEntry->iPreferredCodecs.Append( |
|
909 iCodecs[codecIndex]->iId ); |
|
910 }// for |
|
911 |
|
912 // If no codecs exist create default codecs |
|
913 if ( !numberOfCodecs ) |
|
914 { |
|
915 AddDefaultCodecsL( *cRCSEProfileEntry ); |
|
916 } |
|
917 |
|
918 // StartMediaPort |
|
919 if ( KNotSet != iStartMediaPort ) |
|
920 { |
|
921 cRCSEProfileEntry->iStartMediaPort = iStartMediaPort; |
|
922 } |
|
923 |
|
924 // EndMediaPort |
|
925 if ( KNotSet != iEndMediaPort ) |
|
926 { |
|
927 cRCSEProfileEntry->iEndMediaPort = iEndMediaPort; |
|
928 } |
|
929 |
|
930 // MediaQoS |
|
931 if ( KNotSet != iMediaQoS ) |
|
932 { |
|
933 cRCSEProfileEntry->iMediaQOS = iMediaQoS; |
|
934 } |
|
935 |
|
936 // InbandDTMF |
|
937 if ( KNotSet != iDTMFInBand ) |
|
938 { |
|
939 cRCSEProfileEntry->iInbandDTMF = |
|
940 static_cast<VoIPProfileEntry::TOnOff>( iDTMFInBand ); |
|
941 } |
|
942 |
|
943 // OutbandDTMF |
|
944 if ( KNotSet != iDTMFOutBand ) |
|
945 { |
|
946 cRCSEProfileEntry->iOutbandDTMF = |
|
947 static_cast<VoIPProfileEntry::TOnOff>( iDTMFOutBand ); |
|
948 } |
|
949 |
|
950 // SecureCallPref |
|
951 if ( KNotSet != iSecureCallPref ) |
|
952 { |
|
953 cRCSEProfileEntry->iSecureCallPreference = iSecureCallPref; |
|
954 } |
|
955 |
|
956 // RTCP |
|
957 if ( KNotSet != iRTCP ) |
|
958 { |
|
959 cRCSEProfileEntry->iRTCP = iRTCP; |
|
960 } |
|
961 |
|
962 // UAHTerminalType |
|
963 if ( KNotSet != iUAHTerminalType ) |
|
964 { |
|
965 cRCSEProfileEntry->iSIPVoIPUAHTerminalType = iUAHTerminalType; |
|
966 } |
|
967 |
|
968 // UAHWLANMAC |
|
969 if ( KNotSet != iUAHWLANMAC ) |
|
970 { |
|
971 cRCSEProfileEntry->iSIPVoIPUAHeaderWLANMAC = iUAHWLANMAC; |
|
972 } |
|
973 |
|
974 // UAHString |
|
975 if ( iUAHString->Des().Length() > 0 ) |
|
976 { |
|
977 cRCSEProfileEntry->iSIPVoIPUAHeaderString.Zero(); |
|
978 cRCSEProfileEntry->iSIPVoIPUAHeaderString.Insert( 0, |
|
979 iUAHString->Des() ); |
|
980 } |
|
981 |
|
982 // ProfileLockedToIAP |
|
983 if ( KNotSet != iProfileLockedToIAP ) |
|
984 { |
|
985 cRCSEProfileEntry->iProfileLockedToIAP = |
|
986 static_cast<VoIPProfileEntry::TOnOff>( iProfileLockedToIAP ); |
|
987 } |
|
988 |
|
989 // VoIPPluginUid |
|
990 if ( KNotSet != iVoIPPluginUid ) |
|
991 { |
|
992 cRCSEProfileEntry->iVoIPPluginUID = iVoIPPluginUid; |
|
993 } |
|
994 |
|
995 // AllowVoIPOverWCDMA |
|
996 if ( KNotSet != iAllowVoIPOverWCDMA ) |
|
997 { |
|
998 cRCSEProfileEntry->iAllowVoIPoverWCDMA = |
|
999 static_cast<VoIPProfileEntry::TOnOff>( iAllowVoIPOverWCDMA ); |
|
1000 } |
|
1001 |
|
1002 // VoIPDigits |
|
1003 if ( KNotSet != iVoIPDigits ) |
|
1004 { |
|
1005 cRCSEProfileEntry->iMeanCountOfVoIPDigits = iVoIPDigits; |
|
1006 } |
|
1007 |
|
1008 // DomainPartIgnoreRule |
|
1009 if ( KNotSet != iDomainPartIgnoreRule ) |
|
1010 { |
|
1011 cRCSEProfileEntry->iIgnoreAddrDomainPart = iDomainPartIgnoreRule; |
|
1012 } |
|
1013 |
|
1014 // UserPhoneToAllNumbers |
|
1015 if ( KNotSet != iAddUserPhoneToAllNumbers ) |
|
1016 { |
|
1017 cRCSEProfileEntry->iUserPhoneUriParameter = |
|
1018 static_cast<VoIPProfileEntry::TOnOff> |
|
1019 ( iAddUserPhoneToAllNumbers ); |
|
1020 } |
|
1021 |
|
1022 // SIPConnTestAddress |
|
1023 if ( iSIPConnTestAddress->Des().Length() > 0 ) |
|
1024 { |
|
1025 cRCSEProfileEntry->iSIPConnTestAddress.Zero(); |
|
1026 cRCSEProfileEntry->iSIPConnTestAddress.Insert( 0, |
|
1027 iSIPConnTestAddress->Des() ); |
|
1028 } |
|
1029 |
|
1030 // SIPMinSE |
|
1031 if ( KNotSet != iSIPMinSE ) |
|
1032 { |
|
1033 cRCSEProfileEntry->iSIPMinSE = iSIPMinSE; |
|
1034 } |
|
1035 |
|
1036 // SIPSessionExpires |
|
1037 if ( KNotSet != iSIPSessionExpires ) |
|
1038 { |
|
1039 cRCSEProfileEntry->iSIPSessionExpires = iSIPSessionExpires; |
|
1040 } |
|
1041 |
|
1042 // UsedNATProtocol |
|
1043 if ( KNotSet != iUsedNatProtocol ) |
|
1044 { |
|
1045 cRCSEProfileEntry->iNATProtocol = iUsedNatProtocol; |
|
1046 } |
|
1047 |
|
1048 if ( iSipIdSet ) |
|
1049 { |
|
1050 TSettingIds referredIds; |
|
1051 referredIds.iProfileType = 0; // SIP. |
|
1052 referredIds.iProfileId = TInt( iSipId ); |
|
1053 // Never reference to profile specific settings. |
|
1054 referredIds.iProfileSpecificSettingId = KNotSet; |
|
1055 cRCSEProfileEntry->iIds.Append( referredIds ); |
|
1056 } |
|
1057 |
|
1058 // Save the new profile into the registry. |
|
1059 CRCSEProfileRegistry* cRCSEProfileRegistry = |
|
1060 CRCSEProfileRegistry::NewLC(); |
|
1061 // CS:2 |
|
1062 CheckDuplicatesL( *cRCSEProfileEntry ); |
|
1063 iItemId = cRCSEProfileRegistry->AddL( *cRCSEProfileEntry ); |
|
1064 |
|
1065 CleanupStack::PopAndDestroy( cRCSEProfileRegistry ); // CS:1 |
|
1066 CleanupStack::PopAndDestroy( cRCSEProfileEntry ); // CS:0 |
|
1067 |
|
1068 // __UHEAP_MARKEND; // for testing |
|
1069 |
|
1070 HBufC8* tmpId = HBufC8::NewL( KMaxCharsInTUint32 ); |
|
1071 _LIT8( KFormatTxt,"%u" ); |
|
1072 tmpId->Des().Format( KFormatTxt, iItemId ); |
|
1073 delete iSavedProfileId; |
|
1074 iSavedProfileId = NULL; |
|
1075 iSavedProfileId = tmpId; |
|
1076 tmpId = NULL; |
|
1077 DBG_PRINT( "CWPVoIPItem::StoreL - end" ); |
|
1078 return iItemId; |
|
1079 } |
|
1080 |
|
1081 // --------------------------------------------------------------------------- |
|
1082 // CWPVoIPItem::SaveData |
|
1083 // |
|
1084 // --------------------------------------------------------------------------- |
|
1085 // |
|
1086 const TDesC8& CWPVoIPItem::SaveData() const |
|
1087 { |
|
1088 return *iSavedProfileId; |
|
1089 } |
|
1090 |
|
1091 // --------------------------------------------------------------------------- |
|
1092 // CWPVoIPItem::SavingFinalizedL() |
|
1093 // 1) Save TO-APPREF dependent data and set SIP User Agent Header in SIP |
|
1094 // profile. |
|
1095 // 2) Update the VoIP profile with references to the saved TO-APPREF dependent |
|
1096 // data. |
|
1097 // 3) Reset the data collections that are based on data received via call to |
|
1098 // method SettingsSaved (i.e. APPREF related data). This is because the |
|
1099 // user might for some reason save the settings twice and then the data is |
|
1100 // received once again (there would be then dublicates of data). |
|
1101 // |
|
1102 // --------------------------------------------------------------------------- |
|
1103 // |
|
1104 void CWPVoIPItem::SavingFinalizedL() |
|
1105 { |
|
1106 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - begin" ); |
|
1107 // Load the VoIP profile for update from the registry. |
|
1108 CRCSEProfileRegistry* cRCSEProfileRegistry = |
|
1109 CRCSEProfileRegistry::NewLC(); |
|
1110 // CS:1 |
|
1111 CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC(); // CS:2 |
|
1112 cRCSEProfileRegistry->FindL( iItemId, *cRCSEProfileEntry ); |
|
1113 |
|
1114 // Data dependent on the other adapters can be saved here, because it is |
|
1115 // now quaranteed that TO-APPREF pointed information is known. |
|
1116 // Test if this VoIP settings item of type SIP or SCCP dependent. |
|
1117 |
|
1118 // Save RCSE related data. |
|
1119 //lint -e{961} No need for else statement here |
|
1120 if ( iSccpIdSet ) |
|
1121 { |
|
1122 TSettingIds referredIds; |
|
1123 referredIds.iProfileType = 1; // SCCP. |
|
1124 referredIds.iProfileId = TInt( iSccpId ); |
|
1125 // Never reference to profile specific settings. |
|
1126 referredIds.iProfileSpecificSettingId = KNotSet; |
|
1127 cRCSEProfileEntry->iIds.Append( referredIds ); |
|
1128 cRCSEProfileRegistry->UpdateL( iItemId, *cRCSEProfileEntry ); |
|
1129 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - SCCP ID set" ); |
|
1130 } |
|
1131 |
|
1132 if ( iNatFwIdSet ) |
|
1133 { |
|
1134 cRCSEProfileEntry->iNATSettingsStorageId = iNatFwId; |
|
1135 cRCSEProfileRegistry->UpdateL( iItemId, *cRCSEProfileEntry ); |
|
1136 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - NAT/FW ID set" ); |
|
1137 } |
|
1138 |
|
1139 // Save Service Provider Settings related data if service ID exists. |
|
1140 TUint32 serviceId = cRCSEProfileEntry->iServiceProviderId; |
|
1141 if ( 0 == serviceId ) |
|
1142 { |
|
1143 CleanupStack::PopAndDestroy( 2, cRCSEProfileRegistry ); |
|
1144 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - end" ); |
|
1145 return; |
|
1146 } |
|
1147 CSPSettings* spSettings = CSPSettings::NewLC(); // CS:3 |
|
1148 CSPEntry* spEntry = CSPEntry::NewLC(); // CS:4 |
|
1149 |
|
1150 TInt err = spSettings->FindEntryL( serviceId, *spEntry ); |
|
1151 User::LeaveIfError( err ); |
|
1152 |
|
1153 CSPProperty* property = CSPProperty::NewLC(); // CS:5 |
|
1154 |
|
1155 // VoiceMailBox: SIP ID |
|
1156 //lint -e{961} No need for else statement here |
|
1157 if ( iVmbxSipIdSet ) |
|
1158 { |
|
1159 err = property->SetName( ESubPropertyVMBXSettingsId ); |
|
1160 property->SetValue( iVmbxSipId ); |
|
1161 if ( KErrNone == err ) |
|
1162 { |
|
1163 err = spEntry->AddPropertyL( *property ); |
|
1164 if ( KErrAlreadyExists == err ) |
|
1165 { |
|
1166 User::LeaveIfError( spEntry->UpdateProperty( |
|
1167 ESubPropertyVMBXSettingsId, iVmbxSipId ) ); |
|
1168 } |
|
1169 else |
|
1170 { |
|
1171 User::LeaveIfError( err ); |
|
1172 } |
|
1173 } |
|
1174 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx SIP ID set" ); |
|
1175 } |
|
1176 // Use the same SIP ID as in RCSE. Store only if some |
|
1177 // vmbx settings are provisioned. |
|
1178 else if ( iSipIdSet && iVmbxSettingsExist ) |
|
1179 { |
|
1180 err = property->SetName( ESubPropertyVMBXSettingsId ); |
|
1181 property->SetValue( iSipId ); |
|
1182 if ( KErrNone == err ) |
|
1183 { |
|
1184 err = spEntry->AddPropertyL( *property ); |
|
1185 if ( KErrAlreadyExists == err ) |
|
1186 { |
|
1187 User::LeaveIfError( spEntry->UpdateProperty( |
|
1188 ESubPropertyVMBXSettingsId, iSipId ) ); |
|
1189 } |
|
1190 else |
|
1191 { |
|
1192 User::LeaveIfError( err ); |
|
1193 } |
|
1194 } |
|
1195 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1196 Vmbx SIP ID set (same SIP ID as in RCSE)" ); |
|
1197 } |
|
1198 |
|
1199 // VoiceMailBox: MWI-URI |
|
1200 if ( iIPVoiceMailBoxURI->Des().Length() > 0 ) |
|
1201 { |
|
1202 err = property->SetName( ESubPropertyVMBXMWIAddress ); |
|
1203 property->SetValue( iIPVoiceMailBoxURI->Des() ); |
|
1204 if ( KErrNone == err ) |
|
1205 { |
|
1206 err = spEntry->AddPropertyL( *property ); |
|
1207 if ( KErrAlreadyExists == err ) |
|
1208 { |
|
1209 User::LeaveIfError( spEntry->UpdateProperty( |
|
1210 ESubPropertyVMBXMWIAddress, |
|
1211 iIPVoiceMailBoxURI->Des() ) ); |
|
1212 } |
|
1213 else |
|
1214 { |
|
1215 User::LeaveIfError( err ); |
|
1216 } |
|
1217 } |
|
1218 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx MWI-URI set" ); |
|
1219 } |
|
1220 |
|
1221 // VoiceMailBox: Listening URI |
|
1222 if ( !iVmbxListenAddress->Des().Length() |
|
1223 && iIPVoiceMailBoxURI->Des().Length() ) |
|
1224 { |
|
1225 // Use same URI as with MWI-URI. |
|
1226 delete iVmbxListenAddress; |
|
1227 iVmbxListenAddress = NULL; |
|
1228 iVmbxListenAddress = iIPVoiceMailBoxURI->Des().AllocL(); |
|
1229 } |
|
1230 |
|
1231 if ( iVmbxListenAddress->Des().Length() > 0 ) |
|
1232 { |
|
1233 err = property->SetName( ESubPropertyVMBXListenAddress ); |
|
1234 property->SetValue( iVmbxListenAddress->Des() ); |
|
1235 if ( KErrNone == err ) |
|
1236 { |
|
1237 err = spEntry->AddPropertyL( *property ); |
|
1238 if ( KErrAlreadyExists == err ) |
|
1239 { |
|
1240 User::LeaveIfError( spEntry->UpdateProperty( |
|
1241 ESubPropertyVMBXListenAddress, |
|
1242 iVmbxListenAddress->Des() ) ); |
|
1243 } |
|
1244 else |
|
1245 { |
|
1246 User::LeaveIfError( err ); |
|
1247 } |
|
1248 } |
|
1249 DBG_PRINT( |
|
1250 "CWPVoIPItem::SavingFinalizedL - Vmbx Listening URI set" ); |
|
1251 } |
|
1252 |
|
1253 // VoiceMailBox: Re-Subscribe interval |
|
1254 if ( iVmbxSettingsExist ) |
|
1255 { |
|
1256 err = property->SetName( ESubPropertyVMBXMWISubscribeInterval ); |
|
1257 property->SetValue( iReSubscribeInterval ); |
|
1258 if ( KErrNone == err ) |
|
1259 { |
|
1260 err = spEntry->AddPropertyL( *property ); |
|
1261 if ( KErrAlreadyExists == err ) |
|
1262 { |
|
1263 User::LeaveIfError( spEntry->UpdateProperty( |
|
1264 ESubPropertyVMBXMWISubscribeInterval, |
|
1265 iReSubscribeInterval ) ); |
|
1266 } |
|
1267 else |
|
1268 { |
|
1269 User::LeaveIfError( err ); |
|
1270 } |
|
1271 } |
|
1272 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1273 Vmbx re-SUBSCRIBE interval set" ); |
|
1274 } |
|
1275 |
|
1276 // VoiceMailBox: Preferred IAP ID |
|
1277 if ( iVmbxIapId ) |
|
1278 { |
|
1279 err = property->SetName( ESubPropertyVMBXPreferredIAPId ); |
|
1280 property->SetValue( iVmbxIapId ); |
|
1281 if ( KErrNone == err ) |
|
1282 { |
|
1283 err = spEntry->AddPropertyL( *property ); |
|
1284 if ( KErrAlreadyExists == err ) |
|
1285 { |
|
1286 User::LeaveIfError( spEntry->UpdateProperty( |
|
1287 ESubPropertyVMBXPreferredIAPId, iVmbxIapId ) ); |
|
1288 } |
|
1289 else |
|
1290 { |
|
1291 User::LeaveIfError( err ); |
|
1292 } |
|
1293 } |
|
1294 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Vmbx IAP ID set" ); |
|
1295 } |
|
1296 |
|
1297 // Service provider bookmark URI |
|
1298 if ( iServiceProviderBookmark->Des().Length() > 0 ) |
|
1299 { |
|
1300 err = property->SetName( EPropertyServiceBookmarkUri ); |
|
1301 property->SetValue( iServiceProviderBookmark->Des() ); |
|
1302 if ( KErrNone == err ) |
|
1303 { |
|
1304 err = spEntry->AddPropertyL( *property ); |
|
1305 if ( KErrAlreadyExists == err ) |
|
1306 { |
|
1307 User::LeaveIfError( spEntry->UpdateProperty( |
|
1308 EPropertyServiceBookmarkUri, |
|
1309 iServiceProviderBookmark->Des() ) ); |
|
1310 } |
|
1311 else |
|
1312 { |
|
1313 User::LeaveIfError( err ); |
|
1314 } |
|
1315 } |
|
1316 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1317 Service provider bookmark URI set" ); |
|
1318 } |
|
1319 |
|
1320 // Branding data URI |
|
1321 if ( iBrandingDataAddress->Des().Length() > 0 ) |
|
1322 { |
|
1323 err = property->SetName( ESubPropertyVoIPBrandDataUri ); |
|
1324 property->SetValue( iBrandingDataAddress->Des() ); |
|
1325 if ( KErrNone == err ) |
|
1326 { |
|
1327 err = spEntry->AddPropertyL( *property ); |
|
1328 if ( KErrAlreadyExists == err ) |
|
1329 { |
|
1330 User::LeaveIfError( spEntry->UpdateProperty( |
|
1331 ESubPropertyVoIPBrandDataUri, |
|
1332 iBrandingDataAddress->Des() ) ); |
|
1333 } |
|
1334 else |
|
1335 { |
|
1336 User::LeaveIfError( err ); |
|
1337 } |
|
1338 } |
|
1339 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - Branding data URI set" ); |
|
1340 } |
|
1341 |
|
1342 // Presence settings ID and Presence Subservice plug-in UID |
|
1343 if ( iPresenceIdSet ) |
|
1344 { |
|
1345 err = property->SetName( ESubPropertyPresenceSettingsId ); |
|
1346 property->SetValue( iPresenceId ); |
|
1347 if ( KErrNone == err ) |
|
1348 { |
|
1349 err = spEntry->AddPropertyL( *property ); |
|
1350 if ( KErrAlreadyExists == err ) |
|
1351 { |
|
1352 User::LeaveIfError( spEntry->UpdateProperty( |
|
1353 ESubPropertyPresenceSettingsId, iPresenceId ) ); |
|
1354 } |
|
1355 else |
|
1356 { |
|
1357 User::LeaveIfError( err ); |
|
1358 } |
|
1359 } |
|
1360 |
|
1361 // Converged Connection Handler (CCH) Presence Subservice plug-in UID |
|
1362 err = property->SetName( EPropertyPresenceSubServicePluginId ); |
|
1363 property->SetValue( KCCHPresenceSubServicePlugId ); |
|
1364 if ( KErrNone == err ) |
|
1365 { |
|
1366 err = spEntry->AddPropertyL( *property ); |
|
1367 if ( KErrAlreadyExists == err ) |
|
1368 { |
|
1369 User::LeaveIfError( spEntry->UpdateProperty( |
|
1370 EPropertyPresenceSubServicePluginId, |
|
1371 KCCHPresenceSubServicePlugId ) ); |
|
1372 } |
|
1373 else |
|
1374 { |
|
1375 User::LeaveIfError( err ); |
|
1376 } |
|
1377 } |
|
1378 |
|
1379 // *************** |
|
1380 // IM settings |
|
1381 // *************** |
|
1382 // |
|
1383 if ( iImEnabled ) |
|
1384 { |
|
1385 property->SetName( ESubPropertyIMEnabled ); |
|
1386 property->SetValue( EOn ); |
|
1387 err = spEntry->AddPropertyL( *property ); |
|
1388 if ( KErrAlreadyExists == err ) |
|
1389 { |
|
1390 User::LeaveIfError( spEntry->UpdateProperty( |
|
1391 ESubPropertyIMEnabled, EOn ) ); |
|
1392 } |
|
1393 |
|
1394 property->SetName( ESubPropertyIMLaunchUid ); |
|
1395 property->SetValue( KIMLaunchUid ); |
|
1396 err = spEntry->AddPropertyL( *property ); |
|
1397 if ( KErrAlreadyExists == err ) |
|
1398 { |
|
1399 User::LeaveIfError( spEntry->UpdateProperty( |
|
1400 ESubPropertyIMLaunchUid, KIMLaunchUid ) ); |
|
1401 } |
|
1402 |
|
1403 property->SetName( ESubPropertyIMSettingsId ); |
|
1404 // The value only needs to be different from 0, |
|
1405 // no-one actually uses it. |
|
1406 property->SetValue( KIMSettingsId ); |
|
1407 err = spEntry->AddPropertyL( *property ); |
|
1408 if ( KErrAlreadyExists == err ) |
|
1409 { |
|
1410 User::LeaveIfError( spEntry->UpdateProperty( |
|
1411 ESubPropertyIMSettingsId, KIMSettingsId ) ); |
|
1412 } |
|
1413 |
|
1414 property->SetName( EPropertyIMSubServicePluginId ); |
|
1415 property->SetValue( KIMSubServicePluginId ); |
|
1416 err = spEntry->AddPropertyL( *property ); |
|
1417 if ( KErrAlreadyExists == err ) |
|
1418 { |
|
1419 User::LeaveIfError( spEntry->UpdateProperty( |
|
1420 EPropertyIMSubServicePluginId, KIMSubServicePluginId ) ); |
|
1421 } |
|
1422 |
|
1423 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - set IM tonepath" ); |
|
1424 |
|
1425 MVIMPSTSettingsStore* settings = |
|
1426 CVIMPSTSettingsStore::NewLC(); // CS: 1 |
|
1427 |
|
1428 // Set default tone. |
|
1429 TFileName toneFile; |
|
1430 toneFile.Copy( PathInfo::RomRootPath() ); |
|
1431 toneFile.Append( PathInfo::DigitalSoundsPath() ); |
|
1432 toneFile.Append( KDefaultTone ); |
|
1433 User::LeaveIfError( settings->SetL( serviceId, |
|
1434 EServiceToneFileName, toneFile ) ); |
|
1435 // settings |
|
1436 CleanupStack::PopAndDestroy(); // CS: 0 |
|
1437 |
|
1438 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - IM settings set" ); |
|
1439 } |
|
1440 DBG_PRINT( |
|
1441 "CWPVoIPItem::SavingFinalizedL - Presence settings ID set" ); |
|
1442 } |
|
1443 |
|
1444 // AutoAcceptBuddyRequest |
|
1445 if ( KNotSet != iAutoAcceptBuddyRequest ) |
|
1446 { |
|
1447 err = property->SetName( ESubPropertyPresenceRequestPreference ); |
|
1448 property->SetValue( static_cast<TOnOff> ( iAutoAcceptBuddyRequest ) ); |
|
1449 if ( KErrNone == err ) |
|
1450 { |
|
1451 err = spEntry->AddPropertyL( *property ); |
|
1452 if ( KErrAlreadyExists == err ) |
|
1453 { |
|
1454 User::LeaveIfError( spEntry->UpdateProperty( |
|
1455 ESubPropertyPresenceRequestPreference, |
|
1456 static_cast<TOnOff> ( iAutoAcceptBuddyRequest ) ) ); |
|
1457 } |
|
1458 else |
|
1459 { |
|
1460 User::LeaveIfError( err ); |
|
1461 } |
|
1462 } |
|
1463 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1464 AutoAcceptBuddyRequest set" ); |
|
1465 } |
|
1466 |
|
1467 // AutoEnableService |
|
1468 if ( KNotSet != iAutoEnableService ) |
|
1469 { |
|
1470 err = property->SetName( ESubPropertyVoIPEnabled ); |
|
1471 property->SetValue( static_cast<TOnOff>( iAutoEnableService ) ); |
|
1472 if ( KErrNone == err ) |
|
1473 { |
|
1474 err = spEntry->AddPropertyL( *property ); |
|
1475 if ( KErrAlreadyExists == err ) |
|
1476 { |
|
1477 User::LeaveIfError( spEntry->UpdateProperty( |
|
1478 ESubPropertyVoIPEnabled, |
|
1479 static_cast<TOnOff> ( iAutoEnableService ) ) ); |
|
1480 } |
|
1481 else |
|
1482 { |
|
1483 User::LeaveIfError( err ); |
|
1484 } |
|
1485 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1486 voip AutoEnableService set" ); |
|
1487 } |
|
1488 if ( iPresenceIdSet ) |
|
1489 { |
|
1490 err = property->SetName( ESubPropertyPresenceEnabled ); |
|
1491 property->SetValue( |
|
1492 static_cast<TOnOff>( iAutoEnableService ) ); |
|
1493 if ( KErrNone == err ) |
|
1494 { |
|
1495 err = spEntry->AddPropertyL( *property ); |
|
1496 if ( KErrAlreadyExists == err ) |
|
1497 { |
|
1498 User::LeaveIfError( spEntry->UpdateProperty( |
|
1499 ESubPropertyPresenceEnabled, |
|
1500 static_cast<TOnOff> ( iAutoEnableService ) ) ); |
|
1501 } |
|
1502 else |
|
1503 { |
|
1504 User::LeaveIfError( err ); |
|
1505 } |
|
1506 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1507 presence AutoEnableService set" ); |
|
1508 } |
|
1509 |
|
1510 } |
|
1511 if ( iVmbxSipIdSet || ( iSipIdSet && iVmbxSettingsExist ) |
|
1512 && iIPVoiceMailBoxURI->Des().Length() ) |
|
1513 { |
|
1514 err = property->SetName( ESubPropertyVMBXEnabled ); |
|
1515 property->SetValue( static_cast<TOnOff>( iAutoEnableService ) ); |
|
1516 if ( KErrNone == err ) |
|
1517 { |
|
1518 err = spEntry->AddPropertyL( *property ); |
|
1519 if ( KErrAlreadyExists == err ) |
|
1520 { |
|
1521 User::LeaveIfError( spEntry->UpdateProperty( |
|
1522 ESubPropertyVMBXEnabled, |
|
1523 static_cast<TOnOff> ( iAutoEnableService ) ) ); |
|
1524 } |
|
1525 else |
|
1526 { |
|
1527 User::LeaveIfError( err ); |
|
1528 } |
|
1529 } |
|
1530 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1531 vmbx AutoEnableService set" ); |
|
1532 } |
|
1533 |
|
1534 if ( iImEnabled ) |
|
1535 { |
|
1536 err = property->SetName( ESubPropertyIMEnabled ); |
|
1537 property->SetValue( static_cast<TOnOff>( iAutoEnableService ) ); |
|
1538 if ( KErrNone == err ) |
|
1539 { |
|
1540 err = spEntry->AddPropertyL( *property ); |
|
1541 if ( KErrAlreadyExists == err ) |
|
1542 { |
|
1543 User::LeaveIfError( spEntry->UpdateProperty( |
|
1544 ESubPropertyIMEnabled, |
|
1545 static_cast<TOnOff> ( iAutoEnableService ) ) ); |
|
1546 } |
|
1547 else |
|
1548 { |
|
1549 User::LeaveIfError( err ); |
|
1550 } |
|
1551 } |
|
1552 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1553 im AutoEnableService set" ); |
|
1554 } |
|
1555 } |
|
1556 |
|
1557 // SNAP ID |
|
1558 if ( iSnapIdSet && iSipIdSet ) |
|
1559 { |
|
1560 CSIPProfileRegistryObserver* sipObs = |
|
1561 CSIPProfileRegistryObserver::NewLC(); // CS:1 |
|
1562 CSIPManagedProfileRegistry* sipReg = |
|
1563 CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2 |
|
1564 CSIPProfile* sipProf = NULL; |
|
1565 sipProf = sipReg->ProfileL( iSipId ); |
|
1566 CleanupStack::PushL( sipProf ); // CS:3 |
|
1567 CSIPManagedProfile* sipManagedProf = |
|
1568 static_cast<CSIPManagedProfile*>( sipProf ); |
|
1569 CleanupStack::PushL( sipManagedProf ); // CS:4 |
|
1570 sipManagedProf->SetParameter( KSIPSnapId, iSnapId ); |
|
1571 sipManagedProf->SetParameter( KSIPAccessPointId, (TUint32)0 ); |
|
1572 sipReg->SaveL( *sipManagedProf ); |
|
1573 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
|
1574 CleanupStack::Pop( sipProf ); // CS:2 |
|
1575 sipProf = NULL; |
|
1576 // sipReg, sipObs |
|
1577 CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0 |
|
1578 } |
|
1579 else if ( !iSnapIdSet && iSipIdSet ) |
|
1580 { |
|
1581 CSIPProfileRegistryObserver* sipObs = |
|
1582 CSIPProfileRegistryObserver::NewLC(); // CS:1 |
|
1583 CSIPManagedProfileRegistry* sipReg = |
|
1584 CSIPManagedProfileRegistry::NewLC( *sipObs ); // CS:2 |
|
1585 CSIPProfile* sipProf = NULL; |
|
1586 sipProf = sipReg->ProfileL( iSipId ); |
|
1587 CleanupStack::PushL( sipProf ); // CS:3 |
|
1588 CSIPManagedProfile* sipManagedProf = |
|
1589 static_cast<CSIPManagedProfile*>( sipProf ); |
|
1590 CleanupStack::PushL( sipManagedProf ); // CS:4 |
|
1591 |
|
1592 TUint32 snapId( 0 ); |
|
1593 err = sipManagedProf->GetParameter( KSIPSnapId, snapId ); |
|
1594 if ( KErrNone == err ) |
|
1595 { |
|
1596 iSnapId = snapId; |
|
1597 iSnapIdSet = ETrue; |
|
1598 } |
|
1599 CleanupStack::PopAndDestroy( sipManagedProf ); // CS:3 |
|
1600 CleanupStack::Pop( sipProf ); // CS:2 |
|
1601 sipProf = NULL; |
|
1602 // sipReg, sipObs |
|
1603 CleanupStack::PopAndDestroy( 2, sipObs ); // CS:0 |
|
1604 } |
|
1605 |
|
1606 if ( iSnapIdSet ) |
|
1607 { |
|
1608 err = property->SetName( ESubPropertyVoIPPreferredSNAPId ); |
|
1609 property->SetValue( iSnapId ); |
|
1610 if ( KErrNone == err ) |
|
1611 { |
|
1612 err = spEntry->AddPropertyL( *property ); |
|
1613 if ( KErrAlreadyExists == err ) |
|
1614 { |
|
1615 User::LeaveIfError( spEntry->UpdateProperty( |
|
1616 ESubPropertyVoIPPreferredSNAPId, iSnapId ) ); |
|
1617 } |
|
1618 else |
|
1619 { |
|
1620 User::LeaveIfError( err ); |
|
1621 } |
|
1622 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - SNAP ID set" ); |
|
1623 } |
|
1624 } |
|
1625 |
|
1626 // *************** |
|
1627 // IM SNAP ID |
|
1628 // *************** |
|
1629 // |
|
1630 if ( iImEnabled ) |
|
1631 { |
|
1632 property->SetName( ESubPropertyIMPreferredSNAPId ); |
|
1633 err = property->SetValue( iSnapId ); |
|
1634 if ( KErrNone == err ) |
|
1635 { |
|
1636 err = spEntry->AddPropertyL( *property ); |
|
1637 if ( KErrAlreadyExists == err ) |
|
1638 { |
|
1639 User::LeaveIfError( spEntry->UpdateProperty( |
|
1640 ESubPropertyIMPreferredSNAPId, iSnapId ) ); |
|
1641 } |
|
1642 } |
|
1643 } |
|
1644 |
|
1645 User::LeaveIfError( spSettings->UpdateEntryL( *spEntry ) ); |
|
1646 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - \ |
|
1647 Service provider entry updated" ); |
|
1648 |
|
1649 // property, spEntry spSettings, cRCSEProfileEntry, cRCSEProfileRegistry |
|
1650 CleanupStack::PopAndDestroy( 5, cRCSEProfileRegistry ); // CS:0 |
|
1651 iSipIdSet = EFalse; |
|
1652 |
|
1653 DBG_PRINT( "CWPVoIPItem::SavingFinalizedL - end" ); |
|
1654 } |
|
1655 |
|
1656 // --------------------------------------------------------------------------- |
|
1657 // CWPVoIPItem::CheckDuplicatesL |
|
1658 // Checks if duplicate provider and settings name. Renames if same. |
|
1659 // --------------------------------------------------------------------------- |
|
1660 // |
|
1661 TBool CWPVoIPItem::CheckDuplicatesL( |
|
1662 CRCSEProfileEntry& aEntry ) const |
|
1663 { |
|
1664 DBG_PRINT( "CWPVoIPItem::CheckDuplicatesL - begin" ); |
|
1665 CRCSEProfileRegistry *cRCSEProfile = CRCSEProfileRegistry::NewLC(); |
|
1666 |
|
1667 // Array of pointers to all profile entries. |
|
1668 CArrayPtrFlat<CRCSEProfileEntry>* profileEntries = new (ELeave) |
|
1669 CArrayPtrFlat<CRCSEProfileEntry>( 1 ); |
|
1670 TCleanupItem cleanupItem( CWPVoIPItem::CleanupArrayItem, profileEntries ); |
|
1671 CleanupStack::PushL( cleanupItem ); |
|
1672 |
|
1673 // Load profiles to pointerarray. |
|
1674 RArray<TUint32> allIds; |
|
1675 CleanupClosePushL( allIds ); |
|
1676 cRCSEProfile->GetAllIdsL( allIds ); |
|
1677 |
|
1678 for ( TInt counter = 0; counter < allIds.Count(); counter++ ) |
|
1679 { |
|
1680 CRCSEProfileEntry* profile = CRCSEProfileEntry::NewLC(); |
|
1681 cRCSEProfile->FindL( allIds[counter], *profile ); |
|
1682 profileEntries->AppendL( profile ); |
|
1683 CleanupStack::Pop( profile ); |
|
1684 } |
|
1685 CleanupStack::PopAndDestroy( &allIds ); |
|
1686 |
|
1687 // Check and rename duplicate provider. |
|
1688 |
|
1689 TBool isValid( EFalse ); |
|
1690 |
|
1691 HBufC* newProviderName = HBufC::NewLC( KMaxProviderNameLength * KTwo ); |
|
1692 newProviderName->Des().Copy( aEntry.iProviderName ); |
|
1693 |
|
1694 TInt count( profileEntries->Count() ); |
|
1695 |
|
1696 for ( TInt n = 0; n < count; n++ ) |
|
1697 { |
|
1698 const TDesC& existingName = profileEntries->At( n )->iProviderName; |
|
1699 if ( existingName.Compare( aEntry.iProviderName ) == 0 ) |
|
1700 { |
|
1701 TBool isUnique( EFalse ); |
|
1702 |
|
1703 for ( TInt i = 1; !isUnique; i++ ) |
|
1704 { |
|
1705 TBool found( EFalse ); |
|
1706 newProviderName->Des().Copy( aEntry.iProviderName ); |
|
1707 newProviderName->Des().Append( KOpenParenthesis() ); |
|
1708 newProviderName->Des().AppendNum( static_cast<TInt64>( i ) ); |
|
1709 newProviderName->Des().Append( KClosedParenthesis() ); |
|
1710 for ( TInt m = 0; m < count; m++ ) |
|
1711 { |
|
1712 if ( profileEntries->At( m )->iProviderName.Compare( |
|
1713 newProviderName->Des() ) == 0 ) |
|
1714 { |
|
1715 found = ETrue; |
|
1716 } |
|
1717 } |
|
1718 if ( !found ) |
|
1719 { |
|
1720 isUnique = ETrue; |
|
1721 } |
|
1722 } |
|
1723 } |
|
1724 } |
|
1725 |
|
1726 // Change setting only if length is smaller than max length. |
|
1727 if ( newProviderName->Length() < KMaxProviderNameLength ) |
|
1728 { |
|
1729 aEntry.iProviderName.Copy( newProviderName->Des() ); |
|
1730 isValid = ETrue; |
|
1731 } |
|
1732 |
|
1733 // Check and rename also duplicate settingsName. |
|
1734 HBufC* newSettingsName = HBufC::NewLC( KMaxSettingsNameLength * KTwo ); |
|
1735 newSettingsName->Des().Copy( aEntry.iSettingsName ); |
|
1736 isValid = EFalse; |
|
1737 for ( TInt n = 0; n < count; n++ ) |
|
1738 { |
|
1739 const TDesC& existingName = profileEntries->At( n )->iSettingsName; |
|
1740 if ( existingName.Compare( aEntry.iSettingsName ) == 0 ) |
|
1741 { |
|
1742 TBool isUnique( EFalse ); |
|
1743 |
|
1744 for ( TInt i = 1; !isUnique; i++ ) |
|
1745 { |
|
1746 TBool found( EFalse ); |
|
1747 newSettingsName->Des().Copy( aEntry.iSettingsName ); |
|
1748 newSettingsName->Des().Append( KOpenParenthesis() ); |
|
1749 newSettingsName->Des().AppendNum( static_cast<TInt64>( i ) ); |
|
1750 newSettingsName->Des().Append( KClosedParenthesis() ); |
|
1751 for ( TInt m = 0; m < count; m++ ) |
|
1752 { |
|
1753 if ( profileEntries->At( m )->iSettingsName.Compare( |
|
1754 newSettingsName->Des() ) == 0 ) |
|
1755 { |
|
1756 found = ETrue; |
|
1757 } // if |
|
1758 } // for |
|
1759 |
|
1760 if ( !found ) |
|
1761 { |
|
1762 isUnique = ETrue; |
|
1763 } |
|
1764 } // for ( TInt m = 0; m < count; m++ ) |
|
1765 } // if ( existingName.Compare( ... |
|
1766 } // for ( TInt n = 0; n < count; n++ ) |
|
1767 |
|
1768 // Change setting only if length is smaller than max length. |
|
1769 if ( newSettingsName->Length() < KMaxSettingsNameLength ) |
|
1770 { |
|
1771 aEntry.iSettingsName.Copy( newSettingsName->Des() ); |
|
1772 isValid = ETrue; |
|
1773 } |
|
1774 |
|
1775 // newSettingsName, newProviderName, profileEntries, cRCSEProfile |
|
1776 CleanupStack::PopAndDestroy( 4, cRCSEProfile ); |
|
1777 DBG_PRINT( "CWPVoIPItem::CheckDuplicatesL - end" ); |
|
1778 return isValid; |
|
1779 } |
|
1780 |
|
1781 // --------------------------------------------------------------------------- |
|
1782 // void CWPVoIPItem::SetTelephonyPreferenceL |
|
1783 // For setting telephony preference. |
|
1784 // --------------------------------------------------------------------------- |
|
1785 // |
|
1786 void CWPVoIPItem::SetTelephonyPreferenceL ( const TTelephonyPreference& |
|
1787 aTelephonyPreference ) const |
|
1788 { |
|
1789 DBG_PRINT( "CWPVoIPItem::SetTelephonyPreferenceL - begin" ); |
|
1790 // Central Repository for richcall settings |
|
1791 CRepository* rep = CRepository::NewLC( KCRUidRichCallSettings ); |
|
1792 //lint -e{961} No need for else statement here |
|
1793 if ( EPSPreferred == aTelephonyPreference ) |
|
1794 { |
|
1795 rep->Set( KRCSEPreferredTelephony, EPSPreferred ); |
|
1796 } |
|
1797 else if ( ECSPreferred == aTelephonyPreference ) |
|
1798 { |
|
1799 rep->Set( KRCSEPreferredTelephony, ECSPreferred ); |
|
1800 } |
|
1801 |
|
1802 CleanupStack::PopAndDestroy( rep ); |
|
1803 |
|
1804 DBG_PRINT( "CWPVoIPItem::SetTelephonyPreferenceL - end" ); |
|
1805 } |
|
1806 |
|
1807 // --------------------------------------------------------------------------- |
|
1808 // void CWPVoIPItem::AppRef |
|
1809 // --------------------------------------------------------------------------- |
|
1810 // |
|
1811 HBufC8* CWPVoIPItem::AppRef() |
|
1812 { |
|
1813 DBG_PRINT( "CWPVoIPItem::AppRef()" ); |
|
1814 return iAppRef; |
|
1815 } |
|
1816 |
|
1817 // --------------------------------------------------------------------------- |
|
1818 // CWPVoIPItem::GetTerminalTypeL |
|
1819 // Collect terminal type used in SIP User Agent Header. |
|
1820 // --------------------------------------------------------------------------- |
|
1821 // |
|
1822 void CWPVoIPItem::GetTerminalTypeL( |
|
1823 TBuf<KMaxTerminalTypeLength>& aTerminalType ) const |
|
1824 { |
|
1825 DBG_PRINT( "CWPVoIPItem::GetTerminalTypeL - begin" ); |
|
1826 |
|
1827 aTerminalType.Zero(); // Reset before use |
|
1828 |
|
1829 CIpAppPhoneUtils* phoneUtils = CIpAppPhoneUtils::NewLC(); |
|
1830 phoneUtils->GetTerminalTypeL( aTerminalType ); // Gets phone model + type |
|
1831 CleanupStack::PopAndDestroy( phoneUtils ); |
|
1832 |
|
1833 DBG_PRINT( "CWPVoIPItem::GetTerminalTypeL - end" ); |
|
1834 } |
|
1835 |
|
1836 // --------------------------------------------------------------------------- |
|
1837 // CWPVoIPItem::GetWlanMacAddressL |
|
1838 // Gets WLAN MAC address used in SIP User Agent Header (same as *#62209526#). |
|
1839 // --------------------------------------------------------------------------- |
|
1840 // |
|
1841 void CWPVoIPItem::GetWlanMacAddressL( |
|
1842 TBuf<KWlanMacAddressLength>& aMac ) const |
|
1843 { |
|
1844 DBG_PRINT( "CWPVoIPItem::GetWlanMacAddressL - begin" ); |
|
1845 |
|
1846 CIPAppUtilsAddressResolver* resolver = |
|
1847 CIPAppUtilsAddressResolver::NewLC(); |
|
1848 |
|
1849 TBuf8<KWlanMacAddressLength> wlanmac; |
|
1850 _LIT8( KFormat, "-" ); |
|
1851 resolver->GetWlanMACAddress( wlanmac, KFormat ); |
|
1852 // wlanmac buffer contains now the wlan mac address like 00-15-a0-99-10-ec |
|
1853 CleanupStack::PopAndDestroy( resolver ); |
|
1854 aMac.Copy( wlanmac ); |
|
1855 |
|
1856 DBG_PRINT( "CWPVoIPItem::GetWlanMacAddressL - end" ); |
|
1857 } |
|
1858 |
|
1859 // --------------------------------------------------------------------------- |
|
1860 // CWPVoIPItem::GetUserAgentHeaderL |
|
1861 // Gets SIP User Agent Header. |
|
1862 // --------------------------------------------------------------------------- |
|
1863 // |
|
1864 void CWPVoIPItem::GetUserAgentHeaderL( |
|
1865 TBuf8<KUAHLength>& aUserAgentHeader ) const |
|
1866 { |
|
1867 DBG_PRINT( "CWPVoIPItem::GetUserAgentHeaderL - begin" ); |
|
1868 // Create a CRCSEProfileEntry to get default values for User-Agent header |
|
1869 // parameters. |
|
1870 CRCSEProfileEntry* cRCSEProfileEntry = CRCSEProfileEntry::NewLC(); |
|
1871 |
|
1872 aUserAgentHeader.Zero(); // Reset before use |
|
1873 TBuf<KMaxTerminalTypeLength> tempTerminalType; |
|
1874 TBuf<KWlanMacAddressLength> tempWlanMac; |
|
1875 TBuf<KMaxSettingsLength32> tempFreeString; |
|
1876 tempFreeString = UAHString(); |
|
1877 |
|
1878 TInt uahTerminalType = iUAHTerminalType; |
|
1879 TInt uahWlanMac = iUAHWLANMAC; |
|
1880 |
|
1881 if ( KNotSet == iUAHTerminalType ) |
|
1882 { |
|
1883 uahTerminalType = cRCSEProfileEntry->iSIPVoIPUAHTerminalType; |
|
1884 } |
|
1885 |
|
1886 if ( KNotSet == uahWlanMac ) |
|
1887 { |
|
1888 uahWlanMac = cRCSEProfileEntry->iSIPVoIPUAHeaderWLANMAC; |
|
1889 } |
|
1890 |
|
1891 if ( uahTerminalType || uahWlanMac || ( tempFreeString.Length() > 0 ) ) |
|
1892 { |
|
1893 aUserAgentHeader.Append( KUserAgent ); |
|
1894 aUserAgentHeader.Append( KColonMark ); |
|
1895 aUserAgentHeader.Append( KSpaceMark ); |
|
1896 } |
|
1897 |
|
1898 if ( uahTerminalType ) |
|
1899 { |
|
1900 GetTerminalTypeL( tempTerminalType ); |
|
1901 aUserAgentHeader.Append( tempTerminalType ); |
|
1902 aUserAgentHeader.Append( KSpaceMark ); |
|
1903 } |
|
1904 if ( uahWlanMac ) |
|
1905 { |
|
1906 GetWlanMacAddressL( tempWlanMac ); |
|
1907 aUserAgentHeader.Append( tempWlanMac ); |
|
1908 aUserAgentHeader.Append( KSpaceMark ); |
|
1909 } |
|
1910 if ( tempFreeString.Length() > 0 ) |
|
1911 { |
|
1912 aUserAgentHeader.Append( tempFreeString ); |
|
1913 } |
|
1914 CleanupStack::PopAndDestroy( cRCSEProfileEntry ); |
|
1915 DBG_PRINT( "CWPVoIPItem::GetUserAgentHeader - end" ); |
|
1916 } |
|
1917 |
|
1918 // --------------------------------------------------------------------------- |
|
1919 // CWPVoIPItem::CleanupArrayItem |
|
1920 // Cleans up an array. |
|
1921 // --------------------------------------------------------------------------- |
|
1922 // |
|
1923 void CWPVoIPItem::CleanupArrayItem( TAny* aArray ) |
|
1924 { |
|
1925 CArrayPtrFlat<CRCSEProfileEntry>* tempArray = |
|
1926 static_cast<CArrayPtrFlat<CRCSEProfileEntry>*>( aArray ); |
|
1927 if ( tempArray ) |
|
1928 { |
|
1929 tempArray->ResetAndDestroy(); |
|
1930 } |
|
1931 delete tempArray; |
|
1932 } |
|
1933 |
|
1934 // --------------------------------------------------------------------------- |
|
1935 // CWPVoIPItem::AddDefaultCodecsL |
|
1936 // Creates default codecs. |
|
1937 // --------------------------------------------------------------------------- |
|
1938 // |
|
1939 void CWPVoIPItem::AddDefaultCodecsL( CRCSEProfileEntry& aProfileEntry ) |
|
1940 { |
|
1941 DBG_PRINT( "CWPVoIPItem::AddDefaultCodecsL - start" ); |
|
1942 |
|
1943 CRCSEAudioCodecRegistry* audioCodecRegistry = |
|
1944 CRCSEAudioCodecRegistry::NewLC(); |
|
1945 CRCSEAudioCodecEntry* audioCodecEntry = CRCSEAudioCodecEntry::NewLC(); |
|
1946 |
|
1947 TUint32 codecId( KErrNone ); |
|
1948 |
|
1949 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecAMRWB() ); |
|
1950 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1951 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1952 |
|
1953 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecAMR() ); |
|
1954 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1955 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1956 |
|
1957 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecPCMU() ); |
|
1958 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1959 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1960 |
|
1961 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecPCMA() ); |
|
1962 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1963 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1964 |
|
1965 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodeciLBC() ); |
|
1966 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1967 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1968 |
|
1969 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecG729() ); |
|
1970 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1971 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1972 |
|
1973 audioCodecEntry->SetDefaultCodecValueSet( KAudioCodecCN() ); |
|
1974 codecId = audioCodecRegistry->AddL( *audioCodecEntry ); |
|
1975 aProfileEntry.iPreferredCodecs.AppendL( codecId ); |
|
1976 |
|
1977 // audioCodecEntry, audioCodecRegistry |
|
1978 CleanupStack::PopAndDestroy( 2, audioCodecRegistry ); |
|
1979 |
|
1980 DBG_PRINT( "CWPVoIPItem::AddDefaultCodecsL - end" ); |
|
1981 } |
|
1982 |
|
1983 // --------------------------------------------------------------------------- |
|
1984 // CWPVoIPItem::ItemId |
|
1985 // --------------------------------------------------------------------------- |
|
1986 // |
|
1987 TUint32 CWPVoIPItem::ItemId() |
|
1988 { |
|
1989 return iItemId; |
|
1990 } |
|
1991 |
|
1992 // --------------------------------------------------------------------------- |
|
1993 // CWPVoIPItem::EnableIm |
|
1994 // --------------------------------------------------------------------------- |
|
1995 // |
|
1996 void CWPVoIPItem::EnableIm() |
|
1997 { |
|
1998 iImEnabled = ETrue; |
|
1999 } |
|
2000 |
|
2001 // End of File |