author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 13 Oct 2010 14:59:48 +0300 | |
branch | RCL_3 |
changeset 69 | cf1b3ddbe9a1 |
parent 58 | 83ca720e2b9a |
permissions | -rw-r--r-- |
58 | 1 |
/* |
69
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
58 | 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: Implementation of CCmManagerImpl. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "cmmanagerimpl.h" |
|
19 |
#include <cmpluginbaseeng.h> |
|
20 |
#include <cmpluginbase.h> |
|
21 |
#include <cmdestination.h> |
|
22 |
#include <cmdestinationext.h> |
|
23 |
#include "cmdestinationimpl.h" |
|
24 |
#include "cmtransactionhandler.h" |
|
25 |
#include "cmlogger.h" |
|
26 |
#include "cmmanager.hrh" |
|
27 |
#include <cmcommonconstants.h> |
|
28 |
#include <cmmanagerext.h> |
|
29 |
#include <cmpluginembdestinationdef.h> |
|
30 |
#include "cmobjectpool.h" |
|
31 |
#include "cmcommsdatnotifier.h" |
|
32 |
||
33 |
#include <sysutil.h> |
|
34 |
#include <featmgr.h> |
|
35 |
#include <wlancontainer.h> // CCDWlanServiceRecord |
|
36 |
#include <StringLoader.h> |
|
37 |
#include <commsdattypesv1_1.h> |
|
38 |
#include <e32cmn.h> |
|
39 |
#include <bautils.h> // BaflUtils |
|
40 |
#include <cmmanager.rsg> // resource |
|
41 |
#include <data_caging_path_literals.hrh> |
|
42 |
#include <ecom/ecom.h> // For REComSession |
|
43 |
#include <cmmanagerext.h> |
|
44 |
||
45 |
#include <cmmanager.mbg> // icons |
|
46 |
#include <AknsUtils.h> |
|
47 |
||
48 |
#include <commsdattypesv1_1.h> |
|
49 |
#include <rconnmon.h> |
|
50 |
||
51 |
using namespace CMManager; |
|
52 |
using namespace CommsDat; |
|
53 |
||
54 |
// CONSTANTS |
|
55 |
||
56 |
const TInt KResFileGranularity = 5; |
|
57 |
const TInt KPluginGranularity = 3; |
|
58 |
// if a CmId is grater than KMaxIapId, than it has no iap record |
|
59 |
// Otherwise cmId is the same as the IapId |
|
60 |
const TUint32 KMaxIapID = 255; |
|
61 |
// Safety margin when checking disk space |
|
62 |
const TUint32 KBytesToWrite = 8000; |
|
63 |
||
64 |
const TUint32 KEndOfArray = KMaxTUint; |
|
65 |
/** |
|
66 |
* This array lists all the bearerspecific attributes. |
|
67 |
* The bearerspecific attributes can be queried via both |
|
68 |
* the manager interface's and connection method interface's ::Get functions. |
|
69 |
*/ |
|
70 |
static const TUint32 KBearerSpecificAttributes[]= |
|
71 |
{ |
|
72 |
/** |
|
73 |
*/ |
|
74 |
ECmCoverage, |
|
75 |
ECmDefaultPriority, |
|
76 |
ECmDestination, |
|
77 |
ECmBearerHasUi, |
|
78 |
ECmIPv6Supported, |
|
79 |
ECmDefaultUiPriority, |
|
80 |
ECmBearerIcon, |
|
81 |
ECmBearerAvailableIcon, |
|
82 |
ECmBearerAvailableName, |
|
83 |
ECmBearerSupportedName, |
|
84 |
ECmBearerAvailableText, |
|
85 |
ECmBearerNamePopupNote, |
|
86 |
ECmCommsDBBearerType, |
|
87 |
ECmBearerSettingName, |
|
88 |
ECmVirtual, |
|
89 |
ECmExtensionLevel, |
|
90 |
ECmAddToAvailableList, |
|
91 |
KEndOfArray |
|
92 |
}; |
|
93 |
||
94 |
// ----------------------------------------------------------------------------- |
|
95 |
// Test functions |
|
96 |
// ----------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
/*#ifdef _DEBUG |
|
99 |
void DumIapTableL( CMDBSession& aSession ) |
|
100 |
{ |
|
101 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = |
|
102 |
new (ELeave) CMDBRecordSet<CCDIAPRecord>( KCDTIdIAPRecord ); |
|
103 |
CleanupStack::PushL( ptrRecordSet ); |
|
104 |
||
105 |
TRAP_IGNORE( ptrRecordSet->LoadL( aSession ) ); |
|
106 |
||
107 |
TInt iapRecords = ptrRecordSet->iRecords.Count(); |
|
108 |
CLOG_WRITE_1_PTR( NULL, "Dumping IAP Table\nNo. of IAPs: [%d]", iapRecords ); |
|
109 |
for ( TInt i = 0; i < iapRecords; i++ ) |
|
110 |
{ |
|
111 |
CCDIAPRecord* iapRecord = (*ptrRecordSet)[i]; |
|
112 |
||
113 |
CLOG_WRITE_4_PTR( NULL, "Rec id:[%d] - Name: [%S] - Service Type: [%S] - Bearer Type: [%S]", |
|
114 |
iapRecord->RecordId(), |
|
115 |
&FIELD_TO_TDESC( iapRecord->iRecordName ), |
|
116 |
&FIELD_TO_TDESC( iapRecord->iServiceType ), |
|
117 |
&FIELD_TO_TDESC( iapRecord->iBearerType ) |
|
118 |
); |
|
119 |
} |
|
120 |
||
121 |
CleanupStack::PopAndDestroy( ptrRecordSet ); |
|
122 |
} |
|
123 |
#endif */ // _DEBUG |
|
124 |
||
125 |
//============================================================================= |
|
126 |
// CONSTRUCTION / DESTRUCTION API |
|
127 |
//============================================================================= |
|
128 |
// |
|
129 |
||
130 |
//----------------------------------------------------------------------------- |
|
131 |
// CCmManagerImpl::NewL() |
|
132 |
//----------------------------------------------------------------------------- |
|
133 |
// |
|
134 |
CCmManagerImpl* CCmManagerImpl::NewL( TBool aCreateTables ) |
|
135 |
{ |
|
136 |
CCmManagerImpl* self = new (ELeave) CCmManagerImpl(); |
|
137 |
CleanupStack::PushL( self ); |
|
138 |
self->iCreateTables = aCreateTables; |
|
139 |
self->ConstructL(); |
|
140 |
CleanupStack::Pop( self ); // self |
|
141 |
||
142 |
return self; |
|
143 |
} |
|
144 |
||
145 |
//----------------------------------------------------------------------------- |
|
146 |
// CCmManagerImpl::CCmManagerImpl() |
|
147 |
//----------------------------------------------------------------------------- |
|
148 |
// |
|
149 |
CCmManagerImpl::CCmManagerImpl() |
|
150 |
:iDefConnSupported(EFalse),iCreateTables(ETrue) |
|
151 |
{ |
|
152 |
CLOG_CREATE; |
|
153 |
||
154 |
Dll::SetTls( this ); |
|
155 |
} |
|
156 |
||
157 |
//----------------------------------------------------------------------------- |
|
158 |
// CCmManagerImpl::~CCmManagerImpl() |
|
159 |
//----------------------------------------------------------------------------- |
|
160 |
// |
|
161 |
CCmManagerImpl::~CCmManagerImpl() |
|
162 |
{ |
|
163 |
CLOG_WRITE( "CCmManagerImpl::~CCmManagerImpl" ); |
|
164 |
||
165 |
if ( iBearerPriorityArray ) |
|
166 |
{ |
|
167 |
CleanupGlobalPriorityArray( *iBearerPriorityArray ); |
|
168 |
delete iBearerPriorityArray; |
|
169 |
} |
|
170 |
||
171 |
if ( iPlugins ) |
|
172 |
{ |
|
173 |
iPlugins->ResetAndDestroy(); |
|
174 |
delete iPlugins; |
|
175 |
} |
|
176 |
||
177 |
||
178 |
if ( iResourceFiles ) |
|
179 |
{ |
|
180 |
TInt resCount = iResourceFiles->Count(); |
|
181 |
for ( TInt i = 0; i < resCount; ++i ) |
|
182 |
{ |
|
183 |
// close the resource file |
|
184 |
(*iResourceFiles)[0]->iFile.Close(); |
|
185 |
// delete the structure |
|
186 |
delete (*iResourceFiles)[0]; |
|
187 |
// delete array item |
|
188 |
iResourceFiles->Delete( 0 ); |
|
189 |
} |
|
190 |
||
191 |
iResourceFiles->Reset(); |
|
192 |
delete iResourceFiles; |
|
193 |
} |
|
194 |
||
195 |
iFs.Close(); |
|
196 |
||
197 |
delete iPluginImpl; |
|
198 |
||
199 |
if (iTrans) |
|
200 |
{ |
|
201 |
delete &Session(); |
|
202 |
delete iTrans; |
|
203 |
} |
|
204 |
||
205 |
if( iIsFeatureManagerInitialised ) |
|
206 |
{ |
|
207 |
FeatureManager::UnInitializeLib(); |
|
208 |
} |
|
209 |
||
210 |
REComSession::FinalClose(); |
|
211 |
||
212 |
delete iObjectPool; |
|
213 |
||
214 |
delete iCommsDatIapNotifier; |
|
215 |
delete iCommsDatSnapNotifier; |
|
216 |
||
217 |
CLOG_CLOSE; |
|
218 |
} |
|
219 |
||
220 |
||
221 |
// ----------------------------------------------------------------------------- |
|
222 |
// CCmManagerImpl::CheckTablesL() |
|
223 |
// ----------------------------------------------------------------------------- |
|
224 |
// |
|
225 |
void CCmManagerImpl::CheckTablesL() |
|
226 |
{ |
|
227 |
LOGGER_ENTERFN( "CCmManagerImpl::CheckDestinationNetworkTableL" ); |
|
228 |
||
229 |
TInt err( 0 ); |
|
230 |
||
231 |
CLOG_WRITE( "Destination network" ); |
|
232 |
if (iCreateTables) |
|
233 |
{ |
|
234 |
TRAP( err, iDestinationTableId = |
|
235 |
CCDDataMobilitySelectionPolicyRecord::TableIdL( Session() )); |
|
236 |
CLOG_WRITE_1( "err: [%d]", err ); |
|
237 |
if( err == KErrNotFound ) |
|
238 |
{ |
|
239 |
iDestinationTableId = |
|
240 |
CCDDataMobilitySelectionPolicyRecord::CreateTableL( Session() ); |
|
241 |
} |
|
242 |
else |
|
243 |
{ |
|
244 |
User::LeaveIfError( err ); |
|
245 |
} |
|
246 |
} |
|
247 |
else |
|
248 |
{ |
|
249 |
iDestinationTableId = |
|
250 |
CCDDataMobilitySelectionPolicyRecord::TableIdL( Session() ); |
|
251 |
} |
|
252 |
||
253 |
CLOG_WRITE( "Global Bearer Type Priorization Table" ); |
|
254 |
TRAP( err, iBearerTypePriorizationTableId = |
|
255 |
CCDGlobalBearerTypePriorizationRecord::TableIdL( Session() ) ); |
|
256 |
CLOG_WRITE_1( "err: [%d]", err ); |
|
257 |
if( err == KErrNotFound ) |
|
258 |
{ |
|
259 |
iBearerTypePriorizationTableId = |
|
260 |
CCDGlobalBearerTypePriorizationRecord::CreateTableL( Session() ); |
|
261 |
} |
|
262 |
else |
|
263 |
{ |
|
264 |
User::LeaveIfError( err ); |
|
265 |
} |
|
266 |
||
267 |
CLOG_WRITE( "Destination network - Icon table" ); |
|
268 |
TRAP( err, iIconTableId = CCDSNAPMetadataRecord::TableIdL( Session() ) ); |
|
269 |
if( err == KErrNotFound ) |
|
270 |
{ |
|
271 |
iIconTableId = CCDSNAPMetadataRecord::CreateTableL( Session() ); |
|
272 |
} |
|
273 |
else |
|
274 |
{ |
|
275 |
User::LeaveIfError( err ); |
|
276 |
} |
|
277 |
||
278 |
CLOG_WRITE( "Seamlessness table" ); |
|
279 |
TRAP( err, iSeamlessnessTableId = CCDIAPMetadataRecord::TableIdL( Session() ) ); |
|
280 |
CLOG_WRITE_1( "err: [%d]", err ); |
|
281 |
if( err == KErrNotFound ) |
|
282 |
{ |
|
283 |
iSeamlessnessTableId = CCDIAPMetadataRecord::CreateTableL( Session() ); |
|
284 |
} |
|
285 |
else |
|
286 |
{ |
|
287 |
User::LeaveIfError( err ); |
|
288 |
} |
|
289 |
if ( IsDefConnSupported() ) |
|
290 |
{ |
|
291 |
CLOG_WRITE( "Default connection table" ); |
|
292 |
TRAP( err, iDefConnTableId = CCDDefConnRecord::TableIdL( Session() ) ); |
|
293 |
CLOG_WRITE_1( "err: [%d]", err ); |
|
294 |
if( err == KErrNotFound ) |
|
295 |
{ |
|
296 |
iDefConnTableId = CCDDefConnRecord::CreateTableL( Session() ); |
|
297 |
} |
|
298 |
else |
|
299 |
{ |
|
300 |
User::LeaveIfError( err ); |
|
301 |
} |
|
302 |
} |
|
303 |
} |
|
304 |
||
305 |
//----------------------------------------------------------------------------- |
|
306 |
// CCmManagerImpl::CreateBearerPriorityArrayL() |
|
307 |
//----------------------------------------------------------------------------- |
|
308 |
// |
|
309 |
void CCmManagerImpl::CreateBearerPriorityArrayL() |
|
310 |
{ |
|
311 |
LOGGER_ENTERFN( "CCmManagerImpl:CreateBearerPriorityArray" ); |
|
312 |
||
313 |
iBearerPriorityArray = |
|
314 |
new ( ELeave ) RArray<TBearerPriority>( KCmArrayBigGranularity ); |
|
315 |
||
316 |
CMDBRecordSet<CCmBearerPriRec>* bpRS = |
|
317 |
new (ELeave) CMDBRecordSet<CCmBearerPriRec>( |
|
318 |
iBearerTypePriorizationTableId ); |
|
319 |
CleanupStack::PushL( bpRS ); |
|
320 |
||
321 |
OpenTransactionLC(); |
|
322 |
TRAP_IGNORE( bpRS->LoadL( Session() ) ); |
|
323 |
RollbackTransaction(); |
|
324 |
||
325 |
TInt bpCount = bpRS->iRecords.Count(); |
|
326 |
TInt i( 0 ); |
|
327 |
||
328 |
while ( i < bpCount ) // loop the Bearer Priority table |
|
329 |
{ |
|
330 |
// Bearer Priority record ID |
|
331 |
HBufC* bpServiceType = QUERY_HBUFC_FIELD( (*bpRS)[i], |
|
332 |
KCDTIdGlobalServiceType ); |
|
333 |
||
334 |
TInt bpPriority = ( QUERY_INT_FIELD( (*bpRS)[i], |
|
335 |
KCDTIdGlobalServicePriority ) ); |
|
336 |
TInt uiPriority = ( QUERY_INT_FIELD( (*bpRS)[i], |
|
337 |
KCDTIdGlobalServiceUIPriority ) ); |
|
338 |
CLOG_WRITE( "Bearer Priority Table Values" ); |
|
339 |
CLOG_WRITE_1( "Service Type: [%S]", bpServiceType ); |
|
340 |
CLOG_WRITE_1( "Bearer Priority: [%d]", bpPriority ); |
|
341 |
CLOG_WRITE_1( "UI Priority: [%d]", uiPriority ); |
|
342 |
TBearerPriority bp; |
|
343 |
bp.iServiceType = bpServiceType->AllocL(); |
|
344 |
bp.iPriority = bpPriority; |
|
345 |
bp.iUIPriority = uiPriority; |
|
346 |
iBearerPriorityArray->AppendL( bp ); |
|
347 |
i++; |
|
348 |
} |
|
349 |
||
350 |
CleanupStack::PopAndDestroy( bpRS ); |
|
351 |
} |
|
352 |
||
353 |
//----------------------------------------------------------------------------- |
|
354 |
// CCmManagerImpl::BearerPriorityArrayL() |
|
355 |
//----------------------------------------------------------------------------- |
|
356 |
// |
|
357 |
void CCmManagerImpl::BearerPriorityArrayL( RArray<TBearerPriority>& aArray ) const |
|
358 |
{ |
|
359 |
LOGGER_ENTERFN( "CCmManagerImpl:BearerPriorityArray" ); |
|
360 |
TRAPD( err, CopyBearerPriorityArrayL( aArray ) ); |
|
361 |
if( err ) |
|
362 |
// in case of any problem we clean up this array |
|
363 |
{ |
|
364 |
User::Leave( err ); |
|
365 |
} |
|
366 |
} |
|
367 |
||
368 |
//----------------------------------------------------------------------------- |
|
369 |
// CCmManagerImpl::CopyBearerPriorityArrayL() |
|
370 |
//----------------------------------------------------------------------------- |
|
371 |
// |
|
372 |
void CCmManagerImpl::CopyBearerPriorityArrayL( |
|
373 |
RArray<TBearerPriority>& aArray ) const |
|
374 |
{ |
|
375 |
LOGGER_ENTERFN( "CCmManagerImpl:BearerPriorityArray" ); |
|
376 |
for ( TInt i = 0; i < iBearerPriorityArray->Count(); i++ ) |
|
377 |
{ |
|
378 |
TBearerPriority item; |
|
379 |
||
380 |
TBearerPriority* orgItem = &(*iBearerPriorityArray)[i]; |
|
381 |
||
382 |
item.iServiceType = HBufC::NewLC( orgItem->iServiceType->Length() ); |
|
383 |
item.iServiceType->Des().Copy( *orgItem->iServiceType ); |
|
384 |
item.iPriority = orgItem->iPriority; |
|
385 |
item.iUIPriority = orgItem->iUIPriority; |
|
386 |
||
387 |
User::LeaveIfError( aArray.Append( item ) ); |
|
388 |
||
389 |
CleanupStack::Pop(); // item->iServiceType |
|
390 |
} |
|
391 |
} |
|
392 |
||
393 |
//----------------------------------------------------------------------------- |
|
394 |
// CCmManagerImpl::UpdateBearerPriorityArrayL() |
|
395 |
//----------------------------------------------------------------------------- |
|
396 |
// |
|
397 |
void CCmManagerImpl::UpdateBearerPriorityArrayL( |
|
398 |
const RArray<TBearerPriority>& aArray ) |
|
399 |
{ |
|
400 |
LOGGER_ENTERFN( "CCmManagerImpl::UpdateBearerPriorityArray" ); |
|
401 |
||
402 |
OpenTransactionLC(); |
|
403 |
||
404 |
CMDBRecordSet<CCmBearerPriRec>* bpRS = new (ELeave) |
|
405 |
CMDBRecordSet<CCmBearerPriRec>( iBearerTypePriorizationTableId ); |
|
406 |
CleanupStack::PushL( bpRS ); // 1 |
|
407 |
TRAP_IGNORE( bpRS->LoadL( Session() ) ); |
|
408 |
||
409 |
// Delete the old record |
|
410 |
for ( TInt i = 0; i < bpRS->iRecords.Count(); ++i ) |
|
411 |
{ |
|
412 |
bpRS->iRecords[i]->DeleteL( Session() ); |
|
413 |
} |
|
414 |
||
415 |
CleanupGlobalPriorityArray( *iBearerPriorityArray ); |
|
416 |
||
417 |
CleanupStack::PopAndDestroy( bpRS ); |
|
418 |
bpRS = NULL; |
|
419 |
||
420 |
// Add the new content |
|
421 |
CCmBearerPriRec* bpRcd = |
|
422 |
new (ELeave) CCmBearerPriRec( iBearerTypePriorizationTableId ); |
|
423 |
CleanupStack::PushL( bpRcd ); // 2 |
|
424 |
||
425 |
CLOG_WRITE( "Store bearer info to table" ); |
|
426 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
427 |
{ |
|
428 |
bpRcd->SetRecordId( KCDNewRecordRequest ); |
|
429 |
||
430 |
HBufC* serviceTypeVal = aArray[i].iServiceType; |
|
431 |
TInt priorityVal = aArray[i].iPriority; |
|
432 |
TInt uiPriorityVal = aArray[i].iUIPriority; |
|
433 |
||
434 |
CLOG_WRITE_FORMAT( "Set service type: [%S ]", serviceTypeVal ); |
|
435 |
SET_HBUFC_FIELD( bpRcd, |
|
436 |
KCDTIdGlobalServiceType, |
|
437 |
serviceTypeVal ); |
|
438 |
CLOG_WRITE_1( "Set priority: [%d]", priorityVal ); |
|
439 |
SET_INT_FIELD( bpRcd, |
|
440 |
KCDTIdGlobalServicePriority, |
|
441 |
priorityVal ); |
|
442 |
CLOG_WRITE_1( "Set uipriority: [%d]", uiPriorityVal ); |
|
443 |
SET_INT_FIELD( bpRcd, |
|
444 |
KCDTIdGlobalServiceUIPriority, |
|
445 |
uiPriorityVal ); |
|
446 |
bpRcd->StoreL( Session() ); |
|
447 |
||
448 |
TBearerPriority item; |
|
449 |
||
450 |
item.iServiceType = serviceTypeVal->AllocLC(); |
|
451 |
item.iPriority = priorityVal; |
|
452 |
item.iUIPriority = uiPriorityVal; |
|
453 |
iBearerPriorityArray->AppendL( item ); |
|
454 |
CleanupStack::Pop( item.iServiceType ); |
|
455 |
} |
|
456 |
||
457 |
CleanupStack::PopAndDestroy( bpRcd ); |
|
458 |
||
459 |
CommitTransactionL( KErrNone ); |
|
460 |
} |
|
461 |
||
462 |
//----------------------------------------------------------------------------- |
|
463 |
// CCmManagerImpl::GlobalBearerPriority() |
|
464 |
//----------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
TInt CCmManagerImpl::GlobalBearerPriority( TBool aUiPriority, |
|
467 |
const TDesC& aServiceType ) const |
|
468 |
{ |
|
469 |
for ( TInt i = 0; i < iBearerPriorityArray->Count(); ++i ) |
|
470 |
{ |
|
471 |
if ( !aServiceType.CompareF( *(*iBearerPriorityArray)[i].iServiceType ) ) |
|
472 |
{ |
|
473 |
if( aUiPriority ) |
|
474 |
{ |
|
475 |
return (*iBearerPriorityArray)[i].iUIPriority; |
|
476 |
} |
|
477 |
else |
|
478 |
{ |
|
479 |
return (*iBearerPriorityArray)[i].iPriority; |
|
480 |
} |
|
481 |
} |
|
482 |
} |
|
483 |
||
484 |
return KDataMobilitySelectionPolicyPriorityWildCard; |
|
485 |
} |
|
486 |
||
487 |
//----------------------------------------------------------------------------- |
|
488 |
// CCmManagerImpl::CleanupGlobalPriorityArray() |
|
489 |
//----------------------------------------------------------------------------- |
|
490 |
// |
|
491 |
void CCmManagerImpl::CleanupGlobalPriorityArray( |
|
492 |
RArray<TBearerPriority>& aArray ) const |
|
493 |
{ |
|
494 |
LOGGER_ENTERFN( "CCmManagerImpl::CleanupGlobalPriorityArray" ); |
|
495 |
||
496 |
for ( TInt i = 0; i < aArray.Count(); ++i ) |
|
497 |
{ |
|
498 |
delete aArray[i].iServiceType; |
|
499 |
} |
|
500 |
||
501 |
aArray.Reset(); |
|
502 |
aArray.Close(); |
|
503 |
} |
|
504 |
||
505 |
//----------------------------------------------------------------------------- |
|
506 |
// CCmManagerImpl::AddResourceFileL() |
|
507 |
//----------------------------------------------------------------------------- |
|
508 |
// |
|
509 |
void CCmManagerImpl::AddResourceFileL( TFileName& aName ) |
|
510 |
{ |
|
511 |
LOGGER_ENTERFN( "CCmManagerImpl::AddResourceFileL" ); |
|
512 |
||
513 |
TInt index = FindResourceFile( aName ); |
|
514 |
||
515 |
if ( index != KErrNotFound ) |
|
516 |
{ |
|
517 |
++(*iResourceFiles)[index]->iRefs; |
|
518 |
return; |
|
519 |
} |
|
520 |
||
521 |
TResourceFiles* newRes = new (ELeave) TResourceFiles; |
|
522 |
CleanupStack::PushL( newRes ); |
|
523 |
||
524 |
RResourceFile resFile; |
|
525 |
resFile.OpenL( iFs, aName ); |
|
526 |
CleanupClosePushL( resFile ); |
|
527 |
||
528 |
resFile.ConfirmSignatureL(0); |
|
529 |
||
530 |
newRes->iFile = resFile; |
|
531 |
newRes->iFName.Copy( aName ); |
|
532 |
newRes->iRefs = 1; // 1 reference to this resource file |
|
533 |
||
534 |
iResourceFiles->AppendL( newRes ); |
|
535 |
||
536 |
CleanupStack::Pop( 2 ); // resFile, newRes |
|
537 |
} |
|
538 |
||
539 |
//----------------------------------------------------------------------------- |
|
540 |
// CCmManagerImpl::RemoveResourceFile() |
|
541 |
//----------------------------------------------------------------------------- |
|
542 |
// |
|
543 |
void CCmManagerImpl::RemoveResourceFile( TFileName& aName ) |
|
544 |
{ |
|
545 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveResourceFile" ); |
|
546 |
||
547 |
TInt index = FindResourceFile( aName ); |
|
548 |
||
549 |
if ( index == KErrNotFound ) |
|
550 |
{ |
|
551 |
return; |
|
552 |
} |
|
553 |
||
554 |
if ( !--(*iResourceFiles)[index]->iRefs ) |
|
555 |
// it was the last reference |
|
556 |
{ |
|
557 |
(*iResourceFiles)[index]->iFile.Close(); |
|
558 |
delete (*iResourceFiles)[index]; |
|
559 |
||
560 |
iResourceFiles->Delete( index ); |
|
561 |
} |
|
562 |
} |
|
563 |
||
564 |
//----------------------------------------------------------------------------- |
|
565 |
// CCmManagerImpl::FindResourceFile() |
|
566 |
//----------------------------------------------------------------------------- |
|
567 |
// |
|
568 |
TInt CCmManagerImpl::FindResourceFile( TFileName& aName ) const |
|
569 |
{ |
|
570 |
LOGGER_ENTERFN( "CCmManagerImpl::FindResourceFile" ); |
|
571 |
||
572 |
BaflUtils::NearestLanguageFile( iFs, aName ); |
|
573 |
||
574 |
for ( TInt i = 0; i < iResourceFiles->Count(); ++i ) |
|
575 |
{ |
|
576 |
if ( !(*iResourceFiles)[i]->iFName.CompareF( aName ) ) |
|
577 |
{ |
|
578 |
return i; |
|
579 |
} |
|
580 |
} |
|
581 |
||
582 |
return KErrNotFound; |
|
583 |
} |
|
584 |
||
585 |
//----------------------------------------------------------------------------- |
|
586 |
// CCmManagerImpl::AllocReadL() |
|
587 |
//----------------------------------------------------------------------------- |
|
588 |
// |
|
589 |
HBufC* CCmManagerImpl::AllocReadL( TInt aResourceId ) const |
|
590 |
{ |
|
591 |
LOGGER_ENTERFN( "CCmManagerImpl::AllocReadL" ); |
|
592 |
||
593 |
HBufC* retVal = NULL; |
|
594 |
||
595 |
// Scan all resource files to find owner |
|
596 |
for (TInt i=0; i < iResourceFiles->Count(); i++) |
|
597 |
{ |
|
598 |
RResourceFile& file=(*iResourceFiles)[i]->iFile; |
|
599 |
if ( file.OwnsResourceId(aResourceId) ) |
|
600 |
{ |
|
601 |
HBufC8* readBuffer = file.AllocReadLC( aResourceId ); |
|
602 |
// as we are expecting HBufC16... |
|
603 |
const TPtrC16 ptrReadBuffer( (TText16*) readBuffer->Ptr(), |
|
604 |
readBuffer->Length() >> 1 ); |
|
605 |
retVal=HBufC16::NewL( ptrReadBuffer.Length() ); |
|
606 |
retVal->Des().Copy( ptrReadBuffer ); |
|
607 |
CleanupStack::PopAndDestroy( readBuffer ); // readBuffer |
|
608 |
||
609 |
// exit from loop |
|
610 |
break; |
|
611 |
} |
|
612 |
} |
|
613 |
||
614 |
return retVal; |
|
615 |
} |
|
616 |
||
617 |
//----------------------------------------------------------------------------- |
|
618 |
// CCmManagerImpl::ConstructL() |
|
619 |
//----------------------------------------------------------------------------- |
|
620 |
// |
|
621 |
void CCmManagerImpl::ConstructL() |
|
622 |
{ |
|
623 |
LOGGER_ENTERFN( "CCmManagerImpl::ConstructL" ); |
|
624 |
CLOG_NAME_1( _L("ManagerImpl_0x%x"), this ); |
|
625 |
||
626 |
iObjectPool = new (ELeave) CCMObjectPool(*this); |
|
627 |
||
628 |
FeatureManager::InitializeLibL(); |
|
629 |
iIsFeatureManagerInitialised = ETrue; |
|
630 |
iHelp = FeatureManager::FeatureSupported( KFeatureIdHelp ); |
|
631 |
iDefConnSupported = ETrue; |
|
632 |
//iDefConnSupported = FeatureManager::FeatureSupported( KFeatureIdDefaultConnection ); |
|
633 |
iWLan = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
634 |
||
635 |
CMDBSession* db = CMDBSession::NewL( KCDVersion1_2 ); |
|
636 |
||
637 |
iTrans = CCmTransactionHandler::NewL( *db ); |
|
638 |
CLOG_ATTACH( iTrans, this ); |
|
639 |
||
640 |
User::LeaveIfError( iFs.Connect() ); |
|
641 |
||
642 |
iResourceFiles = new (ELeave) CArrayPtrFlat<TResourceFiles>( |
|
643 |
KResFileGranularity ); |
|
644 |
||
645 |
TParse fp; |
|
646 |
TInt err = fp.Set( KACMManagerResDirAndFileName, |
|
647 |
&KDC_RESOURCE_FILES_DIR, |
|
648 |
NULL ); |
|
649 |
CLOG_WRITE_1( "Set: [%d]", err ); |
|
650 |
if ( err != KErrNone) |
|
651 |
{ |
|
652 |
User::Leave( err ); |
|
653 |
} |
|
654 |
||
655 |
TFileName fName; |
|
656 |
||
657 |
fName.Copy( fp.FullName() ); |
|
658 |
||
659 |
AddResourceFileL( fName ); |
|
660 |
||
661 |
CheckTablesL(); |
|
662 |
CreateBearerPriorityArrayL(); |
|
663 |
||
664 |
BuildPluginArrayL(); |
|
665 |
||
666 |
TCmPluginInitParam params( *this ); |
|
667 |
||
668 |
params.iParentDest = NULL; |
|
669 |
iPluginImpl = CCmConnectionMethodInfo::NewL( ¶ms ); |
|
670 |
CLOG_ATTACH( iPluginImpl, this ); |
|
671 |
} |
|
672 |
||
673 |
// --------------------------------------------------------------------------- |
|
674 |
// CCmManagerImpl::OpenTransactionLC |
|
675 |
// --------------------------------------------------------------------------- |
|
676 |
// |
|
677 |
void CCmManagerImpl::OpenTransactionLC( TBool aSetAttribs ) |
|
678 |
{ |
|
679 |
LOGGER_ENTERFN( "CCmManagerImpl::OpenTransactionL" ); |
|
680 |
||
681 |
iTrans->OpenTransactionLC( aSetAttribs ); |
|
682 |
} |
|
683 |
||
684 |
// --------------------------------------------------------------------------- |
|
685 |
// CCmDestinationImpl::CommitTransactionL |
|
686 |
// --------------------------------------------------------------------------- |
|
687 |
// |
|
688 |
void CCmManagerImpl::CommitTransactionL( TInt aError ) |
|
689 |
{ |
|
690 |
LOGGER_ENTERFN( "CCmManagerImpl::CommitTransactionL" ); |
|
691 |
||
692 |
iTrans->CommitTransactionL( aError ); |
|
693 |
} |
|
694 |
||
695 |
// --------------------------------------------------------------------------- |
|
696 |
// CCmDestinationImpl::CommitTransactionL |
|
697 |
// --------------------------------------------------------------------------- |
|
698 |
// |
|
699 |
void CCmManagerImpl::RollbackTransaction() |
|
700 |
{ |
|
701 |
LOGGER_ENTERFN( "CCmManagerImpl::RollbackTransaction" ); |
|
702 |
CleanupStack::Pop( iTrans ); |
|
703 |
iTrans->Close(); |
|
704 |
} |
|
705 |
||
706 |
// --------------------------------------------------------------------------- |
|
707 |
// CCmDestinationImpl::StartCommsDatNotifier |
|
708 |
// --------------------------------------------------------------------------- |
|
709 |
// |
|
710 |
void CCmManagerImpl::StartCommsDatNotifierL() |
|
711 |
{ |
|
712 |
// Two instances of class CCmCommsDatNotifier are created here and |
|
713 |
// referred by all watchers in CmManager. One is to watch change in Iap Table |
|
714 |
// and the other is to watch change in Snap Table. |
|
69
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
715 |
iCommsDatIapNotifier = CCmCommsDatNotifier::NewL( KCDTIdIAPRecord ); |
58 | 716 |
|
69
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
717 |
TUint32 snapTableId = GetSnapTableIdL(); |
cf1b3ddbe9a1
Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
58
diff
changeset
|
718 |
iCommsDatSnapNotifier = CCmCommsDatNotifier::NewL( snapTableId ); |
58 | 719 |
} |
720 |
||
721 |
//============================================================================= |
|
722 |
// CREATION / DELETION API |
|
723 |
//============================================================================= |
|
724 |
// |
|
725 |
||
726 |
//----------------------------------------------------------------------------- |
|
727 |
// CCmManagerImpl::CreateDestinationL( const TDesC& aName ) |
|
728 |
//----------------------------------------------------------------------------- |
|
729 |
// |
|
730 |
CCmDestinationImpl* CCmManagerImpl::CreateDestinationL( const TDesC& aName ) |
|
731 |
{ |
|
732 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateDestinationL" ); |
|
733 |
||
734 |
CheckAvailableSpaceL(); |
|
735 |
||
736 |
if ( aName.Length() == 0 ) |
|
737 |
{ |
|
738 |
User::Leave( KErrArgument ); |
|
739 |
} |
|
740 |
||
741 |
return iObjectPool->GetDestinationL( aName ); |
|
742 |
} |
|
743 |
||
744 |
//----------------------------------------------------------------------------- |
|
745 |
// CCmManagerImpl::CreateDestinationL( const TDesC& aName, TUint32 |
|
746 |
// aDestId ) |
|
747 |
//----------------------------------------------------------------------------- |
|
748 |
// |
|
749 |
CCmDestinationImpl* CCmManagerImpl::CreateDestinationL( |
|
750 |
const TDesC& aName, |
|
751 |
TUint32 aDestId ) |
|
752 |
{ |
|
753 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateDestinationL" ); |
|
754 |
||
755 |
CheckAvailableSpaceL(); |
|
756 |
||
757 |
if ( aName.Length() == 0 ) |
|
758 |
{ |
|
759 |
User::Leave( KErrArgument ); |
|
760 |
} |
|
761 |
||
762 |
if ( aDestId == 0 ) |
|
763 |
{ |
|
764 |
return CreateDestinationL( aName ); |
|
765 |
} |
|
766 |
||
767 |
return iObjectPool->CreateDestinationL( aName, aDestId ); |
|
768 |
} |
|
769 |
||
770 |
||
771 |
//----------------------------------------------------------------------------- |
|
772 |
// CCmManagerImpl::DestinationUpdated( CCmDestinationImpl* aDestination ) |
|
773 |
//----------------------------------------------------------------------------- |
|
774 |
// |
|
775 |
void CCmManagerImpl::DestinationUpdated( CCmDestinationImpl* aDestination ) |
|
776 |
{ |
|
777 |
LOGGER_ENTERFN( "CCmManagerImpl::DestinationUpdatedL" ); |
|
778 |
iObjectPool->DestinationUpdated( aDestination ); |
|
779 |
} |
|
780 |
||
781 |
// -------------------------------------------------------------------------- |
|
782 |
// CCmManagerImpl::CreateConnectionMethodL() |
|
783 |
// -------------------------------------------------------------------------- |
|
784 |
// |
|
785 |
CCmPluginBase* |
|
786 |
CCmManagerImpl::CreateConnectionMethodL( CCmPluginBaseEng* pluginBaseEng ) |
|
787 |
{ |
|
788 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL 2" ); |
|
789 |
||
790 |
CheckAvailableSpaceL(); |
|
791 |
||
792 |
return iObjectPool->CreateConnectionMethodL( pluginBaseEng ); |
|
793 |
} |
|
794 |
||
795 |
// -------------------------------------------------------------------------- |
|
796 |
// CCmManagerImpl::InsertConnectionMethodL() |
|
797 |
// -------------------------------------------------------------------------- |
|
798 |
// |
|
799 |
void CCmManagerImpl::InsertConnectionMethodL( CCmPluginBaseEng* pluginBaseEng ) |
|
800 |
{ |
|
801 |
iObjectPool->InsertConnectionMethodL( pluginBaseEng ); |
|
802 |
} |
|
803 |
||
804 |
// -------------------------------------------------------------------------- |
|
805 |
// CCmManagerImpl::CreateConnectionMethodL() |
|
806 |
// -------------------------------------------------------------------------- |
|
807 |
// |
|
808 |
CCmPluginBase* |
|
809 |
CCmManagerImpl::CreateConnectionMethodL( TUint32 aImplementationUid, |
|
810 |
CCmDestinationImpl* aParentDestination ) |
|
811 |
{ |
|
812 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL" ); |
|
813 |
||
814 |
CheckAvailableSpaceL(); |
|
815 |
||
816 |
TCmPluginInitParam params( *this ); |
|
817 |
if (aParentDestination) |
|
818 |
{ |
|
819 |
params.iParentDest = aParentDestination->Id(); |
|
820 |
} |
|
821 |
||
822 |
return iObjectPool->CreateConnectionMethodL( aImplementationUid, params ); |
|
823 |
} |
|
824 |
||
825 |
// -------------------------------------------------------------------------- |
|
826 |
// CCmManagerImpl::CreateConnectionMethodL() |
|
827 |
// -------------------------------------------------------------------------- |
|
828 |
// |
|
829 |
CCmPluginBase* |
|
830 |
CCmManagerImpl::CreateConnectionMethodL( TUint32 aImplementationUid, |
|
831 |
TUint32 aConnMethodId, |
|
832 |
CCmDestinationImpl* aParentDestination ) |
|
833 |
{ |
|
834 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateConnectionMethodL" ); |
|
835 |
||
836 |
CheckAvailableSpaceL(); |
|
837 |
||
838 |
TCmPluginInitParam params( *this ); |
|
839 |
if ( aParentDestination ) |
|
840 |
{ |
|
841 |
params.iParentDest = aParentDestination->Id(); |
|
842 |
} |
|
843 |
||
844 |
return iObjectPool->CreateConnectionMethodL( aImplementationUid, |
|
845 |
params, |
|
846 |
aConnMethodId); |
|
847 |
} |
|
848 |
||
849 |
// -------------------------------------------------------------------------- |
|
850 |
// CCmManagerImpl::DoCreateConnectionMethodL() |
|
851 |
// -------------------------------------------------------------------------- |
|
852 |
// |
|
853 |
CCmPluginBaseEng* |
|
854 |
CCmManagerImpl::DoCreateConnectionMethodL( TUint32 aImplementationUid, |
|
855 |
TCmPluginInitParam& aParams ) |
|
856 |
{ |
|
857 |
LOGGER_ENTERFN( "CCmManagerImpl::DoCreateConnectionMethodL" ); |
|
858 |
||
859 |
const TUid KMCMmImplementationUid = { aImplementationUid }; |
|
860 |
TAny* ptr = REComSession::CreateImplementationL( KMCMmImplementationUid, |
|
861 |
_FOFF( CCmPluginBaseEng, |
|
862 |
iDtor_ID_Key ), |
|
863 |
(TAny*)&aParams ); |
|
864 |
||
865 |
CCmPluginBaseEng* plugin = STATIC_CAST( CCmPluginBaseEng*, ptr ); |
|
866 |
CleanupStack::PushL( plugin ); |
|
867 |
||
868 |
plugin->CreateNewL(); |
|
869 |
plugin->SetIdValidity(EFalse); |
|
870 |
CleanupStack::Pop( plugin ); // plugin |
|
871 |
||
872 |
return plugin; |
|
873 |
} |
|
874 |
||
875 |
// -------------------------------------------------------------------------- |
|
876 |
// CCmManagerImpl::DoCreateConnectionMethodL() |
|
877 |
// -------------------------------------------------------------------------- |
|
878 |
// |
|
879 |
CCmPluginBaseEng* |
|
880 |
CCmManagerImpl::DoCreateConnectionMethodL( TUint32 aImplementationUid, |
|
881 |
TCmPluginInitParam& aParams, |
|
882 |
TUint32 aConnMethodId ) |
|
883 |
{ |
|
884 |
LOGGER_ENTERFN( "CCmManagerImpl::DoCreateConnectionMethodL" ); |
|
885 |
||
886 |
const TUid KMCMmImplementationUid = { aImplementationUid }; |
|
887 |
TAny* ptr = REComSession::CreateImplementationL( KMCMmImplementationUid, |
|
888 |
_FOFF( CCmPluginBaseEng, |
|
889 |
iDtor_ID_Key ), |
|
890 |
(TAny*)&aParams ); |
|
891 |
||
892 |
CCmPluginBaseEng* plugin = STATIC_CAST( CCmPluginBaseEng*, ptr ); |
|
893 |
CleanupStack::PushL( plugin ); |
|
894 |
||
895 |
plugin->CreateNewL(); |
|
896 |
plugin->SetIdValidity( EFalse ); |
|
897 |
plugin->SetPreDefinedId( aConnMethodId ); |
|
898 |
CleanupStack::Pop( plugin ); // plugin |
|
899 |
||
900 |
return plugin; |
|
901 |
} |
|
902 |
||
903 |
//----------------------------------------------------------------------------- |
|
904 |
// CCmManagerImpl::ConnectionMethodL( TUint aId ) |
|
905 |
//----------------------------------------------------------------------------- |
|
906 |
// |
|
907 |
EXPORT_C CCmPluginBaseEng* |
|
908 |
CCmManagerImpl::ConnectionMethodL( TUint32 /*aCmId*/ ) |
|
909 |
{ |
|
910 |
LOGGER_ENTERFN( "Error: Obsolete function CCmManagerImpl::ConnectionMethodL used" ); |
|
911 |
User::Panic( _L("CMManager"), KErrNotSupported ); |
|
912 |
return NULL; |
|
913 |
} |
|
914 |
||
915 |
//----------------------------------------------------------------------------- |
|
916 |
// CCmManagerImpl::GetConnectionMethodL( TUint aId ) |
|
917 |
//----------------------------------------------------------------------------- |
|
918 |
// |
|
919 |
EXPORT_C CCmPluginBase* |
|
920 |
CCmManagerImpl::GetConnectionMethodL( TUint32 aCmId ) |
|
921 |
{ |
|
922 |
LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodL" ); |
|
923 |
||
924 |
CCmPluginBase* plugin = DoFindConnMethodL( aCmId, NULL ); |
|
925 |
||
926 |
return plugin; |
|
927 |
} |
|
928 |
||
929 |
||
930 |
//----------------------------------------------------------------------------- |
|
931 |
// CCmManagerImpl::AppendUncatCmListL |
|
932 |
//----------------------------------------------------------------------------- |
|
933 |
// |
|
934 |
void CCmManagerImpl::AppendUncatCmListL( RPointerArray<CCmPluginBase>& aCMArray, |
|
935 |
TBool aCheckBearerType, |
|
936 |
TBool aLegacyOnly, |
|
937 |
TBool aEasyWlan, |
|
938 |
TBool aSortByBearer ) |
|
939 |
{ |
|
940 |
LOGGER_ENTERFN( "CCmManagerImpl::AppendUncatCmListL" ); |
|
941 |
||
942 |
RArray<TUint32> cmUidArray; |
|
943 |
CleanupClosePushL(cmUidArray); |
|
944 |
ConnectionMethodL(cmUidArray, aCheckBearerType, aLegacyOnly, aEasyWlan, aSortByBearer); |
|
945 |
AppendCmListFromUidsL( cmUidArray, aCMArray ); |
|
946 |
||
947 |
CleanupStack::PopAndDestroy(&cmUidArray); |
|
948 |
} |
|
949 |
||
950 |
//----------------------------------------------------------------------------- |
|
951 |
// CCmManagerImpl::AppendUncatCmListLC |
|
952 |
//----------------------------------------------------------------------------- |
|
953 |
// |
|
954 |
void CCmManagerImpl::AppendUncatCmListLC( RPointerArray<CCmPluginBase>& aCMArray, |
|
955 |
TBool aCheckBearerType, |
|
956 |
TBool aLegacyOnly, |
|
957 |
TBool aEasyWlan, |
|
958 |
TBool aSortByBearer ) |
|
959 |
{ |
|
960 |
LOGGER_ENTERFN( "CCmManagerImpl::AppendUncatCmListLC" ); |
|
961 |
||
962 |
AppendUncatCmListL( aCMArray, aCheckBearerType, aLegacyOnly, aEasyWlan, aSortByBearer); |
|
963 |
||
964 |
CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( aCMArray ); |
|
965 |
} |
|
966 |
||
967 |
// ----------------------------------------------------------------------------- |
|
968 |
// CCmDestinationImpl::AppendCmListLC |
|
969 |
// ----------------------------------------------------------------------------- |
|
970 |
// |
|
971 |
void CCmManagerImpl::AppendCmListLC( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCMArray ) |
|
972 |
{ |
|
973 |
LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListLC" ); |
|
974 |
||
975 |
AppendCmListL( aDestintaionId, aCMArray ); |
|
976 |
CCmManagerImpl::CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( aCMArray ); |
|
977 |
} |
|
978 |
||
979 |
// ----------------------------------------------------------------------------- |
|
980 |
// CCmDestinationImpl::AppendCmListL |
|
981 |
// ----------------------------------------------------------------------------- |
|
982 |
// |
|
983 |
void CCmManagerImpl::AppendCmListL( TUint32 aDestintaionId, RPointerArray<CCmPluginBase>& aCMArray ) |
|
984 |
{ |
|
985 |
LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListL" ); |
|
986 |
||
987 |
CCmDestinationImpl* dest = DestinationL( aDestintaionId ); |
|
988 |
CleanupStack::PushL(dest); |
|
989 |
RArray<TUint32> cmIdList; |
|
990 |
CleanupClosePushL(cmIdList); |
|
991 |
dest->ConnectMethodIdArrayL( cmIdList ); |
|
992 |
AppendCmListFromUidsL( cmIdList, aCMArray ); |
|
993 |
CleanupStack::PopAndDestroy(&cmIdList); |
|
994 |
CleanupStack::PopAndDestroy(dest); |
|
995 |
} |
|
996 |
// ----------------------------------------------------------------------------- |
|
997 |
// CCmDestinationImpl::AppendCmListFromUidsL |
|
998 |
// ----------------------------------------------------------------------------- |
|
999 |
// |
|
1000 |
void CCmManagerImpl::AppendCmListFromUidsL( RArray<TUint32>& cmIdList, RPointerArray<CCmPluginBase>& aCMArray ) |
|
1001 |
{ |
|
1002 |
LOGGER_ENTERFN( "CCmManagerImpl::AppendCmListFromUidsL" ); |
|
1003 |
||
1004 |
TInt count = cmIdList.Count(); |
|
1005 |
for ( TInt i = 0; i< count; i++ ) |
|
1006 |
{ |
|
1007 |
CCmPluginBase* cm = NULL; |
|
1008 |
TRAPD( err,cm = GetConnectionMethodL( cmIdList[i] )); |
|
1009 |
if (err == KErrNone) |
|
1010 |
{ |
|
1011 |
aCMArray.AppendL( cm ); |
|
1012 |
} |
|
1013 |
} |
|
1014 |
} |
|
1015 |
||
1016 |
//----------------------------------------------------------------------------- |
|
1017 |
// CCmManagerImpl::ConnectionMethodL |
|
1018 |
//----------------------------------------------------------------------------- |
|
1019 |
// |
|
1020 |
EXPORT_C void CCmManagerImpl::ConnectionMethodL( RArray<TUint32>& aCMArray, |
|
1021 |
TBool aCheckBearerType, |
|
1022 |
TBool aLegacyOnly, |
|
1023 |
TBool aEasyWlan, |
|
1024 |
TBool aSortByBearer ) |
|
1025 |
{ |
|
1026 |
LOGGER_ENTERFN( "CCmManagerImpl::ConnectionMethodL" ); |
|
1027 |
||
1028 |
OpenTransactionLC(); |
|
1029 |
||
1030 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = AllIapsL(); |
|
1031 |
CleanupStack::PushL( ptrRecordSet ); |
|
1032 |
||
1033 |
TInt iapRecords = ptrRecordSet->iRecords.Count(); |
|
1034 |
CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords ); |
|
1035 |
||
1036 |
// Time optimization to load the entire destination table |
|
1037 |
TInt destTblId = DestinationTableId(); |
|
1038 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* ptrDestSet = |
|
1039 |
new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
1040 |
destTblId ); |
|
1041 |
CleanupStack::PushL( ptrDestSet ); |
|
1042 |
TRAP_IGNORE( ptrDestSet->LoadL( Session() ) ); |
|
1043 |
||
1044 |
for ( TInt i = 0; i < iapRecords; i++ ) |
|
1045 |
{ |
|
1046 |
TUint32 iapId = (*ptrRecordSet)[i]->RecordId(); |
|
1047 |
CLOG_WRITE_1_PTR( NULL, "IAP ID [%d]", iapId ); |
|
1048 |
if ( aCheckBearerType ) |
|
1049 |
{ |
|
1050 |
TUint32 bearerType( 0 ); |
|
1051 |
TRAPD( err, |
|
1052 |
bearerType = BearerTypeFromIapRecordL( (*ptrRecordSet)[i] )); |
|
1053 |
if ( !err && bearerType ) |
|
1054 |
{ |
|
1055 |
// append the IAP id - if aLegacyOnly is ETrue, only for legacy IAPs |
|
1056 |
if ( !aLegacyOnly || |
|
1057 |
!NumOfConnMethodReferencesL( iapId, ptrDestSet ) ) |
|
1058 |
{ |
|
1059 |
if( !aEasyWlan && IsEasyWLanL( (*ptrRecordSet)[i] ) ) |
|
1060 |
{ |
|
1061 |
continue; |
|
1062 |
} |
|
1063 |
||
1064 |
aCMArray.Append( iapId ); |
|
1065 |
} |
|
1066 |
} |
|
1067 |
} |
|
1068 |
else |
|
1069 |
{ |
|
1070 |
// append the IAP id - if aLegacyOnly is ETrue, only for legacy IAPs |
|
1071 |
if ( !aLegacyOnly || |
|
1072 |
!NumOfConnMethodReferencesL( iapId, ptrDestSet ) ) |
|
1073 |
{ |
|
1074 |
if( !aEasyWlan && IsEasyWLanL( (*ptrRecordSet)[i] ) ) |
|
1075 |
{ |
|
1076 |
continue; |
|
1077 |
} |
|
1078 |
||
1079 |
aCMArray.Append( iapId ); |
|
1080 |
} |
|
1081 |
} |
|
1082 |
} |
|
1083 |
||
1084 |
// Re-order the array according to the global bearer ordering rules |
|
1085 |
if ( aSortByBearer ) |
|
1086 |
{ |
|
1087 |
RArray<TUint32> bearers( KCmArrayMediumGranularity ); |
|
1088 |
CleanupClosePushL( bearers ); |
|
1089 |
SupportedBearersL( bearers ); |
|
1090 |
||
1091 |
TInt prevInsertedPos = -1; |
|
1092 |
for ( TInt i = 0; i < bearers.Count(); i++ ) |
|
1093 |
{ |
|
1094 |
for ( TInt j = prevInsertedPos + 1; j < aCMArray.Count(); j++ ) |
|
1095 |
{ |
|
1096 |
// Check if CM belongs to this bearer |
|
1097 |
TUint cmBearerId = GetConnectionMethodInfoIntL( aCMArray[j], |
|
1098 |
ECmBearerType ); |
|
1099 |
if ( cmBearerId == bearers[i] ) |
|
1100 |
{ |
|
1101 |
// copy the cm id to the next 'sorted position' in the array |
|
1102 |
// the item removed will always be after the insertion position |
|
1103 |
TUint cmId = aCMArray[j]; |
|
1104 |
aCMArray.Remove(j); |
|
1105 |
aCMArray.Insert( cmId, ++prevInsertedPos ); |
|
1106 |
} |
|
1107 |
} |
|
1108 |
} |
|
1109 |
||
1110 |
CleanupStack::PopAndDestroy( &bearers ); |
|
1111 |
} |
|
1112 |
||
1113 |
CleanupStack::PopAndDestroy( 2, ptrRecordSet ); |
|
1114 |
||
1115 |
RollbackTransaction(); |
|
1116 |
} |
|
1117 |
||
1118 |
//----------------------------------------------------------------------------- |
|
1119 |
// CCmManagerImpl::DoFindConnMethodL |
|
1120 |
//----------------------------------------------------------------------------- |
|
1121 |
// |
|
1122 |
CCmPluginBase* CCmManagerImpl::DoFindConnMethodL( TUint32 aCmId, |
|
1123 |
CCmDestinationImpl* aParentDest ) |
|
1124 |
{ |
|
1125 |
LOGGER_ENTERFN( "CCmManagerImpl::DoFindConnMethodL" ); |
|
1126 |
return iObjectPool->GetConnectionMethodL(aCmId, aParentDest); |
|
1127 |
} |
|
1128 |
||
1129 |
//----------------------------------------------------------------------------- |
|
1130 |
// CCmManagerImpl::FindConnMethodL |
|
1131 |
//----------------------------------------------------------------------------- |
|
1132 |
// |
|
1133 |
CCmPluginBaseEng* CCmManagerImpl::DoFindConnMethL( TUint32 aCmId, |
|
1134 |
CCmDestinationImpl* aParentDest ) |
|
1135 |
{ |
|
1136 |
LOGGER_ENTERFN( "CCmManagerImpl::FindConnMethodL" ); |
|
1137 |
||
1138 |
// Step through each bearer to find which the CMId belongs to |
|
1139 |
CCmPluginBaseEng* plugin = NULL; |
|
1140 |
||
1141 |
TCmPluginInitParam params( *this ); |
|
1142 |
if (aParentDest) |
|
1143 |
{ |
|
1144 |
params.iParentDest = aParentDest->Id(); |
|
1145 |
} |
|
1146 |
else |
|
1147 |
{ |
|
1148 |
params.iParentDest = ParentDestinationL( aCmId ); |
|
1149 |
} |
|
1150 |
||
1151 |
TUint32 bearerType = BearerTypeFromCmIdL( aCmId ); |
|
1152 |
||
1153 |
for ( TInt i=0; i<iPlugins->Count(); i++ ) |
|
1154 |
{ |
|
1155 |
if( (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) == bearerType ) |
|
1156 |
{ |
|
1157 |
plugin = (*iPlugins)[i]->CreateInstanceL( params ); |
|
1158 |
break; |
|
1159 |
} |
|
1160 |
} |
|
1161 |
||
1162 |
if ( !plugin ) |
|
1163 |
{ |
|
1164 |
return plugin; |
|
1165 |
} |
|
1166 |
||
1167 |
CleanupStack::PushL( plugin ); |
|
1168 |
||
1169 |
plugin->LoadL( aCmId ); |
|
1170 |
||
1171 |
CleanupStack::Pop( plugin ); // 1 |
|
1172 |
plugin->SetIdValidity(ETrue); |
|
1173 |
||
1174 |
return plugin; |
|
1175 |
} |
|
1176 |
||
1177 |
//----------------------------------------------------------------------------- |
|
1178 |
// CCmManagerImpl::BearerTypeFromIapL( TUint aId ) |
|
1179 |
//----------------------------------------------------------------------------- |
|
1180 |
// |
|
1181 |
TUint32 CCmManagerImpl::BearerTypeFromCmIdL( TUint32 aCmId ) |
|
1182 |
{ |
|
1183 |
LOGGER_ENTERFN( "CCmManagerImpl::BearerTypeFromIapL" ); |
|
1184 |
TUint32 bearerType; |
|
1185 |
if ( aCmId > KMaxIapID ) |
|
1186 |
{ |
|
1187 |
bearerType = KUidEmbeddedDestination; |
|
1188 |
} |
|
1189 |
else |
|
1190 |
{//aCmId is an IapId |
|
1191 |
// Load this IAP record from the IAP table |
|
1192 |
// This is an optimization that plugins doesn't have |
|
1193 |
// to do it every time the CanHandleIapIdL() is called. |
|
1194 |
CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
1195 |
(CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1196 |
CleanupStack::PushL( iapRecord ); // 1 |
|
1197 |
iapRecord->SetRecordId( aCmId ); |
|
1198 |
||
1199 |
OpenTransactionLC(); |
|
1200 |
iapRecord->LoadL( Session() ); |
|
1201 |
RollbackTransaction(); |
|
1202 |
||
1203 |
bearerType = BearerTypeFromIapRecordL( iapRecord ); |
|
1204 |
||
1205 |
CleanupStack::PopAndDestroy( iapRecord ); // 0 |
|
1206 |
} |
|
1207 |
return bearerType; |
|
1208 |
} |
|
1209 |
||
1210 |
//----------------------------------------------------------------------------- |
|
1211 |
// CCmManagerImpl::BearerTypeFromIapRecordL( CCDIAPRecord* aIapRecord ) |
|
1212 |
//----------------------------------------------------------------------------- |
|
1213 |
// |
|
1214 |
TUint32 CCmManagerImpl::BearerTypeFromIapRecordL( CCDIAPRecord* aIapRecord ) const |
|
1215 |
{ |
|
1216 |
LOGGER_ENTERFN( "CCmManagerImpl::BearerTypeFromIapRecordL" ); |
|
1217 |
||
1218 |
CLOG_WRITE_1( "Plugin count: [%d]", iPlugins->Count() ); |
|
1219 |
||
1220 |
TInt err( KErrNone ); |
|
1221 |
TUint32 extLevel( 0 ); |
|
1222 |
TInt bearerType( 0 ); |
|
1223 |
TBool canHandle( EFalse ); |
|
1224 |
||
1225 |
// Check which bearer handles the given IAPid |
|
1226 |
for ( TInt i=0; i<iPlugins->Count(); i++ ) |
|
1227 |
{ |
|
1228 |
// a defective, or a wrong AP can't cause any trouble. |
|
1229 |
TRAP( err, canHandle = (*iPlugins)[i]->CanHandleIapIdL( aIapRecord ) ); |
|
1230 |
CLOG_WRITE_3( "plugin [%d] returned with error %d, CanH: %d", |
|
1231 |
i, err, TUint32(canHandle) ); |
|
1232 |
if ( !err && canHandle ) |
|
1233 |
{ |
|
1234 |
if ( extLevel < |
|
1235 |
(*iPlugins)[i]->GetIntAttributeL( ECmExtensionLevel ) ) |
|
1236 |
{ |
|
1237 |
extLevel = (*iPlugins)[i]->GetIntAttributeL(ECmExtensionLevel); |
|
1238 |
bearerType = (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ); |
|
1239 |
} |
|
1240 |
} |
|
1241 |
else if ( err == KErrNoMemory ) |
|
1242 |
{ |
|
1243 |
User::Leave( err ); |
|
1244 |
} |
|
1245 |
} |
|
1246 |
||
1247 |
if ( !bearerType ) |
|
1248 |
// No supporting plugin found. |
|
1249 |
{ |
|
1250 |
CLOG_WRITE( "Plugin not found, Leaving." ); |
|
1251 |
User::Leave( KErrNotSupported ); |
|
1252 |
} |
|
1253 |
CLOG_WRITE_1( "Returning bearertype: [%d]", bearerType ); |
|
1254 |
return bearerType; |
|
1255 |
} |
|
1256 |
||
1257 |
//----------------------------------------------------------------------------- |
|
1258 |
// CCmManagerImpl::AllDestinationsL() |
|
1259 |
//----------------------------------------------------------------------------- |
|
1260 |
// |
|
1261 |
EXPORT_C void CCmManagerImpl::AllDestinationsL( RArray<TUint32>& aDestArray ) |
|
1262 |
{ |
|
1263 |
LOGGER_ENTERFN( "CCmManagerImpl::AllDestinationsL" ); |
|
1264 |
||
1265 |
OpenTransactionLC(); |
|
1266 |
||
1267 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* destRecordSet = |
|
1268 |
new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
1269 |
iDestinationTableId ); |
|
1270 |
CleanupStack::PushL( destRecordSet ); |
|
1271 |
||
1272 |
TRAP_IGNORE( destRecordSet->LoadL( Session() ) ); |
|
1273 |
||
1274 |
iDestinationCount = destRecordSet->iRecords.Count(); |
|
1275 |
||
1276 |
//========================================================================= |
|
1277 |
// Step through every item in the NW Table and check whether it is linked |
|
1278 |
// in the DN_IAP table |
|
1279 |
// |
|
1280 |
for ( TInt i = 0; i < iDestinationCount; ++i ) |
|
1281 |
{ |
|
1282 |
TInt nwId = QUERY_INT_FIELD( destRecordSet->iRecords[i], |
|
1283 |
KCDTIdDataMobilitySelectionPolicyNetwork ); |
|
1284 |
TBool found( EFalse ); |
|
1285 |
||
1286 |
for ( TInt j = 0; j < aDestArray.Count(); ++j ) |
|
1287 |
{ |
|
1288 |
if ( aDestArray[j] == nwId ) |
|
1289 |
{ |
|
1290 |
found = ETrue; |
|
1291 |
break; |
|
1292 |
} |
|
1293 |
} |
|
1294 |
||
1295 |
if ( !found ) |
|
1296 |
{ |
|
1297 |
aDestArray.AppendL( nwId ); |
|
1298 |
CLOG_WRITE_2( "Dest(%d): [%d]", aDestArray.Count(), nwId ); |
|
1299 |
} |
|
1300 |
} |
|
1301 |
||
1302 |
CleanupStack::PopAndDestroy( destRecordSet ); |
|
1303 |
||
1304 |
RollbackTransaction(); |
|
1305 |
||
1306 |
CLOG_WRITE_1( "No. of dests found: [%d] ", aDestArray.Count() ); |
|
1307 |
} |
|
1308 |
||
1309 |
//----------------------------------------------------------------------------- |
|
1310 |
// CCmManagerImpl::DestinationL() |
|
1311 |
//----------------------------------------------------------------------------- |
|
1312 |
// |
|
1313 |
EXPORT_C CCmDestinationImpl* CCmManagerImpl::DestinationL( TUint32 aId ) |
|
1314 |
{ |
|
1315 |
LOGGER_ENTERFN( "CCmManagerImpl::DestinationL" ); |
|
1316 |
||
1317 |
// Create destination object |
|
1318 |
return iObjectPool->GetDestinationL( aId ); |
|
1319 |
} |
|
1320 |
||
1321 |
//----------------------------------------------------------------------------- |
|
1322 |
// CCmManagerImpl::RemoveDestFromPool |
|
1323 |
//----------------------------------------------------------------------------- |
|
1324 |
// |
|
1325 |
EXPORT_C void CCmManagerImpl::RemoveDestFromPool( CCmDestinationImpl* aDestination ) |
|
1326 |
{ |
|
1327 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveDestFromPool" ); |
|
1328 |
iObjectPool->RemoveDestination(aDestination); |
|
1329 |
} |
|
1330 |
||
1331 |
//----------------------------------------------------------------------------- |
|
1332 |
// CCmManagerImpl::RemoveDestFromPool |
|
1333 |
//----------------------------------------------------------------------------- |
|
1334 |
// |
|
1335 |
void CCmManagerImpl::RemoveDestFromPool( CCmDestinationData* aDestination ) |
|
1336 |
{ |
|
1337 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveDestFromPool" ); |
|
1338 |
iObjectPool->RemoveDestination(aDestination); |
|
1339 |
} |
|
1340 |
||
1341 |
//----------------------------------------------------------------------------- |
|
1342 |
// CCmManagerImpl::RemoveCMFromPool |
|
1343 |
//----------------------------------------------------------------------------- |
|
1344 |
// |
|
1345 |
void CCmManagerImpl::RemoveCMFromPoolL( CCmPluginBaseEng* aCM ) |
|
1346 |
{ |
|
1347 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveCMFromPool" ); |
|
1348 |
iObjectPool->RemoveConnectionMethodL( aCM ); |
|
1349 |
} |
|
1350 |
||
1351 |
//----------------------------------------------------------------------------- |
|
1352 |
// CCmManagerImpl::RemoveCMFromPool |
|
1353 |
//----------------------------------------------------------------------------- |
|
1354 |
// |
|
1355 |
void CCmManagerImpl::RemoveCMFromPoolL( CCmPluginBase* aCM ) |
|
1356 |
{ |
|
1357 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveCMFromPool" ); |
|
1358 |
iObjectPool->RemoveConnectionMethodL( aCM ); |
|
1359 |
} |
|
1360 |
||
1361 |
//----------------------------------------------------------------------------- |
|
1362 |
// CCmManagerImpl::CopyConnectionMethodL() |
|
1363 |
//----------------------------------------------------------------------------- |
|
1364 |
// |
|
1365 |
TInt CCmManagerImpl::CopyConnectionMethodL( |
|
1366 |
CCmDestinationImpl& aTargetDestination, |
|
1367 |
CCmPluginBase& aConnectionMethod ) |
|
1368 |
{ |
|
1369 |
LOGGER_ENTERFN( "CCmManagerImpl::CopyConnectionMethodL" ); |
|
1370 |
||
1371 |
OpenTransactionLC(); |
|
1372 |
TInt index = aTargetDestination.AddConnectionMethodL( aConnectionMethod ); |
|
1373 |
aTargetDestination.UpdateL(); |
|
1374 |
CommitTransactionL( 0 ); |
|
1375 |
||
1376 |
return index; |
|
1377 |
} |
|
1378 |
||
1379 |
//----------------------------------------------------------------------------- |
|
1380 |
// CCmManagerImpl::MoveConnectionMethodL() |
|
1381 |
//----------------------------------------------------------------------------- |
|
1382 |
// |
|
1383 |
TInt CCmManagerImpl::MoveConnectionMethodL( |
|
1384 |
CCmDestinationImpl& aSourceDestination, |
|
1385 |
CCmDestinationImpl& aTargetDestination, |
|
1386 |
CCmPluginBase& aConnectionMethod ) |
|
1387 |
{ |
|
1388 |
LOGGER_ENTERFN( "CCmManagerImpl::MoveConnectionMethodL" ); |
|
1389 |
||
1390 |
OpenTransactionLC(); |
|
1391 |
||
1392 |
TInt index = CopyConnectionMethodL( aTargetDestination, aConnectionMethod ); |
|
1393 |
aSourceDestination.RemoveConnectionMethodL( aConnectionMethod ); |
|
1394 |
aSourceDestination.UpdateL(); |
|
1395 |
||
1396 |
CommitTransactionL( KErrNone ); |
|
1397 |
||
1398 |
return index; |
|
1399 |
} |
|
1400 |
||
1401 |
//----------------------------------------------------------------------------- |
|
1402 |
// CCmManagerImpl::RemoveConnectionMethodL() |
|
1403 |
//----------------------------------------------------------------------------- |
|
1404 |
// |
|
1405 |
void CCmManagerImpl::RemoveConnectionMethodL( |
|
1406 |
CCmDestinationImpl& aDestination, |
|
1407 |
CCmPluginBase& aConnectionMethod ) |
|
1408 |
{ |
|
1409 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveConnectionMethodL" ); |
|
1410 |
||
1411 |
OpenTransactionLC(); |
|
1412 |
aDestination.RemoveConnectionMethodL( aConnectionMethod ); |
|
1413 |
aDestination.UpdateL(); |
|
1414 |
CommitTransactionL( 0 ); |
|
1415 |
} |
|
1416 |
||
1417 |
//----------------------------------------------------------------------------- |
|
1418 |
// RCmManagerExt::SupportedBearers() |
|
1419 |
//----------------------------------------------------------------------------- |
|
1420 |
// |
|
1421 |
void CCmManagerImpl::SupportedBearersL( RArray<TUint32>& aArray ) const |
|
1422 |
{ |
|
1423 |
LOGGER_ENTERFN( "CCmManagerImpl::SupportedBearersL" ); |
|
1424 |
||
1425 |
for ( TInt i = 0; i < iPlugins->Count(); i++ ) |
|
1426 |
{ |
|
1427 |
TUint32 bearerType( (*iPlugins)[i]->GetIntAttributeL(ECmBearerType) ); |
|
1428 |
||
1429 |
if ( KUidEmbeddedDestination != bearerType ) |
|
1430 |
{ |
|
1431 |
aArray.AppendL( (*iPlugins)[i]->GetIntAttributeL(ECmBearerType) ); |
|
1432 |
} |
|
1433 |
} |
|
1434 |
} |
|
1435 |
||
1436 |
// ----------------------------------------------------------------------------- |
|
1437 |
// CCmManagerImpl::NumOfConnMethodReferencesL() |
|
1438 |
// ----------------------------------------------------------------------------- |
|
1439 |
// |
|
1440 |
TUint32 CCmManagerImpl::NumOfConnMethodReferencesL( |
|
1441 |
TUint32 aId, |
|
1442 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* aRecSet ) |
|
1443 |
{ |
|
1444 |
LOGGER_ENTERFN( "CCmManagerImpl::NumOfConnMethodReferencesL" ); |
|
1445 |
||
1446 |
OpenTransactionLC(); |
|
1447 |
||
1448 |
TUint32 retVal( 0 ); |
|
1449 |
||
1450 |
if ( aRecSet ) |
|
1451 |
{ |
|
1452 |
TMDBElementId id( IAP_ELEMENT_ID(aId) ); |
|
1453 |
||
1454 |
for ( TInt i = 0; i < aRecSet->iRecords.Count(); ++i ) |
|
1455 |
{ |
|
1456 |
if ( QUERY_UINT32_FIELD( (*aRecSet)[i], |
|
1457 |
KCDTIdDataMobilitySelectionPolicyIAP ) == |
|
1458 |
id ) |
|
1459 |
{ |
|
1460 |
++retVal; |
|
1461 |
} |
|
1462 |
} |
|
1463 |
} |
|
1464 |
else |
|
1465 |
{ |
|
1466 |
// Just to test how many record we have |
|
1467 |
TInt destTblId = DestinationTableId(); |
|
1468 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* ptrRecordSet = |
|
1469 |
new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
1470 |
destTblId ); |
|
1471 |
CleanupStack::PushL( ptrRecordSet ); |
|
1472 |
||
1473 |
// Prime record |
|
1474 |
CCDDataMobilitySelectionPolicyRecord* record = |
|
1475 |
new (ELeave) CCDDataMobilitySelectionPolicyRecord( |
|
1476 |
DestinationTableId() ); |
|
1477 |
CleanupStack::PushL( record ); |
|
1478 |
||
1479 |
record->iIAP = IAP_ELEMENT_ID( aId ); |
|
1480 |
ptrRecordSet->iRecords.AppendL( record ); |
|
1481 |
||
1482 |
CleanupStack::Pop( record ); |
|
1483 |
record = NULL; |
|
1484 |
||
1485 |
if ( ptrRecordSet->FindL(Session()) ) |
|
1486 |
{ |
|
1487 |
// we have a match |
|
1488 |
retVal = ptrRecordSet->iRecords.Count(); |
|
1489 |
CLOG_WRITE_1( "Found: [%d]", retVal ); |
|
1490 |
} |
|
1491 |
else |
|
1492 |
{ |
|
1493 |
CLOG_WRITE( "Nothing" ); |
|
1494 |
} |
|
1495 |
||
1496 |
CleanupStack::PopAndDestroy( ); // ptrRecordSet |
|
1497 |
} |
|
1498 |
||
1499 |
RollbackTransaction(); |
|
1500 |
||
1501 |
return retVal; |
|
1502 |
} |
|
1503 |
||
1504 |
// ----------------------------------------------------------------------------- |
|
1505 |
// CCmManagerImpl::HasUnprotectedDestinationsL |
|
1506 |
// ----------------------------------------------------------------------------- |
|
1507 |
// |
|
1508 |
TBool CCmManagerImpl::HasUnprotectedDestinationsL() |
|
1509 |
{ |
|
1510 |
LOGGER_ENTERFN( "CCmManagerImpl::HasUnprotectedDestinationsL" ); |
|
1511 |
||
1512 |
TBool hasUnprotectedDests( EFalse ); |
|
1513 |
||
1514 |
RArray<TUint32> destIdArray( KCmArrayBigGranularity ); |
|
1515 |
AllDestinationsL( destIdArray ); |
|
1516 |
CleanupClosePushL( destIdArray ); |
|
1517 |
||
1518 |
CCmDestinationImpl* dest = NULL; |
|
1519 |
for ( TInt i = 0; i < destIdArray.Count(); i++ ) |
|
1520 |
{ |
|
1521 |
dest = DestinationL( destIdArray[i] ); |
|
1522 |
CleanupStack::PushL( dest ); |
|
1523 |
if ( dest->ProtectionLevel() != EProtLevel1 ) |
|
1524 |
{ |
|
1525 |
hasUnprotectedDests = ETrue; |
|
1526 |
CleanupStack::PopAndDestroy( dest ); |
|
1527 |
break; |
|
1528 |
} |
|
1529 |
CleanupStack::PopAndDestroy( dest ); |
|
1530 |
} |
|
1531 |
||
1532 |
CleanupStack::PopAndDestroy( &destIdArray ); |
|
1533 |
||
1534 |
return hasUnprotectedDests; |
|
1535 |
} |
|
1536 |
||
1537 |
||
1538 |
// ----------------------------------------------------------------------------- |
|
1539 |
// CCmManagerImpl::BuildPluginArrayL() |
|
1540 |
// ----------------------------------------------------------------------------- |
|
1541 |
// |
|
1542 |
void CCmManagerImpl::BuildPluginArrayL() |
|
1543 |
{ |
|
1544 |
LOGGER_ENTERFN( "CCmManagerImpl::BuildPluginArrayL" ); |
|
1545 |
iPlugins = new (ELeave) CArrayPtrFlat<const CCmPluginBaseEng>( |
|
1546 |
KPluginGranularity ); |
|
1547 |
||
1548 |
// Get a list of all the bearer types |
|
1549 |
RImplInfoPtrArray implArray; |
|
1550 |
REComSession::ListImplementationsL( TUid::Uid( KCMPluginInterfaceUid ), |
|
1551 |
implArray ); |
|
1552 |
||
1553 |
CleanupClosePushL( implArray ); // 1 |
|
1554 |
||
1555 |
CCmPluginBaseEng* plugin = NULL; |
|
1556 |
for ( TInt i=0; i<implArray.Count(); i++ ) |
|
1557 |
{ |
|
1558 |
TCmPluginInitParam params( *this ); |
|
1559 |
params.iParentDest = NULL; |
|
1560 |
||
1561 |
// This is the Util implementation |
|
1562 |
// Trap it to be able to work even if there's a faulty plugin installed |
|
1563 |
// in the phone. |
|
1564 |
TRAPD( err, plugin = STATIC_CAST( CCmPluginBaseEng*, |
|
1565 |
REComSession::CreateImplementationL( |
|
1566 |
(implArray)[i]->ImplementationUid(), |
|
1567 |
_FOFF( CCmPluginBaseEng, |
|
1568 |
iDtor_ID_Key ), |
|
1569 |
(TAny*)¶ms )) ); |
|
1570 |
||
1571 |
if ( !err ) |
|
1572 |
{ |
|
1573 |
CLOG_ATTACH( plugin, this ); |
|
1574 |
||
1575 |
CleanupStack::PushL( plugin ); |
|
1576 |
||
1577 |
TBool inserted( EFalse ); |
|
1578 |
TInt defaultPriority( KDataMobilitySelectionPolicyPriorityWildCard ); |
|
1579 |
||
1580 |
// No UI priority -> wildcard |
|
1581 |
TRAP_IGNORE( defaultPriority = plugin->GetIntAttributeL( ECmDefaultUiPriority ) ); |
|
1582 |
||
1583 |
for( TInt j( 0 ); j < iPlugins->Count(); ++j ) |
|
1584 |
{ |
|
1585 |
if( defaultPriority > (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) ) |
|
1586 |
{ |
|
1587 |
continue; |
|
1588 |
} |
|
1589 |
else if( defaultPriority == (*iPlugins)[j]->GetIntAttributeL( ECmDefaultUiPriority ) ) |
|
1590 |
{ |
|
1591 |
if( plugin->GetIntAttributeL( ECmExtensionLevel ) > |
|
1592 |
(*iPlugins)[j]->GetIntAttributeL( ECmExtensionLevel ) ) |
|
1593 |
{ |
|
1594 |
iPlugins->InsertL( j, plugin ); |
|
1595 |
inserted = ETrue; |
|
1596 |
break; |
|
1597 |
} |
|
1598 |
} |
|
1599 |
else |
|
1600 |
{ |
|
1601 |
iPlugins->InsertL( j, plugin ); |
|
1602 |
inserted = ETrue; |
|
1603 |
break; |
|
1604 |
} |
|
1605 |
} |
|
1606 |
||
1607 |
if( !inserted ) |
|
1608 |
{ |
|
1609 |
iPlugins->AppendL( plugin ); |
|
1610 |
} |
|
1611 |
||
1612 |
CleanupStack::Pop( plugin ); |
|
1613 |
} |
|
1614 |
} |
|
1615 |
||
1616 |
implArray.ResetAndDestroy(); |
|
1617 |
||
1618 |
CleanupStack::PopAndDestroy(); // implArray; |
|
1619 |
} |
|
1620 |
||
1621 |
// ----------------------------------------------------------------------------- |
|
1622 |
// CCmManagerImpl::GetBearerInfoIntL() |
|
1623 |
// ----------------------------------------------------------------------------- |
|
1624 |
// |
|
1625 |
EXPORT_C TUint32 CCmManagerImpl::GetBearerInfoIntL( TUint32 aBearerType, |
|
1626 |
TUint32 aAttribute ) const |
|
1627 |
{ |
|
1628 |
LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoIntL" ); |
|
1629 |
if( !IsBearerSpecific( aAttribute ) ) |
|
1630 |
{ |
|
1631 |
User::Leave( KErrNotSupported ); |
|
1632 |
} |
|
1633 |
||
1634 |
for ( TInt i = 0; i < iPlugins->Count(); ++i ) |
|
1635 |
{ |
|
1636 |
if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) ) |
|
1637 |
{ |
|
1638 |
return (*iPlugins)[i]->GetIntAttributeL( aAttribute ); |
|
1639 |
} |
|
1640 |
} |
|
1641 |
||
1642 |
User::Leave( KErrNotSupported ); |
|
1643 |
||
1644 |
return 0; |
|
1645 |
} |
|
1646 |
||
1647 |
// ----------------------------------------------------------------------------- |
|
1648 |
// CCmManagerImpl::GetBearerInfoBoolL() |
|
1649 |
// ----------------------------------------------------------------------------- |
|
1650 |
// |
|
1651 |
EXPORT_C TBool CCmManagerImpl::GetBearerInfoBoolL( TUint32 aBearerType, |
|
1652 |
TUint32 aAttribute ) const |
|
1653 |
{ |
|
1654 |
LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoBoolL" ); |
|
1655 |
if( !IsBearerSpecific( aAttribute ) ) |
|
1656 |
{ |
|
1657 |
User::Leave( KErrNotSupported ); |
|
1658 |
} |
|
1659 |
||
1660 |
for ( TInt i = 0; i < iPlugins->Count(); ++i ) |
|
1661 |
{ |
|
1662 |
if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) ) |
|
1663 |
{ |
|
1664 |
return (*iPlugins)[i]->GetBoolAttributeL( aAttribute ); |
|
1665 |
} |
|
1666 |
} |
|
1667 |
||
1668 |
User::Leave( KErrNotSupported ); |
|
1669 |
||
1670 |
return EFalse; |
|
1671 |
} |
|
1672 |
||
1673 |
// ----------------------------------------------------------------------------- |
|
1674 |
// CCmManagerImpl::GetBearerInfoStringL() |
|
1675 |
// ----------------------------------------------------------------------------- |
|
1676 |
// |
|
1677 |
EXPORT_C HBufC* CCmManagerImpl::GetBearerInfoStringL( TUint32 aBearerType, |
|
1678 |
TUint32 aAttribute ) const |
|
1679 |
{ |
|
1680 |
LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" ); |
|
1681 |
if( !IsBearerSpecific( aAttribute ) ) |
|
1682 |
{ |
|
1683 |
User::Leave( KErrNotSupported ); |
|
1684 |
} |
|
1685 |
||
1686 |
for ( TInt i = 0; i < iPlugins->Count(); ++i ) |
|
1687 |
{ |
|
1688 |
if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) ) |
|
1689 |
{ |
|
1690 |
return (*iPlugins)[i]->GetStringAttributeL( aAttribute ); |
|
1691 |
} |
|
1692 |
} |
|
1693 |
||
1694 |
User::Leave( KErrNotSupported ); |
|
1695 |
||
1696 |
return NULL; |
|
1697 |
} |
|
1698 |
||
1699 |
// ----------------------------------------------------------------------------- |
|
1700 |
// CCmManagerImpl::GetBearerInfoString8L() |
|
1701 |
// ----------------------------------------------------------------------------- |
|
1702 |
// |
|
1703 |
EXPORT_C HBufC8* CCmManagerImpl::GetBearerInfoString8L( TUint32 aBearerType, |
|
1704 |
TUint32 aAttribute ) const |
|
1705 |
{ |
|
1706 |
LOGGER_ENTERFN( "CCmManagerImpl::GetBearerInfoStringL" ); |
|
1707 |
if( !IsBearerSpecific( aAttribute ) ) |
|
1708 |
{ |
|
1709 |
User::Leave( KErrNotSupported ); |
|
1710 |
} |
|
1711 |
||
1712 |
for ( TInt i = 0; i < iPlugins->Count(); ++i ) |
|
1713 |
{ |
|
1714 |
if ( aBearerType == (*iPlugins)[i]->GetIntAttributeL( ECmBearerType ) ) |
|
1715 |
{ |
|
1716 |
return (*iPlugins)[i]->GetString8AttributeL( aAttribute ); |
|
1717 |
} |
|
1718 |
} |
|
1719 |
||
1720 |
User::Leave( KErrNotSupported ); |
|
1721 |
||
1722 |
return NULL; |
|
1723 |
} |
|
1724 |
||
1725 |
// ----------------------------------------------------------------------------- |
|
1726 |
// CCmManagerImpl::GetConnectionMethodInfoIntL() |
|
1727 |
// ----------------------------------------------------------------------------- |
|
1728 |
// |
|
1729 |
EXPORT_C TUint32 CCmManagerImpl::GetConnectionMethodInfoIntL( TUint32 aCmId, |
|
1730 |
TUint32 aAttribute ) const |
|
1731 |
{ |
|
1732 |
LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoIntL" ); |
|
1733 |
||
1734 |
if ( aAttribute == ECmBearerType ) |
|
1735 |
{ |
|
1736 |
return const_cast<CCmManagerImpl*>(this)->BearerTypeFromCmIdL( aCmId ); |
|
1737 |
} |
|
1738 |
else |
|
1739 |
{ |
|
1740 |
return iPluginImpl->GetConnectionInfoIntL( aCmId, aAttribute ); |
|
1741 |
} |
|
1742 |
} |
|
1743 |
||
1744 |
// ----------------------------------------------------------------------------- |
|
1745 |
// CCmManagerImpl::GetConnectionMethodInfoBoolL() |
|
1746 |
// ----------------------------------------------------------------------------- |
|
1747 |
// |
|
1748 |
EXPORT_C TBool CCmManagerImpl::GetConnectionMethodInfoBoolL( TUint32 aCmId, |
|
1749 |
TUint32 aAttribute ) const |
|
1750 |
{ |
|
1751 |
LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoBoolL" ); |
|
1752 |
||
1753 |
TBool retval = EFalse; |
|
1754 |
if ( aAttribute == ECmVirtual ) |
|
1755 |
{ |
|
1756 |
TUint32 b = GetConnectionMethodInfoIntL( aCmId, ECmBearerType ); |
|
1757 |
retval = GetBearerInfoBoolL( b, ECmVirtual ); |
|
1758 |
} |
|
1759 |
else |
|
1760 |
{ |
|
1761 |
retval = iPluginImpl->GetConnectionInfoBoolL( aCmId, aAttribute ); |
|
1762 |
} |
|
1763 |
return retval; |
|
1764 |
} |
|
1765 |
||
1766 |
// ----------------------------------------------------------------------------- |
|
1767 |
// CCmManagerImpl::GetConnectionMethodInfoStringL() |
|
1768 |
// ----------------------------------------------------------------------------- |
|
1769 |
// |
|
1770 |
EXPORT_C HBufC* CCmManagerImpl::GetConnectionMethodInfoStringL( |
|
1771 |
TUint32 aCmId, |
|
1772 |
TUint32 aAttribute ) const |
|
1773 |
{ |
|
1774 |
LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoStringL" ); |
|
1775 |
||
1776 |
return iPluginImpl->GetConnectionInfoStringL( aCmId, aAttribute ); |
|
1777 |
} |
|
1778 |
||
1779 |
// ----------------------------------------------------------------------------- |
|
1780 |
// CCmManagerImpl::GetConnectionMethodInfoStringL() |
|
1781 |
// ----------------------------------------------------------------------------- |
|
1782 |
// |
|
1783 |
EXPORT_C HBufC8* CCmManagerImpl::GetConnectionMethodInfoString8L( |
|
1784 |
TUint32 aCmId, |
|
1785 |
TUint32 aAttribute ) const |
|
1786 |
{ |
|
1787 |
LOGGER_ENTERFN( "CCmManagerImpl::GetConnectionMethodInfoString8L" ); |
|
1788 |
||
1789 |
return iPluginImpl->GetConnectionInfoString8L( aCmId, aAttribute ); |
|
1790 |
} |
|
1791 |
||
1792 |
//----------------------------------------------------------------------------- |
|
1793 |
// CCmManagerImpl::UncategorizedIconL() |
|
1794 |
//----------------------------------------------------------------------------- |
|
1795 |
// |
|
1796 |
CGulIcon* CCmManagerImpl::UncategorizedIconL() const |
|
1797 |
{ |
|
1798 |
LOGGER_ENTERFN( "CCmManagerImpl::UncategorizedIconL" ); |
|
1799 |
||
1800 |
MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); |
|
1801 |
||
1802 |
TParse mbmFile; |
|
1803 |
User::LeaveIfError( mbmFile.Set( KManagerIconFilename, |
|
1804 |
&KDC_BITMAP_DIR, |
|
1805 |
NULL ) ); |
|
1806 |
||
1807 |
CGulIcon* icon = AknsUtils::CreateGulIconL( |
|
1808 |
skinInstance, |
|
1809 |
KAknsIIDQgnPropSetConnDestUncategorized, |
|
1810 |
mbmFile.FullName(), |
|
1811 |
EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized, |
|
1812 |
EMbmCmmanagerQgn_prop_set_conn_dest_uncategorized_mask ); |
|
1813 |
||
1814 |
return icon; |
|
1815 |
} |
|
1816 |
||
1817 |
//----------------------------------------------------------------------------- |
|
1818 |
// CCmManagerImpl::UncategorizedIconL() |
|
1819 |
//----------------------------------------------------------------------------- |
|
1820 |
// |
|
1821 |
CMDBSession& CCmManagerImpl::Session() const |
|
1822 |
{ |
|
1823 |
return iTrans->Session(); |
|
1824 |
} |
|
1825 |
||
1826 |
// ----------------------------------------------------------------------------- |
|
1827 |
// CCmManagerImpl::HasCapabilityL() |
|
1828 |
// ----------------------------------------------------------------------------- |
|
1829 |
// |
|
1830 |
void CCmManagerImpl::HasCapabilityL( TCapability aCapability ) |
|
1831 |
{ |
|
1832 |
TSecurityInfo info; |
|
1833 |
||
1834 |
info.SetToCurrentInfo(); |
|
1835 |
||
1836 |
if( !info.iCaps.HasCapability( aCapability ) ) |
|
1837 |
{ |
|
1838 |
User::Leave( KErrPermissionDenied ); |
|
1839 |
} |
|
1840 |
} |
|
1841 |
||
1842 |
// --------------------------------------------------------------------------- |
|
1843 |
// CCmManagerImpl::FeatureSupported |
|
1844 |
// --------------------------------------------------------------------------- |
|
1845 |
TBool CCmManagerImpl::FeatureSupported( TInt aFeature ) |
|
1846 |
{ |
|
1847 |
return FeatureManager::FeatureSupported( aFeature ); |
|
1848 |
} |
|
1849 |
||
1850 |
// --------------------------------------------------------------------------- |
|
1851 |
// CCmManagerImpl::IsEasyWLan |
|
1852 |
// |
|
1853 |
// We can't have any dependecy to WLan plugin, but |
|
1854 |
// in some cases we need to filter out EasyWLan access points. |
|
1855 |
// --------------------------------------------------------------------------- |
|
1856 |
TBool CCmManagerImpl::IsEasyWLanL( CCDIAPRecord* aIapRecord ) const |
|
1857 |
{ |
|
1858 |
LOGGER_ENTERFN( "CCmManagerImpl::IsEasyWLanL" ); |
|
1859 |
if (!iWLan) |
|
1860 |
{ |
|
1861 |
return EFalse; |
|
1862 |
} |
|
1863 |
if( (TPtrC(aIapRecord->iServiceType) != TPtrC(KCDTypeNameLANService) ) || |
|
1864 |
TPtrC(aIapRecord->iBearerType) != TPtrC(KCDTypeNameLANBearer) ) |
|
1865 |
{ |
|
1866 |
return EFalse; |
|
1867 |
} |
|
1868 |
||
1869 |
TBool retVal( EFalse ); |
|
1870 |
TUint32 serviceId = aIapRecord->iService; |
|
1871 |
||
1872 |
CCDWlanServiceRecord* wLanServ = |
|
1873 |
new (ELeave) CCDWlanServiceRecord( CCDWlanServiceRecord::TableIdL( Session() ) ); |
|
1874 |
||
1875 |
CleanupStack::PushL( wLanServ ); |
|
1876 |
||
1877 |
wLanServ->iWlanServiceId.SetL( serviceId ); |
|
1878 |
||
1879 |
if( wLanServ->FindL( Session() ) ) |
|
1880 |
{ |
|
1881 |
wLanServ->LoadL( Session() ); |
|
1882 |
||
1883 |
if( wLanServ->iWLanSSID.IsNull() || |
|
1884 |
!TPtrC(wLanServ->iWLanSSID).Compare( KNullDesC ) ) |
|
1885 |
{ |
|
1886 |
retVal = ETrue; |
|
1887 |
} |
|
1888 |
} |
|
1889 |
||
1890 |
CleanupStack::PopAndDestroy( wLanServ ); |
|
1891 |
||
1892 |
return retVal; |
|
1893 |
} |
|
1894 |
||
1895 |
// ----------------------------------------------------------------------------- |
|
1896 |
// CCmManagerImpl::EasyWlanIdL() |
|
1897 |
// ----------------------------------------------------------------------------- |
|
1898 |
// |
|
1899 |
EXPORT_C TUint32 CCmManagerImpl::EasyWlanIdL() |
|
1900 |
{ |
|
1901 |
LOGGER_ENTERFN( "CCmManagerImpl::EasyWlanId" ); |
|
1902 |
||
1903 |
OpenTransactionLC(); |
|
1904 |
||
1905 |
TUint32 easyId( 0 ); |
|
1906 |
||
1907 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = AllIapsL(); |
|
1908 |
CleanupStack::PushL( ptrRecordSet ); |
|
1909 |
TInt iapRecords = ptrRecordSet->iRecords.Count(); |
|
1910 |
CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords ); |
|
1911 |
||
1912 |
for ( TInt i = 0; i < iapRecords; i++ ) |
|
1913 |
{ |
|
1914 |
CCDIAPRecord* iapRecord = (*ptrRecordSet)[i]; |
|
1915 |
||
1916 |
if( (TPtrC(iapRecord->iServiceType) == TPtrC(KCDTypeNameLANService) ) && |
|
1917 |
TPtrC(iapRecord->iBearerType) == TPtrC(KCDTypeNameLANBearer) ) |
|
1918 |
{ |
|
1919 |
if( IsEasyWLanL( iapRecord ) ) |
|
1920 |
{ |
|
1921 |
easyId = (*ptrRecordSet)[i]->RecordId(); |
|
1922 |
break; |
|
1923 |
} |
|
1924 |
} |
|
1925 |
} |
|
1926 |
||
1927 |
CleanupStack::PopAndDestroy( ptrRecordSet ); |
|
1928 |
||
1929 |
RollbackTransaction(); |
|
1930 |
||
1931 |
return easyId; |
|
1932 |
} |
|
1933 |
||
1934 |
// ----------------------------------------------------------------------------- |
|
1935 |
// CCmManagerImpl::AllIapsL() |
|
1936 |
// ----------------------------------------------------------------------------- |
|
1937 |
// |
|
1938 |
CMDBRecordSet<CCDIAPRecord>* CCmManagerImpl::AllIapsL() |
|
1939 |
{ |
|
1940 |
LOGGER_ENTERFN( "CCmManagerImpl::AllIapsL" ); |
|
1941 |
||
1942 |
OpenTransactionLC(); |
|
1943 |
||
1944 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = |
|
1945 |
new (ELeave) CMDBRecordSet<CCDIAPRecord>( KCDTIdIAPRecord ); |
|
1946 |
||
1947 |
TRAP_IGNORE( ptrRecordSet->LoadL( Session() ) ); |
|
1948 |
||
1949 |
RollbackTransaction(); |
|
1950 |
||
1951 |
return ptrRecordSet; |
|
1952 |
} |
|
1953 |
||
1954 |
// ----------------------------------------------------------------------------- |
|
1955 |
// CCmManagerImpl::AllSNAPRecordsL() |
|
1956 |
// ----------------------------------------------------------------------------- |
|
1957 |
// |
|
1958 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* |
|
1959 |
CCmManagerImpl::AllSNAPRecordsL( TUint32 aSnapElementId ) |
|
1960 |
{ |
|
1961 |
LOGGER_ENTERFN( "CCmManagerImpl::AllSNAPRecordsL" ); |
|
1962 |
||
1963 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* ptrRecordSet = |
|
1964 |
new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
1965 |
DestinationTableId() ); |
|
1966 |
CleanupStack::PushL( ptrRecordSet ); |
|
1967 |
||
1968 |
OpenTransactionLC(); |
|
1969 |
if( aSnapElementId ) |
|
1970 |
{ |
|
1971 |
// Prime record |
|
1972 |
CCDSnapRecord* record = SNAPRecordL( 0 ); |
|
1973 |
CleanupStack::PushL( record ); |
|
1974 |
record->iEmbeddedSNAP = aSnapElementId; |
|
1975 |
ptrRecordSet->iRecords.AppendL( record ); |
|
1976 |
||
1977 |
CleanupStack::Pop( record ); |
|
1978 |
record = NULL; |
|
1979 |
||
1980 |
ptrRecordSet->FindL( Session() ); |
|
1981 |
} |
|
1982 |
else |
|
1983 |
{ |
|
1984 |
ptrRecordSet->LoadL( Session() ); |
|
1985 |
} |
|
1986 |
||
1987 |
RollbackTransaction(); |
|
1988 |
||
1989 |
return ptrRecordSet; |
|
1990 |
} |
|
1991 |
||
1992 |
// ----------------------------------------------------------------------------- |
|
1993 |
// CCmManagerImpl::IsIapLinkedL() |
|
1994 |
// ----------------------------------------------------------------------------- |
|
1995 |
// |
|
1996 |
TBool CCmManagerImpl::IsIapLinkedL( const CCmPluginBaseEng& aPlugin ) |
|
1997 |
{ |
|
1998 |
LOGGER_ENTERFN( "CCmManagerImpl::IsIapLinkedL" ); |
|
1999 |
||
2000 |
TUint32 iapId = aPlugin.GetIntAttributeL( ECmId ); |
|
2001 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = AllIapsL(); |
|
2002 |
CleanupStack::PushL( ptrRecordSet ); |
|
2003 |
||
2004 |
TInt iapRecords = ptrRecordSet->iRecords.Count(); |
|
2005 |
CLOG_WRITE_1_PTR( NULL, "Record num [%d]", iapRecords ); |
|
2006 |
||
2007 |
TBool linked( EFalse ); |
|
2008 |
for ( TInt i = 0; !linked && i < iapRecords; i++ ) |
|
2009 |
{ |
|
2010 |
CCDIAPRecord* iapRecord = (*ptrRecordSet)[i]; |
|
2011 |
||
2012 |
if( iapRecord->RecordId() == iapId ) |
|
2013 |
{ |
|
2014 |
continue; |
|
2015 |
} |
|
2016 |
||
2017 |
TUint32 bearerType( 0 ); |
|
2018 |
||
2019 |
TRAP_IGNORE( bearerType = BearerTypeFromIapRecordL( iapRecord ) ); |
|
2020 |
if( bearerType ) |
|
2021 |
{ |
|
2022 |
if( GetBearerInfoBoolL( bearerType, ECmVirtual ) ) |
|
2023 |
{ |
|
2024 |
CCmPluginBase* plugin = NULL; |
|
2025 |
||
2026 |
TRAP_IGNORE( plugin = GetConnectionMethodL( iapRecord->RecordId() ) ); |
|
2027 |
if( plugin ) |
|
2028 |
{ |
|
2029 |
linked = plugin->IsLinkedToIap( iapId ); |
|
2030 |
} |
|
2031 |
||
2032 |
delete plugin; |
|
2033 |
} |
|
2034 |
} |
|
2035 |
} |
|
2036 |
CleanupStack::PopAndDestroy( ptrRecordSet ); |
|
2037 |
||
2038 |
return linked; |
|
2039 |
} |
|
2040 |
||
2041 |
// ----------------------------------------------------------------------------- |
|
2042 |
// CCmManagerImpl::RemoveAllReferencesL() |
|
2043 |
// ----------------------------------------------------------------------------- |
|
2044 |
// |
|
2045 |
void CCmManagerImpl::RemoveAllReferencesL( const CCmPluginBaseEng& aPlugin ) |
|
2046 |
{ |
|
2047 |
RArray<TUint32> dests; |
|
2048 |
CleanupClosePushL( dests ); |
|
2049 |
OpenTransactionLC(); |
|
2050 |
||
2051 |
AllDestinationsL( dests ); |
|
2052 |
||
2053 |
for( TInt i = 0; i < dests.Count(); ++i ) |
|
2054 |
{ |
|
2055 |
CCmDestinationImpl* dest = DestinationL( dests[i] ); |
|
2056 |
CleanupStack::PushL( dest ); |
|
2057 |
TRAPD( err, dest->RemoveConnectionMethodL( aPlugin ) ); |
|
2058 |
||
2059 |
if( err != KErrNotFound ) |
|
2060 |
{ |
|
2061 |
User::LeaveIfError( err ); |
|
2062 |
||
2063 |
dest->UpdateL(); |
|
2064 |
} |
|
2065 |
||
2066 |
CleanupStack::PopAndDestroy( dest ); |
|
2067 |
} |
|
2068 |
||
2069 |
CommitTransactionL( 0 ); |
|
2070 |
CleanupStack::PopAndDestroy( &dests ); |
|
2071 |
} |
|
2072 |
||
2073 |
// ----------------------------------------------------------------------------- |
|
2074 |
// CCmManagerImpl::RemoveAllReferencesLWoTransL() |
|
2075 |
// ----------------------------------------------------------------------------- |
|
2076 |
// |
|
2077 |
void CCmManagerImpl::RemoveAllReferencesWoTransL( const CCmPluginBaseEng& aPlugin ) |
|
2078 |
{ |
|
2079 |
LOGGER_ENTERFN( "CCmManagerImpl::RemoveAllReferencesWoTransL" ); |
|
2080 |
||
2081 |
RArray<TUint32> dests; |
|
2082 |
CleanupClosePushL( dests ); |
|
2083 |
||
2084 |
AllDestinationsL( dests ); |
|
2085 |
||
2086 |
for( TInt i = 0; i < dests.Count(); ++i ) |
|
2087 |
{ |
|
2088 |
CCmDestinationImpl* dest = DestinationL( dests[i] ); |
|
2089 |
CleanupStack::PushL( dest ); |
|
2090 |
TRAPD( err, dest->RemoveConnectionMethodL( aPlugin ) ); |
|
2091 |
||
2092 |
if( err != KErrNotFound ) |
|
2093 |
{ |
|
2094 |
User::LeaveIfError( err ); |
|
2095 |
||
2096 |
dest->UpdateL(); |
|
2097 |
} |
|
2098 |
||
2099 |
CleanupStack::PopAndDestroy( dest ); |
|
2100 |
} |
|
2101 |
CleanupStack::PopAndDestroy( &dests ); |
|
2102 |
} |
|
2103 |
||
2104 |
// ----------------------------------------------------------------------------- |
|
2105 |
// CCmManagerImpl::HandleDefConnDeletedL() |
|
2106 |
// ----------------------------------------------------------------------------- |
|
2107 |
// |
|
2108 |
void CCmManagerImpl::HandleDefConnDeletedL( TCmDefConnValue& aDCSetting ) |
|
2109 |
{ |
|
2110 |
LOGGER_ENTERFN( "CCmManagerImpl::HandleDefConnDeletedL" ); |
|
2111 |
||
2112 |
if ( IsDefConnSupported() ) |
|
2113 |
{ |
|
2114 |
TCmDefConnValue defConn; |
|
2115 |
ReadDefConnWoTransL(defConn); |
|
2116 |
if ( defConn == aDCSetting ) |
|
2117 |
{ |
|
2118 |
// Default connection deleted, setting it to default value. |
|
2119 |
TUint32 destId = GetInternetDestinationIdL(); |
|
2120 |
||
2121 |
if ( destId && ( destId != aDCSetting.iId ) ) |
|
2122 |
{ |
|
2123 |
defConn.iType = ECmDefConnDestination; |
|
2124 |
defConn.iId = destId; |
|
2125 |
} |
|
2126 |
else |
|
2127 |
{ |
|
2128 |
// Internet destination not found. Initialise to zero. |
|
2129 |
defConn.iType = TCmDefConnType ( 0 ); |
|
2130 |
defConn.iId = 0; |
|
2131 |
} |
|
2132 |
||
2133 |
WriteDefConnWoTransL( defConn ); |
|
2134 |
} |
|
2135 |
} // do nothing if default connection is not supported |
|
2136 |
} |
|
2137 |
||
2138 |
// ----------------------------------------------------------------------------- |
|
2139 |
// CCmManagerImpl::ReadDefConnWoTransL() |
|
2140 |
// ----------------------------------------------------------------------------- |
|
2141 |
// |
|
2142 |
void CCmManagerImpl::ReadDefConnWoTransL( TCmDefConnValue& aDCSetting ) |
|
2143 |
{ |
|
2144 |
LOGGER_ENTERFN( "CCmManagerImpl::ReadDefConnWoTransL" ); |
|
2145 |
if ( IsDefConnSupported() ) |
|
2146 |
{ |
|
2147 |
CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = |
|
2148 |
new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId ); |
|
2149 |
CleanupStack::PushL( defConnRecordSet ); |
|
2150 |
||
2151 |
TRAPD( err, defConnRecordSet->LoadL( Session() ) ); |
|
2152 |
if (err == KErrNone) |
|
2153 |
{ |
|
2154 |
TInt mode = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], |
|
2155 |
KCDTIdDefConnType ); |
|
2156 |
aDCSetting.iType= TCmDefConnType (mode); |
|
2157 |
||
2158 |
aDCSetting.iId = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], |
|
2159 |
KCDTIdDefConnUid ); |
|
2160 |
CLOG_WRITE( "Default Connection read OK " ); |
|
2161 |
} |
|
2162 |
else |
|
2163 |
{ |
|
2164 |
//deleting old record, writing Always Ask (default value) |
|
2165 |
//aDCSetting.iType = ECmDefConnAlwaysAsk; |
|
2166 |
//aDCSetting.iId = 0; |
|
2167 |
TUint32 destId = GetInternetDestinationIdL(); |
|
2168 |
||
2169 |
if ( destId ) |
|
2170 |
{ |
|
2171 |
aDCSetting.iType = ECmDefConnDestination; |
|
2172 |
aDCSetting.iId = destId; |
|
2173 |
} |
|
2174 |
else |
|
2175 |
{ |
|
2176 |
// Internet destination not found. Initialise to zero. |
|
2177 |
aDCSetting.iType = TCmDefConnType ( 0 ); |
|
2178 |
aDCSetting.iId = 0; |
|
2179 |
} |
|
2180 |
||
2181 |
CLOG_WRITE( "Default Connection read FAILED, storing Always Ask! " ); |
|
2182 |
ReplaceDefConnRecordL( aDCSetting ); |
|
2183 |
} |
|
2184 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2185 |
} |
|
2186 |
else |
|
2187 |
{ |
|
2188 |
CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" ); |
|
2189 |
User::Leave(KErrNotSupported); |
|
2190 |
} |
|
2191 |
} |
|
2192 |
||
2193 |
//----------------------------------------------------------------------------- |
|
2194 |
// CCmManagerImpl::WriteDefConnWoTransL() |
|
2195 |
//----------------------------------------------------------------------------- |
|
2196 |
// |
|
2197 |
void CCmManagerImpl::WriteDefConnWoTransL( const TCmDefConnValue& aDCSetting ) |
|
2198 |
{ |
|
2199 |
LOGGER_ENTERFN( "CCmManagerImpl::WriteDefConnWoTransL" ); |
|
2200 |
||
2201 |
if ( IsDefConnSupported() ) |
|
2202 |
{ |
|
2203 |
ReplaceDefConnRecordL( aDCSetting ); |
|
2204 |
} |
|
2205 |
else |
|
2206 |
{ |
|
2207 |
CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" ); |
|
2208 |
User::Leave(KErrNotSupported); |
|
2209 |
} |
|
2210 |
} |
|
2211 |
||
2212 |
// ----------------------------------------------------------------------------- |
|
2213 |
// CCmManagerImpl::ReadDefConnL() |
|
2214 |
// ----------------------------------------------------------------------------- |
|
2215 |
// |
|
2216 |
void CCmManagerImpl::ReadDefConnL( TCmDefConnValue& aDCSetting ) |
|
2217 |
{ |
|
2218 |
LOGGER_ENTERFN( "CCmManagerImpl::ReadDefConn" ); |
|
2219 |
||
2220 |
if ( IsDefConnSupported() ) |
|
2221 |
{ |
|
2222 |
OpenTransactionLC(); |
|
2223 |
CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = |
|
2224 |
new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId ); |
|
2225 |
CleanupStack::PushL( defConnRecordSet ); |
|
2226 |
||
2227 |
TRAPD( err, defConnRecordSet->LoadL( Session() ) ); |
|
2228 |
if (err == KErrNone) |
|
2229 |
{ |
|
2230 |
TInt mode = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], |
|
2231 |
KCDTIdDefConnType ); |
|
2232 |
aDCSetting.iType= TCmDefConnType ( mode ); |
|
2233 |
||
2234 |
aDCSetting.iId = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], |
|
2235 |
KCDTIdDefConnUid ); |
|
2236 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2237 |
RollbackTransaction(); |
|
2238 |
} |
|
2239 |
else |
|
2240 |
{ |
|
2241 |
//deleting old record, writing Always Ask (default value) |
|
2242 |
//aDCSetting.iType = ECmDefConnAlwaysAsk; |
|
2243 |
//aDCSetting.iId = 0; |
|
2244 |
||
2245 |
TUint32 destId = GetInternetDestinationIdL(); |
|
2246 |
||
2247 |
if ( destId ) |
|
2248 |
{ |
|
2249 |
aDCSetting.iType = ECmDefConnDestination; |
|
2250 |
aDCSetting.iId = destId; |
|
2251 |
} |
|
2252 |
else |
|
2253 |
{ |
|
2254 |
// Internet destination not found. Initialise to zero. |
|
2255 |
aDCSetting.iType = TCmDefConnType ( 0 ); |
|
2256 |
aDCSetting.iId = 0; |
|
2257 |
} |
|
2258 |
||
2259 |
CLOG_WRITE( "Default Connection read FAILED, storing Always Ask! " ); |
|
2260 |
ReplaceDefConnRecordL( aDCSetting ); |
|
2261 |
||
2262 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2263 |
CommitTransactionL( KErrNone ); |
|
2264 |
} |
|
2265 |
} |
|
2266 |
else |
|
2267 |
{ |
|
2268 |
CLOG_WRITE( "Default Connection NOT supported" ); |
|
2269 |
User::Leave(KErrNotSupported); |
|
2270 |
} |
|
2271 |
} |
|
2272 |
||
2273 |
//----------------------------------------------------------------------------- |
|
2274 |
// CCmManagerImpl::ReplaceDefConnRecordL() |
|
2275 |
//----------------------------------------------------------------------------- |
|
2276 |
// |
|
2277 |
void CCmManagerImpl::ReplaceDefConnRecordL( const TCmDefConnValue aDCSetting ) |
|
2278 |
{ |
|
2279 |
||
2280 |
LOGGER_ENTERFN( "CCmManagerImpl::ReplaceDefConnRecordL" ); |
|
2281 |
// Check the Id first (that it exists) |
|
2282 |
if ( aDCSetting.iType == ECmDefConnConnectionMethod ) |
|
2283 |
{ |
|
2284 |
CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
|
2285 |
( CCDRecordBase::RecordFactoryL( KCDTIdIAPRecord ) ); |
|
2286 |
CleanupStack::PushL( iapRecord ); |
|
2287 |
iapRecord->SetRecordId( aDCSetting.iId ); |
|
2288 |
TRAPD( err, iapRecord->LoadL( Session() ) ); |
|
2289 |
if ( err == KErrNotFound ) |
|
2290 |
{ |
|
2291 |
User::Leave( KErrArgument ); |
|
2292 |
} |
|
2293 |
CleanupStack::PopAndDestroy( iapRecord ); |
|
2294 |
||
2295 |
// Check that Connection Method is not hidden |
|
2296 |
if ( GetConnectionMethodInfoBoolL( aDCSetting.iId, ECmHidden ) ) |
|
2297 |
{ |
|
2298 |
User::Leave( KErrArgument ); |
|
2299 |
} |
|
2300 |
} |
|
2301 |
else if ( aDCSetting.iType == ECmDefConnDestination ) |
|
2302 |
{ |
|
2303 |
TUint32 destId = GetInternetDestinationIdL(); |
|
2304 |
||
2305 |
// Allow empty Internet destination, others must have some content |
|
2306 |
if ( destId != aDCSetting.iId ) |
|
2307 |
{ |
|
2308 |
CCDAccessPointRecord* destAPRecord = static_cast<CCDAccessPointRecord *>( |
|
2309 |
CCDRecordBase::RecordFactoryL( KCDTIdAccessPointRecord ) ); |
|
2310 |
CleanupStack::PushL( destAPRecord ); |
|
2311 |
||
2312 |
destAPRecord->iRecordTag = aDCSetting.iId; |
|
2313 |
if ( !destAPRecord->FindL( Session() ) ) |
|
2314 |
{ |
|
2315 |
User::Leave( KErrArgument ); |
|
2316 |
} |
|
2317 |
CleanupStack::PopAndDestroy( destAPRecord ); |
|
2318 |
} |
|
2319 |
} |
|
2320 |
||
2321 |
TInt ret = KErrNone; |
|
2322 |
TCmGenConnSettings genConnSettings; |
|
2323 |
||
2324 |
SetGenConnSettingsToDefault( genConnSettings ); |
|
2325 |
||
2326 |
CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = |
|
2327 |
new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId ); |
|
2328 |
CleanupStack::PushL( defConnRecordSet ); |
|
2329 |
||
2330 |
TRAP( ret, defConnRecordSet->LoadL( Session() ) ); |
|
2331 |
||
2332 |
if (ret == KErrNone) |
|
2333 |
{ |
|
2334 |
TInt value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdUsageOfWlan ); |
|
2335 |
genConnSettings.iUsageOfWlan = TCmUsageOfWlan( value ); |
|
2336 |
||
2337 |
value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdCellularDataUsageHome ); |
|
2338 |
genConnSettings.iCellularDataUsageHome = TCmCellularDataUsage( value ); |
|
2339 |
||
2340 |
value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdCellularDataUsageVisitor ); |
|
2341 |
genConnSettings.iCellularDataUsageVisitor = TCmCellularDataUsage( value ); |
|
2342 |
} |
|
2343 |
||
2344 |
TInt typeVal = aDCSetting.iType; |
|
2345 |
TInt uidVal = aDCSetting.iId; |
|
2346 |
||
2347 |
// Delete the old record |
|
2348 |
for ( TInt i = 0; i < defConnRecordSet->iRecords.Count(); ++i ) |
|
2349 |
{ |
|
2350 |
defConnRecordSet->iRecords[i]->DeleteL( Session() ); |
|
2351 |
} |
|
2352 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2353 |
||
2354 |
CCDDefConnRecord* dcRcd = |
|
2355 |
new (ELeave) CCDDefConnRecord( iDefConnTableId ); |
|
2356 |
CleanupStack::PushL( dcRcd ); // 2 |
|
2357 |
||
2358 |
dcRcd->SetRecordId( KCDNewRecordRequest ); |
|
2359 |
||
2360 |
SET_INT_FIELD(dcRcd, KCDTIdUsageOfWlan, genConnSettings.iUsageOfWlan ); |
|
2361 |
SET_INT_FIELD(dcRcd, KCDTIdCellularDataUsageHome, genConnSettings.iCellularDataUsageHome ); |
|
2362 |
SET_INT_FIELD(dcRcd, KCDTIdCellularDataUsageVisitor, genConnSettings.iCellularDataUsageVisitor ); |
|
2363 |
||
2364 |
CLOG_WRITE_FORMAT( "Set default connection type: [%d]", typeVal ); |
|
2365 |
SET_INT_FIELD( dcRcd, |
|
2366 |
KCDTIdDefConnType, |
|
2367 |
typeVal ); |
|
2368 |
CLOG_WRITE_1( "Set uid: [%d]", uidVal ); |
|
2369 |
SET_INT_FIELD( dcRcd, |
|
2370 |
KCDTIdDefConnUid, |
|
2371 |
uidVal ); |
|
2372 |
dcRcd->StoreL( Session() ); |
|
2373 |
CleanupStack::PopAndDestroy( dcRcd ); |
|
2374 |
} |
|
2375 |
||
2376 |
//----------------------------------------------------------------------------- |
|
2377 |
// CCmManagerImpl::WriteDefConnL() |
|
2378 |
//----------------------------------------------------------------------------- |
|
2379 |
// |
|
2380 |
void CCmManagerImpl::WriteDefConnL( const TCmDefConnValue& aDCSetting ) |
|
2381 |
{ |
|
2382 |
LOGGER_ENTERFN( "CCmManagerImpl::WriteDefConnL" ); |
|
2383 |
||
2384 |
if ( ( aDCSetting.iType == ECmDefConnAlwaysAsk ) || |
|
2385 |
( aDCSetting.iType == ECmDefConnAskOnce ) ) |
|
2386 |
{ |
|
2387 |
User::Leave( KErrNotSupported ); |
|
2388 |
} |
|
2389 |
||
2390 |
if ( IsDefConnSupported() ) |
|
2391 |
{ |
|
2392 |
OpenTransactionLC(); |
|
2393 |
||
2394 |
ReplaceDefConnRecordL( aDCSetting ); |
|
2395 |
CommitTransactionL( KErrNone ); |
|
2396 |
} |
|
2397 |
else |
|
2398 |
{ |
|
2399 |
CLOG_WRITE( "Default Connection NOT supported, leaving with KErrNotSupported" ); |
|
2400 |
User::Leave(KErrNotSupported); |
|
2401 |
} |
|
2402 |
} |
|
2403 |
||
2404 |
//----------------------------------------------------------------------------- |
|
2405 |
// CCmManagerImpl::IsDefConnSupported() |
|
2406 |
//----------------------------------------------------------------------------- |
|
2407 |
// |
|
2408 |
TBool CCmManagerImpl::IsDefConnSupported( ) |
|
2409 |
{ |
|
2410 |
LOGGER_ENTERFN( "CCmManagerImpl::IsDefConnSupported" ); |
|
2411 |
||
2412 |
return iDefConnSupported; |
|
2413 |
} |
|
2414 |
||
2415 |
// ----------------------------------------------------------------------------- |
|
2416 |
// CCmManagerImpl::ReadGenConneSettingsL() |
|
2417 |
// ----------------------------------------------------------------------------- |
|
2418 |
// |
|
2419 |
void CCmManagerImpl::ReadGenConnSettingsL( TCmGenConnSettings& aGenConnSettings ) |
|
2420 |
{ |
|
2421 |
LOGGER_ENTERFN( "CCmManagerImpl::ReadGenConnSettingsL" ); |
|
2422 |
||
2423 |
OpenTransactionLC(); |
|
2424 |
CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = |
|
2425 |
new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId ); |
|
2426 |
CleanupStack::PushL( defConnRecordSet ); |
|
2427 |
||
2428 |
defConnRecordSet->LoadL( Session() ); |
|
2429 |
||
2430 |
TInt value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdUsageOfWlan ); |
|
2431 |
aGenConnSettings.iUsageOfWlan = TCmUsageOfWlan( value ); |
|
2432 |
||
2433 |
value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdCellularDataUsageHome ); |
|
2434 |
aGenConnSettings.iCellularDataUsageHome = TCmCellularDataUsage( value ); |
|
2435 |
||
2436 |
value = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdCellularDataUsageVisitor ); |
|
2437 |
aGenConnSettings.iCellularDataUsageVisitor = TCmCellularDataUsage( value ); |
|
2438 |
||
2439 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2440 |
RollbackTransaction(); |
|
2441 |
} |
|
2442 |
||
2443 |
//----------------------------------------------------------------------------- |
|
2444 |
// CCmManagerImpl::ReplaceGenConnSettingsL() |
|
2445 |
//----------------------------------------------------------------------------- |
|
2446 |
// |
|
2447 |
void CCmManagerImpl::ReplaceGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings ) |
|
2448 |
{ |
|
2449 |
||
2450 |
LOGGER_ENTERFN( "CCmManagerImpl::ReplaceGenConnSettingsL" ); |
|
2451 |
||
2452 |
TInt ret = KErrNone; |
|
2453 |
TCmDefConnValue defConn; |
|
2454 |
||
2455 |
defConn.iType = TCmDefConnType ( 0 ); |
|
2456 |
defConn.iId = 0; |
|
2457 |
||
2458 |
CMDBRecordSet<CCDDefConnRecord>* defConnRecordSet = |
|
2459 |
new ( ELeave ) CMDBRecordSet<CCDDefConnRecord>( iDefConnTableId ); |
|
2460 |
CleanupStack::PushL( defConnRecordSet ); |
|
2461 |
||
2462 |
TRAP(ret, defConnRecordSet->LoadL(Session())); |
|
2463 |
||
2464 |
if (ret == KErrNone) |
|
2465 |
{ |
|
2466 |
TInt type = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdDefConnType); |
|
2467 |
defConn.iType = TCmDefConnType( type ); |
|
2468 |
TInt id = QUERY_INT_FIELD( defConnRecordSet->iRecords[0], KCDTIdDefConnUid); |
|
2469 |
defConn.iId = id; |
|
2470 |
} |
|
2471 |
||
2472 |
TInt usageOfNewWlan = aGenConnSettings.iUsageOfWlan; |
|
2473 |
TInt cellularDataUsageHome = aGenConnSettings.iCellularDataUsageHome; |
|
2474 |
TInt cellularDataUsageVisitor = aGenConnSettings.iCellularDataUsageVisitor; |
|
2475 |
||
2476 |
// Delete the old record |
|
2477 |
for ( TInt i = 0; i < defConnRecordSet->iRecords.Count(); ++i ) |
|
2478 |
{ |
|
2479 |
defConnRecordSet->iRecords[i]->DeleteL( Session() ); |
|
2480 |
} |
|
2481 |
CleanupStack::PopAndDestroy( defConnRecordSet ); |
|
2482 |
||
2483 |
CCDDefConnRecord* dcRcd = |
|
2484 |
new (ELeave) CCDDefConnRecord( iDefConnTableId ); |
|
2485 |
CleanupStack::PushL( dcRcd ); // 2 |
|
2486 |
||
2487 |
dcRcd->SetRecordId( KCDNewRecordRequest ); |
|
2488 |
||
2489 |
SET_INT_FIELD(dcRcd, KCDTIdDefConnType, defConn.iType); |
|
2490 |
SET_INT_FIELD(dcRcd, KCDTIdDefConnUid, defConn.iId); |
|
2491 |
||
2492 |
CLOG_WRITE_1( "Set wlan usage: [%d]", usageOfNewWlan ); |
|
2493 |
SET_INT_FIELD(dcRcd, KCDTIdUsageOfWlan, usageOfNewWlan ); |
|
2494 |
||
2495 |
CLOG_WRITE_1( "Set cellularDataUsageHome: [%d]", cellularDataUsageHome ); |
|
2496 |
SET_INT_FIELD(dcRcd, KCDTIdCellularDataUsageHome, cellularDataUsageHome ); |
|
2497 |
||
2498 |
CLOG_WRITE_1( "Set cellularDataUsageVisitor: [%d]", cellularDataUsageVisitor ); |
|
2499 |
SET_INT_FIELD(dcRcd, KCDTIdCellularDataUsageVisitor, cellularDataUsageVisitor ); |
|
2500 |
||
2501 |
dcRcd->StoreL( Session() ); |
|
2502 |
CleanupStack::PopAndDestroy( dcRcd ); |
|
2503 |
} |
|
2504 |
||
2505 |
//----------------------------------------------------------------------------- |
|
2506 |
// CCmManagerImpl::WriteGenConnSettingsL() |
|
2507 |
//----------------------------------------------------------------------------- |
|
2508 |
// |
|
2509 |
void CCmManagerImpl::WriteGenConnSettingsL( const TCmGenConnSettings& aGenConnSettings ) |
|
2510 |
{ |
|
2511 |
LOGGER_ENTERFN( "CCmManagerImpl::WriteGenConnSettingsL" ); |
|
2512 |
||
2513 |
OpenTransactionLC(); |
|
2514 |
||
2515 |
ReplaceGenConnSettingsL( aGenConnSettings ); |
|
2516 |
CommitTransactionL( KErrNone ); |
|
2517 |
} |
|
2518 |
||
2519 |
//----------------------------------------------------------------------------- |
|
2520 |
// CCmManagerImpl::IsMemoryLow() |
|
2521 |
//----------------------------------------------------------------------------- |
|
2522 |
// |
|
2523 |
TBool CCmManagerImpl::IsMemoryLow() |
|
2524 |
{ |
|
2525 |
LOGGER_ENTERFN( "CCmManagerImpl::IsMemoryLow" ); |
|
2526 |
||
2527 |
TBool ret( EFalse ); |
|
2528 |
// Any plugin can be used here, because CheckSpaceBelowCriticalLevelL |
|
2529 |
// is defined in their father class CCmPluginBaseEng |
|
2530 |
TRAPD( err, ret = (*iPlugins)[0]->CheckSpaceBelowCriticalLevelL() ); |
|
2531 |
if( err != KErrNone ) |
|
2532 |
{ |
|
2533 |
ret = ETrue; |
|
2534 |
return ret; |
|
2535 |
} |
|
2536 |
return ret; |
|
2537 |
} |
|
2538 |
||
2539 |
// ----------------------------------------------------------------------------- |
|
2540 |
// CCmManagerImpl::SNAPRecordL |
|
2541 |
// ----------------------------------------------------------------------------- |
|
2542 |
CCDSnapRecord* CCmManagerImpl::SNAPRecordL( TUint32 aRecordId ) const |
|
2543 |
{ |
|
2544 |
CCDSnapRecord* record = new (ELeave) CCDSnapRecord( |
|
2545 |
DestinationTableId() ); |
|
2546 |
||
2547 |
if( aRecordId ) |
|
2548 |
{ |
|
2549 |
record->SetRecordId( aRecordId ); |
|
2550 |
||
2551 |
CleanupStack::PushL( record ); |
|
2552 |
record->LoadL( Session() ); |
|
2553 |
CleanupStack::Pop( record ); |
|
2554 |
} |
|
2555 |
||
2556 |
return record; |
|
2557 |
} |
|
2558 |
||
2559 |
// ----------------------------------------------------------------------------- |
|
2560 |
// CCmManagerImpl::SNAPRecordL |
|
2561 |
// ----------------------------------------------------------------------------- |
|
2562 |
CCDSnapRecord* CCmManagerImpl::CreateSNAPRecordL( TUint32 aRecordId ) const |
|
2563 |
{ |
|
2564 |
CCDSnapRecord* record = new (ELeave) CCDSnapRecord( |
|
2565 |
DestinationTableId() ); |
|
2566 |
||
2567 |
if( aRecordId ) |
|
2568 |
{ |
|
2569 |
record->SetRecordId( aRecordId ); |
|
2570 |
} |
|
2571 |
||
2572 |
return record; |
|
2573 |
} |
|
2574 |
||
2575 |
//----------------------------------------------------------------------------- |
|
2576 |
// CCmManagerImpl::WrapCmManager() |
|
2577 |
//----------------------------------------------------------------------------- |
|
2578 |
// |
|
2579 |
EXPORT_C void CCmManagerImpl::WrapCmManager( RCmManagerExt& aCmManagerExt ) |
|
2580 |
{ |
|
2581 |
aCmManagerExt.iImplementation = this; |
|
2582 |
} |
|
2583 |
||
2584 |
// -------------------------------------------------------------------------- |
|
2585 |
// CCmManagerImpl::FilterOutVirtualsL |
|
2586 |
// -------------------------------------------------------------------------- |
|
2587 |
// |
|
2588 |
EXPORT_C void CCmManagerImpl::FilterOutVirtualsL( RPointerArray<CCmPluginBase>& aCmDataArray ) |
|
2589 |
{ |
|
2590 |
LOGGER_ENTERFN( "CCmManagerImpl::FilterOutVirtualsL" ); |
|
2591 |
||
2592 |
for ( TInt i = 0; i < aCmDataArray.Count(); i++ ) |
|
2593 |
{ |
|
2594 |
if ( aCmDataArray[i]->GetBoolAttributeL( ECmVirtual ) ) |
|
2595 |
{ |
|
2596 |
delete aCmDataArray[i]; |
|
2597 |
aCmDataArray.Remove(i); |
|
2598 |
i--; |
|
2599 |
} |
|
2600 |
} |
|
2601 |
} |
|
2602 |
||
2603 |
// -------------------------------------------------------------------------- |
|
2604 |
// CCmManagerImpl::CreateFlatCMListLC |
|
2605 |
// -------------------------------------------------------------------------- |
|
2606 |
// |
|
2607 |
EXPORT_C void CCmManagerImpl::CreateFlatCMListLC( TUint32 aDestinationId , |
|
2608 |
RPointerArray<CCmPluginBase>& aCmArray ) |
|
2609 |
{ |
|
2610 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateFlatCMListLC" ); |
|
2611 |
||
2612 |
CreateFlatCMListL(aDestinationId, aCmArray); |
|
2613 |
CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >(aCmArray); |
|
2614 |
} |
|
2615 |
||
2616 |
// -------------------------------------------------------------------------- |
|
2617 |
// CCmManagerImpl::CreateFlatCMListL |
|
2618 |
// -------------------------------------------------------------------------- |
|
2619 |
// |
|
2620 |
EXPORT_C void CCmManagerImpl::CreateFlatCMListL( TUint32 aDestinationId , |
|
2621 |
RPointerArray<CCmPluginBase>& aCmArray ) |
|
2622 |
{ |
|
2623 |
LOGGER_ENTERFN( "CCmManagerImpl::CreateFlatCMListL" ); |
|
2624 |
// get the uncategorised connection methods |
|
2625 |
if ( aDestinationId == KDestItemUncategorized ) |
|
2626 |
{ |
|
2627 |
AppendUncatCmListLC( aCmArray); |
|
2628 |
} |
|
2629 |
else |
|
2630 |
{ |
|
2631 |
// Get the CM ids from the destination |
|
2632 |
AppendCmListLC( aDestinationId, aCmArray ); |
|
2633 |
} |
|
2634 |
||
2635 |
// get the possible embedded destinations to be able to list their content, too |
|
2636 |
// we only have to check in cmArray |
|
2637 |
// put them in a sep. array and get their data into another. |
|
2638 |
RArray<TUint32> cmEmbDestArray ( KCmArrayMediumGranularity ); |
|
2639 |
CleanupClosePushL( cmEmbDestArray ); |
|
2640 |
for ( TInt i = 0; i < aCmArray.Count(); i++ ) |
|
2641 |
{ |
|
2642 |
if ( aCmArray[i]->GetBoolAttributeL( ECmDestination ) ) |
|
2643 |
{ |
|
2644 |
cmEmbDestArray.AppendL( aCmArray[i]->GetIntAttributeL( ECmId ) ); |
|
2645 |
//remove embedded destination right now |
|
2646 |
delete aCmArray[i]; |
|
2647 |
aCmArray.Remove(i); |
|
2648 |
i--; // Array gets re-indexed after calling Remove(). |
|
2649 |
} |
|
2650 |
} |
|
2651 |
// now we stored the needed emb.dest, |
|
2652 |
// we can filter out all virtual ones |
|
2653 |
//iCmManager.FilterOutVirtualsL( cmArray ); //no filtering here, we can do it later |
|
2654 |
||
2655 |
// now we have the list of emb.dest. inside current destination, |
|
2656 |
// now get their CM's data appended to one flat list |
|
2657 |
RPointerArray<CCmPluginBase> cmLinkedDataArray ( KCmArrayMediumGranularity ); |
|
2658 |
CleanupResetAndDestroyPushL< RPointerArray<CCmPluginBase> >( cmLinkedDataArray ); |
|
2659 |
TInt embdestcount = cmEmbDestArray.Count(); |
|
2660 |
for ( TInt i = 0; i < embdestcount; i++ ) |
|
2661 |
{ |
|
2662 |
// get the list of CM's |
|
2663 |
CCmPluginBase* emdestcm = |
|
2664 |
GetConnectionMethodL( cmEmbDestArray[i] ); |
|
2665 |
CleanupStack::PushL( emdestcm ); |
|
2666 |
TUint destUid = emdestcm->Destination()->Id(); |
|
2667 |
AppendCmListL( destUid, cmLinkedDataArray ); |
|
2668 |
CleanupStack::PopAndDestroy( emdestcm ); |
|
2669 |
} |
|
2670 |
// filter out virtuals |
|
2671 |
//iCmManager.FilterOutVirtualsL( cmLinkedDataArray ); //still no filtering here |
|
2672 |
||
2673 |
// now we have the original, sorted list and an unsorted cmLinkedDataArray, |
|
2674 |
// add each element to original array with sorting |
|
2675 |
||
2676 |
CombineArraysForPriorityOrderL( aCmArray, cmLinkedDataArray ); |
|
2677 |
||
2678 |
// now we do no longer need the linked array |
|
2679 |
CleanupStack::Pop( &cmLinkedDataArray ); // don't destroy the cm objects! |
|
2680 |
||
2681 |
cmLinkedDataArray.Close(); // they are appended to aCmArray!!! |
|
2682 |
CleanupStack::PopAndDestroy( &cmEmbDestArray ); |
|
2683 |
||
2684 |
CleanupStack::Pop(&aCmArray); |
|
2685 |
} |
|
2686 |
||
2687 |
// -------------------------------------------------------------------------- |
|
2688 |
// CCmManagerImpl::CombineCmListsL |
|
2689 |
// -------------------------------------------------------------------------- |
|
2690 |
// |
|
2691 |
EXPORT_C void CCmManagerImpl::CombineArraysForPriorityOrderL( |
|
2692 |
RPointerArray<CCmPluginBase>& aCmArray , |
|
2693 |
RPointerArray<CCmPluginBase>& aCmLinkedArray ) |
|
2694 |
{ |
|
2695 |
LOGGER_ENTERFN( "CCmManagerImpl::CombineArraysForPriorityOrderL" ); |
|
2696 |
||
2697 |
// now we have two arrays, the first is sorted as needed, |
|
2698 |
// the second is not. |
|
2699 |
// we have to insert the items from the second to the first into their |
|
2700 |
// correct position based on the bearer type priorities |
|
2701 |
||
2702 |
// so loop on the second array, and for ech element, find it's place |
|
2703 |
TInt count = aCmLinkedArray.Count(); |
|
2704 |
for ( TInt i = 0; i < count; i++ ) |
|
2705 |
{ |
|
2706 |
TUint32 linkedpriority( aCmLinkedArray[i]->GetIntAttributeL( ECmDefaultPriority ) ); |
|
2707 |
// InsertItemL( aCmArray, aCmLinkedArray[i]); |
|
2708 |
// higher priority means smaller number |
|
2709 |
// if same priority elements exist, then |
|
2710 |
// - we need to insert our element inside the elements |
|
2711 |
// of the same priority according to |
|
2712 |
// bearetypes and extension levels |
|
2713 |
// or before the first element having higher priority numbers. |
|
2714 |
TInt cc = aCmArray.Count(); |
|
2715 |
if ( cc ) |
|
2716 |
{ |
|
2717 |
TInt ii = 0; |
|
2718 |
for ( ; ii < cc; ii++ ) |
|
2719 |
{ |
|
2720 |
if ( linkedpriority < aCmArray[ii]->GetIntAttributeL( ECmDefaultPriority ) ) |
|
2721 |
{ |
|
2722 |
// the next element already has larger number, |
|
2723 |
// we must insert it HERE |
|
2724 |
break; |
|
2725 |
} |
|
2726 |
else |
|
2727 |
{ |
|
2728 |
// priorities either same, then we need to check bearer, |
|
2729 |
// ext.level, etc |
|
2730 |
// or we simply still need to go to next element |
|
2731 |
if ( linkedpriority == aCmArray[ii]->GetIntAttributeL( ECmDefaultPriority )) |
|
2732 |
{ |
|
2733 |
// check if the same bearer |
|
2734 |
if ( aCmArray[ii]->GetIntAttributeL( ECmBearerType ) == |
|
2735 |
aCmLinkedArray[i]->GetIntAttributeL( ECmBearerType ) ) |
|
2736 |
{ |
|
2737 |
// we need to find the last one of these bearers, |
|
2738 |
// and insert after the last one |
|
2739 |
do |
|
2740 |
{ |
|
2741 |
ii++; |
|
2742 |
}while ( ( ii < cc ) |
|
2743 |
&& (aCmArray[ii]->GetIntAttributeL( ECmBearerType ) == |
|
2744 |
aCmLinkedArray[i]->GetIntAttributeL( ECmBearerType )) ); |
|
2745 |
// now we either found a correct place or |
|
2746 |
// we are at the end of the list |
|
2747 |
break; |
|
2748 |
} |
|
2749 |
else |
|
2750 |
{ |
|
2751 |
// diff. bearers, check Ext.level |
|
2752 |
if ( aCmArray[ii]->GetIntAttributeL( ECmExtensionLevel ) < aCmLinkedArray[i]->GetIntAttributeL( ECmExtensionLevel ) ) |
|
2753 |
{ |
|
2754 |
break; |
|
2755 |
} |
|
2756 |
// if not, then go for the next one... |
|
2757 |
} |
|
2758 |
} |
|
2759 |
} |
|
2760 |
} |
|
2761 |
// now we either found a correct place or |
|
2762 |
// we are at the end of the list |
|
2763 |
// ( we break-ed for cycle when found the correct place ) |
|
2764 |
if ( ii == cc ) |
|
2765 |
{ |
|
2766 |
// end of the list, append |
|
2767 |
aCmArray.AppendL( aCmLinkedArray[i]); |
|
2768 |
} |
|
2769 |
else |
|
2770 |
{ |
|
2771 |
// we found the place to be inserted |
|
2772 |
aCmArray.InsertL( aCmLinkedArray[i], ii ); |
|
2773 |
} |
|
2774 |
} |
|
2775 |
else |
|
2776 |
{ |
|
2777 |
// no elements in original array yet, |
|
2778 |
// so simply append |
|
2779 |
aCmArray.AppendL( aCmLinkedArray[i]); |
|
2780 |
} |
|
2781 |
} |
|
2782 |
} |
|
2783 |
||
2784 |
||
2785 |
// -------------------------------------------------------------------------- |
|
2786 |
// CCmManagerImpl::ParentDestinationL |
|
2787 |
// -------------------------------------------------------------------------- |
|
2788 |
// |
|
2789 |
TUint32 CCmManagerImpl::ParentDestinationL( TUint32 aCmId ) |
|
2790 |
{ |
|
2791 |
LOGGER_ENTERFN( "CCmManagerImpl::ParentDestinationL" ); |
|
2792 |
||
2793 |
TUint32 retval(0); |
|
2794 |
||
2795 |
TUint32 destTblId = DestinationTableId(); |
|
2796 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* ptrRecordSet = |
|
2797 |
new (ELeave) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
2798 |
destTblId ); |
|
2799 |
CleanupStack::PushL( ptrRecordSet ); |
|
2800 |
||
2801 |
// Prime record |
|
2802 |
CCDDataMobilitySelectionPolicyRecord* record = |
|
2803 |
new (ELeave) CCDDataMobilitySelectionPolicyRecord( |
|
2804 |
DestinationTableId() ); |
|
2805 |
CleanupStack::PushL( record ); |
|
2806 |
||
2807 |
record->iIAP = IAP_ELEMENT_ID( aCmId ); |
|
2808 |
ptrRecordSet->iRecords.AppendL( record ); |
|
2809 |
||
2810 |
CleanupStack::Pop( record ); |
|
2811 |
record = NULL; |
|
2812 |
||
2813 |
if ( ptrRecordSet->FindL(Session()) ) |
|
2814 |
{ |
|
2815 |
// we have a match |
|
2816 |
retval = QUERY_INT_FIELD( (*ptrRecordSet)[0], |
|
2817 |
KCDTIdDataMobilitySelectionPolicyNetwork ); |
|
2818 |
||
2819 |
} |
|
2820 |
CleanupStack::PopAndDestroy( ptrRecordSet ); |
|
2821 |
||
2822 |
return retval; |
|
2823 |
} |
|
2824 |
||
2825 |
// -------------------------------------------------------------------------- |
|
2826 |
// CCmManagerImpl::GetInternetDestinationIdL |
|
2827 |
// -------------------------------------------------------------------------- |
|
2828 |
// |
|
2829 |
TUint32 CCmManagerImpl::GetInternetDestinationIdL() |
|
2830 |
{ |
|
2831 |
||
2832 |
LOGGER_ENTERFN( "CCmManagerImpl::GetInternetDestinationIdL" ); |
|
2833 |
||
2834 |
TUint32 destId = 0; |
|
2835 |
||
2836 |
// Get all destinations |
|
2837 |
RArray<TUint32> destIdArray( KCmArrayBigGranularity ); |
|
2838 |
AllDestinationsL( destIdArray ); |
|
2839 |
CleanupClosePushL( destIdArray ); |
|
2840 |
||
2841 |
CCmDestinationImpl* dest = NULL; |
|
2842 |
||
2843 |
for ( TInt i = 0; i < destIdArray.Count(); i++ ) |
|
2844 |
{ |
|
2845 |
dest = DestinationL( destIdArray[i] ); |
|
2846 |
CleanupStack::PushL( dest ); |
|
2847 |
||
2848 |
// Check if destination is internet |
|
2849 |
if ( dest->MetadataL(ESnapMetadataInternet) ) |
|
2850 |
{ |
|
2851 |
destId = destIdArray[i]; |
|
2852 |
} |
|
2853 |
||
2854 |
CleanupStack::PopAndDestroy( dest ); |
|
2855 |
||
2856 |
if ( destId ) |
|
2857 |
{ |
|
2858 |
break; |
|
2859 |
} |
|
2860 |
} |
|
2861 |
||
2862 |
CleanupStack::PopAndDestroy( &destIdArray ); |
|
2863 |
||
2864 |
return destId; |
|
2865 |
} |
|
2866 |
||
2867 |
// ----------------------------------------------------------------------------- |
|
2868 |
// CCmManagerImpl::SetGenConnSettingsToDefault() |
|
2869 |
// ----------------------------------------------------------------------------- |
|
2870 |
// |
|
2871 |
void CCmManagerImpl::SetGenConnSettingsToDefault( TCmGenConnSettings& aGenConnSettings ) |
|
2872 |
{ |
|
2873 |
LOGGER_ENTERFN( "CCmManagerImpl::SetGenConnSettingsToDefault" ); |
|
2874 |
||
2875 |
aGenConnSettings.iUsageOfWlan = ECmUsageOfWlanKnown; |
|
2876 |
aGenConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic; |
|
2877 |
aGenConnSettings.iCellularDataUsageVisitor = ECmCellularDataUsageConfirm; |
|
2878 |
} |
|
2879 |
||
2880 |
||
2881 |
// ----------------------------------------------------------------------------- |
|
2882 |
// CCmManagerImpl::CheckAvailableSpaceL() |
|
2883 |
// ----------------------------------------------------------------------------- |
|
2884 |
// |
|
2885 |
void CCmManagerImpl::CheckAvailableSpaceL() |
|
2886 |
{ |
|
2887 |
LOGGER_ENTERFN( "CCmManagerImpl::CheckAvailableSpaceL" ); |
|
2888 |
TBool belowCritical = SysUtil::FFSSpaceBelowCriticalLevelL( &(this->iFs), KBytesToWrite ); |
|
2889 |
CLOG_WRITE_1( "belowCritical: [%d]", belowCritical ); |
|
2890 |
if ( belowCritical ) |
|
2891 |
{ |
|
2892 |
User::Leave( KErrDiskFull ); |
|
2893 |
} |
|
2894 |
} |
|
2895 |
||
2896 |
||
2897 |
// -------------------------------------------------------------------------- |
|
2898 |
// CCmManagerImpl::WatcherRegisterL |
|
2899 |
// -------------------------------------------------------------------------- |
|
2900 |
// |
|
2901 |
EXPORT_C void CCmManagerImpl::WatcherRegisterL( MCmCommsDatWatcher* aWatcher ) |
|
2902 |
{ |
|
2903 |
iCommsDatIapNotifier->WatcherRegisterL( aWatcher ); |
|
2904 |
iCommsDatSnapNotifier->WatcherRegisterL( aWatcher ); |
|
2905 |
} |
|
2906 |
||
2907 |
// -------------------------------------------------------------------------- |
|
2908 |
// CCmManagerImpl::WatcherUnRegister |
|
2909 |
// -------------------------------------------------------------------------- |
|
2910 |
// |
|
2911 |
EXPORT_C void CCmManagerImpl::WatcherUnRegister() |
|
2912 |
{ |
|
2913 |
iCommsDatIapNotifier->WatcherUnRegister(); |
|
2914 |
iCommsDatSnapNotifier->WatcherUnRegister(); |
|
2915 |
} |
|
2916 |
||
2917 |
// -------------------------------------------------------------------------- |
|
2918 |
// CCmManagerImpl::DestinationStillExistedL |
|
2919 |
// -------------------------------------------------------------------------- |
|
2920 |
// |
|
2921 |
EXPORT_C TBool CCmManagerImpl::DestinationStillExistedL( CCmDestinationImpl* aDest ) |
|
2922 |
{ |
|
2923 |
TUint32 destId = aDest->Id(); |
|
2924 |
TBool found( EFalse ); |
|
2925 |
TInt count; |
|
2926 |
||
2927 |
OpenTransactionLC(); |
|
2928 |
||
2929 |
CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>* destRecordSet = |
|
2930 |
new ( ELeave ) CMDBRecordSet<CCDDataMobilitySelectionPolicyRecord>( |
|
2931 |
iDestinationTableId ); |
|
2932 |
CleanupStack::PushL( destRecordSet ); |
|
2933 |
||
2934 |
TRAP_IGNORE( destRecordSet->LoadL( Session() ) ); |
|
2935 |
||
2936 |
count = destRecordSet->iRecords.Count(); |
|
2937 |
||
2938 |
for ( TInt i = 0; i < count; ++i ) |
|
2939 |
{ |
|
2940 |
TInt nwId = QUERY_INT_FIELD( destRecordSet->iRecords[i], |
|
2941 |
KCDTIdDataMobilitySelectionPolicyNetwork ); |
|
2942 |
//nwId = RECORD_FROM_ELEMENT_ID( nwId ); |
|
2943 |
||
2944 |
if( nwId == destId ) |
|
2945 |
{ |
|
2946 |
found = ETrue; |
|
2947 |
break; |
|
2948 |
} |
|
2949 |
} |
|
2950 |
||
2951 |
CleanupStack::PopAndDestroy( destRecordSet ); |
|
2952 |
||
2953 |
RollbackTransaction(); |
|
2954 |
||
2955 |
return found; |
|
2956 |
} |
|
2957 |
||
2958 |
// -------------------------------------------------------------------------- |
|
2959 |
// CCmManagerImpl::IapStillExistedL |
|
2960 |
// -------------------------------------------------------------------------- |
|
2961 |
// |
|
2962 |
EXPORT_C TBool CCmManagerImpl::IapStillExistedL( const CCmPluginBaseEng& aPlugin ) |
|
2963 |
{ |
|
2964 |
TUint32 iapId = aPlugin.GetIntAttributeL( ECmId ); |
|
2965 |
CMDBRecordSet<CCDIAPRecord>* ptrRecordSet = AllIapsL(); |
|
2966 |
CleanupStack::PushL( ptrRecordSet ); |
|
2967 |
||
2968 |
TInt iapRecords = ptrRecordSet->iRecords.Count(); |
|
2969 |
||
2970 |
TBool found( EFalse ); |
|
2971 |
for ( TInt i = 0; !found && i < iapRecords; i++ ) |
|
2972 |
{ |
|
2973 |
CCDIAPRecord* iapRecord = (*ptrRecordSet)[i]; |
|
2974 |
||
2975 |
if( iapRecord->RecordId() == iapId ) |
|
2976 |
{ |
|
2977 |
found = ETrue; |
|
2978 |
break; |
|
2979 |
} |
|
2980 |
} |
|
2981 |
||
2982 |
CleanupStack::PopAndDestroy( ptrRecordSet ); |
|
2983 |
||
2984 |
return found; |
|
2985 |
} |
|
2986 |
||
2987 |
// -------------------------------------------------------------------------- |
|
2988 |
// CCmManagerImpl::IsIapStillInDestL |
|
2989 |
// -------------------------------------------------------------------------- |
|
2990 |
// |
|
2991 |
EXPORT_C TBool CCmManagerImpl::IsIapStillInDestL( |
|
2992 |
CCmDestinationImpl* aDest, |
|
2993 |
const CCmPluginBaseEng& aPlugin ) |
|
2994 |
{ |
|
2995 |
TUint32 iapId = aPlugin.GetIntAttributeL( ECmId ); |
|
2996 |
||
2997 |
aDest->ReLoadConnectionMethodsL(); |
|
2998 |
RArray<TUint32> cmIds; |
|
2999 |
aDest->ConnectMethodIdArrayL( cmIds ); |
|
3000 |
CleanupClosePushL( cmIds ); |
|
3001 |
||
3002 |
TBool found( EFalse ); |
|
3003 |
for ( TInt i = 0; i < cmIds.Count(); i++ ) |
|
3004 |
{ |
|
3005 |
if( cmIds[i] == iapId ) |
|
3006 |
{ |
|
3007 |
found = ETrue; |
|
3008 |
break; |
|
3009 |
} |
|
3010 |
} |
|
3011 |
||
3012 |
CleanupStack::PopAndDestroy( &cmIds ); |
|
3013 |
||
3014 |
return found; |
|
3015 |
} |
|
3016 |
||
3017 |
// -------------------------------------------------------------------------- |
|
3018 |
// CCmManagerImpl::GetSnapTableIdL |
|
3019 |
// -------------------------------------------------------------------------- |
|
3020 |
// |
|
3021 |
TUint32 CCmManagerImpl::GetSnapTableIdL() |
|
3022 |
{ |
|
3023 |
TUint32 snapTableId; |
|
3024 |
||
3025 |
CMDBSession* db = CMDBSession::NewLC( CMDBSession::LatestVersion() ); |
|
3026 |
db->SetAttributeMask( ECDHidden | ECDProtectedWrite ); |
|
3027 |
||
3028 |
snapTableId = CCDDataMobilitySelectionPolicyRecord::TableIdL( *db ); |
|
3029 |
||
3030 |
CleanupStack::PopAndDestroy( db ); |
|
3031 |
||
3032 |
return snapTableId; |
|
3033 |
} |
|
3034 |
||
3035 |
// ----------------------------------------------------------------------------- |
|
3036 |
// CCmManagerImpl::IsBearerSpecific() |
|
3037 |
// ----------------------------------------------------------------------------- |
|
3038 |
// |
|
3039 |
TBool CCmManagerImpl::IsBearerSpecific( TUint32 aAttribute ) const |
|
3040 |
{ |
|
3041 |
TUint32 i = 0; |
|
3042 |
while( KBearerSpecificAttributes[i] != KEndOfArray ) |
|
3043 |
{ |
|
3044 |
if( KBearerSpecificAttributes[i] == aAttribute ) |
|
3045 |
{ |
|
3046 |
return ETrue; |
|
3047 |
} |
|
3048 |
i++; |
|
3049 |
} |
|
3050 |
return EFalse; |
|
3051 |
} |