author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:20:32 +0300 | |
branch | RCL_3 |
changeset 33 | 2989b291cac7 |
parent 28 | d38647835c2e |
permissions | -rw-r--r-- |
28 | 1 |
/* |
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
*/ |
|
17 |
#include <e32std.h> |
|
18 |
#include <escapeutils.h> |
|
19 |
#include <cmmanager.h> |
|
20 |
#include <cmdestination.h> |
|
21 |
#include <cmconnectionmethoddef.h> |
|
22 |
#include <cmpluginwlandef.h> |
|
23 |
||
24 |
#include "scpservicemanager.h" |
|
25 |
#include "scpsettinghandler.h" |
|
26 |
#include "scpservicestorage.h" |
|
27 |
#include "scputility.h" |
|
28 |
#include "scplogger.h" |
|
29 |
#include "scpprofilehandler.h" |
|
30 |
#include "scpservice.h" |
|
31 |
#include "scpsubservice.h" |
|
32 |
#include "scpsipconnection.h" |
|
33 |
#include "scpstatecontainer.h" |
|
34 |
||
35 |
const TInt KUsernameMaxLength = 255; |
|
36 |
const TInt KDomainMaxLength = 255; |
|
37 |
const TInt KTempBufMaxLength = 255; |
|
38 |
||
39 |
#ifdef _DEBUG |
|
40 |
const TInt KDebugInfoMaxLength = 255; |
|
41 |
#endif |
|
42 |
||
43 |
// ----------------------------------------------------------------------------- |
|
44 |
// CScpServiceManager::CScpServiceManager() |
|
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
CScpServiceManager::CScpServiceManager( MCchServiceObserver& aServiceObserver ) : |
|
48 |
iServiceObserver( aServiceObserver ) |
|
49 |
{ |
|
50 |
SCPLOGSTRING( "CScpServiceManager::CScpServiceManager"); |
|
51 |
} |
|
52 |
||
53 |
// ----------------------------------------------------------------------------- |
|
54 |
// CScpServiceManager::NewL |
|
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
CScpServiceManager* CScpServiceManager::NewL( MCchServiceObserver& aServiceObserver ) |
|
58 |
{ |
|
59 |
SCPLOGSTRING( "CScpServiceManager::NewL"); |
|
60 |
||
61 |
CScpServiceManager* self = new ( ELeave ) CScpServiceManager( aServiceObserver ); |
|
62 |
CleanupStack::PushL( self ); |
|
63 |
self->ConstructL(); |
|
64 |
CleanupStack::Pop( self ); |
|
65 |
return self; |
|
66 |
} |
|
67 |
||
68 |
// ----------------------------------------------------------------------------- |
|
69 |
// CScpServiceManager::ConstructL |
|
70 |
// ----------------------------------------------------------------------------- |
|
71 |
// |
|
72 |
void CScpServiceManager::ConstructL() |
|
73 |
{ |
|
74 |
SCPLOGSTRING( "CScpServiceManager::ConstructL"); |
|
75 |
||
76 |
iProfileHandler = CScpProfileHandler::NewL(); |
|
77 |
iSettingHandler = CScpSettingHandler::NewL( *iProfileHandler ); |
|
78 |
iServiceStorage = CScpServiceStorage::NewL( *iSettingHandler ); |
|
79 |
||
80 |
||
81 |
iStateContainer.InitializeL(); |
|
82 |
} |
|
83 |
||
84 |
// ----------------------------------------------------------------------------- |
|
85 |
// CScpServiceManager::~CScpServiceManager |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
CScpServiceManager::~CScpServiceManager() |
|
89 |
{ |
|
90 |
SCPLOGSTRING( "CScpServiceManager::~CScpServiceManager"); |
|
91 |
||
92 |
delete iServiceStorage; |
|
93 |
delete iSettingHandler; |
|
94 |
delete iProfileHandler; |
|
95 |
} |
|
96 |
||
97 |
// ----------------------------------------------------------------------------- |
|
98 |
// CScpServiceManager::GetServiceL |
|
99 |
// ----------------------------------------------------------------------------- |
|
100 |
// |
|
101 |
CScpService* CScpServiceManager::GetServiceL( TUint aServiceId, |
|
102 |
TCCHSubserviceType aSubServiceType ) |
|
103 |
{ |
|
104 |
SCPLOGSTRING2( "CScpServiceManager::GetService: %i", aServiceId ); |
|
105 |
||
106 |
CScpService* service( NULL ); |
|
107 |
||
108 |
if( iSettingHandler->ServiceExistsL( aServiceId ) ) |
|
109 |
{ |
|
110 |
service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
111 |
||
112 |
if( service ) |
|
113 |
{ |
|
114 |
TRAPD( result, iSettingHandler->UpdateSettingsL( *service, aSubServiceType ) ); |
|
115 |
||
116 |
if( result != KErrNone ) |
|
117 |
{ |
|
118 |
#ifndef SCP_UNIT_TEST |
|
119 |
__ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrGeneral ) ); |
|
120 |
#endif |
|
121 |
service = NULL; |
|
122 |
} |
|
123 |
if ( KErrNoMemory == result ) |
|
124 |
{ |
|
125 |
User::Leave( KErrNoMemory ); |
|
126 |
} |
|
127 |
} |
|
128 |
} |
|
129 |
||
130 |
return service; |
|
131 |
} |
|
132 |
||
133 |
// ----------------------------------------------------------------------------- |
|
134 |
// CScpServiceManager::CreateServiceL |
|
135 |
// ----------------------------------------------------------------------------- |
|
136 |
// |
|
137 |
CScpService* CScpServiceManager::CreateServiceL( TUint aServiceId, |
|
138 |
TCCHSubserviceType aSubServiceType ) |
|
139 |
{ |
|
140 |
SCPLOGSTRING2( "CScpServiceManager::CreateServiceL: %i", aServiceId ); |
|
141 |
||
142 |
if( !iSettingHandler->ServiceExistsL( aServiceId ) ) |
|
143 |
{ |
|
144 |
User::Leave( KErrNotFound ); |
|
145 |
} |
|
146 |
||
147 |
// Check if it is already available |
|
148 |
CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
149 |
||
150 |
if( !service ) |
|
151 |
{ |
|
152 |
CScpService& createdService = |
|
153 |
iServiceStorage->CreateServiceL( aServiceId, |
|
154 |
*iProfileHandler, |
|
155 |
iServiceObserver ); |
|
156 |
||
157 |
service = &createdService; |
|
158 |
||
159 |
TRAPD( result, iSettingHandler->UpdateSettingsL( *service, aSubServiceType ) ); |
|
160 |
||
161 |
if( result != KErrNone ) |
|
162 |
{ |
|
163 |
// Remove the service if something went wrong |
|
164 |
iServiceStorage->RemoveService( service->Id() ); |
|
165 |
User::Leave( result ); |
|
166 |
} |
|
167 |
} |
|
168 |
else |
|
169 |
{ |
|
170 |
#ifndef SCP_UNIT_TEST |
|
171 |
__ASSERT_DEBUG( EFalse, User::Panic( KNullDesC, KErrAlreadyExists ) ); |
|
172 |
#endif |
|
173 |
} |
|
174 |
||
175 |
return service; |
|
176 |
} |
|
177 |
||
178 |
// ----------------------------------------------------------------------------- |
|
179 |
// CScpServiceManager::EnableServiceL |
|
180 |
// ----------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
void CScpServiceManager::EnableServiceL( TUint aServiceId, |
|
183 |
TCCHSubserviceType aSubServiceType ) |
|
184 |
{ |
|
185 |
SCPLOGSTRING2( "CScpServiceManager::EnableServiceL service:%i", aServiceId ); |
|
186 |
SCPLOGSTRING2( "CScpServiceManager::EnableServiceL type:%i", aSubServiceType ); |
|
187 |
__ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) ); |
|
188 |
||
189 |
CheckRestrictedConnectionsL( aServiceId ); |
|
190 |
||
191 |
CScpService* service = GetServiceL( aServiceId, aSubServiceType ); |
|
192 |
||
193 |
if( !service ) |
|
194 |
{ |
|
195 |
service = CreateServiceL( aServiceId, aSubServiceType ); |
|
196 |
} |
|
197 |
||
198 |
RArray< TInt > subServiceIds; |
|
199 |
CleanupClosePushL( subServiceIds ); |
|
200 |
service->GetSubServiceIds( subServiceIds ); |
|
201 |
||
202 |
for( TInt i=0 ;i<subServiceIds.Count(); i++ ) |
|
203 |
{ |
|
204 |
CScpSubService* subService = |
|
205 |
service->GetSubService( subServiceIds[ i ] ); |
|
206 |
||
207 |
if( subService ) |
|
208 |
{ |
|
209 |
SCPLOGSTRING2( "Subservice's type: %d", subService->SubServiceType() ); |
|
210 |
||
211 |
// Check is VoIP supported |
|
212 |
if ( !iSettingHandler->IsVoIPSupported() && |
|
213 |
ECCHVoIPSub == subService->SubServiceType() ) |
|
214 |
{ |
|
215 |
SCPLOGSTRING( "No support for VoIP" ); |
|
216 |
subService = NULL; |
|
217 |
} |
|
218 |
||
219 |
if ( subService && |
|
220 |
( aSubServiceType == subService->SubServiceType() || |
|
221 |
ECCHUnknown == aSubServiceType ) ) |
|
222 |
{ |
|
223 |
UpdateProfileValuesL( aServiceId, aSubServiceType ); |
|
224 |
subService->EnableL(); |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
||
229 |
CleanupStack::PopAndDestroy( &subServiceIds ); |
|
230 |
||
231 |
SCPLOGSTRING( "CScpServiceManager::EnableServiceL out" ); |
|
232 |
} |
|
233 |
||
234 |
// ----------------------------------------------------------------------------- |
|
235 |
// CScpServiceManager::EnableServiceL |
|
236 |
// ----------------------------------------------------------------------------- |
|
237 |
// |
|
238 |
void CScpServiceManager::EnableServiceL( TUint aServiceId, |
|
239 |
TCCHSubserviceType aSubServiceType, |
|
240 |
TUint /*aIapId*/ ) |
|
241 |
{ |
|
242 |
// : Change sip profiles IAP settings, but |
|
243 |
// If SNAP != 0 add the IAP to SNAP (CommsDB) |
|
244 |
EnableServiceL( aServiceId, aSubServiceType ); |
|
245 |
} |
|
246 |
||
247 |
// ----------------------------------------------------------------------------- |
|
248 |
// CScpServiceManager::DisableServiceL |
|
249 |
// ----------------------------------------------------------------------------- |
|
250 |
// |
|
251 |
void CScpServiceManager::DisableServiceL( TUint aServiceId, |
|
252 |
TCCHSubserviceType aSubServiceType ) |
|
253 |
{ |
|
254 |
SCPLOGSTRING2( "CScpServiceManager::DisableService service:%i", aServiceId ); |
|
255 |
__ASSERT_DEBUG( aServiceId > 0, User::Panic( KNullDesC, KErrNotFound ) ); |
|
256 |
||
257 |
CScpService* service = GetServiceL( aServiceId, aSubServiceType ); |
|
258 |
if( !service ) |
|
259 |
{ |
|
260 |
service = CreateServiceL( aServiceId, aSubServiceType ); |
|
261 |
} |
|
262 |
||
263 |
RArray< TInt > subServiceIds; |
|
264 |
CleanupClosePushL( subServiceIds ); |
|
265 |
service->GetSubServiceIds( subServiceIds ); |
|
266 |
||
267 |
if( subServiceIds.Count() == 0 ) |
|
268 |
{ |
|
269 |
// Nothing to disable |
|
270 |
User::Leave( KErrNotFound ); |
|
271 |
} |
|
272 |
||
273 |
TBool atLeastOneDisableSucceeded = EFalse; |
|
274 |
||
275 |
for( TInt i=0 ;i<subServiceIds.Count(); i++ ) |
|
276 |
{ |
|
277 |
CScpSubService* subService = service->GetSubService( subServiceIds[ i ] ); |
|
278 |
if( subService && ( aSubServiceType == subService->SubServiceType() || |
|
279 |
aSubServiceType == ECCHUnknown ) ) |
|
280 |
{ |
|
281 |
TInt result = subService->Disable(); |
|
282 |
if( result == KErrNone ) |
|
283 |
{ |
|
284 |
atLeastOneDisableSucceeded = ETrue; |
|
285 |
} |
|
286 |
} |
|
287 |
} |
|
288 |
||
289 |
if( !atLeastOneDisableSucceeded ) |
|
290 |
{ |
|
291 |
User::Leave( KErrNotSupported ); |
|
292 |
} |
|
293 |
||
294 |
CleanupStack::PopAndDestroy( &subServiceIds ); |
|
295 |
||
296 |
// After the disabling there might be some cleaning to do |
|
297 |
iServiceStorage->RemoveDisabledServices(); |
|
298 |
} |
|
299 |
||
300 |
// ----------------------------------------------------------------------------- |
|
301 |
// CScpServiceManager::IsAvailableL |
|
302 |
// ----------------------------------------------------------------------------- |
|
303 |
// |
|
304 |
TBool CScpServiceManager::IsAvailableL( TUint /*aServiceId*/, |
|
305 |
TCCHSubserviceType /*a*/, |
|
306 |
const RArray<TUint32>& /*aIapIdArray*/ ) const |
|
307 |
{ |
|
308 |
SCPLOGSTRING( "CScpServiceManager::IsAvailableL" ); |
|
309 |
// : |
|
310 |
return ETrue; |
|
311 |
} |
|
312 |
||
313 |
// ----------------------------------------------------------------------------- |
|
314 |
// CScpServiceManager::GetServiceState |
|
315 |
// ----------------------------------------------------------------------------- |
|
316 |
// |
|
317 |
TInt CScpServiceManager::GetServiceState( TUint aServiceId, |
|
318 |
TCCHSubserviceType aSubServiceType, |
|
319 |
TCCHSubserviceState& aState ) const |
|
320 |
{ |
|
321 |
SCPLOGSTRING2( "CScpServiceManager::GetServiceState service:%i", aServiceId ); |
|
322 |
||
323 |
TInt result( KErrNone ); |
|
324 |
aState = ECCHDisabled; |
|
325 |
||
326 |
CScpServiceManager* self = const_cast<CScpServiceManager*>(this); |
|
327 |
CScpService* service = NULL; |
|
328 |
TRAPD( err, service = self->GetServiceL( aServiceId, aSubServiceType ) ); |
|
329 |
if ( KErrNoMemory == err ) |
|
330 |
{ |
|
331 |
return err; |
|
332 |
} |
|
333 |
||
334 |
if( service ) |
|
335 |
{ |
|
336 |
result = service->State( aSubServiceType, aState ); |
|
337 |
} |
|
338 |
else |
|
339 |
{ |
|
340 |
TRAP( result, service = CreateTemporaryServiceL( aServiceId, aSubServiceType ) ); |
|
341 |
||
342 |
if( result == KErrNone && service ) |
|
343 |
{ |
|
344 |
result = service->State( aSubServiceType, aState ); |
|
345 |
delete service; |
|
346 |
} |
|
347 |
} |
|
348 |
||
349 |
return result; |
|
350 |
} |
|
351 |
||
352 |
// ----------------------------------------------------------------------------- |
|
353 |
// CScpServiceManager::GetServiceNetworkInfo |
|
354 |
// ----------------------------------------------------------------------------- |
|
355 |
// |
|
356 |
TInt CScpServiceManager::GetServiceNetworkInfo( TUint aServiceId, |
|
357 |
TCCHSubserviceType aSubServiceType, |
|
358 |
TUint32& aSnapId, |
|
359 |
TUint32& aIapId, |
|
360 |
TBool& aSnapLocked, |
|
361 |
TBool& aPasswordSet ) const |
|
362 |
{ |
|
363 |
SCPLOGSTRING( "CScpServiceManager::GetServiceNetworkInfo" ); |
|
364 |
||
365 |
// Get service network info |
|
366 |
TRAPD( ret, GetServiceNetworkInfoL( aServiceId, |
|
367 |
aSubServiceType, |
|
368 |
aSnapId, |
|
369 |
aIapId, |
|
370 |
aSnapLocked, |
|
371 |
aPasswordSet) ); |
|
372 |
||
373 |
return ret; |
|
374 |
} |
|
375 |
||
376 |
// ----------------------------------------------------------------------------- |
|
377 |
// CScpServiceManager::SetSnapId |
|
378 |
// ----------------------------------------------------------------------------- |
|
379 |
// |
|
380 |
TInt CScpServiceManager::SetSnapId( TUint aServiceId, |
|
381 |
TCCHSubserviceType aSubServiceType, |
|
382 |
const TUint aSnapId ) |
|
383 |
{ |
|
384 |
SCPLOGSTRING4( "CScpServiceManager::SetSnapId service id: %d type: %d snap: %d", |
|
385 |
aServiceId, aSubServiceType, aSnapId ); |
|
386 |
||
387 |
return SetAccessPointId( aServiceId, aSubServiceType, EScpSnap, aSnapId ); |
|
388 |
} |
|
389 |
||
390 |
// ----------------------------------------------------------------------------- |
|
391 |
// CScpServiceManager::SetIapId |
|
392 |
// ----------------------------------------------------------------------------- |
|
393 |
// |
|
394 |
TInt CScpServiceManager::SetIapId( TUint aServiceId, |
|
395 |
TCCHSubserviceType aSubServiceType, |
|
396 |
TUint aIapId ) |
|
397 |
{ |
|
398 |
SCPLOGSTRING4( "CScpServiceManager::SetIapId service id: %d type: %d iap: %d", |
|
399 |
aServiceId, aSubServiceType, aIapId ); |
|
400 |
||
401 |
return SetAccessPointId( aServiceId, aSubServiceType, EScpIap, aIapId ); |
|
402 |
} |
|
403 |
||
404 |
// ----------------------------------------------------------------------------- |
|
405 |
// CScpServiceManager::SetAccessPointId |
|
406 |
// ----------------------------------------------------------------------------- |
|
407 |
// |
|
408 |
TInt CScpServiceManager::SetAccessPointId( TUint aServiceId, |
|
409 |
TCCHSubserviceType aSubServiceType, |
|
410 |
TScpAccessPointType aAccessPointType, |
|
411 |
TInt aAccessPointId ) |
|
412 |
{ |
|
413 |
SCPLOGSTRING4( "CScpServiceManager[0x%x]::SetAccessPointId: type: %d id: %d", |
|
414 |
this, aSubServiceType, aAccessPointId ); |
|
415 |
||
416 |
TBool serviceCreated = EFalse; |
|
417 |
TInt result = KErrNone; |
|
418 |
||
419 |
CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
420 |
||
421 |
if( !service ) |
|
422 |
{ |
|
423 |
TRAP( result, service = CreateTemporaryServiceL( aServiceId, |
|
424 |
ECCHUnknown ) ); |
|
425 |
||
426 |
if( result == KErrNone ) |
|
427 |
{ |
|
428 |
serviceCreated = ETrue; |
|
429 |
} |
|
430 |
} |
|
431 |
||
432 |
if( result == KErrNone ) |
|
433 |
{ |
|
434 |
result = service->SetAccessPointId( aSubServiceType, |
|
435 |
aAccessPointType, |
|
436 |
aAccessPointId ); |
|
437 |
} |
|
438 |
||
439 |
if( serviceCreated ) |
|
440 |
{ |
|
441 |
delete service; |
|
442 |
} |
|
443 |
||
444 |
return result; |
|
445 |
} |
|
446 |
||
447 |
// ----------------------------------------------------------------------------- |
|
448 |
// CScpServiceManager::CreateTemporaryServiceL |
|
449 |
// ----------------------------------------------------------------------------- |
|
450 |
// |
|
451 |
CScpService* CScpServiceManager::CreateTemporaryServiceL( TInt aServiceId, |
|
452 |
TCCHSubserviceType aSubServiceType ) const |
|
453 |
{ |
|
454 |
SCPLOGSTRING3( "CScpServiceManager::CreateTemporaryServiceL service id: %d type: %d", |
|
455 |
aServiceId, |
|
456 |
aSubServiceType ); |
|
457 |
||
458 |
// Create a temporary service |
|
459 |
CScpService* service = CScpService::NewL( aServiceId, |
|
460 |
aSubServiceType, |
|
461 |
*iProfileHandler, |
|
462 |
*iServiceStorage, |
|
463 |
iServiceObserver ); |
|
464 |
||
465 |
CleanupStack::PushL( service ); |
|
466 |
||
467 |
service->SetServiceId( aServiceId ); |
|
468 |
||
469 |
iSettingHandler->UpdateSettingsL( *service, aSubServiceType ); |
|
470 |
||
471 |
CleanupStack::Pop( service ); |
|
472 |
||
473 |
return service; |
|
474 |
} |
|
475 |
||
476 |
// ----------------------------------------------------------------------------- |
|
477 |
// CScpServiceManager::GetServiceInfoL |
|
478 |
// ----------------------------------------------------------------------------- |
|
479 |
// |
|
480 |
void CScpServiceManager::GetServiceInfoL( TUint aServiceId, |
|
481 |
TCCHSubserviceType aSubServiceType, |
|
482 |
RBuf& aBuffer ) const |
|
483 |
{ |
|
484 |
SCPLOGSTRING3( "CScpServiceManager::GetServiceInfoL service id: %d type: %d", |
|
485 |
aServiceId, aSubServiceType ); |
|
486 |
||
487 |
// Info request about the state of SCP for debugging purposes |
|
488 |
#ifdef _DEBUG |
|
489 |
||
490 |
TInt infoCode = 0xAAA; |
|
491 |
if( aServiceId == infoCode ) |
|
492 |
{ |
|
493 |
aBuffer.Close(); |
|
494 |
HBufC* buf = HBufC::NewL( KDebugInfoMaxLength ); |
|
495 |
TPtr ptr = buf->Des(); |
|
496 |
||
497 |
iServiceStorage->GetDebugInfo( ptr ); |
|
498 |
iProfileHandler->GetDebugInfo( ptr ); |
|
499 |
||
500 |
aBuffer.Assign( buf ); |
|
501 |
||
502 |
return; |
|
503 |
} |
|
504 |
#endif |
|
505 |
||
506 |
TBool sipConnectionCreated( EFalse ); |
|
507 |
||
508 |
CScpSipConnection* sipConnection = GetSipConnectionL( aServiceId, |
|
509 |
aSubServiceType, |
|
510 |
sipConnectionCreated ); |
|
511 |
||
512 |
if( sipConnectionCreated ) |
|
513 |
{ |
|
514 |
CleanupStack::PushL( sipConnection ); |
|
515 |
} |
|
516 |
||
517 |
TBuf8<KUsernameMaxLength> username; |
|
518 |
TBuf8<KDomainMaxLength> domain; |
|
519 |
TBuf16<KTempBufMaxLength> tempBuf; |
|
520 |
||
521 |
User::LeaveIfError( sipConnection->GetUsername( username ) ); |
|
522 |
User::LeaveIfError( sipConnection->GetDomain( domain ) ); |
|
523 |
||
524 |
_LIT16( KUsername, "username="); |
|
525 |
_LIT16( KDomain, "domain="); |
|
526 |
_LIT16( KSpace, " "); |
|
527 |
||
528 |
HBufC* buffer = HBufC::NewL( KUsername().Length() + |
|
529 |
KDomain().Length() + |
|
530 |
( KSpace().Length() * 2) + |
|
531 |
username.Length() + |
|
532 |
domain.Length() ); |
|
533 |
||
534 |
buffer->Des().Copy( KUsername ); |
|
535 |
tempBuf.Copy( username ); |
|
536 |
buffer->Des().Append( tempBuf ); |
|
537 |
buffer->Des().Append( KSpace ); |
|
538 |
buffer->Des().Append( KDomain ); |
|
539 |
tempBuf.Copy( domain ); |
|
540 |
buffer->Des().Append( tempBuf ); |
|
541 |
buffer->Des().Append( KSpace ); |
|
542 |
||
543 |
aBuffer.Assign( buffer ); |
|
544 |
||
545 |
if( sipConnectionCreated ) |
|
546 |
{ |
|
547 |
CleanupStack::PopAndDestroy( sipConnection ); |
|
548 |
} |
|
549 |
||
550 |
SCPLOGSTRING2( "Result: %S", &aBuffer ); |
|
551 |
} |
|
552 |
||
553 |
// ----------------------------------------------------------------------------- |
|
554 |
// CScpServiceManager::GetSipConnectionL |
|
555 |
// ----------------------------------------------------------------------------- |
|
556 |
// |
|
557 |
CScpSipConnection* CScpServiceManager::GetSipConnectionL( |
|
558 |
TUint aServiceId, |
|
559 |
TCCHSubserviceType aSubServiceType, |
|
560 |
TBool& aConnectionCreated ) const |
|
561 |
{ |
|
562 |
SCPLOGSTRING2( "CScpServiceManager::GetSipConnectionL service:%i", |
|
563 |
aServiceId ); |
|
564 |
||
565 |
CScpSipConnection* sipConnection( NULL ); |
|
566 |
aConnectionCreated = EFalse; |
|
567 |
TUint32 profileId( 0 ); |
|
568 |
||
569 |
// Get SIP profile for service |
|
570 |
iSettingHandler->GetSipProfileIdByTypeL( aServiceId, |
|
571 |
aSubServiceType, |
|
572 |
profileId ); |
|
573 |
||
574 |
if( profileId != 0 ) |
|
575 |
{ |
|
576 |
if( iProfileHandler->SipConnectionExists( profileId ) ) |
|
577 |
{ |
|
578 |
sipConnection = iProfileHandler->GetSipConnection( profileId ); |
|
579 |
} |
|
580 |
else |
|
581 |
{ |
|
582 |
if( iProfileHandler->ProfileExists( profileId ) ) |
|
583 |
{ |
|
584 |
sipConnection = iProfileHandler->CreateSipConnectionL( profileId ); |
|
585 |
aConnectionCreated = ETrue; |
|
586 |
} |
|
587 |
} |
|
588 |
} |
|
589 |
||
590 |
if( !sipConnection ) |
|
591 |
{ |
|
592 |
User::Leave( KErrNotFound ); |
|
593 |
} |
|
594 |
||
595 |
return sipConnection; |
|
596 |
} |
|
597 |
||
598 |
// ----------------------------------------------------------------------------- |
|
599 |
// CScpServiceManager::GetServiceNetworkInfoL |
|
600 |
// ----------------------------------------------------------------------------- |
|
601 |
// |
|
602 |
void CScpServiceManager::GetServiceNetworkInfoL( TUint aServiceId, |
|
603 |
TCCHSubserviceType aSubServiceType, |
|
604 |
TUint32& aSnapId, |
|
605 |
TUint32& aIapId, |
|
606 |
TBool& aSnapLocked, |
|
607 |
TBool& aPasswordSet ) const |
|
608 |
{ |
|
609 |
SCPLOGSTRING2( "CScpServiceManager::GetServiceNetworkInfoL service:%i", |
|
610 |
aServiceId ); |
|
611 |
__ASSERT_DEBUG( (TInt)aServiceId > KErrNotFound, User::Panic( KNullDesC, KErrGeneral ) ); |
|
612 |
||
613 |
TBool serviceCreated = EFalse; |
|
614 |
||
615 |
CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
616 |
||
617 |
if( !service ) |
|
618 |
{ |
|
619 |
service = CreateTemporaryServiceL( aServiceId, ECCHUnknown ); |
|
620 |
||
621 |
serviceCreated = ETrue; |
|
622 |
CleanupStack::PushL( service ); |
|
623 |
} |
|
624 |
||
625 |
if( aSubServiceType == ECCHUnknown && |
|
626 |
service->SubServicesContainSameSipProfile() == EFalse ) |
|
627 |
{ |
|
628 |
// We can't return any valid snap/iap values if different |
|
629 |
// sip profiles are in use |
|
630 |
User::Leave( KErrNotSupported ); |
|
631 |
} |
|
632 |
||
633 |
TBool sipConnectionCreated( EFalse ); |
|
634 |
CScpSipConnection* sipConnection = GetSipConnectionL( aServiceId, |
|
635 |
aSubServiceType, |
|
636 |
sipConnectionCreated ); |
|
637 |
||
638 |
TInt result = sipConnection->GetIap( aIapId ); |
|
639 |
if( result != KErrNone ) |
|
640 |
{ |
|
641 |
aIapId = 0; |
|
642 |
} |
|
643 |
||
644 |
result = sipConnection->GetSnap( aSnapId ); |
|
645 |
if( result != KErrNone ) |
|
646 |
{ |
|
647 |
aSnapId = 0; |
|
648 |
} |
|
649 |
||
650 |
aPasswordSet = sipConnection->IsPasswordSet(); |
|
651 |
||
652 |
if( sipConnectionCreated ) |
|
653 |
{ |
|
654 |
delete sipConnection; |
|
655 |
} |
|
656 |
||
657 |
// Decide if snap is locked |
|
658 |
aSnapLocked = ETrue; |
|
659 |
||
660 |
if( aSubServiceType == ECCHUnknown || |
|
661 |
aSubServiceType == ECCHVoIPSub ) |
|
662 |
{ |
|
663 |
aSnapLocked = EFalse; |
|
664 |
} |
|
665 |
else |
|
666 |
{ |
|
667 |
CScpSubService* voipSubService = service->GetSubServiceByType( ECCHVoIPSub ); |
|
668 |
if( voipSubService ) |
|
669 |
{ |
|
670 |
TInt sipProfileId = voipSubService->SipProfileId(); |
|
671 |
||
672 |
CScpSubService* subService = service->GetSubServiceByType( aSubServiceType ); |
|
673 |
||
674 |
if( subService ) |
|
675 |
{ |
|
676 |
// If profiles are same the snap can't be changed |
|
677 |
if( subService->SipProfileId() != sipProfileId ) |
|
678 |
{ |
|
679 |
aSnapLocked = EFalse; |
|
680 |
} |
|
681 |
} |
|
682 |
else |
|
683 |
{ |
|
684 |
User::Leave( KErrNotFound ); |
|
685 |
} |
|
686 |
} |
|
687 |
else |
|
688 |
{ |
|
689 |
aSnapLocked = EFalse; |
|
690 |
} |
|
691 |
} |
|
692 |
||
693 |
if( serviceCreated ) |
|
694 |
{ |
|
695 |
CleanupStack::PopAndDestroy( service ); |
|
696 |
} |
|
697 |
||
698 |
SCPLOGSTRING2( "CScpServiceManager::ServiceNetworkInfo snap:%i", aSnapId ); |
|
699 |
SCPLOGSTRING2( "CScpServiceManager::ServiceNetworkInfo iap:%i", aIapId ); |
|
700 |
} |
|
701 |
||
702 |
// ----------------------------------------------------------------------------- |
|
703 |
// CScpServiceManager::ReserveService |
|
704 |
// ----------------------------------------------------------------------------- |
|
705 |
// |
|
706 |
TInt CScpServiceManager::SetServiceReserved( TBool aReserved, |
|
707 |
TUint aServiceId, |
|
708 |
TCCHSubserviceType aSubServiceType ) |
|
709 |
{ |
|
710 |
SCPLOGSTRING4( "CScpServiceManager::SetServiceReserved: %d service: %d type: %d", |
|
711 |
aReserved, aServiceId, aSubServiceType ); |
|
712 |
||
713 |
TInt result = KErrNone; |
|
714 |
||
715 |
CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
716 |
||
717 |
if( service ) |
|
718 |
{ |
|
719 |
result = service->SetReserved( aReserved, aSubServiceType ); |
|
720 |
} |
|
721 |
else |
|
722 |
{ |
|
723 |
result = KErrNotFound; |
|
724 |
} |
|
725 |
||
726 |
return result; |
|
727 |
} |
|
728 |
||
729 |
// ----------------------------------------------------------------------------- |
|
730 |
// CScpServiceManager::IsReserved |
|
731 |
// ----------------------------------------------------------------------------- |
|
732 |
// |
|
733 |
TInt CScpServiceManager::IsReserved( TUint aServiceId, |
|
734 |
TCCHSubserviceType aSubServiceType ) const |
|
735 |
{ |
|
736 |
SCPLOGSTRING3( "CScpServiceManager::IsReserved service: %d type: %d", |
|
737 |
aServiceId, aSubServiceType ); |
|
738 |
||
739 |
TBool result = EFalse; |
|
740 |
||
741 |
CScpService* service = iServiceStorage->GetServiceByServiceId( aServiceId ); |
|
742 |
||
743 |
if( service ) |
|
744 |
{ |
|
745 |
result = service->IsReserved( aSubServiceType ); |
|
746 |
} |
|
747 |
||
748 |
return result; |
|
749 |
} |
|
750 |
||
751 |
// ----------------------------------------------------------------------------- |
|
752 |
// CScpServiceManager::UpdateProfileValuesL |
|
753 |
// ----------------------------------------------------------------------------- |
|
754 |
// |
|
755 |
void CScpServiceManager::UpdateProfileValuesL( |
|
756 |
TUint aServiceId, |
|
757 |
TCCHSubserviceType aSubServiceType ) const |
|
758 |
{ |
|
759 |
TUint32 sipId( KErrNone ); |
|
760 |
iSettingHandler->GetSipProfileIdByTypeL( aServiceId, aSubServiceType, sipId ); |
|
761 |
iProfileHandler->UpdateSipProfileL( sipId, |
|
762 |
iSettingHandler->IsUahTerminalTypeDefinedL( aServiceId ), |
|
763 |
iSettingHandler->IsUahWLANMacDefinedL( aServiceId ), |
|
764 |
iSettingHandler->UahStringLengthL( aServiceId ) ); |
|
765 |
} |
|
766 |
||
767 |
// ----------------------------------------------------------------------------- |
|
768 |
// CScpServiceManager::GetConnectionParameter |
|
769 |
// ----------------------------------------------------------------------------- |
|
770 |
// |
|
771 |
void CScpServiceManager::GetConnectionParameterL( |
|
772 |
const TServiceSelection& /*aServiceSelection*/, |
|
773 |
TCchConnectionParameter /*aParameter*/, |
|
774 |
TInt& /*aValue*/ ) const |
|
775 |
{ |
|
776 |
SCPLOGSTRING( "CScpServiceManager::GetConnectionParameter (int return)\ |
|
777 |
Not supported yet. GetServiceNetworkInfoL is used at the moment." ); |
|
778 |
User::Leave( KErrNotSupported ); |
|
779 |
} |
|
780 |
||
781 |
// ----------------------------------------------------------------------------- |
|
782 |
// CScpServiceManager::GetConnectionParameter |
|
783 |
// ----------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
void CScpServiceManager::GetConnectionParameterL( |
|
786 |
const TServiceSelection& aServiceSelection, |
|
787 |
TCchConnectionParameter aParameter, |
|
788 |
RBuf& aValue ) const |
|
789 |
{ |
|
790 |
SCPLOGSTRING3( "CScpServiceManager::GetConnectionParameter (TBuf return) service id: %d type: %d", |
|
791 |
aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
792 |
||
793 |
// check supported get values here, to avoid unnecessary object creation |
|
794 |
if( aParameter!=ECchUsername ) |
|
795 |
{ |
|
796 |
SCPLOGSTRING2( "CScpServiceManager::GetConnectionParameter: not supported parameter:%d", aParameter ); |
|
797 |
User::Leave(KErrArgument ); |
|
798 |
} |
|
799 |
||
800 |
TBool sipConnectionCreated( EFalse ); |
|
801 |
||
802 |
CScpSipConnection* sipConnection = GetSipConnectionL( |
|
803 |
aServiceSelection.iServiceId, |
|
804 |
aServiceSelection.iType, |
|
805 |
sipConnectionCreated ); |
|
806 |
if( sipConnectionCreated ) |
|
807 |
{ |
|
808 |
CleanupStack::PushL( sipConnection ); |
|
809 |
} |
|
810 |
||
811 |
||
812 |
if( aParameter==ECchUsername ) |
|
813 |
{ |
|
814 |
TBuf16<KTempBufMaxLength> tempBuf; |
|
815 |
TBuf8<KUsernameMaxLength> username; |
|
816 |
||
817 |
if( sipConnection->GetUsername( username ) == KErrNone ) |
|
818 |
{ |
|
819 |
// Decode encoded username (spaces to %20). |
|
820 |
HBufC8* decodedUsername = EscapeUtils::EscapeDecodeL( username ); |
|
821 |
CleanupStack::PushL( decodedUsername ); |
|
822 |
||
823 |
HBufC* userName16 = |
|
824 |
EscapeUtils::ConvertToUnicodeFromUtf8L( decodedUsername->Des() ); |
|
825 |
||
826 |
CleanupStack::PopAndDestroy( decodedUsername ); |
|
827 |
||
828 |
if ( userName16 ) |
|
829 |
{ |
|
830 |
aValue.Copy( userName16->Des() ); |
|
831 |
delete userName16; |
|
832 |
userName16 = NULL; |
|
833 |
} |
|
834 |
else |
|
835 |
{ |
|
836 |
aValue.Copy( KNullDesC ); |
|
837 |
} |
|
838 |
} |
|
839 |
} |
|
840 |
||
841 |
if( sipConnectionCreated ) |
|
842 |
{ |
|
843 |
CleanupStack::PopAndDestroy( sipConnection ); |
|
844 |
} |
|
845 |
||
846 |
SCPLOGSTRING2( "Username: %S", &aValue ); |
|
847 |
} |
|
848 |
||
849 |
// ----------------------------------------------------------------------------- |
|
850 |
// CScpServiceManager::SetConnectionParameter |
|
851 |
// ----------------------------------------------------------------------------- |
|
852 |
// |
|
853 |
void CScpServiceManager::SetConnectionParameterL( |
|
854 |
const TServiceSelection& /*aServiceSelection*/, |
|
855 |
TCchConnectionParameter /*aParameter*/, |
|
856 |
TInt /*aValue*/ ) |
|
857 |
{ |
|
858 |
SCPLOGSTRING( "CScpServiceManager::SetConnectionParameter(TInt) \ |
|
859 |
Not supported yet. Separate set methods used." ); |
|
860 |
||
861 |
// this is not implemented yet, separate functions are used. |
|
862 |
User::Leave( KErrNotSupported ); |
|
863 |
} |
|
864 |
||
865 |
// ----------------------------------------------------------------------------- |
|
866 |
// CScpServiceManager::SetConnectionParameter |
|
867 |
// ----------------------------------------------------------------------------- |
|
868 |
// |
|
869 |
void CScpServiceManager::SetConnectionParameterL( |
|
870 |
const TServiceSelection& aServiceSelection, |
|
871 |
TCchConnectionParameter aParameter, |
|
872 |
const TDesC& aValue ) |
|
873 |
{ |
|
874 |
SCPLOGSTRING3( "CScpServiceManager::SetConnectionParameter (TDesC) service id: %d type: %d", |
|
875 |
aServiceSelection.iServiceId, aServiceSelection.iType ); |
|
876 |
||
877 |
if( aParameter!=ECchUsername && aParameter!=ECchPassword ) |
|
878 |
{ |
|
879 |
User::Leave( KErrArgument ); |
|
880 |
} |
|
881 |
||
882 |
HBufC8* buf8 = NULL; |
|
883 |
buf8 = EscapeUtils::ConvertFromUnicodeToUtf8L( aValue ); |
|
884 |
CleanupStack::PushL( buf8 ); |
|
885 |
||
886 |
TBool sipConnectionCreated( EFalse ); |
|
887 |
||
888 |
CScpSipConnection* sipConnection = |
|
889 |
GetSipConnectionL( aServiceSelection.iServiceId, |
|
890 |
aServiceSelection.iType, |
|
891 |
sipConnectionCreated ); |
|
892 |
||
893 |
if( sipConnectionCreated ) |
|
894 |
{ |
|
895 |
CleanupStack::PushL( sipConnection ); |
|
896 |
} |
|
897 |
||
898 |
// Get presence settings id. |
|
899 |
TInt presenceSettingsId( KErrNotFound ); |
|
900 |
TRAP_IGNORE( iSettingHandler->GetSPSettingsIntPropertyL( |
|
901 |
aServiceSelection.iServiceId, |
|
902 |
ESubPropertyPresenceSettingsId, |
|
903 |
presenceSettingsId ) ); |
|
904 |
||
905 |
if( aParameter == ECchUsername ) |
|
906 |
{ |
|
907 |
// Use EscapeUtils to convert spaces to %20. |
|
908 |
HBufC8* encodedUsername = EscapeUtils::EscapeEncodeL( |
|
909 |
buf8->Des(), EscapeUtils::EEscapeNormal ); |
|
910 |
||
911 |
if ( encodedUsername ) |
|
912 |
{ |
|
913 |
CleanupStack::PushL( encodedUsername ); |
|
914 |
||
915 |
// Set username to SIP-profile |
|
916 |
iProfileHandler->SetUsernameAndPasswordL( |
|
917 |
sipConnection->ProfileId(), |
|
918 |
encodedUsername->Des(), ETrue, KNullDesC8, EFalse ); |
|
919 |
||
920 |
// Set username to XDM-setting if setting exists |
|
921 |
if ( KErrNotFound != presenceSettingsId ) |
|
922 |
{ |
|
923 |
SetUsernameAndPasswordToXdmL( |
|
924 |
aServiceSelection.iServiceId, |
|
925 |
*encodedUsername, |
|
926 |
ETrue, |
|
927 |
KNullDesC8, |
|
928 |
EFalse ); |
|
929 |
} |
|
930 |
||
931 |
CleanupStack::PopAndDestroy( encodedUsername ); |
|
932 |
||
933 |
SCPLOGSTRING2( "Username is set: %S", &aValue ); |
|
934 |
} |
|
935 |
} |
|
936 |
else if( aParameter == ECchPassword ) |
|
937 |
{ |
|
938 |
// Set password to SIP-profile |
|
939 |
iProfileHandler->SetUsernameAndPasswordL( |
|
940 |
sipConnection->ProfileId(), |
|
941 |
KNullDesC8, EFalse, buf8->Des(), ETrue ); |
|
942 |
||
943 |
// Set password to XDM-setting if setting exists |
|
944 |
if ( KErrNotFound != presenceSettingsId ) |
|
945 |
{ |
|
946 |
SetUsernameAndPasswordToXdmL( |
|
947 |
aServiceSelection.iServiceId, |
|
948 |
KNullDesC8, |
|
949 |
EFalse, |
|
950 |
buf8->Des(), |
|
951 |
ETrue ); |
|
952 |
} |
|
953 |
||
954 |
SCPLOGSTRING2( "Password is set: %S", &aValue ); |
|
955 |
} |
|
956 |
else |
|
957 |
{ |
|
958 |
User::Leave( KErrArgument ); |
|
959 |
} |
|
960 |
||
961 |
if( sipConnectionCreated ) |
|
962 |
{ |
|
963 |
CleanupStack::PopAndDestroy( sipConnection ); |
|
964 |
} |
|
965 |
||
966 |
CleanupStack::PopAndDestroy( buf8 ); |
|
967 |
} |
|
968 |
||
969 |
// ----------------------------------------------------------------------------- |
|
970 |
// CScpServiceManager::SetUsernameAndPasswordToXdmL |
|
971 |
// ----------------------------------------------------------------------------- |
|
972 |
// |
|
973 |
void CScpServiceManager::SetUsernameAndPasswordToXdmL( |
|
974 |
TUint aServiceId, |
|
975 |
const TDesC8& aUsername, |
|
976 |
TBool aSetUsername, |
|
977 |
const TDesC8& aPassword, |
|
978 |
TBool aSetPassword ) |
|
979 |
{ |
|
980 |
CScpService* service = GetServiceL( |
|
981 |
aServiceId, ECCHPresenceSub ); |
|
982 |
||
983 |
TBool deleteTemporaryService( EFalse ); |
|
984 |
if ( !service ) |
|
985 |
{ |
|
986 |
TRAPD( err, service = CreateTemporaryServiceL( |
|
987 |
aServiceId, |
|
988 |
ECCHPresenceSub ) ); |
|
989 |
||
990 |
if( err == KErrNone && service ) |
|
991 |
{ |
|
992 |
deleteTemporaryService = ETrue; |
|
993 |
} |
|
994 |
} |
|
995 |
||
996 |
if ( service && aSetUsername ) |
|
997 |
{ |
|
998 |
iSettingHandler->UpdateXdmUsernameL( |
|
999 |
*service, |
|
1000 |
ECCHPresenceSub, |
|
1001 |
aUsername ); |
|
1002 |
} |
|
1003 |
||
1004 |
if ( service && aSetPassword ) |
|
1005 |
{ |
|
1006 |
iSettingHandler->UpdateXdmPasswordL( |
|
1007 |
*service, |
|
1008 |
ECCHPresenceSub, |
|
1009 |
aPassword ); |
|
1010 |
} |
|
1011 |
||
1012 |
if ( deleteTemporaryService ) |
|
1013 |
{ |
|
1014 |
delete service; |
|
1015 |
service = NULL; |
|
1016 |
} |
|
1017 |
} |
|
1018 |
||
1019 |
// ----------------------------------------------------------------------------- |
|
1020 |
// CScpServiceManager::CheckRestrictedConnectionsL |
|
1021 |
// ----------------------------------------------------------------------------- |
|
1022 |
// |
|
1023 |
void CScpServiceManager::CheckRestrictedConnectionsL( TUint aServiceId ) |
|
1024 |
{ |
|
33
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1025 |
if ( !iSettingHandler->IsVoIPOverWcdmaAllowedL( aServiceId ) ) |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1026 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1027 |
SCPLOGSTRING( "CScpServiceManager::CheckRestrictedConnectionsL WCDMA not allowed" ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1028 |
|
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1029 |
TBool sipConnectionCreated( EFalse ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1030 |
CScpSipConnection* sipConnection = GetSipConnectionL( |
28 | 1031 |
aServiceId, |
1032 |
ECCHVoIPSub, |
|
1033 |
sipConnectionCreated ); |
|
1034 |
||
33
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1035 |
if( sipConnectionCreated ) |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1036 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1037 |
CleanupStack::PushL( sipConnection ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1038 |
} |
28 | 1039 |
|
1040 |
TUint32 snapId( KErrNone ); |
|
1041 |
sipConnection->GetSnap( snapId ); |
|
1042 |
||
1043 |
RArray<TInt> iaps; |
|
1044 |
CleanupClosePushL( iaps ); |
|
1045 |
// get first iap and iap's bearer, there must be atleast |
|
1046 |
// one iap if not cch does not work as it should |
|
1047 |
RCmManager cmm; |
|
1048 |
cmm.OpenL(); |
|
1049 |
CleanupClosePushL( cmm ); |
|
1050 |
RCmDestination destination( cmm.DestinationL( snapId ) ); |
|
1051 |
CleanupClosePushL( destination ); |
|
1052 |
||
1053 |
TBool wlanIapFound( EFalse ); |
|
1054 |
||
1055 |
for ( TInt i = 0; i < destination.ConnectionMethodCount(); i++ ) |
|
1056 |
{ |
|
1057 |
RCmConnectionMethod cm = destination.ConnectionMethodL( i ); |
|
1058 |
CleanupClosePushL( cm ); |
|
1059 |
||
1060 |
if( KUidWlanBearerType == |
|
1061 |
cm.GetIntAttributeL( CMManager::ECmBearerType ) ) |
|
1062 |
{ |
|
1063 |
SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP found" ); |
|
1064 |
iaps.Append( cm.GetIntAttributeL( CMManager::ECmIapId ) ); |
|
1065 |
wlanIapFound = ETrue; |
|
1066 |
} |
|
1067 |
else |
|
1068 |
{ |
|
1069 |
SCPLOGSTRING2( "CScpServiceManager::CheckAvailableConnectionsL iaps count = %d", iaps.Count() ); |
|
1070 |
SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL 3G IAP found break the loop" ); |
|
1071 |
i = destination.ConnectionMethodCount(); |
|
1072 |
} |
|
1073 |
||
1074 |
CleanupStack::PopAndDestroy( &cm ); |
|
1075 |
} |
|
1076 |
||
1077 |
TBool available( EFalse ); |
|
1078 |
for ( TInt j( 0 ); j < iaps.Count(); j++ ) |
|
1079 |
{ |
|
1080 |
if ( sipConnection->IsIapConnectionAvailable( iaps[ j ] ) ) |
|
1081 |
{ |
|
1082 |
SCPLOGSTRING( "CScpServiceManager::CheckAvailableConnectionsL WLAN IAP available" ); |
|
1083 |
available = ETrue; |
|
1084 |
break; |
|
1085 |
} |
|
1086 |
} |
|
1087 |
||
1088 |
CleanupStack::PopAndDestroy( &destination ); |
|
1089 |
CleanupStack::PopAndDestroy( &cmm ); |
|
1090 |
CleanupStack::PopAndDestroy( &iaps ); |
|
1091 |
||
33
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1092 |
if( sipConnectionCreated ) |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1093 |
{ |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1094 |
CleanupStack::PopAndDestroy( sipConnection ); |
2989b291cac7
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
28
diff
changeset
|
1095 |
} |
28 | 1096 |
|
1097 |
if ( !available && wlanIapFound ) |
|
1098 |
{ |
|
1099 |
User::Leave( KCCHErrorNetworkLost ); |
|
1100 |
} |
|
1101 |
||
1102 |
else if( !wlanIapFound ) |
|
1103 |
{ |
|
1104 |
User::Leave( KCCHErrorAccessPointNotDefined ); |
|
1105 |
} |
|
1106 |
} |
|
1107 |
} |
|
1108 |
||
1109 |
// End of file |