57
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
|
|
21 |
#include <centralrepository.h>
|
|
22 |
|
|
23 |
#include "IptvTestUtilALR.h"
|
|
24 |
#include "VCXTestLog.h"
|
|
25 |
#include "TestUtilConnection.h"
|
|
26 |
#include "CIptvTestActiveWait.h"
|
|
27 |
#include "TestUtilConnectionWaiter.h"
|
|
28 |
#include "VCXTestConstants.h"
|
|
29 |
#include <cmpluginpacketdatadef.h>
|
|
30 |
|
|
31 |
// ========================== MEMBER FUNCTIONS ===============================
|
|
32 |
|
|
33 |
// ---------------------------------------------------------------------------
|
|
34 |
// CIptvTestUtilALR::NewL()
|
|
35 |
//
|
|
36 |
// Constructs CIptvTestUtilALR object
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
//
|
|
39 |
EXPORT_C CIptvTestUtilALR* CIptvTestUtilALR::NewL()
|
|
40 |
{
|
|
41 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::NewL");
|
|
42 |
CIptvTestUtilALR* self = NewLC();
|
|
43 |
CleanupStack::Pop(self);
|
|
44 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::NewL");
|
|
45 |
return self;
|
|
46 |
}
|
|
47 |
|
|
48 |
// ---------------------------------------------------------------------------
|
|
49 |
// CIptvTestUtilALR::NewLC()
|
|
50 |
//
|
|
51 |
// Constructs CIptvTestUtilALR object
|
|
52 |
// ---------------------------------------------------------------------------
|
|
53 |
//
|
|
54 |
EXPORT_C CIptvTestUtilALR* CIptvTestUtilALR::NewLC()
|
|
55 |
{
|
|
56 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::NewLC");
|
|
57 |
CIptvTestUtilALR* self = new (ELeave) CIptvTestUtilALR();
|
|
58 |
CleanupStack::PushL(self);
|
|
59 |
self->ConstructL();
|
|
60 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::NewLC");
|
|
61 |
return self;
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// CIptvTestUtilALR::~CIptvTestUtilALR()
|
|
66 |
//
|
|
67 |
// Destructor
|
|
68 |
// ---------------------------------------------------------------------------
|
|
69 |
//
|
|
70 |
EXPORT_C CIptvTestUtilALR::~CIptvTestUtilALR()
|
|
71 |
{
|
|
72 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::~CIptvIptvTestUtilALR");
|
|
73 |
|
|
74 |
iCmManager.Close();
|
|
75 |
|
|
76 |
delete iActiveWait;
|
|
77 |
iActiveWait = NULL;
|
|
78 |
|
|
79 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::~CIptvIptvTestUtilALR");
|
|
80 |
}
|
|
81 |
|
|
82 |
// ---------------------------------------------------------------------------
|
|
83 |
// CIptvTestUtilALR::ConstructL()
|
|
84 |
//
|
|
85 |
// Second phase constructor
|
|
86 |
// ---------------------------------------------------------------------------
|
|
87 |
//
|
|
88 |
void CIptvTestUtilALR::ConstructL()
|
|
89 |
{
|
|
90 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::ConstructL");
|
|
91 |
|
|
92 |
iCmManager.OpenL();
|
|
93 |
|
|
94 |
iActiveWait = CIptvTestActiveWait::NewL();
|
|
95 |
|
|
96 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::ConstructL");
|
|
97 |
}
|
|
98 |
|
|
99 |
// ---------------------------------------------------------------------------
|
|
100 |
// CIptvTestUtilALR::CIptvTestUtilALR()
|
|
101 |
//
|
|
102 |
// Constructor
|
|
103 |
// ---------------------------------------------------------------------------
|
|
104 |
//
|
|
105 |
CIptvTestUtilALR::CIptvTestUtilALR()
|
|
106 |
{
|
|
107 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::CIptvIptvTestUtilALR");
|
|
108 |
|
|
109 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::CIptvIptvTestUtilALR");
|
|
110 |
}
|
|
111 |
|
|
112 |
// ---------------------------------------------------------------------------
|
|
113 |
// CIptvTestUtilALR::RemoveUsedDestinationCenRepL()
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
EXPORT_C void CIptvTestUtilALR::RemoveUsedDestinationCenRepL()
|
|
117 |
{
|
|
118 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::RemoveUsedDestinationCenRep");
|
|
119 |
|
|
120 |
CRepository* cenRep = CRepository::NewLC( VCXTEST_KIptvAlrCenRepUid );
|
|
121 |
User::LeaveIfError( cenRep->Delete( VCXTEST_KIptvCenRepUsedSnapIdKey ) );
|
|
122 |
CleanupStack::PopAndDestroy( cenRep );
|
|
123 |
|
|
124 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::RemoveUsedDestinationCenRep");
|
|
125 |
}
|
|
126 |
|
|
127 |
// ---------------------------------------------------------------------------
|
|
128 |
// CIptvTestUtilALR::SetUsedDestinationL()
|
|
129 |
// ---------------------------------------------------------------------------
|
|
130 |
//
|
|
131 |
EXPORT_C void CIptvTestUtilALR::SetUsedDestinationL( TDesC& aDestinationName )
|
|
132 |
{
|
|
133 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::SetUsedDestinationL");
|
|
134 |
|
|
135 |
VCXLOGLO2("CIptvIptvTestUtilALR:: dest name: %S", &aDestinationName);
|
|
136 |
|
|
137 |
TInt destId(0);
|
|
138 |
|
|
139 |
if( aDestinationName.Compare( _L("ALWAYS_ASK") ) != KErrNone )
|
|
140 |
{
|
|
141 |
destId = GetDestinationIdL( aDestinationName );
|
|
142 |
}
|
|
143 |
VCXLOGLO2("CIptvIptvTestUtilALR:: dest id: %d", destId);
|
|
144 |
|
|
145 |
TCmDefConnValue defaultConnection;
|
|
146 |
defaultConnection.iType = ECmDefConnDestination;
|
|
147 |
defaultConnection.iId = destId;
|
|
148 |
iCmManager.WriteDefConnL( defaultConnection );
|
|
149 |
|
|
150 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetUsedDestinationL");
|
|
151 |
}
|
|
152 |
|
|
153 |
// ---------------------------------------------------------------------------
|
|
154 |
// CIptvTestUtilALR::CreateDestinationL()
|
|
155 |
// ---------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
EXPORT_C void CIptvTestUtilALR::CreateDestinationL( TDesC& aDestinationName )
|
|
158 |
{
|
|
159 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::CreateDestinationL");
|
|
160 |
|
|
161 |
VCXLOGLO2("CIptvIptvTestUtilALR:: dest name: %S", &aDestinationName);
|
|
162 |
|
|
163 |
RCmDestinationExt dest;
|
|
164 |
TRAPD( err, dest = iCmManager.CreateDestinationL( aDestinationName ) );
|
|
165 |
VCXLOGLO2("CIptvIptvTestUtilALR::CreateDestinationL: CreateDestinationL returned: %d", err);
|
|
166 |
User::LeaveIfError( err );
|
|
167 |
|
|
168 |
CleanupClosePushL( dest );
|
|
169 |
TRAP( err, dest.SetHiddenL( EFalse ) );
|
|
170 |
VCXLOGLO2("CIptvIptvTestUtilALR::CreateDestinationL: SetHiddenL returned: %d", err);
|
|
171 |
User::LeaveIfError( err );
|
|
172 |
|
|
173 |
// This leaves sometimes with KErrLocked, try again in that case few times.
|
|
174 |
for( TInt retry = 0; retry < 5; retry++ )
|
|
175 |
{
|
|
176 |
TRAP( err, dest.UpdateL() );
|
|
177 |
VCXLOGLO2("CIptvIptvTestUtilALR::CreateDestinationL: UpdateL returned: %d", err);
|
|
178 |
if( err != KErrLocked )
|
|
179 |
{
|
|
180 |
User::LeaveIfError( err );
|
|
181 |
break; // All ok.
|
|
182 |
}
|
|
183 |
User::After( 1000000 );
|
|
184 |
}
|
|
185 |
|
|
186 |
CleanupStack::PopAndDestroy( &dest );
|
|
187 |
|
|
188 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::CreateDestinationL");
|
|
189 |
}
|
|
190 |
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
// CIptvTestUtilALR::DeleteDestinationL()
|
|
193 |
// ---------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
EXPORT_C void CIptvTestUtilALR::DeleteDestinationL( TDesC& aDestinationName )
|
|
196 |
{
|
|
197 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::DeleteDestinationL");
|
|
198 |
|
|
199 |
VCXLOGLO2("CIptvIptvTestUtilALR:: dest name: '%S'", &aDestinationName);
|
|
200 |
|
|
201 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
202 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
203 |
CleanupClosePushL( destination );
|
|
204 |
|
|
205 |
TRAP_IGNORE( TerminateDestinationConnectionsL( aDestinationName ) );
|
|
206 |
|
|
207 |
// Delete methods first.
|
|
208 |
for(TInt e=destination.ConnectionMethodCount()-1; e>=0 ; e--)
|
|
209 |
{
|
|
210 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
211 |
CleanupClosePushL( method );
|
|
212 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: deleting method: %d", e );
|
|
213 |
|
|
214 |
destination.DeleteConnectionMethodL( method );
|
|
215 |
destination.UpdateL();
|
|
216 |
CleanupStack::PopAndDestroy( &method );
|
|
217 |
}
|
|
218 |
|
|
219 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: deleting destination id: %d", destId );
|
|
220 |
destination.DeleteLD();
|
|
221 |
|
|
222 |
CleanupStack::PopAndDestroy( &destination );
|
|
223 |
|
|
224 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::DeleteDestinationL");
|
|
225 |
}
|
|
226 |
|
|
227 |
// ---------------------------------------------------------------------------
|
|
228 |
// CIptvTestUtilALR::CopyMethodL()
|
|
229 |
// ---------------------------------------------------------------------------
|
|
230 |
//
|
|
231 |
EXPORT_C void CIptvTestUtilALR::CopyMethodL( TDesC& aMethodName, TDesC& aNewMethodName, TDesC& aNewDestinationName )
|
|
232 |
{
|
|
233 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::CopyMethodL");
|
|
234 |
|
|
235 |
TBuf<256> srcMethodName( aMethodName );
|
|
236 |
|
|
237 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: srcMethodName: %S", &srcMethodName );
|
|
238 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aNewMethodName: %S", &aNewMethodName );
|
|
239 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aNewDestinationName: %S", &aNewDestinationName );
|
|
240 |
|
|
241 |
// Find target destination.
|
|
242 |
TInt targetDestId = GetDestinationIdL( aNewDestinationName );
|
|
243 |
RCmDestinationExt targetDestination = iCmManager.DestinationL( targetDestId );
|
|
244 |
CleanupClosePushL( targetDestination );
|
|
245 |
|
|
246 |
// Check if target has destination with the name already.
|
|
247 |
for(TInt e=0; e<targetDestination.ConnectionMethodCount(); e++)
|
|
248 |
{
|
|
249 |
RCmConnectionMethodExt method = targetDestination.ConnectionMethodL( e );
|
|
250 |
CleanupClosePushL( method );
|
|
251 |
|
|
252 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
253 |
CleanupStack::PushL( methodName );
|
|
254 |
|
|
255 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: method: '%S'", methodName );
|
|
256 |
if( MethodMatchesL( srcMethodName, *methodName, ETrue ) )
|
|
257 |
{
|
|
258 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Target destination already has method with the name.");
|
|
259 |
CleanupStack::PopAndDestroy( methodName );
|
|
260 |
CleanupStack::PopAndDestroy( &method );
|
|
261 |
CleanupStack::PopAndDestroy( &targetDestination );
|
|
262 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::CopyMethodL");
|
|
263 |
return;
|
|
264 |
}
|
|
265 |
CleanupStack::PopAndDestroy( methodName );
|
|
266 |
CleanupStack::PopAndDestroy( &method );
|
|
267 |
}
|
|
268 |
|
|
269 |
// Find method from destinations and create copy of it.
|
|
270 |
TBool found( EFalse );
|
|
271 |
TBool foundExact( EFalse );
|
|
272 |
TUint32 foundDestId( 0 );
|
|
273 |
TInt foundIapIndex( 0 );
|
|
274 |
|
|
275 |
RArray<TUint32> destIds(5);
|
|
276 |
iCmManager.AllDestinationsL( destIds );
|
|
277 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: dest Count: %d", destIds.Count() );
|
|
278 |
|
|
279 |
for(TInt i=0; i<destIds.Count(); i++ )
|
|
280 |
{
|
|
281 |
RCmDestinationExt sourceDestination = iCmManager.DestinationL( destIds[i] );
|
|
282 |
CleanupClosePushL( sourceDestination );
|
|
283 |
|
|
284 |
HBufC* name = sourceDestination.NameLC();
|
|
285 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: dest: '%S'", name );
|
|
286 |
TInt methodCount = sourceDestination.ConnectionMethodCount();
|
|
287 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: methodCount: %d", methodCount );
|
|
288 |
|
|
289 |
for(TInt e=0; e<sourceDestination.ConnectionMethodCount(); e++)
|
|
290 |
{
|
|
291 |
RCmConnectionMethodExt sourceMethod = sourceDestination.ConnectionMethodL( e );
|
|
292 |
CleanupClosePushL( sourceMethod );
|
|
293 |
|
|
294 |
HBufC* methodName = sourceMethod.GetStringAttributeL( CMManager::ECmName );
|
|
295 |
CleanupStack::PushL( methodName );
|
|
296 |
|
|
297 |
TInt iapId = sourceMethod.GetIntAttributeL( CMManager::ECmIapId );
|
|
298 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
299 |
|
|
300 |
// Check for exact match.
|
|
301 |
if( MethodMatchesL( srcMethodName, *methodName, ETrue ) )
|
|
302 |
{
|
|
303 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: exact match.");
|
|
304 |
foundExact = ETrue;
|
|
305 |
foundDestId = destIds[i];
|
|
306 |
foundIapIndex = e;
|
|
307 |
}
|
|
308 |
|
|
309 |
// No exact match found yet, check if its any of the alternative iaps.
|
|
310 |
if( !foundExact && MethodMatchesL( srcMethodName, *methodName, EFalse ) )
|
|
311 |
{
|
|
312 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: alt match.");
|
|
313 |
found = ETrue;
|
|
314 |
foundDestId = destIds[i];
|
|
315 |
foundIapIndex = e;
|
|
316 |
}
|
|
317 |
|
|
318 |
CleanupStack::PopAndDestroy( methodName );
|
|
319 |
CleanupStack::PopAndDestroy( &sourceMethod );
|
|
320 |
|
|
321 |
// No need to search further.
|
|
322 |
if( foundExact )
|
|
323 |
{
|
|
324 |
break;
|
|
325 |
}
|
|
326 |
}
|
|
327 |
|
|
328 |
CleanupStack::PopAndDestroy( name );
|
|
329 |
CleanupStack::PopAndDestroy( &sourceDestination );
|
|
330 |
|
|
331 |
// No need to search further.
|
|
332 |
if( foundExact )
|
|
333 |
{
|
|
334 |
break;
|
|
335 |
}
|
|
336 |
}
|
|
337 |
|
|
338 |
// Iap found, create copy of it.
|
|
339 |
if( foundExact || found )
|
|
340 |
{
|
|
341 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Creating copy of the method." );
|
|
342 |
|
|
343 |
RCmDestinationExt sourceDestination = iCmManager.DestinationL( foundDestId );
|
|
344 |
CleanupClosePushL( sourceDestination );
|
|
345 |
|
|
346 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: source dest ok." );
|
|
347 |
|
|
348 |
RCmConnectionMethodExt sourceMethod = sourceDestination.ConnectionMethodL( foundIapIndex );
|
|
349 |
CleanupClosePushL( sourceMethod );
|
|
350 |
|
|
351 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: source method ok." );
|
|
352 |
|
|
353 |
HBufC* sourceMethodName = sourceMethod.GetStringAttributeL( CMManager::ECmName );
|
|
354 |
CleanupStack::PushL( sourceMethodName );
|
|
355 |
|
|
356 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: source method name ok." );
|
|
357 |
|
|
358 |
RCmConnectionMethodExt newMethod = sourceMethod.CreateCopyL();
|
|
359 |
CleanupClosePushL( newMethod );
|
|
360 |
|
|
361 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: copy ok." );
|
|
362 |
|
|
363 |
// If method names are same rename source method because there can't be two with same name.
|
|
364 |
if( *sourceMethodName == aNewMethodName )
|
|
365 |
{
|
|
366 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Method names are same, renaming source method." );
|
|
367 |
HBufC* newName = HBufC::NewL( sourceMethodName->Length() + 5);
|
|
368 |
newName->Des().Append( *sourceMethodName );
|
|
369 |
newName->Des().Append( _L("_old") );
|
|
370 |
sourceMethod.SetStringAttributeL( CMManager::ECmName, *newName );
|
|
371 |
delete newName;
|
|
372 |
sourceMethod.UpdateL();
|
|
373 |
}
|
|
374 |
|
|
375 |
// Set name for new method.
|
|
376 |
newMethod.SetStringAttributeL( CMManager::ECmName, aNewMethodName );
|
|
377 |
// Disable dialog asking permission.
|
|
378 |
newMethod.SetIntAttributeL( CMManager::ECmSeamlessnessLevel, CMManager::ESeamlessnessShowprogress );
|
|
379 |
|
|
380 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: new method updated." );
|
|
381 |
|
|
382 |
targetDestination.AddConnectionMethodL( newMethod );
|
|
383 |
targetDestination.UpdateL();
|
|
384 |
|
|
385 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method added to target dest." );
|
|
386 |
|
|
387 |
CleanupStack::PopAndDestroy( &newMethod );
|
|
388 |
CleanupStack::PopAndDestroy( sourceMethodName );
|
|
389 |
CleanupStack::PopAndDestroy( &sourceMethod );
|
|
390 |
CleanupStack::PopAndDestroy( &sourceDestination );
|
|
391 |
}
|
|
392 |
// No iap found, search from uncategorized IAPs.
|
|
393 |
else
|
|
394 |
{
|
|
395 |
RArray<TUint32> cmarray;
|
|
396 |
TRAPD( err, iCmManager.ConnectionMethodL( cmarray, EFalse, EFalse, EFalse ) );
|
|
397 |
if( err != KErrNone )
|
|
398 |
{
|
|
399 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: could not get uncategorized IAPs. err: %d", err );
|
|
400 |
cmarray.Reset();
|
|
401 |
cmarray.Close();
|
|
402 |
}
|
|
403 |
|
|
404 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: uncategorized IAP count: %d", cmarray.Count() );
|
|
405 |
|
|
406 |
for( TInt e = 0; e < cmarray.Count(); e++ )
|
|
407 |
{
|
|
408 |
RCmConnectionMethodExt sourceMethod = iCmManager.ConnectionMethodL( cmarray[e] );
|
|
409 |
CleanupClosePushL( sourceMethod );
|
|
410 |
|
|
411 |
HBufC* methodName = sourceMethod.GetStringAttributeL( CMManager::ECmName );
|
|
412 |
CleanupStack::PushL( methodName );
|
|
413 |
|
|
414 |
TInt iapId = sourceMethod.GetIntAttributeL( CMManager::ECmIapId );
|
|
415 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
416 |
|
|
417 |
// Check for exact match.
|
|
418 |
if( MethodMatchesL( srcMethodName, *methodName, ETrue ) )
|
|
419 |
{
|
|
420 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: exact match.");
|
|
421 |
foundExact = ETrue;
|
|
422 |
foundIapIndex = e;
|
|
423 |
}
|
|
424 |
|
|
425 |
// No exact match found yet, check if its any of the alternative iaps.
|
|
426 |
if( !foundExact && MethodMatchesL( srcMethodName, *methodName, EFalse ) )
|
|
427 |
{
|
|
428 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: alt match.");
|
|
429 |
found = ETrue;
|
|
430 |
foundIapIndex = e;
|
|
431 |
}
|
|
432 |
|
|
433 |
CleanupStack::PopAndDestroy( methodName );
|
|
434 |
CleanupStack::PopAndDestroy( &sourceMethod );
|
|
435 |
|
|
436 |
// No need to search further.
|
|
437 |
if( foundExact )
|
|
438 |
{
|
|
439 |
break;
|
|
440 |
}
|
|
441 |
}
|
|
442 |
|
|
443 |
// Found IAP from uncategorized dest.
|
|
444 |
if( found || foundExact )
|
|
445 |
{
|
|
446 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Creating copy of the method." );
|
|
447 |
|
|
448 |
RCmConnectionMethodExt sourceMethod = iCmManager.ConnectionMethodL( cmarray[foundIapIndex] );
|
|
449 |
CleanupClosePushL( sourceMethod );
|
|
450 |
|
|
451 |
HBufC* sourceMethodName = sourceMethod.GetStringAttributeL( CMManager::ECmName );
|
|
452 |
CleanupStack::PushL( sourceMethodName );
|
|
453 |
|
|
454 |
RCmConnectionMethodExt newMethod = sourceMethod.CreateCopyL();
|
|
455 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: New Method ok." );
|
|
456 |
CleanupClosePushL( newMethod );
|
|
457 |
|
|
458 |
// If method names are same rename source method because there can't be two with same name.
|
|
459 |
if( *sourceMethodName == aNewMethodName )
|
|
460 |
{
|
|
461 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Method names are same, renaming source method." );
|
|
462 |
HBufC* newName = HBufC::NewL( sourceMethodName->Length() + 5);
|
|
463 |
newName->Des().Append( *sourceMethodName );
|
|
464 |
newName->Des().Append( _L("_old") );
|
|
465 |
sourceMethod.SetStringAttributeL( CMManager::ECmName, *newName );
|
|
466 |
delete newName;
|
|
467 |
sourceMethod.UpdateL();
|
|
468 |
}
|
|
469 |
|
|
470 |
// Set name for new method.
|
|
471 |
newMethod.SetStringAttributeL( CMManager::ECmName, aNewMethodName );
|
|
472 |
// Disable dialog asking permission.
|
|
473 |
newMethod.SetIntAttributeL( CMManager::ECmSeamlessnessLevel, CMManager::ESeamlessnessShowprogress );
|
|
474 |
|
|
475 |
targetDestination.AddConnectionMethodL( newMethod );
|
|
476 |
targetDestination.UpdateL();
|
|
477 |
|
|
478 |
CleanupStack::PopAndDestroy( &newMethod );
|
|
479 |
CleanupStack::PopAndDestroy( sourceMethodName );
|
|
480 |
CleanupStack::PopAndDestroy( &sourceMethod );
|
|
481 |
}
|
|
482 |
|
|
483 |
cmarray.Reset();
|
|
484 |
cmarray.Close();
|
|
485 |
}
|
|
486 |
|
|
487 |
destIds.Reset();
|
|
488 |
destIds.Close();
|
|
489 |
|
|
490 |
PrintDestinationL( targetDestination );
|
|
491 |
CleanupStack::PopAndDestroy( &targetDestination );
|
|
492 |
|
|
493 |
if( !foundExact && !found )
|
|
494 |
{
|
|
495 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: source method %S not found!", &srcMethodName );
|
|
496 |
#ifdef __WINSCW__
|
|
497 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: EMULATOR BUILD, check that iap is not uncategorized." );
|
|
498 |
#endif
|
|
499 |
User::Leave(KErrNotFound);
|
|
500 |
}
|
|
501 |
|
|
502 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::CopyMethodL");
|
|
503 |
}
|
|
504 |
|
|
505 |
// ---------------------------------------------------------------------------
|
|
506 |
// CIptvTestUtilALR::DeleteMethodL()
|
|
507 |
// ---------------------------------------------------------------------------
|
|
508 |
//
|
|
509 |
EXPORT_C void CIptvTestUtilALR::DeleteMethodL( TDesC& aDestinationName, TDesC& aMethodName )
|
|
510 |
{
|
|
511 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::DeleteMethodL");
|
|
512 |
|
|
513 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
514 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aMethodName: %S", &aMethodName );
|
|
515 |
|
|
516 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
517 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
518 |
CleanupClosePushL( destination );
|
|
519 |
|
|
520 |
TBool found( EFalse );
|
|
521 |
|
|
522 |
// Find method and delete it.
|
|
523 |
for(TInt e=0; e< destination.ConnectionMethodCount(); e++)
|
|
524 |
{
|
|
525 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
526 |
CleanupClosePushL( method );
|
|
527 |
|
|
528 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
529 |
CleanupStack::PushL( methodName );
|
|
530 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
531 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
532 |
|
|
533 |
if( methodName->Compare( aMethodName ) == 0 )
|
|
534 |
{
|
|
535 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Match. Deleting." );
|
|
536 |
found = ETrue;
|
|
537 |
destination.DeleteConnectionMethodL( method );
|
|
538 |
destination.UpdateL();
|
|
539 |
}
|
|
540 |
CleanupStack::PopAndDestroy( methodName );
|
|
541 |
CleanupStack::PopAndDestroy( &method );
|
|
542 |
}
|
|
543 |
|
|
544 |
if(!found)
|
|
545 |
{
|
|
546 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method not found!");
|
|
547 |
User::Leave(KErrNotFound);
|
|
548 |
}
|
|
549 |
|
|
550 |
PrintDestinationL( destination );
|
|
551 |
CleanupStack::PopAndDestroy( &destination );
|
|
552 |
|
|
553 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::DeleteMethodL");
|
|
554 |
}
|
|
555 |
|
|
556 |
// ---------------------------------------------------------------------------
|
|
557 |
// CIptvTestUtilALR::SetMethodPriorityL()
|
|
558 |
// ---------------------------------------------------------------------------
|
|
559 |
//
|
|
560 |
EXPORT_C void CIptvTestUtilALR::SetMethodPriorityL( TDesC& aDestinationName, TDesC& aMethodName, TUint32 aPriority )
|
|
561 |
{
|
|
562 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::SetMethodPriorityL");
|
|
563 |
|
|
564 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
565 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aMethodName: %S", &aMethodName );
|
|
566 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aPriority: %d", aPriority );
|
|
567 |
|
|
568 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
569 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
570 |
CleanupClosePushL( destination );
|
|
571 |
|
|
572 |
TBool found( EFalse );
|
|
573 |
|
|
574 |
if( aPriority > destination.ConnectionMethodCount() )
|
|
575 |
{
|
|
576 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: Priority must be less than there's methods in the destination, count: %d!", destination.ConnectionMethodCount() );
|
|
577 |
User::Leave( KErrCorrupt );
|
|
578 |
}
|
|
579 |
|
|
580 |
// No need to set priority here.
|
|
581 |
if( destination.ConnectionMethodCount() <= 1 )
|
|
582 |
{
|
|
583 |
CleanupStack::PopAndDestroy( &destination );
|
|
584 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetMethodPriorityL");
|
|
585 |
return;
|
|
586 |
}
|
|
587 |
|
|
588 |
// Find the method and set priority
|
|
589 |
for(TInt e=0; e < destination.ConnectionMethodCount(); e++)
|
|
590 |
{
|
|
591 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Get method." );
|
|
592 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
593 |
CleanupClosePushL( method );
|
|
594 |
|
|
595 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
596 |
CleanupStack::PushL( methodName );
|
|
597 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Get iap id." );
|
|
598 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
599 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
600 |
|
|
601 |
if( methodName->Compare( aMethodName ) == 0 )
|
|
602 |
{
|
|
603 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Match. Setting priority." );
|
|
604 |
found = ETrue;
|
|
605 |
destination.ModifyPriorityL( method, aPriority );
|
|
606 |
destination.UpdateL();
|
|
607 |
}
|
|
608 |
CleanupStack::PopAndDestroy( methodName );
|
|
609 |
CleanupStack::PopAndDestroy( &method );
|
|
610 |
}
|
|
611 |
|
|
612 |
if(!found)
|
|
613 |
{
|
|
614 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method not found!");
|
|
615 |
User::Leave(KErrNotFound);
|
|
616 |
}
|
|
617 |
|
|
618 |
PrintDestinationL( destination );
|
|
619 |
CleanupStack::PopAndDestroy( &destination );
|
|
620 |
|
|
621 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetMethodPriorityL");
|
|
622 |
}
|
|
623 |
|
|
624 |
// ---------------------------------------------------------------------------
|
|
625 |
// CIptvTestUtilALR::SetMethodStringAttributeL()
|
|
626 |
// ---------------------------------------------------------------------------
|
|
627 |
//
|
|
628 |
EXPORT_C void CIptvTestUtilALR::SetMethodStringAttributeL( TDesC& aDestinationName, TDesC& aMethodName, TInt aAttribute, TDesC& aAttributeValue )
|
|
629 |
{
|
|
630 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::SetMethodStringAttributeL");
|
|
631 |
|
|
632 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
633 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aMethodName: %S", &aMethodName );
|
|
634 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttribute: %d", aAttribute );
|
|
635 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttributeValue: %S", &aAttributeValue );
|
|
636 |
|
|
637 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
638 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
639 |
CleanupClosePushL( destination );
|
|
640 |
|
|
641 |
TBool found( EFalse );
|
|
642 |
|
|
643 |
// Find the method and set attribute
|
|
644 |
for(TInt e=0; e < destination.ConnectionMethodCount(); e++)
|
|
645 |
{
|
|
646 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
647 |
CleanupClosePushL( method );
|
|
648 |
|
|
649 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
650 |
CleanupStack::PushL( methodName );
|
|
651 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
652 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
653 |
|
|
654 |
if( MethodMatchesL( aMethodName, *methodName, EFalse ) )
|
|
655 |
{
|
|
656 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Match. Setting attribute." );
|
|
657 |
found = ETrue;
|
|
658 |
|
|
659 |
method.SetStringAttributeL( aAttribute, aAttributeValue );
|
|
660 |
method.UpdateL();
|
|
661 |
}
|
|
662 |
|
|
663 |
CleanupStack::PopAndDestroy( methodName );
|
|
664 |
CleanupStack::PopAndDestroy( &method );
|
|
665 |
}
|
|
666 |
|
|
667 |
if(!found)
|
|
668 |
{
|
|
669 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method not found!");
|
|
670 |
User::Leave(KErrNotFound);
|
|
671 |
}
|
|
672 |
|
|
673 |
CleanupStack::PopAndDestroy( &destination );
|
|
674 |
|
|
675 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetMethodStringAttributeL");
|
|
676 |
}
|
|
677 |
|
|
678 |
// ---------------------------------------------------------------------------
|
|
679 |
// CIptvTestUtilALR::SetMethodIntAttributeL()
|
|
680 |
// ---------------------------------------------------------------------------
|
|
681 |
//
|
|
682 |
EXPORT_C void CIptvTestUtilALR::SetMethodIntAttributeL( TDesC& aDestinationName, TDesC& aMethodName, TInt aAttribute, TInt aAttributeValue )
|
|
683 |
{
|
|
684 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::SetMethodIntAttributeL");
|
|
685 |
|
|
686 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
687 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aMethodName: %S", &aMethodName );
|
|
688 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttribute: %d", aAttribute );
|
|
689 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttributeValue: %d", aAttributeValue );
|
|
690 |
|
|
691 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
692 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
693 |
CleanupClosePushL( destination );
|
|
694 |
|
|
695 |
TBool found( EFalse );
|
|
696 |
|
|
697 |
// Find the method and set attribute
|
|
698 |
for(TInt e=0; e < destination.ConnectionMethodCount(); e++)
|
|
699 |
{
|
|
700 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
701 |
CleanupClosePushL( method );
|
|
702 |
|
|
703 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
704 |
CleanupStack::PushL( methodName );
|
|
705 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
706 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
707 |
|
|
708 |
if( MethodMatchesL( aMethodName, *methodName, EFalse ) )
|
|
709 |
{
|
|
710 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Match. Setting attribute." );
|
|
711 |
found = ETrue;
|
|
712 |
|
|
713 |
method.SetIntAttributeL( aAttribute, aAttributeValue );
|
|
714 |
method.UpdateL();
|
|
715 |
}
|
|
716 |
|
|
717 |
CleanupStack::PopAndDestroy( methodName );
|
|
718 |
CleanupStack::PopAndDestroy( &method );
|
|
719 |
}
|
|
720 |
|
|
721 |
if(!found)
|
|
722 |
{
|
|
723 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method not found!");
|
|
724 |
User::Leave(KErrNotFound);
|
|
725 |
}
|
|
726 |
|
|
727 |
CleanupStack::PopAndDestroy( &destination );
|
|
728 |
|
|
729 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetMethodIntAttributeL");
|
|
730 |
}
|
|
731 |
|
|
732 |
// ---------------------------------------------------------------------------
|
|
733 |
// CIptvTestUtilALR::SetMethodBoolAttributeL
|
|
734 |
// ---------------------------------------------------------------------------
|
|
735 |
//
|
|
736 |
EXPORT_C void CIptvTestUtilALR::SetMethodBoolAttributeL( TDesC& aDestinationName, TDesC& aMethodName, TInt aAttribute, TBool aAttributeValue )
|
|
737 |
{
|
|
738 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::SetMethodBoolAttributeL");
|
|
739 |
|
|
740 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
741 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aMethodName: %S", &aMethodName );
|
|
742 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttribute: %d", aAttribute );
|
|
743 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aAttributeValue: %d", &aAttributeValue );
|
|
744 |
|
|
745 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
746 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
747 |
CleanupClosePushL( destination );
|
|
748 |
|
|
749 |
TBool found = EFalse;
|
|
750 |
|
|
751 |
// Find the method and set attribute
|
|
752 |
for(TInt e=0; e < destination.ConnectionMethodCount(); e++)
|
|
753 |
{
|
|
754 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
755 |
CleanupClosePushL( method );
|
|
756 |
|
|
757 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
758 |
CleanupStack::PushL( methodName );
|
|
759 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
760 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
761 |
|
|
762 |
if( MethodMatchesL( aMethodName, *methodName, EFalse ) )
|
|
763 |
{
|
|
764 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: Match. Setting attribute." );
|
|
765 |
found = ETrue;
|
|
766 |
|
|
767 |
method.SetBoolAttributeL( aAttribute, aAttributeValue );
|
|
768 |
method.UpdateL();
|
|
769 |
}
|
|
770 |
|
|
771 |
CleanupStack::PopAndDestroy( methodName );
|
|
772 |
CleanupStack::PopAndDestroy( &method );
|
|
773 |
}
|
|
774 |
|
|
775 |
if(!found)
|
|
776 |
{
|
|
777 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: method not found!");
|
|
778 |
User::Leave(KErrNotFound);
|
|
779 |
}
|
|
780 |
|
|
781 |
CleanupStack::PopAndDestroy( &destination );
|
|
782 |
|
|
783 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::SetMethodBoolAttributeL");
|
|
784 |
}
|
|
785 |
|
|
786 |
// ---------------------------------------------------------------------------
|
|
787 |
// CIptvTestUtilALR::GetDestinationIdL()
|
|
788 |
// ---------------------------------------------------------------------------
|
|
789 |
//
|
|
790 |
EXPORT_C TInt CIptvTestUtilALR::GetDestinationIdL( TDesC& aDestinationName )
|
|
791 |
{
|
|
792 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::GetDestinationIdL");
|
|
793 |
|
|
794 |
VCXLOGLO2("CIptvIptvTestUtilALR:: dest name: '%S'", &aDestinationName);
|
|
795 |
|
|
796 |
RArray<TUint32> destIds(5);
|
|
797 |
|
|
798 |
iCmManager.AllDestinationsL( destIds );
|
|
799 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: dest Count: %d", destIds.Count() );
|
|
800 |
|
|
801 |
TInt foundDestId(0);
|
|
802 |
|
|
803 |
for(TInt i=0; i<destIds.Count(); i++ )
|
|
804 |
{
|
|
805 |
RCmDestinationExt dest = iCmManager.DestinationL( destIds[i] );
|
|
806 |
CleanupClosePushL( dest );
|
|
807 |
HBufC* name = dest.NameLC();
|
|
808 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: dest: '%S', id: %d", name, destIds[i] );
|
|
809 |
if( name->Compare( aDestinationName ) == 0 )
|
|
810 |
{
|
|
811 |
foundDestId = destIds[i];
|
|
812 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: found destination id: %d", destIds[i] );
|
|
813 |
CleanupStack::PopAndDestroy( name );
|
|
814 |
CleanupStack::PopAndDestroy( &dest );
|
|
815 |
break;
|
|
816 |
}
|
|
817 |
else
|
|
818 |
{
|
|
819 |
CleanupStack::PopAndDestroy( name );
|
|
820 |
CleanupStack::PopAndDestroy( &dest );
|
|
821 |
}
|
|
822 |
}
|
|
823 |
|
|
824 |
if( foundDestId == 0 )
|
|
825 |
{
|
|
826 |
VCXLOGLO1( "CIptvIptvTestUtilALR:: destination not found!");
|
|
827 |
User::Leave( KErrNotFound );
|
|
828 |
}
|
|
829 |
|
|
830 |
destIds.Reset();
|
|
831 |
destIds.Close();
|
|
832 |
|
|
833 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::GetDestinationIdL");
|
|
834 |
return foundDestId;
|
|
835 |
}
|
|
836 |
|
|
837 |
// ---------------------------------------------------------------------------
|
|
838 |
// CIptvTestUtilALR::TerminateDestinationConnectionsL
|
|
839 |
// ---------------------------------------------------------------------------
|
|
840 |
//
|
|
841 |
EXPORT_C void CIptvTestUtilALR::TerminateDestinationConnectionsL( TDesC& aDestinationName )
|
|
842 |
{
|
|
843 |
VCXLOGLO1(">>>CIptvIptvTestUtilALR::TerminateDestinationConnectionsL");
|
|
844 |
|
|
845 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: aDestinationName: %S", &aDestinationName );
|
|
846 |
|
|
847 |
TInt destId = GetDestinationIdL( aDestinationName );
|
|
848 |
RCmDestinationExt destination = iCmManager.DestinationL( destId );
|
|
849 |
CleanupClosePushL( destination );
|
|
850 |
|
|
851 |
// Check if there's active connections for the methods
|
|
852 |
for(TInt e=0; e < destination.ConnectionMethodCount(); e++)
|
|
853 |
{
|
|
854 |
RCmConnectionMethodExt method = destination.ConnectionMethodL( e );
|
|
855 |
CleanupClosePushL( method );
|
|
856 |
|
|
857 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
858 |
CleanupStack::PushL( methodName );
|
|
859 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
860 |
VCXLOGLO3( "CIptvIptvTestUtilALR:: method: '%S', id: %d", methodName, iapId );
|
|
861 |
|
|
862 |
CTestUtilConnectionWaiter* connectionWaiter = CTestUtilConnectionWaiter::NewL( this );
|
|
863 |
CleanupStack::PushL( connectionWaiter );
|
|
864 |
|
|
865 |
// Terminate active connection
|
|
866 |
if( connectionWaiter->IsConnectionActive( iapId ) )
|
|
867 |
{
|
|
868 |
CTestUtilConnection* connectionUtil = CTestUtilConnection::NewL( this );
|
|
869 |
CleanupStack::PushL( connectionUtil );
|
|
870 |
connectionUtil->SetConnectionPreferences( KCommDbBearerUnknown, iapId );
|
|
871 |
connectionUtil->AttachL();
|
|
872 |
|
|
873 |
connectionUtil->TerminateConnectionL();
|
|
874 |
connectionWaiter->WaitUntilConnectionIsClosed( iapId );
|
|
875 |
iActiveWait->Start();
|
|
876 |
|
|
877 |
CleanupStack::PopAndDestroy( connectionUtil );
|
|
878 |
}
|
|
879 |
CleanupStack::PopAndDestroy( connectionWaiter );
|
|
880 |
CleanupStack::PopAndDestroy( methodName );
|
|
881 |
CleanupStack::PopAndDestroy( &method );
|
|
882 |
}
|
|
883 |
|
|
884 |
CleanupStack::PopAndDestroy( &destination );
|
|
885 |
|
|
886 |
VCXLOGLO1("<<<CIptvIptvTestUtilALR::TerminateDestinationConnectionsL");
|
|
887 |
}
|
|
888 |
|
|
889 |
// ---------------------------------------------------------------------------
|
|
890 |
// CIptvTestUtilALR::GetDefaultIap
|
|
891 |
// ---------------------------------------------------------------------------
|
|
892 |
//
|
|
893 |
EXPORT_C TUint32 CIptvTestUtilALR::GetDefaultIap()
|
|
894 |
{
|
|
895 |
VCXLOGLO1(">>>CIptvTestUtilALR::GetDefaultIap");
|
|
896 |
RSocketServ ss;
|
|
897 |
ss.Connect();
|
|
898 |
|
|
899 |
RConnection conn;
|
|
900 |
conn.Open( ss );
|
|
901 |
|
|
902 |
TCommDbConnPref prefs;
|
|
903 |
prefs.SetDialogPreference( ECommDbDialogPrefDoNotPrompt );
|
|
904 |
|
|
905 |
conn.Start( prefs );
|
|
906 |
TUint32 iap( 0 );
|
|
907 |
conn.GetIntSetting( _L("IAP\\Id"), iap );
|
|
908 |
conn.Close();
|
|
909 |
|
|
910 |
VCXLOGLO2("<<<CIptvTestUtilALR::GetDefaultIap return %D", iap);
|
|
911 |
return iap;
|
|
912 |
}
|
|
913 |
|
|
914 |
// ---------------------------------------------------------------------------
|
|
915 |
// CIptvTestUtilALR::SetDefaultIapCenRep
|
|
916 |
// ---------------------------------------------------------------------------
|
|
917 |
//
|
|
918 |
EXPORT_C TInt CIptvTestUtilALR::SetDefaultIapCenRep()
|
|
919 |
{
|
|
920 |
TUint32 iap( 0 );
|
|
921 |
iap = GetDefaultIap();
|
|
922 |
TInt err( 0 );
|
|
923 |
|
|
924 |
if( iap != 0 )
|
|
925 |
{
|
|
926 |
VCXLOGLO1("CIptvTestUtilALR::SetDefaultIapCenRep Create cenrep.");
|
|
927 |
CRepository* cenRep = CRepository::NewLC( VCXTEST_KIptvAlrCenRepUid );
|
|
928 |
VCXLOGLO1("CIptvTestUtilALR::SetDefaultIapCenRep Set cenrep.");
|
|
929 |
User::LeaveIfError( cenRep->Set( VCXTEST_KIptvCenRepDefaultIapIdKey, (TInt)iap ) );
|
|
930 |
CleanupStack::PopAndDestroy( cenRep );
|
|
931 |
}
|
|
932 |
else
|
|
933 |
{
|
|
934 |
err = KErrNotFound;
|
|
935 |
}
|
|
936 |
|
|
937 |
return err;
|
|
938 |
}
|
|
939 |
|
|
940 |
// ---------------------------------------------------------------------------
|
|
941 |
// CIptvTestUtilALR::GetDefaultIap
|
|
942 |
// ---------------------------------------------------------------------------
|
|
943 |
//
|
|
944 |
EXPORT_C TUint32 CIptvTestUtilALR::GetDefaultIapCenRep()
|
|
945 |
{
|
|
946 |
TInt iap( 0 );
|
|
947 |
|
|
948 |
VCXLOGLO1("CIptvTestUtilALR::GetDefaultIapCenRep Create cenrep.");
|
|
949 |
CRepository* cenRep = CRepository::NewLC( VCXTEST_KIptvAlrCenRepUid );
|
|
950 |
VCXLOGLO1("CIptvTestUtilALR::GetDefaultIapCenRep Set cenrep.");
|
|
951 |
User::LeaveIfError( cenRep->Get( VCXTEST_KIptvCenRepDefaultIapIdKey, iap) );
|
|
952 |
CleanupStack::PopAndDestroy( cenRep );
|
|
953 |
|
|
954 |
TUint32 iapId( iap );
|
|
955 |
|
|
956 |
return iapId;
|
|
957 |
}
|
|
958 |
|
|
959 |
// ---------------------------------------------------------------------------
|
|
960 |
// CIptvTestUtilALR::PrintDestinationL
|
|
961 |
// ---------------------------------------------------------------------------
|
|
962 |
//
|
|
963 |
void CIptvTestUtilALR::PrintDestinationL( RCmDestinationExt& aDestination )
|
|
964 |
{
|
|
965 |
HBufC* destName = aDestination.NameLC();
|
|
966 |
|
|
967 |
TPtr destNamePtr = destName->Des();
|
|
968 |
VCXLOGLO2( "CIptvIptvTestUtilALR:: Destination: %S", &destNamePtr );
|
|
969 |
|
|
970 |
for(TInt e=0; e < aDestination.ConnectionMethodCount(); e++)
|
|
971 |
{
|
|
972 |
RCmConnectionMethodExt method = aDestination.ConnectionMethodL( e );
|
|
973 |
CleanupClosePushL( method );
|
|
974 |
|
|
975 |
HBufC* methodName = method.GetStringAttributeL( CMManager::ECmName );
|
|
976 |
CleanupStack::PushL( methodName );
|
|
977 |
|
|
978 |
TUint priority = aDestination.PriorityL( method );
|
|
979 |
TInt iapId = method.GetIntAttributeL( CMManager::ECmIapId );
|
|
980 |
VCXLOGLO4( "CIptvIptvTestUtilALR:: Method: %S, priority: %d, id: %d", methodName, priority, iapId );
|
|
981 |
|
|
982 |
CleanupStack::PopAndDestroy( methodName );
|
|
983 |
CleanupStack::PopAndDestroy( &method );
|
|
984 |
}
|
|
985 |
|
|
986 |
CleanupStack::PopAndDestroy( destName );
|
|
987 |
}
|
|
988 |
|
|
989 |
// ---------------------------------------------------------------------------
|
|
990 |
// CIptvTestUtilALR::MethodMatchesL
|
|
991 |
// ---------------------------------------------------------------------------
|
|
992 |
//
|
|
993 |
TBool CIptvTestUtilALR::MethodMatchesL( const TDesC& aSearchedName, const TDesC& aCurrentName, TBool aStrict )
|
|
994 |
{
|
|
995 |
#ifdef __WINSCW__
|
|
996 |
if( aSearchedName.Compare( _L("Ethernet with Daemon Dynamic IP") ) == 0 )
|
|
997 |
{
|
|
998 |
return ETrue;
|
|
999 |
}
|
|
1000 |
#endif
|
|
1001 |
|
|
1002 |
if( aSearchedName.Compare( aCurrentName ) == 0 )
|
|
1003 |
{
|
|
1004 |
return ETrue;
|
|
1005 |
}
|
|
1006 |
|
|
1007 |
if( aStrict)
|
|
1008 |
{
|
|
1009 |
return EFalse;
|
|
1010 |
}
|
|
1011 |
|
|
1012 |
if( aSearchedName.Compare( _L("Internet") ) == 0 || aSearchedName.Compare( _L("Internet2") ) == 0 )
|
|
1013 |
{
|
|
1014 |
TBuf<256> temp( aCurrentName );
|
|
1015 |
temp.LowerCase();
|
|
1016 |
|
|
1017 |
_LIT(KIapElisaInternet, "elisa internet");
|
|
1018 |
_LIT(KIapDnaGPRS, "dna gprs");
|
|
1019 |
_LIT(KIapSoneraGPRS, "sonera gprs");
|
|
1020 |
_LIT(KIapRLGPRS, "rl gprs");
|
|
1021 |
_LIT(KIapInternet, "internet");
|
|
1022 |
_LIT(KIapProinternet, "prointernet");
|
|
1023 |
_LIT(KGprsInternet, "gprs internet");
|
|
1024 |
|
|
1025 |
if( temp.Compare( KIapElisaInternet ) == KErrNone ) return ETrue;
|
|
1026 |
if( temp.Compare( KIapDnaGPRS ) == KErrNone ) return ETrue;
|
|
1027 |
if( temp.Compare( KIapRLGPRS ) == KErrNone ) return ETrue;
|
|
1028 |
if( temp.Compare( KIapInternet ) == KErrNone ) return ETrue;
|
|
1029 |
if( temp.Compare( KIapProinternet ) == KErrNone ) return ETrue;
|
|
1030 |
if( temp.Compare( KGprsInternet ) == KErrNone ) return ETrue;
|
|
1031 |
if( temp.Compare( KIapSoneraGPRS ) == KErrNone ) return ETrue;
|
|
1032 |
}
|
|
1033 |
|
|
1034 |
return EFalse;
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
// ---------------------------------------------------------------------------
|
|
1038 |
// CIptvTestUtilALR::ConnectionCreated
|
|
1039 |
// ---------------------------------------------------------------------------
|
|
1040 |
//
|
|
1041 |
void CIptvTestUtilALR::ConnectionCreated()
|
|
1042 |
{
|
|
1043 |
iActiveWait->Stop();
|
|
1044 |
}
|
|
1045 |
|
|
1046 |
// ---------------------------------------------------------------------------
|
|
1047 |
// CIptvTestUtilALR::ConnectionClosed
|
|
1048 |
// ---------------------------------------------------------------------------
|
|
1049 |
//
|
|
1050 |
void CIptvTestUtilALR::ConnectionClosed()
|
|
1051 |
{
|
|
1052 |
iActiveWait->Stop();
|
|
1053 |
}
|
|
1054 |
|
|
1055 |
// ---------------------------------------------------------------------------
|
|
1056 |
// CIptvTestUtilALR::ConnectionFailed
|
|
1057 |
// ---------------------------------------------------------------------------
|
|
1058 |
//
|
|
1059 |
void CIptvTestUtilALR::ConnectionFailed()
|
|
1060 |
{
|
|
1061 |
iActiveWait->Stop();
|
|
1062 |
}
|
|
1063 |
|
|
1064 |
// ---------------------------------------------------------------------------
|
|
1065 |
// CIptvTestUtilALR::ConnectionAlreadyExists
|
|
1066 |
// ---------------------------------------------------------------------------
|
|
1067 |
//
|
|
1068 |
void CIptvTestUtilALR::ConnectionAlreadyExists()
|
|
1069 |
{
|
|
1070 |
iActiveWait->Stop();
|
|
1071 |
}
|
|
1072 |
|
|
1073 |
// ---------------------------------------------------------------------------
|
|
1074 |
// CIptvTestUtilALR::ConnectionTimeout
|
|
1075 |
// ---------------------------------------------------------------------------
|
|
1076 |
//
|
|
1077 |
void CIptvTestUtilALR::ConnectionTimeout()
|
|
1078 |
{
|
|
1079 |
iActiveWait->Stop();
|
|
1080 |
}
|
|
1081 |
|
|
1082 |
// End of file
|