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