1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of plugin base class |
|
15 * |
|
16 */ |
|
17 #include <cmmanager.rsg> |
|
18 #include <es_sock.h> // RSocketServ, RConnection |
|
19 #include <in_sock.h> // KAfInet |
|
20 #include <es_enum.h> // TConnectionInfo |
|
21 #include <StringLoader.h> |
|
22 #include <AknUtils.h> |
|
23 #include <data_caging_path_literals.hrh> |
|
24 #include <sysutil.h> |
|
25 |
|
26 #include <cmmanager.h> |
|
27 #include "cmmanagerimpl.h" |
|
28 #include "cmdestinationimpl.h" |
|
29 #include <cmpluginbaseeng.h> |
|
30 #include <cmpsettingsconsts.h> |
|
31 #include "cmlogger.h" |
|
32 #include <cmcommonui.h> |
|
33 |
|
34 using namespace CMManager; |
|
35 using namespace CommsDat; |
|
36 |
|
37 // EXTERNAL LINKS |
|
38 |
|
39 // MACROS |
|
40 |
|
41 #undef _IPV6_DISABLED |
|
42 |
|
43 // CONSTANTS |
|
44 const TInt KApMaxConnNameLength = 30; |
|
45 _LIT(KFormatPostfix, "%02d"); |
|
46 _LIT(KFormatLargePostfix, "%d"); |
|
47 _LIT(KFormatNameWithPostfix, "%S(%S)" ); |
|
48 _LIT(KFormatNoPostfix, "%S"); |
|
49 const TInt KMaxPostfixLength = 5; |
|
50 const TInt KEstimatedOverhead = 8192; |
|
51 |
|
52 _LIT( KDefWapGatewayIpAddress, "0.0.0.0" ); |
|
53 |
|
54 _LIT( KLocationName, "Mobile" ); |
|
55 |
|
56 static const TCmAttribConvTable SIapConvTbl[] = |
|
57 { |
|
58 // iAttribId, iCommsDatId, iValidFuncL, |
|
59 // iTitleId, |
|
60 // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2 |
|
61 // first element describes the min-max values, does not connects to DB! |
|
62 { ECmName, ECmIapId, NULL }, |
|
63 { ECmName, KCDTIdRecordName, NULL, |
|
64 R_CMMANAGERUI_CONNECTION_NAME, |
|
65 KMaxConnNameLength, EConvNoZeroLength | EConvCompulsory, |
|
66 0, R_TEXT_SETTING_PAGE_CONN_NAME, NULL, NULL }, |
|
67 { ECmIapId, KCDTIdRecordTag, NULL }, |
|
68 { 0, 0, NULL }, |
|
69 }; |
|
70 |
|
71 static const TCmAttribConvTable SProxyConvTbl[] = |
|
72 { |
|
73 // iAttribId, iCommsDatId, iValidFuncL, |
|
74 // iTitleId, |
|
75 // iMaxLength, iAttribFlags, iDefValueResId, iEditorResId, iNotUsed1, iNotUsed2 |
|
76 { ECmProxyUsageEnabled, ECmProxyRangeMax, NULL }, |
|
77 { ECmProxyUsageEnabled, KCDTIdUseProxyServer, NULL }, |
|
78 { ECmProxyServerName, KCDTIdServerName, &SetProxyServerNameL, |
|
79 R_QTN_SET_PROXY_SERVER_ADDRESS, |
|
80 KMaxProxyServerLength, 0, R_QTN_SET_PROXY_SERVER_ADDRESS_NONE, R_TEXT_SETTING_PAGE_PROXY_SERVER_ADDR, NULL, NULL }, |
|
81 { ECmProxyProtocolName, KCDTIdProtocolName, NULL }, |
|
82 { ECmProxyPortNumber, KCDTIdPortNumber, &CheckPortNumberValidityL, |
|
83 R_QTN_SET_PROXY_PORT_NUMBER, |
|
84 KMaxProxyPortNumberLength, EConvNumber, 0, 0, NULL, NULL }, |
|
85 { ECmProxyExceptions, KCDTIdExceptions, NULL }, |
|
86 { 0, 0, NULL }, |
|
87 }; |
|
88 |
|
89 static const TCmAttribConvTable SChargeCardConvTbl[] = |
|
90 { |
|
91 { ECmChargeCardUsageEnabled, ECmChargeCardRangeMax, NULL }, |
|
92 { ECmChargeCardAccountNumber, KCDTIdAccountNo, NULL }, |
|
93 { ECmChargeCardPIN, KCDTIdPin, NULL }, |
|
94 { ECmChargeCardLocalRule, KCDTIdLocalRule, NULL }, |
|
95 { ECmChargeCardNatRule, KCDTIdNatRule, NULL }, |
|
96 { ECmChargeCardIntlRule, KCDTIdIntlRule, NULL }, |
|
97 { 0, 0, NULL }, |
|
98 }; |
|
99 |
|
100 static const TCmAttribConvTable SLocationConvTbl[] = |
|
101 { |
|
102 { ECmLocationUsageEnabled, ECmLocationRangeMax, NULL }, |
|
103 { ECmLocationIntlPrefixCode, KCDTIdIntlPrefixCode, NULL }, |
|
104 { ECmLocationNatPrefixCode, KCDTIdNatPrefixCode, NULL }, |
|
105 { ECmLocationNatCode, KCDTIdNatCode, NULL }, |
|
106 { ECmLocationAreaCode, KCDTIdAreaCode, NULL }, |
|
107 { ECmLocationDialOutCode, KCDTIdDialOutCode, NULL }, |
|
108 { ECmLocationDisableCallWaitingCode, KCDTIdDisableCallWaitingCode, NULL }, |
|
109 { ECmLocationMobile, KCDTIdMobile, NULL }, |
|
110 { ECmLocationUsePulseDial, KCDTIdUsePulseDial, NULL }, |
|
111 { ECmLocationWaitForDialTone, KCDTIdWaitForDialTone, NULL }, |
|
112 { ECmLocationPauseAfterDialOut, KCDTIdPauseAfterDialOut, NULL }, |
|
113 { 0, 0, NULL }, |
|
114 }; |
|
115 |
|
116 static const TCmAttribConvTable SWapConvTbl[] = |
|
117 { |
|
118 { ECmWapIPGatewayAddress, ECmWapRangeMax, NULL }, |
|
119 { ECmWapIPGatewayAddress, KCDTIdWAPGatewayAddress, &CheckIPv4ValidityL }, |
|
120 { ECmWapIPWSPOption, KCDTIdWAPWSPOption, &CheckWAPWspOptionValidityL }, |
|
121 { ECmWapIPSecurity, KCDTIdWAPSecurity, NULL }, |
|
122 { ECmWapIPProxyPort, KCDTIdWAPProxyPort, &CheckPortNumberValidityL }, |
|
123 { ECmWapIPProxyLoginName, KCDTIdWAPProxyLoginName, NULL }, |
|
124 { ECmWapIPProxyLoginPass, KCDTIdWAPProxyLoginPass, NULL }, |
|
125 { 0, 0, NULL }, |
|
126 }; |
|
127 |
|
128 static const TCmAttribConvTable SUiTable[] = |
|
129 { |
|
130 { ECmName, 0, NULL, |
|
131 R_CMMANAGERUI_CONNECTION_NAME, |
|
132 KMaxConnNameLength, EConvNoZeroLength | EConvCompulsory, 0, R_TEXT_SETTING_PAGE_CONN_NAME, NULL, NULL }, |
|
133 { ECmBearerSettingName, 0, NULL, |
|
134 R_PLUGIN_BASE_SET_AP_BEARER, |
|
135 0, 0, 0, 0, NULL, NULL }, |
|
136 { ECmStartPage, 0, NULL, |
|
137 R_QTN_SET_STARTING_PAGE, |
|
138 KMaxStartPageLength, 0, R_QTN_SET_HOME_PAGE_NONE, R_TEXT_SETTING_PAGE_STARTING_PAGE, |
|
139 R_START_PAGE_DEF_VALUE, NULL, NULL }, |
|
140 { 0, 0, NULL, |
|
141 0, |
|
142 0, 0, 0, NULL, NULL }, |
|
143 }; |
|
144 |
|
145 /** |
|
146 * Private data of plugin base |
|
147 */ |
|
148 NONSHARABLE_CLASS( CCmPluginBasePrivate ) : public CBase |
|
149 { |
|
150 public: |
|
151 |
|
152 CCmPluginBasePrivate(); |
|
153 ~CCmPluginBasePrivate(); |
|
154 |
|
155 public: |
|
156 |
|
157 CCDWAPAccessPointRecord* iWapAPRecord; |
|
158 CCDWAPIPBearerRecord* iWapIPBearerRecord; |
|
159 CCDIAPMetadataRecord* iMetaDataRecord; |
|
160 |
|
161 TNamingMethod iNamingMethod; |
|
162 |
|
163 CArrayPtrFlat<TCmAttrConvArrayItem>* iConvTblArray; |
|
164 RArray<const TCmCommonAttrConvArrayItem*> iCommonConvTblArray; |
|
165 |
|
166 TInt iLoadResult; |
|
167 }; |
|
168 |
|
169 // ======== LOCAL FUNCTIONS ======== |
|
170 |
|
171 // --------------------------------------------------------------------------- |
|
172 // ReadOnlyAttributeL |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 EXPORT_C TBool ReadOnlyAttributeL( CCmPluginBaseEng* aThis, |
|
176 TUint32 aAttribute, |
|
177 const TAny* aValue ) |
|
178 { |
|
179 User::Leave( KErrNotSupported ); |
|
180 |
|
181 (void)aThis; |
|
182 (void)aAttribute; |
|
183 (void)aValue; |
|
184 |
|
185 return EFalse; |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // CheckIPv4ValidityL |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 EXPORT_C TBool CheckIPv4ValidityL( CCmPluginBaseEng* aThis, |
|
193 TUint32 aAttribute, |
|
194 const TAny* aValue ) |
|
195 { |
|
196 (void)aThis; |
|
197 (void)aAttribute; |
|
198 (void)aValue; |
|
199 |
|
200 return EFalse; |
|
201 } |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // CheckIPv6ValidityL |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C TBool CheckIPv6ValidityL( CCmPluginBaseEng* aThis, |
|
208 TUint32 aAttribute, |
|
209 const TAny* aValue ) |
|
210 { |
|
211 (void)aThis; |
|
212 (void)aAttribute; |
|
213 (void)aValue; |
|
214 |
|
215 return EFalse; |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // CheckPortNumberValidityL |
|
220 // --------------------------------------------------------------------------- |
|
221 // |
|
222 EXPORT_C TBool CheckPortNumberValidityL( CCmPluginBaseEng* aThis, |
|
223 TUint32 aAttribute, |
|
224 const TAny* aValue ) |
|
225 { |
|
226 (void)aThis; |
|
227 (void)aAttribute; |
|
228 (void)aValue; |
|
229 |
|
230 return EFalse; |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------------------------- |
|
234 // CheckRecordIdValidityL |
|
235 // --------------------------------------------------------------------------- |
|
236 // |
|
237 EXPORT_C TBool CheckRecordIdValidityL( CCmPluginBaseEng* aThis, |
|
238 TUint32 aAttribute, |
|
239 const TAny* aValue ) |
|
240 { |
|
241 TUint32 recId = *(TUint32*)aValue; |
|
242 |
|
243 if( recId < 1 || recId > 254 ) |
|
244 { |
|
245 CLOG_WRITE_1_PTR( aThis, "Not valid Rec id: [%d]", recId ); |
|
246 User::Leave( KErrArgument ); |
|
247 } |
|
248 |
|
249 (void)aThis; |
|
250 (void)aAttribute; |
|
251 (void)aValue; |
|
252 |
|
253 return EFalse; |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // CheckWAPWspOptionValidityL |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 EXPORT_C TBool CheckWAPWspOptionValidityL( CCmPluginBaseEng* aThis, |
|
261 TUint32 aAttribute, |
|
262 const TAny* aValue ) |
|
263 { |
|
264 TUint32 wspOpt = (TUint32)aValue; |
|
265 |
|
266 |
|
267 if( wspOpt != ECmWapWspOptionConnectionless && |
|
268 wspOpt != ECmWapWspOptionConnectionOriented ) |
|
269 { |
|
270 User::Leave( KErrArgument ); |
|
271 } |
|
272 |
|
273 (void)aThis; |
|
274 (void)aAttribute; |
|
275 (void)aValue; |
|
276 |
|
277 return EFalse; |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------------------------- |
|
281 // IsUnspecifiedIPv4Address |
|
282 // --------------------------------------------------------------------------- |
|
283 // |
|
284 EXPORT_C TBool IsUnspecifiedIPv4Address( const TDesC& aIpv4Address ) |
|
285 { |
|
286 if( aIpv4Address.Length() == 0 || |
|
287 !aIpv4Address.CompareF( KUnspecifiedIPv4 ) ) |
|
288 { |
|
289 return ETrue; |
|
290 } |
|
291 |
|
292 return EFalse; |
|
293 } |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // ClassifyIPv6Address |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 EXPORT_C TIPv6Types ClassifyIPv6Address( const TDesC& aIpv6Address ) |
|
300 { |
|
301 if( aIpv6Address.Length() == 0 || |
|
302 !aIpv6Address.CompareF( KDynamicIpv6Address ) ) |
|
303 { |
|
304 return EIPv6Unspecified; |
|
305 } |
|
306 else if( !aIpv6Address.CompareF( KKnownIp6NameServer1 ) || |
|
307 !aIpv6Address.CompareF( KKnownIp6NameServer2 ) ) |
|
308 { |
|
309 return EIPv6WellKnown; |
|
310 } |
|
311 |
|
312 return EIPv6UserDefined; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // SetProxyServerNameL |
|
317 // --------------------------------------------------------------------------- |
|
318 // |
|
319 EXPORT_C TBool SetProxyServerNameL( CCmPluginBaseEng* aThis, |
|
320 TUint32 /*aAttribute*/, |
|
321 const TAny* aValue ) |
|
322 { |
|
323 const TDesC* proxyServer = (const TDesC*)aValue; |
|
324 |
|
325 return aThis->SetProxyServerNameL( *proxyServer ); |
|
326 } |
|
327 |
|
328 // ======== MEMBER FUNCTIONS ======== |
|
329 |
|
330 // --------------------------------------------------------------------------- |
|
331 // TCmPluginInitParam::TCmPluginInitParam |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 TCmPluginInitParam::TCmPluginInitParam( CCmManagerImpl& aCmMgr ) |
|
335 : iCmMgr( aCmMgr ) |
|
336 { |
|
337 iParentDest = 0; |
|
338 iNotused1 = NULL; |
|
339 iNotused2 = NULL; |
|
340 } |
|
341 |
|
342 // --------------------------------------------------------------------------- |
|
343 // CCmPluginBasePrivate::CCmPluginBasePrivate |
|
344 // --------------------------------------------------------------------------- |
|
345 // |
|
346 CCmPluginBasePrivate::CCmPluginBasePrivate() |
|
347 : iNamingMethod( ENamingUnique ) |
|
348 , iCommonConvTblArray( KDefAttrsArrayGranSize ) |
|
349 { |
|
350 } |
|
351 |
|
352 // --------------------------------------------------------------------------- |
|
353 // CCmPluginBasePrivate::~CCmPluginBasePrivate |
|
354 // --------------------------------------------------------------------------- |
|
355 // |
|
356 CCmPluginBasePrivate::~CCmPluginBasePrivate() |
|
357 { |
|
358 delete iWapAPRecord; |
|
359 delete iWapIPBearerRecord; |
|
360 delete iMetaDataRecord; |
|
361 |
|
362 if ( iConvTblArray ) |
|
363 { |
|
364 iConvTblArray->ResetAndDestroy(); |
|
365 delete iConvTblArray; |
|
366 } |
|
367 |
|
368 iCommonConvTblArray.Reset(); |
|
369 iCommonConvTblArray.Close(); |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------------------------- |
|
373 // CCmPluginBaseEng::CCmPluginBaseEng |
|
374 // --------------------------------------------------------------------------- |
|
375 // |
|
376 EXPORT_C CCmPluginBaseEng::CCmPluginBaseEng( TCmPluginInitParam *aInitParam ) |
|
377 : iCmMgr( aInitParam->iCmMgr ) |
|
378 , iParentDest( aInitParam->iParentDest ) |
|
379 { |
|
380 CLOG_CREATE; |
|
381 } |
|
382 |
|
383 // --------------------------------------------------------------------------- |
|
384 // CCmPluginBaseEng::~CCmPluginBaseEng |
|
385 // --------------------------------------------------------------------------- |
|
386 // |
|
387 EXPORT_C CCmPluginBaseEng::~CCmPluginBaseEng() |
|
388 { |
|
389 Reset(); |
|
390 |
|
391 delete iPriv; |
|
392 |
|
393 REComSession::DestroyedImplementation( iDtor_ID_Key ); |
|
394 CLOG_CLOSE; |
|
395 } |
|
396 |
|
397 // --------------------------------------------------------------------------- |
|
398 // CCmPluginBaseEng::ConstructL |
|
399 // --------------------------------------------------------------------------- |
|
400 // |
|
401 EXPORT_C void CCmPluginBaseEng::ConstructL() |
|
402 { |
|
403 LOGGER_ENTERFN( "CCmPluginBaseEng::ConstructL" ); |
|
404 |
|
405 iPriv = new (ELeave) CCmPluginBasePrivate; |
|
406 |
|
407 // 4 for our tables + 4 for bearer specific ones. |
|
408 iPriv->iConvTblArray = new (ELeave)CArrayPtrFlat<TCmAttrConvArrayItem>( 8 ); |
|
409 |
|
410 AddConverstionTableL( (CCDRecordBase**)&iIapRecord, |
|
411 NULL, SIapConvTbl ); |
|
412 AddConverstionTableL( (CCDRecordBase**)&iProxyRecord, |
|
413 NULL, SProxyConvTbl ); |
|
414 AddConverstionTableL( (CCDRecordBase**)&iChargeCardRecord, |
|
415 &iChargeCardEnabled, SChargeCardConvTbl ); |
|
416 AddConverstionTableL( (CCDRecordBase**)&iLocationRecord, |
|
417 &iLocationEnabled, SLocationConvTbl ); |
|
418 AddConverstionTableL( (CCDRecordBase**)&iPriv->iWapIPBearerRecord, |
|
419 NULL, SWapConvTbl ); |
|
420 } |
|
421 |
|
422 |
|
423 // --------------------------------------------------------------------------- |
|
424 // CCmPluginBaseEng::GetIntAttributeL |
|
425 // --------------------------------------------------------------------------- |
|
426 // |
|
427 EXPORT_C TUint32 |
|
428 CCmPluginBaseEng::GetIntAttributeL( const TUint32 aAttribute ) const |
|
429 { |
|
430 LOGGER_ENTERFN( "CCmPluginBaseEng::GetIntAttributeL" ); |
|
431 |
|
432 TUint32 retVal( 0 ); |
|
433 |
|
434 switch ( aAttribute ) |
|
435 { |
|
436 case ECmBearerIcon: |
|
437 { |
|
438 retVal = 0; // bearer doesn't provide any icon |
|
439 } |
|
440 break; |
|
441 |
|
442 case ECmBearerAvailableIcon: |
|
443 { |
|
444 retVal = 0; // bearer doesn't provide any icon |
|
445 } |
|
446 break; |
|
447 |
|
448 case ECmId: // if the CM has an IapId than the ECmId is the ECmId |
|
449 case ECmIapId: |
|
450 { |
|
451 retVal = iIapId; |
|
452 } |
|
453 break; |
|
454 case ECmWapId: |
|
455 { |
|
456 retVal = iPriv->iWapIPBearerRecord->iWAPAccessPointId; |
|
457 } |
|
458 break; |
|
459 case ECmIapServiceId: |
|
460 { |
|
461 retVal = TUint32(iIapRecord->iService); |
|
462 } |
|
463 break; |
|
464 case ECmBearerType: |
|
465 { |
|
466 retVal = iBearerType; |
|
467 } |
|
468 break; |
|
469 |
|
470 case ECmDefaultPriority: |
|
471 { |
|
472 retVal = KDataMobilitySelectionPolicyPriorityWildCard; |
|
473 } |
|
474 break; |
|
475 |
|
476 case ECmDefaultUiPriority: |
|
477 { |
|
478 retVal = KDataMobilitySelectionPolicyPriorityWildCard; |
|
479 } |
|
480 break; |
|
481 |
|
482 case ECmNamingMethod: |
|
483 { |
|
484 retVal = iPriv->iNamingMethod; |
|
485 } |
|
486 break; |
|
487 |
|
488 case ECmExtensionLevel: |
|
489 { |
|
490 retVal = KExtensionBaseLevel; |
|
491 } |
|
492 break; |
|
493 |
|
494 case ECmInvalidAttribute: |
|
495 { |
|
496 retVal = iInvalidAttribute; |
|
497 } |
|
498 break; |
|
499 |
|
500 case ECmCommsDBBearerType: |
|
501 { |
|
502 User::Leave( KErrUnknown ); |
|
503 } |
|
504 break; |
|
505 |
|
506 case ECmSeamlessnessLevel: |
|
507 { |
|
508 retVal = iPriv->iMetaDataRecord->iSeamlessness; |
|
509 } |
|
510 break; |
|
511 |
|
512 case ECmElementID: |
|
513 { |
|
514 if ( !iIapRecord ) |
|
515 { |
|
516 User::Leave( KErrNotReady ); |
|
517 } |
|
518 |
|
519 retVal = (KCDMaskShowField & iIapRecord->ElementId()); |
|
520 } |
|
521 break; |
|
522 |
|
523 case ECmLoadResult: |
|
524 { |
|
525 retVal = iPriv->iLoadResult; |
|
526 } |
|
527 break; |
|
528 |
|
529 case ECmNetworkId: |
|
530 { |
|
531 retVal = iIapRecord->iNetwork; |
|
532 } |
|
533 break; |
|
534 |
|
535 default: |
|
536 { |
|
537 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
538 CMDBField<TUint32>* field; |
|
539 |
|
540 FindFieldL( attribute, ECmInt, (CMDBElement*&)field ); |
|
541 |
|
542 retVal = *field; |
|
543 } |
|
544 break; |
|
545 } |
|
546 |
|
547 return retVal; |
|
548 } |
|
549 |
|
550 // --------------------------------------------------------------------------- |
|
551 // CCmPluginBaseEng::GetBoolAttributeL |
|
552 // --------------------------------------------------------------------------- |
|
553 // |
|
554 EXPORT_C TBool |
|
555 CCmPluginBaseEng::GetBoolAttributeL( const TUint32 aAttribute ) const |
|
556 { |
|
557 LOGGER_ENTERFN( "CCmPluginBaseEng::GetBoolAttributeL" ); |
|
558 |
|
559 TBool retVal; |
|
560 |
|
561 switch ( aAttribute ) |
|
562 { |
|
563 case ECmProtected: |
|
564 { |
|
565 retVal = IsProtected(); |
|
566 } |
|
567 break; |
|
568 |
|
569 case ECmHidden: |
|
570 { |
|
571 retVal = iIapRecord->Attributes() & ECDHidden; |
|
572 } |
|
573 break; |
|
574 |
|
575 case ECmDestination: |
|
576 { |
|
577 retVal = EFalse; |
|
578 } |
|
579 break; |
|
580 |
|
581 case ECmChargeCardUsageEnabled: |
|
582 { |
|
583 retVal = iChargeCardEnabled; |
|
584 } |
|
585 break; |
|
586 |
|
587 case ECmCoverage: |
|
588 // In default the plugin has no network coverage |
|
589 { |
|
590 retVal = EFalse; |
|
591 } |
|
592 break; |
|
593 |
|
594 case ECmAddToAvailableList: |
|
595 { |
|
596 retVal = EFalse; |
|
597 } |
|
598 break; |
|
599 |
|
600 case ECmBearerHasUi: |
|
601 { |
|
602 retVal = EFalse; |
|
603 } |
|
604 break; |
|
605 |
|
606 case ECmMetaHighlight: |
|
607 { |
|
608 retVal = iPriv->iMetaDataRecord->iMetadata & EMetaHighlight; |
|
609 } |
|
610 break; |
|
611 |
|
612 case ECmMetaHiddenAgent: |
|
613 { |
|
614 retVal = iPriv->iMetaDataRecord->iMetadata & EMetaHiddenAgent; |
|
615 } |
|
616 break; |
|
617 |
|
618 case ECmIPv6Supported: |
|
619 { |
|
620 retVal = FeatureSupported( KFeatureIdIPv6 ); |
|
621 } |
|
622 break; |
|
623 |
|
624 case ECmConnected: |
|
625 { |
|
626 retVal = CheckIfAlreadyConnected(); |
|
627 } |
|
628 break; |
|
629 |
|
630 case ECmVirtual: |
|
631 { |
|
632 retVal = EFalse; |
|
633 } |
|
634 break; |
|
635 |
|
636 case ECmIsLinked: |
|
637 { |
|
638 retVal = iCmMgr.IsIapLinkedL( *this ); |
|
639 } |
|
640 break; |
|
641 |
|
642 default: |
|
643 { |
|
644 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
645 CMDBField<TBool>* field; |
|
646 |
|
647 FindFieldL( attribute, ECmBool, (CMDBElement*&)field ); |
|
648 |
|
649 retVal = *field; |
|
650 } |
|
651 } |
|
652 |
|
653 return retVal; |
|
654 } |
|
655 |
|
656 // --------------------------------------------------------------------------- |
|
657 // CCmPluginBaseEng::GetStringAttributeL |
|
658 // --------------------------------------------------------------------------- |
|
659 // |
|
660 EXPORT_C HBufC* |
|
661 CCmPluginBaseEng::GetStringAttributeL( const TUint32 aAttribute ) const |
|
662 { |
|
663 LOGGER_ENTERFN( "CCmPluginBaseEng::GetStringAttributeL" ); |
|
664 |
|
665 HBufC* retVal = NULL; |
|
666 |
|
667 switch ( aAttribute ) |
|
668 { |
|
669 case ECmStartPage: |
|
670 { |
|
671 retVal = TPtrC(iPriv->iWapAPRecord->iWAPStartPage).AllocL(); |
|
672 } |
|
673 break; |
|
674 |
|
675 case ECmName: |
|
676 { |
|
677 retVal = TPtrC(iIapRecord->iRecordName).AllocL(); |
|
678 } |
|
679 break; |
|
680 |
|
681 default: |
|
682 { |
|
683 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
684 CMDBField<TDesC>* field; |
|
685 |
|
686 FindFieldL( attribute, ECmText, (CMDBElement*&)field ); |
|
687 |
|
688 if ( !field->IsNull() ) |
|
689 { |
|
690 retVal = field->GetL().AllocL(); |
|
691 } |
|
692 else |
|
693 { |
|
694 retVal = KNullDesC().AllocL(); |
|
695 } |
|
696 } |
|
697 } |
|
698 |
|
699 return retVal; |
|
700 } |
|
701 |
|
702 // --------------------------------------------------------------------------- |
|
703 // CCmPluginBaseEng::GetString8AttributeL |
|
704 // --------------------------------------------------------------------------- |
|
705 // |
|
706 EXPORT_C HBufC8* |
|
707 CCmPluginBaseEng::GetString8AttributeL( const TUint32 aAttribute ) const |
|
708 { |
|
709 LOGGER_ENTERFN( "CCmPluginBaseEng::GetString8AttributeL" ); |
|
710 |
|
711 HBufC8* retVal = NULL; |
|
712 |
|
713 switch ( aAttribute ) |
|
714 { |
|
715 default: |
|
716 { |
|
717 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
718 CMDBField<TDesC8>* field; |
|
719 |
|
720 FindFieldL( attribute, ECmText8, (CMDBElement*&)field ); |
|
721 |
|
722 if ( !field->IsNull() ) |
|
723 { |
|
724 retVal = field->GetL().AllocL(); |
|
725 } |
|
726 else |
|
727 { |
|
728 retVal = KNullDesC8().AllocL(); |
|
729 } |
|
730 } |
|
731 } |
|
732 |
|
733 return retVal; |
|
734 } |
|
735 |
|
736 // --------------------------------------------------------------------------- |
|
737 // CCmPluginBaseEng::SetIntAttributeL |
|
738 // --------------------------------------------------------------------------- |
|
739 // |
|
740 EXPORT_C void CCmPluginBaseEng::SetIntAttributeL( const TUint32 aAttribute, |
|
741 TUint32 aValue ) |
|
742 { |
|
743 LOGGER_ENTERFN( "CCmPluginBaseEng::SetIntAttributeL" ); |
|
744 |
|
745 switch ( aAttribute ) |
|
746 { |
|
747 case ECmNamingMethod: |
|
748 { |
|
749 iPriv->iNamingMethod = (TNamingMethod)aValue; |
|
750 } |
|
751 break; |
|
752 |
|
753 case ECmCommsDBBearerType: |
|
754 case ECmElementID: |
|
755 case ECmIapId: |
|
756 case ECmId: |
|
757 { |
|
758 User::Leave( KErrNotSupported ); |
|
759 } |
|
760 break; |
|
761 |
|
762 case ECmSeamlessnessLevel: |
|
763 { |
|
764 if ( aValue == ESeamlessnessConfirmFirst || |
|
765 aValue == ESeamlessnessShowprogress ) |
|
766 { |
|
767 iPriv->iMetaDataRecord->iSeamlessness = aValue; |
|
768 } |
|
769 else |
|
770 { |
|
771 User::Leave( KErrNotSupported ); |
|
772 } |
|
773 } |
|
774 break; |
|
775 |
|
776 case ECmNetworkId: |
|
777 { |
|
778 User::Leave( KErrNotSupported ); |
|
779 } |
|
780 break; |
|
781 |
|
782 default: |
|
783 { |
|
784 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
785 CMDBField<TUint32>* field; |
|
786 |
|
787 TValidationFunctionL func = |
|
788 FindFieldL( attribute, ECmInt, (CMDBElement*&)field ); |
|
789 |
|
790 if( func ) |
|
791 { |
|
792 func( this, attribute, (TAny*)aValue ); |
|
793 } |
|
794 |
|
795 *field = aValue; |
|
796 } |
|
797 break; |
|
798 } |
|
799 |
|
800 } |
|
801 |
|
802 // --------------------------------------------------------------------------- |
|
803 // CCmPluginBaseEng::SetBoolAttributeL |
|
804 // --------------------------------------------------------------------------- |
|
805 // |
|
806 EXPORT_C void CCmPluginBaseEng::SetBoolAttributeL( const TUint32 aAttribute, |
|
807 TBool aValue ) |
|
808 { |
|
809 LOGGER_ENTERFN( "CCmPluginBaseEng::SetBoolAttributeL" ); |
|
810 |
|
811 switch ( aAttribute ) |
|
812 { |
|
813 case ECmProtected: |
|
814 { |
|
815 SetAttribute( iIapRecord, ECDProtectedWrite, aValue ); |
|
816 } |
|
817 break; |
|
818 |
|
819 case ECmHidden: |
|
820 { |
|
821 // Check that this is not Default Connection |
|
822 TCmDefConnValue defConn; |
|
823 iCmMgr.ReadDefConnL( defConn ); |
|
824 if ( defConn.iType == ECmDefConnConnectionMethod && |
|
825 defConn.iId == iIapRecord->RecordId() ) |
|
826 { |
|
827 User::Leave( KErrArgument ); |
|
828 } |
|
829 |
|
830 SetAttribute( iIapRecord, ECDHidden, aValue ); |
|
831 } |
|
832 break; |
|
833 |
|
834 case ECmProxyUsageEnabled: |
|
835 { |
|
836 EnableProxyL( aValue ); |
|
837 } |
|
838 break; |
|
839 |
|
840 case ECmChargeCardUsageEnabled: |
|
841 { |
|
842 EnableChargeCardL( aValue ); |
|
843 } |
|
844 break; |
|
845 |
|
846 case ECmLocationUsageEnabled: |
|
847 { |
|
848 EnableLocationL( aValue ); |
|
849 } |
|
850 break; |
|
851 |
|
852 case ECmMetaHighlight: |
|
853 { |
|
854 if( aValue ) |
|
855 { |
|
856 iPriv->iMetaDataRecord->iMetadata = |
|
857 EMetaHighlight | iPriv->iMetaDataRecord->iMetadata; |
|
858 } |
|
859 else |
|
860 { |
|
861 iPriv->iMetaDataRecord->iMetadata = |
|
862 ~EMetaHighlight & iPriv->iMetaDataRecord->iMetadata; |
|
863 } |
|
864 } |
|
865 break; |
|
866 |
|
867 case ECmMetaHiddenAgent: |
|
868 { |
|
869 if( aValue ) |
|
870 { |
|
871 iPriv->iMetaDataRecord->iMetadata = |
|
872 EMetaHiddenAgent | iPriv->iMetaDataRecord->iMetadata; |
|
873 } |
|
874 else |
|
875 { |
|
876 iPriv->iMetaDataRecord->iMetadata = |
|
877 ~EMetaHiddenAgent & iPriv->iMetaDataRecord->iMetadata; |
|
878 } |
|
879 } |
|
880 break; |
|
881 |
|
882 default: |
|
883 { |
|
884 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
885 CMDBField<TBool>* field; |
|
886 |
|
887 TValidationFunctionL func = |
|
888 FindFieldL( attribute, ECmBool, (CMDBElement*&)field ); |
|
889 |
|
890 if( func ) |
|
891 { |
|
892 func( this, attribute, (const TAny*)aValue ); |
|
893 } |
|
894 |
|
895 |
|
896 *field = aValue; |
|
897 } |
|
898 } |
|
899 } |
|
900 |
|
901 // --------------------------------------------------------------------------- |
|
902 // CCmPluginBaseEng::SetStringAttributeL |
|
903 // --------------------------------------------------------------------------- |
|
904 // |
|
905 EXPORT_C void CCmPluginBaseEng::SetStringAttributeL( const TUint32 aAttribute, |
|
906 const TDesC16& aValue ) |
|
907 { |
|
908 LOGGER_ENTERFN( "CCmPluginBaseEng::SetStringAttributeL" ); |
|
909 |
|
910 TUint32 commonattribute = MappedCommonAttribute( aAttribute ); |
|
911 switch ( commonattribute ) |
|
912 { |
|
913 case ECmStartPage: |
|
914 { |
|
915 iPriv->iWapAPRecord->iWAPStartPage.SetL( aValue ); |
|
916 } |
|
917 break; |
|
918 |
|
919 case ECmName: |
|
920 { |
|
921 SetNameL( aValue ); |
|
922 } |
|
923 break; |
|
924 case ECmIPAddress: |
|
925 { |
|
926 GenericStringWriterL( commonattribute, aValue ); |
|
927 if (( aValue.Compare(KUnspecifiedIPv4) == 0) || ( aValue.Compare(KNullDesC)==0 ) ) |
|
928 { |
|
929 SetBoolAttributeL( ECmIPAddFromServer, ETrue ); |
|
930 } |
|
931 else |
|
932 { |
|
933 SetBoolAttributeL( ECmIPAddFromServer, EFalse ); |
|
934 } |
|
935 } |
|
936 break; |
|
937 default: |
|
938 { |
|
939 GenericStringWriterL( commonattribute, aValue ); |
|
940 } |
|
941 } |
|
942 } |
|
943 |
|
944 // --------------------------------------------------------------------------- |
|
945 // CCmPluginBaseEng::SetString8AttributeL |
|
946 // --------------------------------------------------------------------------- |
|
947 // |
|
948 EXPORT_C void CCmPluginBaseEng::SetString8AttributeL( const TUint32 aAttribute, |
|
949 const TDesC8& aValue ) |
|
950 { |
|
951 LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" ); |
|
952 |
|
953 switch ( aAttribute ) |
|
954 { |
|
955 default: |
|
956 { |
|
957 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
958 CMDBField<TDesC8>* field; |
|
959 |
|
960 TValidationFunctionL func = |
|
961 FindFieldL( attribute, ECmText8, (CMDBElement*&)field ); |
|
962 |
|
963 if( func ) |
|
964 { |
|
965 func( this, attribute, (const TAny*)&aValue ); |
|
966 } |
|
967 |
|
968 field->SetL( aValue ); |
|
969 } |
|
970 } |
|
971 } |
|
972 |
|
973 // --------------------------------------------------------------------------- |
|
974 // CCmPluginBaseEng::RestoreAttributeL |
|
975 // --------------------------------------------------------------------------- |
|
976 // |
|
977 EXPORT_C void CCmPluginBaseEng::RestoreAttributeL( const TUint32 aAttribute ) |
|
978 { |
|
979 LOGGER_ENTERFN( "CCmPluginBaseEng::RestoreAttributeL" ); |
|
980 |
|
981 TCmAttrConvArrayItem* item = ConversionTable( aAttribute ); |
|
982 |
|
983 TInt index( 0 ); |
|
984 CMDBElement& field = FieldByAttributeL( item, aAttribute, index ); |
|
985 |
|
986 TRAPD( err, field.LoadL( Session() ) ); |
|
987 if( err == KErrNotFound ) |
|
988 { |
|
989 switch ( field.Type() ) |
|
990 { |
|
991 case EText: |
|
992 case EMedText: |
|
993 case ELongText: |
|
994 { |
|
995 CMDBField<TDesC>* textField = static_cast<CMDBField<TDesC>*>( &field ); |
|
996 |
|
997 textField->SetL( KNullDesC ); |
|
998 } |
|
999 break; |
|
1000 |
|
1001 case EDesC8: |
|
1002 { |
|
1003 CMDBField<TDesC8>* textField = static_cast<CMDBField<TDesC8>*>( &field ); |
|
1004 |
|
1005 textField->SetL( KNullDesC8 ); |
|
1006 } |
|
1007 break; |
|
1008 |
|
1009 case EUint32: |
|
1010 case EInt: |
|
1011 case EBool: |
|
1012 { |
|
1013 CMDBField<TInt>* intField = static_cast<CMDBField<TInt>*>( &field ); |
|
1014 |
|
1015 intField->SetL( 0 ); |
|
1016 } |
|
1017 break; |
|
1018 |
|
1019 default: |
|
1020 { |
|
1021 User::Leave( KErrArgument ); |
|
1022 } |
|
1023 break; |
|
1024 } |
|
1025 } |
|
1026 else |
|
1027 { |
|
1028 User::LeaveIfError( err ); |
|
1029 } |
|
1030 } |
|
1031 |
|
1032 // --------------------------------------------------------------------------- |
|
1033 // CCmPluginBaseEng::Destination |
|
1034 // --------------------------------------------------------------------------- |
|
1035 // |
|
1036 EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::Destination() const |
|
1037 { |
|
1038 LOGGER_ENTERFN( "CCmPluginBaseEng::Destination" ); |
|
1039 |
|
1040 return NULL; |
|
1041 } |
|
1042 |
|
1043 // --------------------------------------------------------------------------- |
|
1044 // CCmPluginBaseEng::UpdateL |
|
1045 // --------------------------------------------------------------------------- |
|
1046 // |
|
1047 EXPORT_C void CCmPluginBaseEng::UpdateL() |
|
1048 { |
|
1049 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateL" ); |
|
1050 |
|
1051 CheckSpaceBelowCriticalLevelL(); |
|
1052 |
|
1053 OpenTransactionLC(); |
|
1054 |
|
1055 PrepareToUpdateRecordsL(); |
|
1056 |
|
1057 UpdateChargeCardRecordL(); |
|
1058 UpdateServiceRecordL(); |
|
1059 |
|
1060 UpdateLocationRecordL(); |
|
1061 UpdateNetworkRecordL(); |
|
1062 |
|
1063 UpdateIAPRecordL(); |
|
1064 |
|
1065 UpdateWapRecordL(); |
|
1066 UpdateProxyRecordL(); |
|
1067 UpdateSeamlessnessRecordL(); |
|
1068 UpdateConnPrefSettingL(); |
|
1069 |
|
1070 UpdateAdditionalRecordsL(); |
|
1071 |
|
1072 CommitTransactionL( 0 ); |
|
1073 iCmMgr.ConnMethodUpdatedL( this ); |
|
1074 iIdIsValid = ETrue; |
|
1075 } |
|
1076 |
|
1077 // --------------------------------------------------------------------------- |
|
1078 // CCmPluginBaseEng::NumOfConnMethodReferencesL |
|
1079 // --------------------------------------------------------------------------- |
|
1080 // |
|
1081 EXPORT_C TInt CCmPluginBaseEng::NumOfConnMethodReferencesL() |
|
1082 { |
|
1083 LOGGER_ENTERFN( "CCmPluginBaseEng::NumOfConnMethodReferencesL" ); |
|
1084 |
|
1085 return iCmMgr.NumOfConnMethodReferencesL( iIapId ); |
|
1086 } |
|
1087 |
|
1088 // --------------------------------------------------------------------------- |
|
1089 // CCmPluginBaseEng::Session |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // |
|
1092 EXPORT_C CMDBSession& CCmPluginBaseEng::Session()const |
|
1093 { |
|
1094 LOGGER_ENTERFN( "CCmPluginBaseEng::Session" ); |
|
1095 |
|
1096 return iCmMgr.Session(); |
|
1097 } |
|
1098 |
|
1099 // --------------------------------------------------------------------------- |
|
1100 // Delete this connection methond. |
|
1101 // Record ids are checked to be sure that we delete only records |
|
1102 // that were loaded before. |
|
1103 // --------------------------------------------------------------------------- |
|
1104 // |
|
1105 EXPORT_C TBool CCmPluginBaseEng::DeleteL( TBool aForced, |
|
1106 TBool aOneRefAllowed ) |
|
1107 { |
|
1108 LOGGER_ENTERFN( "CCmPluginBaseEng::DeleteL" ); |
|
1109 |
|
1110 if ( CheckIfAlreadyConnected() ) |
|
1111 { |
|
1112 User::Leave( KErrInUse ); |
|
1113 } |
|
1114 |
|
1115 if( iPriv->iLoadResult ) |
|
1116 // previous load failed -> do NOT delete this partially loaded cm. |
|
1117 { |
|
1118 User::Leave( KErrNotReady ); |
|
1119 } |
|
1120 |
|
1121 if( GetBoolAttributeL( ECmIsLinked ) ) |
|
1122 { |
|
1123 User::Leave( KErrLocked ); |
|
1124 } |
|
1125 |
|
1126 // If there is no parent destination, we can delete |
|
1127 TBool retVal(ETrue); |
|
1128 |
|
1129 if( !aForced ) |
|
1130 { |
|
1131 TInt refs = NumOfConnMethodReferencesL(); |
|
1132 |
|
1133 switch ( refs ) |
|
1134 { |
|
1135 case 0: |
|
1136 // no referencies to this cm |
|
1137 { |
|
1138 CLOG_WRITE( "No ref -> do delete it" ); |
|
1139 } |
|
1140 break; |
|
1141 |
|
1142 case 1: |
|
1143 // one reference |
|
1144 { |
|
1145 if ( !aOneRefAllowed ) |
|
1146 // this is not a legacy cm -> cannot be deleted. |
|
1147 { |
|
1148 retVal = EFalse; |
|
1149 } |
|
1150 } |
|
1151 break; |
|
1152 |
|
1153 default: |
|
1154 // connection method is multiple referenced from |
|
1155 // destinations -> no delete |
|
1156 { |
|
1157 retVal = EFalse; |
|
1158 } |
|
1159 break; |
|
1160 } |
|
1161 } |
|
1162 |
|
1163 if ( retVal ) |
|
1164 { |
|
1165 TCmDefConnValue deletedItem; |
|
1166 deletedItem.iType = ECmDefConnConnectionMethod; |
|
1167 deletedItem.iId = iIapId; |
|
1168 iCmMgr.HandleDefConnDeletedL( deletedItem ); |
|
1169 |
|
1170 if( aForced ) |
|
1171 { |
|
1172 iCmMgr.RemoveAllReferencesWoTransL( *this ); |
|
1173 } |
|
1174 |
|
1175 OpenTransactionLC(); |
|
1176 // And now we have everything from CommsDat, |
|
1177 // so we delete only those records. |
|
1178 PrepareToDeleteRecordsL(); |
|
1179 |
|
1180 if ( iIapRecord && iIapRecord->RecordId() ) |
|
1181 { |
|
1182 iIapRecord->DeleteL( Session() ); |
|
1183 } |
|
1184 |
|
1185 if ( iProxyRecord && iProxyRecord->RecordId() ) |
|
1186 { |
|
1187 iProxyRecord->DeleteL( Session() ); |
|
1188 } |
|
1189 |
|
1190 if ( iServiceRecord && iServiceRecord->RecordId() ) |
|
1191 { |
|
1192 iServiceRecord->DeleteL( Session() ); |
|
1193 } |
|
1194 |
|
1195 if ( iChargeCardRecord && iChargeCardRecord->RecordId() ) |
|
1196 { |
|
1197 iChargeCardRecord->DeleteL( Session() ); |
|
1198 } |
|
1199 |
|
1200 if ( iNetworkRecord && iNetworkRecord->RecordId() ) |
|
1201 { |
|
1202 iNetworkRecord->DeleteL( Session() ); |
|
1203 } |
|
1204 |
|
1205 if ( iLocationRecord && iLocationRecord->RecordId() ) |
|
1206 { |
|
1207 iLocationRecord->DeleteL( Session() ); |
|
1208 } |
|
1209 |
|
1210 if ( iPriv->iWapAPRecord && |
|
1211 iPriv->iWapAPRecord->RecordId() ) |
|
1212 { |
|
1213 iPriv->iWapAPRecord->DeleteL( Session() ); |
|
1214 } |
|
1215 |
|
1216 if ( iPriv->iWapIPBearerRecord && |
|
1217 iPriv->iWapIPBearerRecord->RecordId() ) |
|
1218 { |
|
1219 iPriv->iWapIPBearerRecord->DeleteL( Session() ); |
|
1220 } |
|
1221 |
|
1222 if ( iPriv->iMetaDataRecord && |
|
1223 iPriv->iMetaDataRecord->RecordId() ) |
|
1224 { |
|
1225 iPriv->iMetaDataRecord->DeleteL( Session() ); |
|
1226 } |
|
1227 |
|
1228 DeleteAdditionalRecordsL(); |
|
1229 |
|
1230 CommitTransactionL( KErrNone ); |
|
1231 } |
|
1232 |
|
1233 return retVal; |
|
1234 } |
|
1235 |
|
1236 // --------------------------------------------------------------------------- |
|
1237 // CCmPluginBaseEng::LoadL |
|
1238 // --------------------------------------------------------------------------- |
|
1239 // |
|
1240 EXPORT_C void CCmPluginBaseEng::LoadL( TUint32 aIapId ) |
|
1241 { |
|
1242 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadL" ); |
|
1243 CLOG_NAME_2( _L("plugin_0x%x_%d"), this, aIapId ); |
|
1244 |
|
1245 OpenTransactionLC(); |
|
1246 |
|
1247 // trap it to set iPriv->iLoadResult |
|
1248 TRAP( iPriv->iLoadResult, DoLoadL( aIapId ) ); |
|
1249 |
|
1250 User::LeaveIfError( iPriv->iLoadResult ); |
|
1251 |
|
1252 RollbackTransaction(); |
|
1253 } |
|
1254 |
|
1255 // --------------------------------------------------------------------------- |
|
1256 // CCmPluginBaseEng::CreateNewL |
|
1257 // --------------------------------------------------------------------------- |
|
1258 // |
|
1259 EXPORT_C void CCmPluginBaseEng::CreateNewL() |
|
1260 { |
|
1261 LOGGER_ENTERFN( "CCmPluginBaseEng::CreateNewL" ); |
|
1262 |
|
1263 CheckSpaceBelowCriticalLevelL(); |
|
1264 |
|
1265 if ( iIapId ) |
|
1266 // we already have IAP id -> |
|
1267 { |
|
1268 User::Leave( KErrAlreadyExists ); |
|
1269 } |
|
1270 |
|
1271 iPreDefIapId = 0; |
|
1272 |
|
1273 // optional record are disable in default |
|
1274 iChargeCardEnabled = EFalse; |
|
1275 iLocationEnabled = EFalse; |
|
1276 |
|
1277 // create mandatory records |
|
1278 iIapRecord = static_cast<CCDIAPRecord *> |
|
1279 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1280 iNetworkRecord = static_cast<CCDNetworkRecord *> |
|
1281 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1282 iProxyRecord = static_cast<CCDProxiesRecord *> |
|
1283 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
1284 NewWapRecordL(); |
|
1285 iPriv->iWapIPBearerRecord->iWAPGatewayAddress.SetL( |
|
1286 KDefWapGatewayIpAddress ); |
|
1287 |
|
1288 iPriv->iMetaDataRecord = NewSeamlessnessRecordL( ETrue ); |
|
1289 |
|
1290 // call plugin to create its own records |
|
1291 CreateNewServiceRecordL(); |
|
1292 CreateAdditionalRecordsL(); |
|
1293 |
|
1294 EnableProxyL( EFalse ); |
|
1295 |
|
1296 // Load default CM name from resource |
|
1297 HBufC* defApName = AllocReadL( R_CMMANAGERENG_DEFAULT_AP_NAME ); |
|
1298 CleanupStack::PushL( defApName ); |
|
1299 |
|
1300 SetNameL( *defApName ); |
|
1301 |
|
1302 CleanupStack::PopAndDestroy( defApName ); |
|
1303 |
|
1304 iIapRecord->iNetworkWeighting = 0; // it's always 0. |
|
1305 } |
|
1306 |
|
1307 // --------------------------------------------------------------------------- |
|
1308 // CCmPluginBaseEng::CreateCopyL |
|
1309 // --------------------------------------------------------------------------- |
|
1310 // |
|
1311 EXPORT_C CCmPluginBaseEng* CCmPluginBaseEng::CreateCopyL() const |
|
1312 { |
|
1313 LOGGER_ENTERFN( "CCmPluginBaseEng::CreateCopyL" ); |
|
1314 CheckSpaceBelowCriticalLevelL(); |
|
1315 |
|
1316 TCmPluginInitParam params( iCmMgr ); |
|
1317 |
|
1318 CCmPluginBaseEng* copyInst = CreateInstanceL( params ); |
|
1319 CleanupStack::PushL( copyInst ); |
|
1320 |
|
1321 copyInst->CreateNewL(); |
|
1322 |
|
1323 TInt err( KErrNone ); |
|
1324 TRAP( err, copyInst->SetBoolAttributeL( ECmChargeCardUsageEnabled, iChargeCardEnabled ) ); |
|
1325 if( err != KErrNotSupported ) |
|
1326 { |
|
1327 User::LeaveIfError( err ); |
|
1328 } |
|
1329 TRAP( err, copyInst->SetBoolAttributeL( ECmLocationUsageEnabled, iLocationEnabled ) ); |
|
1330 if( err != KErrNotSupported ) |
|
1331 { |
|
1332 User::LeaveIfError( err ); |
|
1333 } |
|
1334 copyInst->SetIntAttributeL( ECmNamingMethod, iPriv->iNamingMethod ); |
|
1335 copyInst->SetStringAttributeL( ECmName, TPtrC( iIapRecord->iRecordName ) ); |
|
1336 copyInst->SetStringAttributeL( ECmStartPage, TPtrC( iPriv->iWapAPRecord->iWAPStartPage ) ); |
|
1337 |
|
1338 |
|
1339 PrepareToCopyDataL( *copyInst ); |
|
1340 |
|
1341 for ( TInt tblInd = 0; tblInd < iPriv->iConvTblArray->Count(); ++tblInd ) |
|
1342 { |
|
1343 const TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[tblInd]; |
|
1344 |
|
1345 if ( item->iEnabled && !(*item->iEnabled) ) |
|
1346 // Enabled flag is set to 'disabled' state |
|
1347 { |
|
1348 continue; |
|
1349 } |
|
1350 |
|
1351 if( !item->iRecord || |
|
1352 (item->iRecord && !(*item->iRecord)) ) |
|
1353 // no record |
|
1354 { |
|
1355 continue; |
|
1356 } |
|
1357 |
|
1358 for ( TInt attrInd = 1; item->iConvTable[attrInd].iAttribId; ++attrInd ) |
|
1359 { |
|
1360 if( item->iConvTable[attrInd].iAttribFlags & EConvReadOnly ) |
|
1361 // Read-only flags are not copied. |
|
1362 { |
|
1363 continue; |
|
1364 } |
|
1365 |
|
1366 TInt commsdatid( item->iConvTable[attrInd].iCommsDatId ); |
|
1367 |
|
1368 if ( !commsdatid ) |
|
1369 { // not connected to the DB, calculated field, no copy |
|
1370 continue; |
|
1371 } |
|
1372 |
|
1373 CMDBElement* field = (*item->iRecord)->GetFieldByIdL( commsdatid ); |
|
1374 |
|
1375 if( field->IsNull() ) |
|
1376 { |
|
1377 continue; |
|
1378 } |
|
1379 |
|
1380 switch ( field->Type() ) |
|
1381 { |
|
1382 case EText: |
|
1383 case EMedText: |
|
1384 case ELongText: |
|
1385 { |
|
1386 CMDBField<TDesC>* textField = (CMDBField<TDesC>*)field; |
|
1387 |
|
1388 TRAP( err, copyInst->SetStringAttributeL( |
|
1389 item->iConvTable[attrInd].iAttribId, |
|
1390 *textField ) ); |
|
1391 if( err != KErrNotSupported ) |
|
1392 { |
|
1393 User::LeaveIfError( err ); |
|
1394 } |
|
1395 } |
|
1396 break; |
|
1397 |
|
1398 case EDesC8: |
|
1399 { |
|
1400 CMDBField<TDesC8>* textField = (CMDBField<TDesC8>*)field; |
|
1401 |
|
1402 TRAP( err, copyInst->SetString8AttributeL( |
|
1403 item->iConvTable[attrInd].iAttribId, |
|
1404 *textField ) ); |
|
1405 if( err != KErrNotSupported ) |
|
1406 { |
|
1407 User::LeaveIfError( err ); |
|
1408 } |
|
1409 } |
|
1410 break; |
|
1411 |
|
1412 case EUint32: |
|
1413 case EInt: |
|
1414 { |
|
1415 CMDBField<TUint32>* intField = (CMDBField<TUint32>*)field; |
|
1416 |
|
1417 TRAP( err, copyInst->SetIntAttributeL( |
|
1418 item->iConvTable[attrInd].iAttribId, |
|
1419 *intField ) ); |
|
1420 if ( !(( err == KErrNotSupported ) || ( err == KErrArgument )) ) |
|
1421 { |
|
1422 User::LeaveIfError( err ); |
|
1423 } |
|
1424 } |
|
1425 break; |
|
1426 |
|
1427 case EBool: |
|
1428 { |
|
1429 CMDBField<TBool>* intField = (CMDBField<TBool>*)field; |
|
1430 |
|
1431 TRAP( err, copyInst->SetBoolAttributeL( |
|
1432 item->iConvTable[attrInd].iAttribId, |
|
1433 *intField ) ); |
|
1434 if( err != KErrNotSupported ) |
|
1435 { |
|
1436 User::LeaveIfError( err ); |
|
1437 } |
|
1438 } |
|
1439 break; |
|
1440 |
|
1441 case ELink: // links are not copied! |
|
1442 default: |
|
1443 { |
|
1444 } |
|
1445 break; |
|
1446 } |
|
1447 } |
|
1448 } |
|
1449 |
|
1450 CopyAdditionalDataL( *copyInst ); |
|
1451 |
|
1452 CleanupStack::Pop( copyInst ); |
|
1453 |
|
1454 return copyInst; |
|
1455 } |
|
1456 |
|
1457 // --------------------------------------------------------------------------- |
|
1458 // CCmPluginBaseEng::AddResourceFileL |
|
1459 // --------------------------------------------------------------------------- |
|
1460 // |
|
1461 EXPORT_C void CCmPluginBaseEng::AddResourceFileL( const TDesC& aName ) |
|
1462 { |
|
1463 LOGGER_ENTERFN( "CCmPluginBaseEng::AddResourceFileL" ); |
|
1464 |
|
1465 CLOG_WRITE_1( "[%S]", &aName ); |
|
1466 |
|
1467 TParse fp; |
|
1468 TInt err = fp.Set( aName, |
|
1469 &KDC_RESOURCE_FILES_DIR, |
|
1470 NULL ); |
|
1471 if ( err != KErrNone) |
|
1472 { |
|
1473 User::Leave( err ); |
|
1474 } |
|
1475 |
|
1476 TFileName fName; |
|
1477 |
|
1478 fName.Copy( fp.FullName() ); |
|
1479 |
|
1480 iCmMgr.AddResourceFileL( fName ); |
|
1481 } |
|
1482 |
|
1483 // --------------------------------------------------------------------------- |
|
1484 // CCmPluginBaseEng::RemoveResourceFile |
|
1485 // --------------------------------------------------------------------------- |
|
1486 // |
|
1487 EXPORT_C void CCmPluginBaseEng::RemoveResourceFile( const TDesC& aName ) |
|
1488 { |
|
1489 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveResourceFileL" ); |
|
1490 |
|
1491 TParse fp; |
|
1492 TInt err = fp.Set( aName, |
|
1493 &KDC_RESOURCE_FILES_DIR, |
|
1494 NULL ); |
|
1495 CLOG_WRITE_1( "Set: [%d]", err ); |
|
1496 |
|
1497 TFileName fName; |
|
1498 |
|
1499 fName.Copy( fp.FullName() ); |
|
1500 |
|
1501 iCmMgr.RemoveResourceFile( fName ); |
|
1502 } |
|
1503 |
|
1504 // --------------------------------------------------------------------------- |
|
1505 // CCmPluginBaseEng::AllocReadL |
|
1506 // --------------------------------------------------------------------------- |
|
1507 // |
|
1508 EXPORT_C HBufC* CCmPluginBaseEng::AllocReadL( TInt aResourceId ) const |
|
1509 { |
|
1510 LOGGER_ENTERFN( "CCmPluginBaseEng::AllocReadL" ); |
|
1511 |
|
1512 return iCmMgr.AllocReadL( aResourceId ); |
|
1513 } |
|
1514 |
|
1515 // --------------------------------------------------------------------------- |
|
1516 // CCmPluginBaseEng::OpenTransactionLC |
|
1517 // --------------------------------------------------------------------------- |
|
1518 // |
|
1519 void CCmPluginBaseEng::OpenTransactionLC() |
|
1520 { |
|
1521 LOGGER_ENTERFN( "CCmPluginBaseEng::OpenTransactionL" ); |
|
1522 |
|
1523 iCmMgr.OpenTransactionLC( ETrue ); |
|
1524 } |
|
1525 |
|
1526 // --------------------------------------------------------------------------- |
|
1527 // CCmPluginBaseEng::CommitTransactionL |
|
1528 // --------------------------------------------------------------------------- |
|
1529 // |
|
1530 void CCmPluginBaseEng::CommitTransactionL( TInt aError ) |
|
1531 { |
|
1532 LOGGER_ENTERFN( "CCmPluginBaseEng::CommitTransactionL" ); |
|
1533 |
|
1534 iCmMgr.CommitTransactionL( aError ); |
|
1535 } |
|
1536 |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // CCmPluginBaseEng::RollbackTransaction |
|
1539 // --------------------------------------------------------------------------- |
|
1540 // |
|
1541 void CCmPluginBaseEng::RollbackTransaction() |
|
1542 { |
|
1543 LOGGER_ENTERFN( "CCmPluginBaseEng::RollbackTransaction" ); |
|
1544 |
|
1545 iCmMgr.RollbackTransaction(); |
|
1546 } |
|
1547 |
|
1548 // --------------------------------------------------------------------------- |
|
1549 // CCmPluginBaseEng::PrepareToLoadRecordsL |
|
1550 // --------------------------------------------------------------------------- |
|
1551 // |
|
1552 void CCmPluginBaseEng::DoLoadL( TUint32 aIapId ) |
|
1553 { |
|
1554 LOGGER_ENTERFN( "CCmPluginBaseEng::DoLoadL" ); |
|
1555 |
|
1556 PrepareToLoadRecordsL(); |
|
1557 |
|
1558 LoadIAPRecordL( aIapId ); |
|
1559 LoadWapRecordL(); |
|
1560 LoadSeamlessnessRecordL(); |
|
1561 LoadNetworkSettingL(); |
|
1562 LoadLocationSettingL(); |
|
1563 |
|
1564 // This is a connectionmethodinfo instance, that has no |
|
1565 // service and proxy setting. |
|
1566 if( KDummyBearerType != iBearerType ) |
|
1567 { |
|
1568 LoadServiceSettingL(); |
|
1569 LoadProxySettingL(); |
|
1570 } |
|
1571 |
|
1572 LoadAdditionalRecordsL(); |
|
1573 } |
|
1574 |
|
1575 // --------------------------------------------------------------------------- |
|
1576 // CCmPluginBaseEng::PrepareToLoadRecordsL |
|
1577 // --------------------------------------------------------------------------- |
|
1578 // |
|
1579 EXPORT_C void CCmPluginBaseEng::PrepareToLoadRecordsL() |
|
1580 { |
|
1581 LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToLoadRecordsL" ); |
|
1582 |
|
1583 iChargeCardEnabled = EFalse; |
|
1584 iLocationEnabled = EFalse; |
|
1585 } |
|
1586 |
|
1587 // --------------------------------------------------------------------------- |
|
1588 // CCmPluginBaseEng::LoadIAPRecordL |
|
1589 // --------------------------------------------------------------------------- |
|
1590 // |
|
1591 void CCmPluginBaseEng::LoadIAPRecordL( TUint32 aIapId ) |
|
1592 { |
|
1593 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadIAPRecordL" ); |
|
1594 |
|
1595 iIapId = aIapId; |
|
1596 |
|
1597 // Load IAP record |
|
1598 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
1599 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1600 |
|
1601 CleanupStack::PushL( iapRecord ); |
|
1602 |
|
1603 iapRecord->SetRecordId( iIapId ); |
|
1604 |
|
1605 iapRecord->LoadL( Session() ); |
|
1606 |
|
1607 CleanupStack::Pop( iapRecord ); |
|
1608 |
|
1609 iIapRecord = iapRecord; |
|
1610 } |
|
1611 |
|
1612 // --------------------------------------------------------------------------- |
|
1613 // CCmPluginBaseEng::LoadProxySettingL |
|
1614 // --------------------------------------------------------------------------- |
|
1615 // |
|
1616 void CCmPluginBaseEng::LoadProxySettingL() |
|
1617 { |
|
1618 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadProxySettingL" ); |
|
1619 |
|
1620 // Load Proxy record |
|
1621 CMDBRecordSet<CCDProxiesRecord>* proxieRS = |
|
1622 new(ELeave) CMDBRecordSet<CCDProxiesRecord>(KCDTIdProxiesRecord); |
|
1623 CleanupStack::PushL(proxieRS); |
|
1624 |
|
1625 // Now try to find the linked proxy record |
|
1626 // create new record |
|
1627 CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord *> |
|
1628 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
1629 |
|
1630 CleanupStack::PushL( proxyRecord ); |
|
1631 |
|
1632 // Prime record |
|
1633 TPtrC serviceType( iIapRecord->iServiceType ); |
|
1634 |
|
1635 proxyRecord->iServiceType.SetL( serviceType ); |
|
1636 |
|
1637 proxieRS->iRecords.AppendL( proxyRecord ); |
|
1638 |
|
1639 CleanupStack::Pop( proxyRecord ); |
|
1640 |
|
1641 proxyRecord = NULL; |
|
1642 |
|
1643 CLOG_WRITE_1( "Looking for proxy: [%d]", TUint32(iIapRecord->iService) ); |
|
1644 |
|
1645 if ( proxieRS->FindL(Session()) ) |
|
1646 { |
|
1647 TInt i(0); |
|
1648 while( i<proxieRS->iRecords.Count() ) |
|
1649 // Now that we have a list of services with the proper service type |
|
1650 // search for our proxy record and remove it from the array, |
|
1651 // then destroy the array. |
|
1652 { |
|
1653 CCDProxiesRecord* proxyRecord = (*proxieRS)[i]; |
|
1654 |
|
1655 // Compare the record id of these 2 services |
|
1656 if ( TUint32(proxyRecord->iService) == |
|
1657 TUint32(iIapRecord->iService) ) |
|
1658 { |
|
1659 iProxyRecord = proxyRecord; |
|
1660 // take ownership of this record |
|
1661 proxieRS->iRecords.Remove( i ); |
|
1662 break; |
|
1663 } |
|
1664 ++i; |
|
1665 } |
|
1666 } |
|
1667 |
|
1668 proxieRS->iRecords.ResetAndDestroy(); |
|
1669 |
|
1670 if( !iProxyRecord ) |
|
1671 { |
|
1672 // This creates a proxy record, where usage is disabled. |
|
1673 EnableProxyL( EFalse ); |
|
1674 } |
|
1675 |
|
1676 CleanupStack::PopAndDestroy( proxieRS ); |
|
1677 } |
|
1678 |
|
1679 // --------------------------------------------------------------------------- |
|
1680 // CCmPluginBaseEng::LoadServiceSettingL |
|
1681 // --------------------------------------------------------------------------- |
|
1682 // |
|
1683 EXPORT_C void CCmPluginBaseEng::LoadServiceSettingL() |
|
1684 { |
|
1685 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadServiceSettingL" ); |
|
1686 |
|
1687 if ( iServiceRecord ) |
|
1688 { |
|
1689 iServiceRecord->SetRecordId( iIapRecord->iService ); |
|
1690 TRAPD( err, iServiceRecord->LoadL( Session() ) ); |
|
1691 if( err == KErrNotFound ) |
|
1692 // record not found -> create a default one |
|
1693 { |
|
1694 CreateNewServiceRecordL(); |
|
1695 } |
|
1696 else |
|
1697 { |
|
1698 User::LeaveIfError( err ); |
|
1699 } |
|
1700 } |
|
1701 else |
|
1702 { |
|
1703 CLOG_WRITE( "CCmPluginBaseEng::LoadServiceSettingL: No service rec" ); |
|
1704 } |
|
1705 } |
|
1706 |
|
1707 // --------------------------------------------------------------------------- |
|
1708 // CCmPluginBaseEng::LoadChargeCardSettingL |
|
1709 // --------------------------------------------------------------------------- |
|
1710 // |
|
1711 void CCmPluginBaseEng::LoadChargeCardSettingL( TUint32 aRecordId ) |
|
1712 { |
|
1713 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadChargeCardSettingL" ); |
|
1714 |
|
1715 if ( !aRecordId ) |
|
1716 // No charge card is link to this IAP |
|
1717 { |
|
1718 iChargeCardEnabled = EFalse; |
|
1719 |
|
1720 CLOG_WRITE( "CCmPluginBaseEng::LoadChargeCardSettingL: No charge card" ); |
|
1721 return; |
|
1722 } |
|
1723 |
|
1724 iChargeCardRecord = static_cast<CCDChargecardRecord *> |
|
1725 (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord)); |
|
1726 iChargeCardRecord->SetRecordId( aRecordId ); |
|
1727 TRAPD( err, iChargeCardRecord->LoadL( Session() ) ); |
|
1728 if( err == KErrNotFound ) |
|
1729 // referenced but doesn't exist. Try to fix it. |
|
1730 { |
|
1731 iChargeCardRecord->SetRecordId( KCDNewRecordRequest ); |
|
1732 |
|
1733 // if it fails we can't do anything to solve this problem |
|
1734 iChargeCardRecord->StoreL( Session() ); |
|
1735 } |
|
1736 else |
|
1737 { |
|
1738 User::LeaveIfError( err ); |
|
1739 } |
|
1740 |
|
1741 iChargeCardEnabled = ETrue; |
|
1742 } |
|
1743 |
|
1744 // --------------------------------------------------------------------------- |
|
1745 // CCmPluginBaseEng::LoadNetworkSettingL |
|
1746 // --------------------------------------------------------------------------- |
|
1747 // |
|
1748 void CCmPluginBaseEng::LoadNetworkSettingL() |
|
1749 { |
|
1750 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadNetworkSettingL" ); |
|
1751 |
|
1752 CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*> |
|
1753 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1754 CleanupStack::PushL( networkRecord ); |
|
1755 |
|
1756 networkRecord->SetRecordId( iIapRecord->iNetwork ); |
|
1757 TRAPD( err, networkRecord->LoadL( Session() ) ); |
|
1758 if( err == KErrNotFound ) |
|
1759 { |
|
1760 CleanupStack::PopAndDestroy( networkRecord ); |
|
1761 |
|
1762 networkRecord = static_cast<CCDNetworkRecord*> |
|
1763 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1764 } |
|
1765 else |
|
1766 // KErrNotFound -> doesn't matter. We will do it UpdateL() |
|
1767 { |
|
1768 User::LeaveIfError( err ); |
|
1769 |
|
1770 CleanupStack::Pop( networkRecord ); |
|
1771 } |
|
1772 |
|
1773 iNetworkRecord = networkRecord; |
|
1774 } |
|
1775 |
|
1776 // --------------------------------------------------------------------------- |
|
1777 // CCmPluginBaseEng::LoadLocationSettingL |
|
1778 // --------------------------------------------------------------------------- |
|
1779 // |
|
1780 void CCmPluginBaseEng::LoadLocationSettingL() |
|
1781 { |
|
1782 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadLocationSettingL" ); |
|
1783 |
|
1784 CCDLocationRecord* locationRecord = static_cast<CCDLocationRecord*> |
|
1785 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
1786 |
|
1787 CleanupStack::PushL( locationRecord ); |
|
1788 |
|
1789 locationRecord->SetRecordId( iIapRecord->iLocation ); |
|
1790 if ( locationRecord->FindL(Session()) ) |
|
1791 { |
|
1792 iLocationEnabled = ETrue; |
|
1793 |
|
1794 iLocationRecord = locationRecord; |
|
1795 |
|
1796 CleanupStack::Pop( locationRecord ); |
|
1797 } |
|
1798 else |
|
1799 { |
|
1800 iLocationEnabled = EFalse; |
|
1801 |
|
1802 CleanupStack::PopAndDestroy( locationRecord ); |
|
1803 } |
|
1804 } |
|
1805 |
|
1806 // --------------------------------------------------------------------------- |
|
1807 // CCmPluginBaseEng::PrepareToUpdateRecordsL |
|
1808 // --------------------------------------------------------------------------- |
|
1809 // |
|
1810 EXPORT_C void CCmPluginBaseEng::PrepareToUpdateRecordsL() |
|
1811 { |
|
1812 LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToUpdateRecordsL" ); |
|
1813 } |
|
1814 |
|
1815 // --------------------------------------------------------------------------- |
|
1816 // CCmPluginBaseEng::UpdateIAPRecordL |
|
1817 // --------------------------------------------------------------------------- |
|
1818 // |
|
1819 void CCmPluginBaseEng::UpdateIAPRecordL() |
|
1820 { |
|
1821 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateIAPRecordL" ); |
|
1822 |
|
1823 if ( !iIapId ) |
|
1824 { |
|
1825 if ( iPreDefIapId ) |
|
1826 { |
|
1827 iIapRecord->SetRecordId( iPreDefIapId ); |
|
1828 iPreDefIapId = 0; |
|
1829 } |
|
1830 else |
|
1831 { |
|
1832 iIapRecord->SetRecordId( KCDNewRecordRequest ); |
|
1833 } |
|
1834 |
|
1835 TUint32 id; |
|
1836 HBufC* name; |
|
1837 |
|
1838 ServiceRecordIdLC( name, id ); |
|
1839 iIapRecord->iService = id; |
|
1840 iIapRecord->iServiceType.SetL( *name ); |
|
1841 CleanupStack::PopAndDestroy( name ); |
|
1842 |
|
1843 BearerRecordIdLC( name, id ); |
|
1844 iIapRecord->iBearer = id; |
|
1845 iIapRecord->iBearerType.SetL( *name ); |
|
1846 CleanupStack::PopAndDestroy( name ); |
|
1847 |
|
1848 iIapRecord->iNetwork = iNetworkRecord->RecordId(); |
|
1849 |
|
1850 if ( iLocationRecord ) |
|
1851 { |
|
1852 iIapRecord->iLocation = iLocationRecord->RecordId(); |
|
1853 } |
|
1854 |
|
1855 iIapRecord->iLocation = GetLocationIdL(); |
|
1856 |
|
1857 iIapRecord->StoreL( Session() ); |
|
1858 iIapId = iIapRecord->RecordId(); |
|
1859 |
|
1860 CLOG_NAME_2( _L("plugin_0x%x_%d"), this, iIapId ); |
|
1861 CLOG_WRITE_1( "New IapId: [%d]", iIapId ); |
|
1862 } |
|
1863 else |
|
1864 { |
|
1865 iIapRecord->ModifyL( Session() ); |
|
1866 } |
|
1867 } |
|
1868 |
|
1869 // --------------------------------------------------------------------------- |
|
1870 // CCmPluginBaseEng::UpdateProxyRecordL |
|
1871 // --------------------------------------------------------------------------- |
|
1872 // |
|
1873 void CCmPluginBaseEng::UpdateProxyRecordL() |
|
1874 { |
|
1875 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateProxyRecordL" ); |
|
1876 |
|
1877 CopyAttributes( iIapRecord, iProxyRecord ); |
|
1878 CheckIfNameModifiedL( iProxyRecord ); |
|
1879 |
|
1880 if ( iProxyRecord->iUseProxyServer ) |
|
1881 { |
|
1882 if ( !iProxyRecord->RecordId() ) |
|
1883 // new proxy setting -> create new record |
|
1884 { |
|
1885 iProxyRecord->iService = iServiceRecord->RecordId(); |
|
1886 iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType ); |
|
1887 |
|
1888 // By default protocol is set to "http" |
|
1889 if ( TPtrC(iProxyRecord->iProtocolName).Length() == 0 ) |
|
1890 { |
|
1891 iProxyRecord->iProtocolName.SetL(KDefProxyProtocolName); |
|
1892 } |
|
1893 |
|
1894 iProxyRecord->SetRecordId( KCDNewRecordRequest ); |
|
1895 |
|
1896 iProxyRecord->StoreL( Session() ); |
|
1897 } |
|
1898 else |
|
1899 // already existing record -> update only |
|
1900 { |
|
1901 iProxyRecord->ModifyL( Session() ); |
|
1902 } |
|
1903 } |
|
1904 else |
|
1905 { |
|
1906 if ( iProxyRecord->RecordId() ) |
|
1907 { |
|
1908 iProxyRecord->DeleteL( Session() ); |
|
1909 } |
|
1910 } |
|
1911 } |
|
1912 |
|
1913 |
|
1914 // --------------------------------------------------------------------------- |
|
1915 // CCmPluginBaseEng::UpdateSeamlessnessRecordL |
|
1916 // --------------------------------------------------------------------------- |
|
1917 // |
|
1918 void CCmPluginBaseEng::UpdateSeamlessnessRecordL() |
|
1919 { |
|
1920 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateSeamlessnessRecordL" ); |
|
1921 |
|
1922 CopyAttributes( iIapRecord, iPriv->iMetaDataRecord ); |
|
1923 CheckIfNameModifiedL( iPriv->iMetaDataRecord ); |
|
1924 |
|
1925 if ( !iPriv->iMetaDataRecord->RecordId() ) |
|
1926 { |
|
1927 iPriv->iMetaDataRecord->iIAP = IAPRecordElementId(); |
|
1928 iPriv->iMetaDataRecord->SetRecordId( KCDNewRecordRequest ); |
|
1929 iPriv->iMetaDataRecord->StoreL( Session() ); |
|
1930 } |
|
1931 else |
|
1932 { |
|
1933 iPriv->iMetaDataRecord->ModifyL( Session() ); |
|
1934 } |
|
1935 } |
|
1936 |
|
1937 // --------------------------------------------------------------------------- |
|
1938 // CCmPluginBaseEng::UpdateChargeCardRecordL |
|
1939 // --------------------------------------------------------------------------- |
|
1940 // |
|
1941 void CCmPluginBaseEng::UpdateChargeCardRecordL() |
|
1942 { |
|
1943 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateChargeCardRecordL" ); |
|
1944 if ( iChargeCardEnabled ) |
|
1945 { |
|
1946 CopyAttributes( iIapRecord, iChargeCardRecord ); |
|
1947 CheckIfNameModifiedL( iChargeCardRecord ); |
|
1948 |
|
1949 if ( !iChargeCardRecord->RecordId() ) |
|
1950 { |
|
1951 iChargeCardRecord->SetRecordId( KCDNewRecordRequest ); |
|
1952 iChargeCardRecord->StoreL( Session() ); |
|
1953 } |
|
1954 else |
|
1955 { |
|
1956 iChargeCardRecord->ModifyL( Session() ); |
|
1957 } |
|
1958 } |
|
1959 else |
|
1960 { |
|
1961 if ( iChargeCardRecord ) |
|
1962 { |
|
1963 iChargeCardRecord->DeleteL( Session() ); |
|
1964 } |
|
1965 } |
|
1966 } |
|
1967 |
|
1968 // --------------------------------------------------------------------------- |
|
1969 // CCmPluginBaseEng::UpdateServiceRecordL |
|
1970 // --------------------------------------------------------------------------- |
|
1971 // |
|
1972 EXPORT_C void CCmPluginBaseEng::UpdateServiceRecordL() |
|
1973 { |
|
1974 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateServiceRecordL" ); |
|
1975 |
|
1976 if ( iServiceRecord ) |
|
1977 { |
|
1978 CopyAttributes( iIapRecord, iServiceRecord ); |
|
1979 CheckIfNameModifiedL( iServiceRecord ); |
|
1980 |
|
1981 if ( !iServiceRecord->RecordId() ) |
|
1982 { |
|
1983 iServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
1984 iServiceRecord->StoreL( Session() ); |
|
1985 } |
|
1986 else |
|
1987 { |
|
1988 iServiceRecord->ModifyL( Session() ); |
|
1989 } |
|
1990 } |
|
1991 else |
|
1992 { |
|
1993 CLOG_WRITE( "No service record" ); |
|
1994 } |
|
1995 } |
|
1996 |
|
1997 // --------------------------------------------------------------------------- |
|
1998 // CCmPluginBaseEng::UpdateNetworkRecordL |
|
1999 // --------------------------------------------------------------------------- |
|
2000 // |
|
2001 void CCmPluginBaseEng::UpdateNetworkRecordL() |
|
2002 { |
|
2003 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateNetworkRecordL" ); |
|
2004 |
|
2005 CopyAttributes( iIapRecord, iNetworkRecord ); |
|
2006 if ( !iNetworkRecord->RecordId() ) |
|
2007 { |
|
2008 CheckIfNameModifiedL( iNetworkRecord ); |
|
2009 |
|
2010 iNetworkRecord->SetRecordId( KCDNewRecordRequest ); |
|
2011 iNetworkRecord->StoreL( Session() ); |
|
2012 } |
|
2013 else |
|
2014 { |
|
2015 iNetworkRecord->ModifyL( Session() ); |
|
2016 } |
|
2017 } |
|
2018 |
|
2019 // --------------------------------------------------------------------------- |
|
2020 // CCmPluginBaseEng::UpdateLocationRecordL |
|
2021 // --------------------------------------------------------------------------- |
|
2022 // |
|
2023 void CCmPluginBaseEng::UpdateLocationRecordL() |
|
2024 { |
|
2025 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateLocationRecordL" ); |
|
2026 if ( iLocationEnabled ) |
|
2027 { |
|
2028 CopyAttributes( iIapRecord, iLocationRecord ); |
|
2029 CheckIfNameModifiedL( iLocationRecord ); |
|
2030 |
|
2031 if ( !iLocationRecord->RecordId() ) |
|
2032 { |
|
2033 iLocationRecord->SetRecordId( KCDNewRecordRequest ); |
|
2034 iLocationRecord->StoreL( Session() ); |
|
2035 } |
|
2036 else |
|
2037 { |
|
2038 iLocationRecord->ModifyL( Session() ); |
|
2039 } |
|
2040 } |
|
2041 else |
|
2042 { |
|
2043 if ( iLocationRecord ) |
|
2044 { |
|
2045 iLocationRecord->DeleteL( Session() ); |
|
2046 } |
|
2047 } |
|
2048 } |
|
2049 |
|
2050 // --------------------------------------------------------------------------- |
|
2051 // CCmPluginBaseEng::UpdateConnPrefSettingL |
|
2052 // --------------------------------------------------------------------------- |
|
2053 // |
|
2054 void CCmPluginBaseEng::UpdateConnPrefSettingL() |
|
2055 { |
|
2056 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateConnPrefSettingL" ); |
|
2057 } |
|
2058 |
|
2059 // --------------------------------------------------------------------------- |
|
2060 // CCmPluginBaseEng::EnableProxyL |
|
2061 // --------------------------------------------------------------------------- |
|
2062 // |
|
2063 void CCmPluginBaseEng::EnableProxyL( TBool aEnable ) |
|
2064 { |
|
2065 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableProxyL" ); |
|
2066 |
|
2067 if ( !iServiceRecord ) |
|
2068 { |
|
2069 CLOG_WRITE( "No service record -> no proxy" ); |
|
2070 User::Leave( KErrNotSupported ); |
|
2071 } |
|
2072 |
|
2073 if( !iProxyRecord ) |
|
2074 { |
|
2075 iProxyRecord = static_cast<CCDProxiesRecord *> |
|
2076 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
2077 } |
|
2078 |
|
2079 iProxyRecord->iUseProxyServer = aEnable; |
|
2080 } |
|
2081 |
|
2082 // --------------------------------------------------------------------------- |
|
2083 // CCmPluginBaseEng::EnableChargeCardL |
|
2084 // --------------------------------------------------------------------------- |
|
2085 // |
|
2086 void CCmPluginBaseEng::EnableChargeCardL( TBool aEnable ) |
|
2087 { |
|
2088 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableChargeCardL" ); |
|
2089 |
|
2090 if ( aEnable ) |
|
2091 { |
|
2092 if ( !iChargeCardRecord ) |
|
2093 { |
|
2094 iChargeCardRecord = static_cast<CCDChargecardRecord *> |
|
2095 (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord)); |
|
2096 } |
|
2097 } |
|
2098 else |
|
2099 // charge card is disabled. To be deleted in UpdateL |
|
2100 // Nothing to do here |
|
2101 { |
|
2102 } |
|
2103 |
|
2104 iChargeCardEnabled = aEnable; |
|
2105 } |
|
2106 |
|
2107 // --------------------------------------------------------------------------- |
|
2108 // CCmPluginBaseEng::EnableLocationL |
|
2109 // --------------------------------------------------------------------------- |
|
2110 // |
|
2111 void CCmPluginBaseEng::EnableLocationL( TBool aEnable ) |
|
2112 { |
|
2113 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableLocationL" ); |
|
2114 |
|
2115 if ( aEnable ) |
|
2116 { |
|
2117 if ( !iLocationRecord ) |
|
2118 { |
|
2119 iLocationRecord = static_cast<CCDLocationRecord *> |
|
2120 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
2121 } |
|
2122 } |
|
2123 else |
|
2124 // location is disabled. To be deleted in UpdateL. |
|
2125 // Nothing to do here |
|
2126 { |
|
2127 } |
|
2128 |
|
2129 iLocationEnabled = aEnable; |
|
2130 } |
|
2131 |
|
2132 // --------------------------------------------------------------------------- |
|
2133 // CCmPluginBaseEng::LoadWapRecordL |
|
2134 // --------------------------------------------------------------------------- |
|
2135 // |
|
2136 void CCmPluginBaseEng::LoadWapRecordL() |
|
2137 { |
|
2138 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadWapRecordL" ); |
|
2139 |
|
2140 iPriv->iWapIPBearerRecord = FindWAPRecordL(); |
|
2141 if ( iPriv->iWapIPBearerRecord ) |
|
2142 { |
|
2143 CCDWAPAccessPointRecord *wapApRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2144 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2145 |
|
2146 CleanupStack::PushL( wapApRecord ); |
|
2147 |
|
2148 wapApRecord->SetRecordId( |
|
2149 iPriv->iWapIPBearerRecord->iWAPAccessPointId ); |
|
2150 TRAPD( err, wapApRecord->LoadL( Session() ) ); |
|
2151 if( err == KErrNotFound ) |
|
2152 { |
|
2153 CleanupStack::PopAndDestroy( wapApRecord ); |
|
2154 |
|
2155 wapApRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2156 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2157 } |
|
2158 else |
|
2159 { |
|
2160 CLOG_WRITE( "WAP bearer record found, WAP AP Not??" ); |
|
2161 |
|
2162 User::LeaveIfError( err ); |
|
2163 |
|
2164 CleanupStack::Pop( wapApRecord ); |
|
2165 } |
|
2166 |
|
2167 iPriv->iWapAPRecord = wapApRecord; |
|
2168 } |
|
2169 else |
|
2170 // No WAP record found -> create a new one |
|
2171 { |
|
2172 NewWapRecordL(); |
|
2173 } |
|
2174 } |
|
2175 |
|
2176 // --------------------------------------------------------------------------- |
|
2177 // CCmPluginBaseEng::LoadSeamlessnessRecordL |
|
2178 // --------------------------------------------------------------------------- |
|
2179 // |
|
2180 void CCmPluginBaseEng::LoadSeamlessnessRecordL() |
|
2181 { |
|
2182 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadSeamlessnessRecordL" ); |
|
2183 |
|
2184 iPriv->iMetaDataRecord = FindSeamlessnessRecordL(); |
|
2185 } |
|
2186 |
|
2187 // --------------------------------------------------------------------------- |
|
2188 // CCmPluginBaseEng::UpdateWapRecordL |
|
2189 // --------------------------------------------------------------------------- |
|
2190 // |
|
2191 void CCmPluginBaseEng::UpdateWapRecordL() |
|
2192 { |
|
2193 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateWapRecordL" ); |
|
2194 |
|
2195 if ( !iPriv->iWapIPBearerRecord ) |
|
2196 // nothing to update |
|
2197 { |
|
2198 return; |
|
2199 } |
|
2200 |
|
2201 // we have the bearer but to make sure that we have WAP_AP, too. |
|
2202 NewWapRecordL(); |
|
2203 |
|
2204 CopyAttributes( iIapRecord, iPriv->iWapAPRecord ); |
|
2205 CopyAttributes( iIapRecord, iPriv->iWapIPBearerRecord ); |
|
2206 |
|
2207 CheckIfNameModifiedL( iPriv->iWapAPRecord ); |
|
2208 CheckIfNameModifiedL( iPriv->iWapIPBearerRecord ); |
|
2209 |
|
2210 if ( !iPriv->iWapAPRecord->RecordId() ) |
|
2211 { |
|
2212 iPriv->iWapAPRecord->SetRecordId( KCDNewRecordRequest ); |
|
2213 iPriv->iWapAPRecord->StoreL( Session() ); |
|
2214 } |
|
2215 else |
|
2216 { |
|
2217 iPriv->iWapAPRecord->ModifyL( Session() ); |
|
2218 } |
|
2219 |
|
2220 if ( !iPriv->iWapIPBearerRecord->RecordId() ) |
|
2221 { |
|
2222 iPriv->iWapIPBearerRecord->iWAPAccessPointId = iPriv->iWapAPRecord->RecordId(); |
|
2223 iPriv->iWapIPBearerRecord->iWAPIAP = iIapId; |
|
2224 |
|
2225 iPriv->iWapIPBearerRecord->SetRecordId( KCDNewRecordRequest ); |
|
2226 iPriv->iWapIPBearerRecord->StoreL( Session() ); |
|
2227 } |
|
2228 else |
|
2229 { |
|
2230 iPriv->iWapIPBearerRecord->ModifyL( Session() ); |
|
2231 } |
|
2232 } |
|
2233 |
|
2234 // --------------------------------------------------------------------------- |
|
2235 // CCmPluginBaseEng::NewWapRecordL |
|
2236 // --------------------------------------------------------------------------- |
|
2237 // |
|
2238 void CCmPluginBaseEng::NewWapRecordL() |
|
2239 { |
|
2240 LOGGER_ENTERFN( "CCmPluginBaseEng::NewWapBearerRecordL" ); |
|
2241 |
|
2242 if ( !iPriv->iWapIPBearerRecord ) |
|
2243 { |
|
2244 iPriv->iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord *> |
|
2245 (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
2246 iPriv->iWapIPBearerRecord->iWAPProxyPort = 0; |
|
2247 iPriv->iWapIPBearerRecord->iWAPWSPOption = ECmWapWspOptionConnectionOriented; |
|
2248 iPriv->iWapIPBearerRecord->iWAPSecurity = EFalse; |
|
2249 } |
|
2250 |
|
2251 if ( !iPriv->iWapAPRecord ) |
|
2252 { |
|
2253 iPriv->iWapAPRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2254 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2255 // SMS bearer is not supported by this version |
|
2256 iPriv->iWapAPRecord->iWAPCurrentBearer.SetL( |
|
2257 TPtrC(KCDTypeNameWAPIPBearer) ); |
|
2258 } |
|
2259 } |
|
2260 |
|
2261 // --------------------------------------------------------------------------- |
|
2262 // CCmPluginBaseEng::NewSeamlessnessRecordL |
|
2263 // --------------------------------------------------------------------------- |
|
2264 // |
|
2265 CCDIAPMetadataRecord* CCmPluginBaseEng::NewSeamlessnessRecordL( TBool aSetDef ) |
|
2266 { |
|
2267 LOGGER_ENTERFN( "CCmPluginBaseEng::NewSeamlessnessRecordL" ); |
|
2268 |
|
2269 CCDIAPMetadataRecord* record = new (ELeave) CCDIAPMetadataRecord( |
|
2270 iCmMgr.SeamlessnessTableId() ); |
|
2271 |
|
2272 if( aSetDef ) |
|
2273 { |
|
2274 record->iSeamlessness = ESeamlessnessConfirmFirst; |
|
2275 } |
|
2276 |
|
2277 return record; |
|
2278 } |
|
2279 |
|
2280 // --------------------------------------------------------------------------- |
|
2281 // CCmPluginBaseEng::SetAttribute |
|
2282 // --------------------------------------------------------------------------- |
|
2283 // |
|
2284 void CCmPluginBaseEng::SetAttribute( CCDRecordBase* aRecord, |
|
2285 TUint32 aAttribute, |
|
2286 TBool aSet ) |
|
2287 { |
|
2288 LOGGER_ENTERFN( "CCmPluginBaseEng::SetAttribute" ); |
|
2289 |
|
2290 if ( aSet ) |
|
2291 { |
|
2292 aRecord->SetAttributes( aAttribute ); |
|
2293 } |
|
2294 else |
|
2295 { |
|
2296 aRecord->ClearAttributes( aAttribute ); |
|
2297 } |
|
2298 } |
|
2299 |
|
2300 // --------------------------------------------------------------------------- |
|
2301 // CCmPluginBaseEng::CopyAttributes |
|
2302 // --------------------------------------------------------------------------- |
|
2303 // |
|
2304 void CCmPluginBaseEng::CopyAttributes( CCDRecordBase* aSrcRecord, |
|
2305 CCDRecordBase* aDstRecord ) |
|
2306 { |
|
2307 LOGGER_ENTERFN( "CCmPluginBaseEng::CopyAttributes" ); |
|
2308 |
|
2309 TMDBAttributeFlags attr( aSrcRecord->Attributes() ); |
|
2310 |
|
2311 aDstRecord->SetAttributes( attr ); |
|
2312 } |
|
2313 |
|
2314 // --------------------------------------------------------------------------- |
|
2315 // CCmPluginBaseEng::FindWAPRecordL |
|
2316 // --------------------------------------------------------------------------- |
|
2317 // |
|
2318 CCDWAPIPBearerRecord* CCmPluginBaseEng::FindWAPRecordL() |
|
2319 { |
|
2320 LOGGER_ENTERFN( "CCmPluginBaseEng::FindWAPRecordL" ); |
|
2321 |
|
2322 CMDBRecordSet<CCDWAPIPBearerRecord>* wapRS = |
|
2323 new(ELeave) |
|
2324 CMDBRecordSet<CCDWAPIPBearerRecord>(KCDTIdWAPIPBearerRecord); |
|
2325 CleanupStack::PushL( wapRS ); |
|
2326 |
|
2327 CCDWAPIPBearerRecord* wapBearerRecord = static_cast<CCDWAPIPBearerRecord *> |
|
2328 (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
2329 |
|
2330 CleanupStack::PushL( wapBearerRecord ); |
|
2331 |
|
2332 wapBearerRecord->iWAPIAP = iIapId; |
|
2333 wapRS->iRecords.AppendL( wapBearerRecord ); |
|
2334 |
|
2335 CleanupStack::Pop( wapBearerRecord ); |
|
2336 wapBearerRecord = NULL; |
|
2337 |
|
2338 if ( wapRS->FindL(Session()) ) |
|
2339 { |
|
2340 CLOG_WRITE( "WAP bearer record found" ); |
|
2341 |
|
2342 wapBearerRecord = |
|
2343 static_cast<CCDWAPIPBearerRecord *>(wapRS->iRecords[0]); |
|
2344 |
|
2345 // we take over the ownership of this record |
|
2346 wapRS->iRecords.Remove( 0 ); |
|
2347 } |
|
2348 |
|
2349 CleanupStack::PopAndDestroy( wapRS ); |
|
2350 |
|
2351 return wapBearerRecord; |
|
2352 } |
|
2353 |
|
2354 // --------------------------------------------------------------------------- |
|
2355 // CCmPluginBaseEng::FindSeamlessnessRecordL |
|
2356 // --------------------------------------------------------------------------- |
|
2357 // |
|
2358 CCDIAPMetadataRecord* CCmPluginBaseEng::FindSeamlessnessRecordL() |
|
2359 { |
|
2360 LOGGER_ENTERFN( "CCmPluginBaseEng::FindSeamlessnessRecordL" ); |
|
2361 |
|
2362 CMDBRecordSet<CCDIAPMetadataRecord>* slnRS = |
|
2363 new(ELeave) CMDBRecordSet<CCDIAPMetadataRecord>(iCmMgr.SeamlessnessTableId()); |
|
2364 CleanupStack::PushL( slnRS ); |
|
2365 |
|
2366 CCDIAPMetadataRecord* slnRecord = |
|
2367 new (ELeave) CCDIAPMetadataRecord( iCmMgr.SeamlessnessTableId() ); |
|
2368 |
|
2369 slnRecord->iIAP = IAPRecordElementId(); |
|
2370 slnRS->iRecords.AppendL( slnRecord ); |
|
2371 |
|
2372 slnRecord = NULL; |
|
2373 |
|
2374 if ( slnRS->FindL(Session()) ) |
|
2375 { |
|
2376 CMDBRecordBase* record = slnRS->iRecords[0]; |
|
2377 |
|
2378 slnRecord = NewSeamlessnessRecordL( EFalse ); |
|
2379 slnRecord->SetRecordId( record->RecordId() ); |
|
2380 |
|
2381 // This can leave only in case of OOM. |
|
2382 slnRecord->LoadL( Session() ); |
|
2383 } |
|
2384 else |
|
2385 { |
|
2386 slnRecord = NewSeamlessnessRecordL( ETrue ); |
|
2387 } |
|
2388 |
|
2389 CleanupStack::PopAndDestroy( slnRS ); |
|
2390 |
|
2391 return slnRecord; |
|
2392 } |
|
2393 |
|
2394 // --------------------------------------------------------------------------- |
|
2395 // CCmPluginBaseEng::DoMakeValidNameL |
|
2396 // --------------------------------------------------------------------------- |
|
2397 // |
|
2398 HBufC* CCmPluginBaseEng::DoMakeValidNameL( const TDesC& aName ) |
|
2399 { |
|
2400 LOGGER_ENTERFN( "CCmPluginBaseEng::DoMakeValidNameL" ); |
|
2401 |
|
2402 TBool changed( EFalse ); |
|
2403 HBufC* temp = HBufC::NewLC( KApMaxConnNameLength ); |
|
2404 HBufC* temp2 = HBufC::NewLC( KApMaxConnNameLength ); |
|
2405 |
|
2406 HBufC* corrname = EnsureMaxLengthLC( aName, changed ); |
|
2407 *temp = *corrname; |
|
2408 TInt postfix( 0 ); |
|
2409 TInt pf( 0 ); |
|
2410 TInt i( 0 ); |
|
2411 TBool valid ( EFalse ); |
|
2412 |
|
2413 TPtrC prefix = GetPrefix( *corrname ); |
|
2414 |
|
2415 postfix = GetPostfix( *temp, prefix ); |
|
2416 postfix = -1; |
|
2417 do |
|
2418 { |
|
2419 valid = IsValidNameL( *temp ); |
|
2420 if ( !valid ) |
|
2421 { |
|
2422 changed = ETrue; |
|
2423 postfix++; |
|
2424 // check the length of postfix, check text length accordingly |
|
2425 pf = postfix; |
|
2426 for (i=1; i<10; i++) |
|
2427 { |
|
2428 pf /= 10; |
|
2429 if ( !pf ) |
|
2430 break; |
|
2431 } |
|
2432 TPtr sgdptr( temp->Des() ); |
|
2433 TPtr sgdptr2( temp2->Des() ); |
|
2434 if ( postfix ) |
|
2435 { |
|
2436 if ( postfix < 10 ) |
|
2437 { |
|
2438 sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 3 ); |
|
2439 } |
|
2440 else |
|
2441 { |
|
2442 sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 2 ); |
|
2443 } |
|
2444 } |
|
2445 else |
|
2446 { |
|
2447 sgdptr2 = prefix.Left( KApMaxConnNameLength ); |
|
2448 } |
|
2449 if ( postfix ) |
|
2450 { |
|
2451 TBuf< KMaxPostfixLength > postfixString; |
|
2452 if ( postfix > 9 ) |
|
2453 { |
|
2454 postfixString.Format( KFormatLargePostfix, postfix ); |
|
2455 AknTextUtils::LanguageSpecificNumberConversion( postfixString ); |
|
2456 } |
|
2457 else |
|
2458 { |
|
2459 postfixString.Format( KFormatPostfix, postfix ); |
|
2460 AknTextUtils::LanguageSpecificNumberConversion( postfixString ); |
|
2461 } |
|
2462 sgdptr.Format( KFormatNameWithPostfix, &sgdptr2, |
|
2463 &postfixString ); |
|
2464 } |
|
2465 else |
|
2466 { |
|
2467 sgdptr.Format( KFormatNoPostfix, &sgdptr2 ); |
|
2468 } |
|
2469 } |
|
2470 } while ( !valid ); |
|
2471 |
|
2472 CleanupStack::PopAndDestroy( corrname ); |
|
2473 CleanupStack::PopAndDestroy( temp2 ); |
|
2474 |
|
2475 if ( changed ) |
|
2476 { |
|
2477 CLOG_WRITE_1( "New name: [%S]", temp ); |
|
2478 CleanupStack::Pop( temp ); |
|
2479 } |
|
2480 else |
|
2481 { |
|
2482 CleanupStack::PopAndDestroy( temp ); |
|
2483 temp = NULL; |
|
2484 } |
|
2485 |
|
2486 return temp; |
|
2487 } |
|
2488 |
|
2489 // --------------------------------------------------------------------------- |
|
2490 // CCmPluginBaseEng::EnsureMaxLengthLC |
|
2491 // --------------------------------------------------------------------------- |
|
2492 // |
|
2493 HBufC* CCmPluginBaseEng::EnsureMaxLengthLC( const TDesC& aName, |
|
2494 TBool& aChanged ) |
|
2495 { |
|
2496 LOGGER_ENTERFN( "CCmPluginBaseEng::EnsureMaxLengthLC" ); |
|
2497 |
|
2498 TInt length = aName.Length(); |
|
2499 |
|
2500 aChanged = EFalse; |
|
2501 |
|
2502 if ( !length ) |
|
2503 { |
|
2504 // Name is required. |
|
2505 User::Leave( KErrArgument ); |
|
2506 } |
|
2507 |
|
2508 HBufC* corrname; |
|
2509 if ( KApMaxConnNameLength < length ) |
|
2510 { // name too long, truncate. |
|
2511 corrname = aName.Left( KApMaxConnNameLength ).AllocLC(); |
|
2512 aChanged = ETrue; |
|
2513 } |
|
2514 else |
|
2515 { |
|
2516 corrname = aName.AllocLC(); |
|
2517 corrname->Des().Trim(); |
|
2518 if ( corrname->Length() == 0 ) |
|
2519 { |
|
2520 User::Leave( KErrArgument ); |
|
2521 } |
|
2522 // comes here only if name is valid |
|
2523 if ( corrname->Length() != aName.Length() ) |
|
2524 { |
|
2525 aChanged = ETrue; |
|
2526 } |
|
2527 } |
|
2528 |
|
2529 return corrname; |
|
2530 } |
|
2531 |
|
2532 // --------------------------------------------------------------------------- |
|
2533 // Given aName in the format <prefix> or <prefix><brace><integer><brace>, |
|
2534 // return a pointer to the leading part. |
|
2535 // That is, if there is trailing <space><integer>, |
|
2536 // then that is excluded; if there is no trailing part, then the original |
|
2537 // decriptor is returned. |
|
2538 // Examples: |
|
2539 // - "Foo" returns "Foo"; |
|
2540 // - "Foo 12" returns "Foo 12"; |
|
2541 // - "Foo(12)" returns "Foo"; |
|
2542 // - "Foo 12 (34)" returns "Foo 12 "; |
|
2543 // - "Foo bar" returns "Foo bar"; |
|
2544 // - "Foo " returns "Foo ". |
|
2545 // --------------------------------------------------------------------------- |
|
2546 TPtrC CCmPluginBaseEng::GetPrefix( const TDesC& aName ) |
|
2547 { |
|
2548 LOGGER_ENTERFN( "CCmPluginBaseEng::GetPrefix" ); |
|
2549 |
|
2550 TPtrC prefix = aName; |
|
2551 TInt lastBrace = aName.LocateReverse('('); |
|
2552 if ( lastBrace != KErrNotFound ) |
|
2553 { |
|
2554 // aName looks like "<prefix><brace><something>". |
|
2555 // See if <something> is an integer number. |
|
2556 TPtrC num = aName.Right( aName.Length() - lastBrace - 1 ); |
|
2557 TInt val; |
|
2558 TLex lex( num ); |
|
2559 if ( lex.Val( val ) == KErrNone ) |
|
2560 { |
|
2561 // Yes, the trailer is an integer. |
|
2562 prefix.Set( aName.Left( lastBrace ) ); |
|
2563 } |
|
2564 } |
|
2565 return prefix; |
|
2566 } |
|
2567 |
|
2568 |
|
2569 // --------------------------------------------------------------------------- |
|
2570 // If aName is constructed from aPrefix with a postfix, get the numeric |
|
2571 // value of the postfix, e.g: |
|
2572 // - GetPostfix( "Foo (3)", "Foo" ) == 3 |
|
2573 // - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45 |
|
2574 // If aName is the same as aPrefix, return 0, e.g.: |
|
2575 // - GetPostfix( "Foo", "Foo" ) == 0 |
|
2576 // If aName is not constructed from aPrefix, return -1, e.g.: |
|
2577 // - GetPostfix( "Foobar", "Foo" ) == -1 |
|
2578 // - GetPostfix( "Fo 23 45", "Foo" ) == -1 |
|
2579 // --------------------------------------------------------------------------- |
|
2580 TInt CCmPluginBaseEng::GetPostfix( const TDesC& aName, const TDesC& aPrefix ) |
|
2581 { |
|
2582 LOGGER_ENTERFN( "CCmPluginBaseEng::GetPostfix" ); |
|
2583 TInt postfix( KErrNotFound ); |
|
2584 TInt nameLength = aName.Length(); |
|
2585 TInt prefixLength = aPrefix.Length(); |
|
2586 if ( nameLength >= prefixLength && aName.FindF( aPrefix ) == 0 ) |
|
2587 { |
|
2588 // aName is longer or equal length, and |
|
2589 // aPrefix can be found in the beginning of aName. |
|
2590 if ( nameLength == prefixLength ) |
|
2591 { |
|
2592 // They have the same length; they equal. |
|
2593 postfix = 0; |
|
2594 } |
|
2595 else |
|
2596 { |
|
2597 if ( prefixLength > 0 ) |
|
2598 { |
|
2599 if ( aName[ prefixLength ] == '(' ) |
|
2600 { |
|
2601 // (Now we know that aName is longer than aPrefix.) |
|
2602 // aName looks like "aPrefix<brace><something>". |
|
2603 // See if <something> is an integer number. |
|
2604 TPtrC num = aName.Right( nameLength - prefixLength - 1 ); |
|
2605 TBuf< KApMaxConnNameLength > pf; |
|
2606 pf = num; |
|
2607 AknTextUtils::ConvertDigitsTo( pf, EDigitTypeWestern ); |
|
2608 TInt val; |
|
2609 TLex lex( pf ); |
|
2610 if ( lex.Val( val ) == KErrNone ) |
|
2611 { |
|
2612 // Yes, the trailer is an integer. |
|
2613 if ( val > 0 ) |
|
2614 { |
|
2615 postfix = val; |
|
2616 } |
|
2617 else |
|
2618 { |
|
2619 // signal that it is invalid... |
|
2620 postfix = -1; |
|
2621 } |
|
2622 } |
|
2623 } |
|
2624 } |
|
2625 else |
|
2626 { |
|
2627 postfix = -1; |
|
2628 } |
|
2629 } |
|
2630 } |
|
2631 return postfix; |
|
2632 } |
|
2633 |
|
2634 // --------------------------------------------------------------------------- |
|
2635 // CCmPluginBaseEng::IsValidNameL |
|
2636 // --------------------------------------------------------------------------- |
|
2637 // |
|
2638 TBool CCmPluginBaseEng::IsValidNameL( const TDesC& aNameText ) |
|
2639 { |
|
2640 LOGGER_ENTERFN( "CCmPluginBaseEng::IsValidNameL" ); |
|
2641 |
|
2642 TBool retVal( ETrue ); |
|
2643 |
|
2644 OpenTransactionLC(); |
|
2645 |
|
2646 CMDBRecordSet<CCDIAPRecord>* iapRS = |
|
2647 new(ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord); |
|
2648 CleanupStack::PushL(iapRS); |
|
2649 |
|
2650 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
|
2651 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
2652 |
|
2653 CleanupStack::PushL( iapRecord ); |
|
2654 |
|
2655 // Prime record |
|
2656 iapRecord->iRecordName.SetL( aNameText ); |
|
2657 |
|
2658 iapRS->iRecords.AppendL( iapRecord ); |
|
2659 |
|
2660 CleanupStack::Pop( iapRecord ); |
|
2661 |
|
2662 iapRecord = NULL; |
|
2663 |
|
2664 if ( iapRS->FindL(Session()) ) |
|
2665 { |
|
2666 if ( iIapId ) |
|
2667 // this is not a new CM |
|
2668 { |
|
2669 for ( TInt i = 0; i < iapRS->iRecords.Count(); ++i ) |
|
2670 { |
|
2671 if ( iapRS->iRecords[i]->RecordId() != iIapId ) |
|
2672 // duplication because it's not our name |
|
2673 { |
|
2674 retVal = EFalse; |
|
2675 break; |
|
2676 } |
|
2677 } |
|
2678 } |
|
2679 else |
|
2680 // new CM -> any occurence is a duplication |
|
2681 { |
|
2682 retVal = EFalse; |
|
2683 } |
|
2684 } |
|
2685 |
|
2686 CleanupStack::PopAndDestroy( iapRS ); |
|
2687 |
|
2688 RollbackTransaction(); |
|
2689 |
|
2690 return retVal; |
|
2691 } |
|
2692 |
|
2693 // --------------------------------------------------------------------------- |
|
2694 // CCmPluginBaseEng::EscapeTextLC |
|
2695 // --------------------------------------------------------------------------- |
|
2696 // |
|
2697 HBufC* CCmPluginBaseEng::EscapeTextLC( const TDesC& aLiteral ) |
|
2698 { |
|
2699 LOGGER_ENTERFN( "CCmPluginBaseEng::EscapeTextLC" ); |
|
2700 |
|
2701 TInt l( aLiteral.Length() ); |
|
2702 //> 2*, to ensure correct esc. even if ALL chars are quotes... |
|
2703 HBufC* retbuf = HBufC::NewLC( 2*l ); |
|
2704 TPtr ret = retbuf->Des(); |
|
2705 TUint quote( '\'' ); // TChar gives warnings in THUMB & ARMI |
|
2706 TInt i( 0 ); |
|
2707 |
|
2708 for ( i=0; i<l; i++ ) |
|
2709 { |
|
2710 ret.Append( aLiteral[i] ); |
|
2711 if ( aLiteral[i] == quote ) |
|
2712 { |
|
2713 // Duplicate quote. |
|
2714 ret.Append( quote ); |
|
2715 } |
|
2716 } |
|
2717 return retbuf; |
|
2718 } |
|
2719 |
|
2720 // --------------------------------------------------------------------------- |
|
2721 // CCmPluginBaseEng::SetNameL |
|
2722 // --------------------------------------------------------------------------- |
|
2723 // |
|
2724 void CCmPluginBaseEng::SetNameL( const TDesC& aName ) |
|
2725 { |
|
2726 LOGGER_ENTERFN( "CCmPluginBaseEng::SetNameL" ); |
|
2727 |
|
2728 if ( iPriv->iNamingMethod == ENamingNothing ) |
|
2729 { |
|
2730 iIapRecord->iRecordName.SetL( aName ); |
|
2731 } |
|
2732 else if ( iPriv->iNamingMethod == ENamingUnique ) |
|
2733 { |
|
2734 HBufC* newName = DoMakeValidNameL( aName ); |
|
2735 |
|
2736 if ( newName ) |
|
2737 // name converted to unique |
|
2738 { |
|
2739 CleanupStack::PushL( newName ); |
|
2740 iIapRecord->iRecordName.SetL( *newName ); |
|
2741 CleanupStack::PopAndDestroy( newName ); |
|
2742 } |
|
2743 else |
|
2744 { |
|
2745 iIapRecord->iRecordName.SetL( aName ); |
|
2746 } |
|
2747 } |
|
2748 else if ( iPriv->iNamingMethod == ENamingNotAccept ) |
|
2749 { |
|
2750 if ( IsValidNameL( aName ) ) |
|
2751 { |
|
2752 iIapRecord->iRecordName.SetL( aName ); |
|
2753 } |
|
2754 else |
|
2755 { |
|
2756 User::Leave( KErrArgument ); |
|
2757 } |
|
2758 } |
|
2759 else |
|
2760 { |
|
2761 User::Leave( KErrCorrupt ); |
|
2762 } |
|
2763 |
|
2764 CLOG_WRITE_1( "Finale name: [%S]", &FIELD_TO_TDESC(iIapRecord->iRecordName) ); |
|
2765 } |
|
2766 |
|
2767 // --------------------------------------------------------------------------- |
|
2768 // CCmPluginBaseEng::AddConverstionTableL |
|
2769 // --------------------------------------------------------------------------- |
|
2770 // |
|
2771 EXPORT_C void CCmPluginBaseEng::AddConverstionTableL( CCDRecordBase* *aRecord, |
|
2772 TBool* aEnabled, |
|
2773 const TCmAttribConvTable* aConvTable ) |
|
2774 { |
|
2775 LOGGER_ENTERFN( "CCmPluginBaseEng::AddConverstionTableL" ); |
|
2776 TCmAttrConvArrayItem* item = new (ELeave) TCmAttrConvArrayItem; |
|
2777 |
|
2778 item->iRecord = aRecord; |
|
2779 item->iEnabled = aEnabled; |
|
2780 item->iConvTable = aConvTable; |
|
2781 |
|
2782 iPriv->iConvTblArray->AppendL( item ); |
|
2783 } |
|
2784 |
|
2785 // --------------------------------------------------------------------------- |
|
2786 // CCmPluginBaseEng::AddConverstionTableL |
|
2787 // --------------------------------------------------------------------------- |
|
2788 // |
|
2789 EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( |
|
2790 const TCmCommonAttrConvArrayItem* aConvTable ) |
|
2791 { |
|
2792 LOGGER_ENTERFN( "CCmPluginBaseEng::AddCommonConversionTableL" ); |
|
2793 |
|
2794 User::LeaveIfError( iPriv->iCommonConvTblArray.Append( aConvTable ) ); |
|
2795 } |
|
2796 |
|
2797 // --------------------------------------------------------------------------- |
|
2798 // CCmPluginBaseEng::RemoveConversionTable |
|
2799 // --------------------------------------------------------------------------- |
|
2800 // |
|
2801 EXPORT_C void CCmPluginBaseEng::RemoveConversionTable( |
|
2802 const TCmAttribConvTable* aConvTable ) |
|
2803 { |
|
2804 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveConversionTable" ); |
|
2805 |
|
2806 for ( TInt i = 0; i < iPriv->iConvTblArray->Count(); ++i ) |
|
2807 { |
|
2808 if ( (*iPriv->iConvTblArray)[i]->iConvTable == aConvTable ) |
|
2809 { |
|
2810 delete (*iPriv->iConvTblArray)[i]; |
|
2811 iPriv->iConvTblArray->Delete( i ); |
|
2812 } |
|
2813 } |
|
2814 } |
|
2815 |
|
2816 // --------------------------------------------------------------------------- |
|
2817 // CCmPluginBaseEng::RemoveCommonConversionTable |
|
2818 // --------------------------------------------------------------------------- |
|
2819 // |
|
2820 EXPORT_C void CCmPluginBaseEng::RemoveCommonConversionTable( |
|
2821 const TCmCommonAttrConvArrayItem* aConvTable ) |
|
2822 { |
|
2823 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" ); |
|
2824 |
|
2825 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
2826 { |
|
2827 if ( iPriv->iCommonConvTblArray[i] == aConvTable ) |
|
2828 { |
|
2829 iPriv->iCommonConvTblArray.Remove( i ); |
|
2830 } |
|
2831 } |
|
2832 } |
|
2833 |
|
2834 // --------------------------------------------------------------------------- |
|
2835 // CCmPluginBaseEng::FindFieldL |
|
2836 // --------------------------------------------------------------------------- |
|
2837 // |
|
2838 TValidationFunctionL CCmPluginBaseEng::FindFieldL( TUint32 aAttribute, |
|
2839 TCMFieldTypes aType, |
|
2840 CMDBElement* &aElement ) const |
|
2841 { |
|
2842 LOGGER_ENTERFN( "CCmPluginBaseEng::FindFieldL" ); |
|
2843 |
|
2844 TValidationFunctionL func = NULL; |
|
2845 const TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute ); |
|
2846 |
|
2847 aElement = NULL; |
|
2848 |
|
2849 if( !foundItem ) |
|
2850 { |
|
2851 User::Leave( KErrNotSupported ); |
|
2852 } |
|
2853 |
|
2854 if ( foundItem->iEnabled ) |
|
2855 { |
|
2856 if ( !(*foundItem->iEnabled) ) |
|
2857 { |
|
2858 User::Leave( KErrNotSupported ); |
|
2859 } |
|
2860 } |
|
2861 |
|
2862 if ( !(*foundItem->iRecord) ) |
|
2863 { |
|
2864 User::Leave( KErrNotSupported ); |
|
2865 } |
|
2866 |
|
2867 TInt index( 0 ); |
|
2868 CMDBElement& field = FieldByAttributeL( foundItem, aAttribute, index ); |
|
2869 switch ( field.Type() ) |
|
2870 { |
|
2871 case EText: |
|
2872 case EMedText: |
|
2873 case ELongText: |
|
2874 { |
|
2875 if ( aType == ECmText ) |
|
2876 { |
|
2877 aElement = &field; |
|
2878 } |
|
2879 else |
|
2880 { |
|
2881 User::Leave( KErrNotSupported ); |
|
2882 } |
|
2883 } |
|
2884 break; |
|
2885 |
|
2886 case EDesC8: |
|
2887 { |
|
2888 if ( aType == ECmText8 ) |
|
2889 { |
|
2890 aElement = &field; |
|
2891 } |
|
2892 else |
|
2893 { |
|
2894 User::Leave( KErrNotSupported ); |
|
2895 } |
|
2896 } |
|
2897 break; |
|
2898 |
|
2899 case EUint32: |
|
2900 case EInt: |
|
2901 case EBool: |
|
2902 { |
|
2903 if ( aType == ECmInt || |
|
2904 aType == ECmBool ) |
|
2905 { |
|
2906 aElement = &field; |
|
2907 } |
|
2908 else |
|
2909 { |
|
2910 User::Leave( KErrNotSupported ); |
|
2911 } |
|
2912 } |
|
2913 break; |
|
2914 |
|
2915 default: |
|
2916 { |
|
2917 User::Leave( KErrArgument ); |
|
2918 } |
|
2919 break; |
|
2920 } |
|
2921 |
|
2922 if( aElement ) |
|
2923 { |
|
2924 func = foundItem->iConvTable[index].iValidFuncL; |
|
2925 } |
|
2926 else |
|
2927 { |
|
2928 User::Leave( KErrNotSupported ); |
|
2929 } |
|
2930 |
|
2931 return func; |
|
2932 } |
|
2933 |
|
2934 // --------------------------------------------------------------------------- |
|
2935 // CCmPluginBaseEng::Reset |
|
2936 // --------------------------------------------------------------------------- |
|
2937 // |
|
2938 EXPORT_C void CCmPluginBaseEng::Reset() |
|
2939 { |
|
2940 LOGGER_ENTERFN( "CCmPluginBaseEng::Reset" ); |
|
2941 |
|
2942 iIapId = 0; |
|
2943 |
|
2944 delete iIapRecord; iIapRecord = NULL; |
|
2945 delete iProxyRecord; iProxyRecord = NULL; |
|
2946 delete iServiceRecord; iServiceRecord = NULL; |
|
2947 delete iChargeCardRecord; iChargeCardRecord = NULL; |
|
2948 delete iNetworkRecord; iNetworkRecord = NULL; |
|
2949 delete iLocationRecord; iLocationRecord = NULL; |
|
2950 if ( iPriv ) |
|
2951 { |
|
2952 iPriv->iLoadResult = KErrNone; |
|
2953 delete iPriv->iWapAPRecord; iPriv->iWapAPRecord = NULL; |
|
2954 delete iPriv->iWapIPBearerRecord; iPriv->iWapIPBearerRecord = NULL; |
|
2955 delete iPriv->iMetaDataRecord; iPriv->iMetaDataRecord = NULL; |
|
2956 } |
|
2957 |
|
2958 iChargeCardEnabled = EFalse; |
|
2959 iLocationEnabled = EFalse; |
|
2960 } |
|
2961 |
|
2962 |
|
2963 // --------------------------------------------------------------------------- |
|
2964 // CCmPluginBaseEng::CheckIfAlreadyConnected |
|
2965 // --------------------------------------------------------------------------- |
|
2966 EXPORT_C TBool CCmPluginBaseEng::CheckIfAlreadyConnected() const |
|
2967 { |
|
2968 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfAlreadyConnected" ); |
|
2969 |
|
2970 TBool retVal( EFalse ); |
|
2971 RSocketServ serv; |
|
2972 RConnection connection; |
|
2973 TUint count; |
|
2974 |
|
2975 if ( serv.Connect() == KErrNone ) |
|
2976 { |
|
2977 if ( connection.Open( serv, KAfInet ) == KErrNone ) |
|
2978 { |
|
2979 if ( connection.EnumerateConnections( count ) == KErrNone ) |
|
2980 { |
|
2981 TPckgBuf<TConnectionInfo> connInfo; |
|
2982 |
|
2983 for ( TUint32 i = 1; i <= count; ++i ) |
|
2984 { |
|
2985 connection.GetConnectionInfo( i, connInfo ); |
|
2986 |
|
2987 if ( connInfo().iIapId == iIapId ) |
|
2988 { |
|
2989 CLOG_WRITE( "Found connection" ); |
|
2990 retVal = ETrue; |
|
2991 break; |
|
2992 } |
|
2993 } |
|
2994 } |
|
2995 |
|
2996 connection.Close(); |
|
2997 } |
|
2998 |
|
2999 serv.Close(); |
|
3000 } |
|
3001 |
|
3002 return retVal; |
|
3003 } |
|
3004 |
|
3005 // --------------------------------------------------------------------------- |
|
3006 // CCmPluginBaseEng::CheckIfNameModifiedL |
|
3007 // --------------------------------------------------------------------------- |
|
3008 EXPORT_C void |
|
3009 CCmPluginBaseEng::CheckIfNameModifiedL( CCDRecordBase* aRecord ) const |
|
3010 { |
|
3011 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfNameModifiedL" ); |
|
3012 |
|
3013 if ( !TPtrC(iIapRecord->iRecordName).CompareF( TPtrC(aRecord->iRecordName)) ) |
|
3014 // names matche |
|
3015 { |
|
3016 return; |
|
3017 } |
|
3018 |
|
3019 aRecord->iRecordName.SetL( TPtrC(iIapRecord->iRecordName) ); |
|
3020 } |
|
3021 |
|
3022 // --------------------------------------------------------------------------- |
|
3023 // CCmPluginBaseEng::IAPRecordElementId |
|
3024 // --------------------------------------------------------------------------- |
|
3025 TMDBElementId CCmPluginBaseEng::IAPRecordElementId() const |
|
3026 { |
|
3027 LOGGER_ENTERFN( "CCmPluginBaseEng::IAPRecordElementId" ); |
|
3028 |
|
3029 return ( KCDMaskShowField & iIapRecord->ElementId() ); |
|
3030 } |
|
3031 |
|
3032 // --------------------------------------------------------------------------- |
|
3033 // CCmPluginBaseEng::IsProtected |
|
3034 // --------------------------------------------------------------------------- |
|
3035 TBool CCmPluginBaseEng::IsProtected() const |
|
3036 { |
|
3037 LOGGER_ENTERFN( "CCmPluginBaseEng::IsProtected" ); |
|
3038 |
|
3039 return ( iIapRecord->Attributes() & ECDProtectedWrite ); |
|
3040 } |
|
3041 |
|
3042 // --------------------------------------------------------------------------- |
|
3043 // CCmPluginBaseEng::GetLocationIdL |
|
3044 // --------------------------------------------------------------------------- |
|
3045 TUint32 CCmPluginBaseEng::GetLocationIdL() const |
|
3046 { |
|
3047 LOGGER_ENTERFN( "CCmPluginBaseEng::GetLocationIdL" ); |
|
3048 |
|
3049 TUint32 locId( 0 ); |
|
3050 CMDBRecordSet<CCDLocationRecord>* locRS = |
|
3051 new(ELeave) CMDBRecordSet<CCDLocationRecord>(KCDTIdLocationRecord); |
|
3052 CleanupStack::PushL( locRS ); |
|
3053 |
|
3054 CCDLocationRecord* locRecord = static_cast<CCDLocationRecord *> |
|
3055 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
3056 |
|
3057 CleanupStack::PushL( locRecord ); |
|
3058 locRecord->iRecordName.SetL( KLocationName ); |
|
3059 locRS->iRecords.AppendL( locRecord ); |
|
3060 CleanupStack::Pop( locRecord ); |
|
3061 |
|
3062 if ( locRS->FindL(Session()) ) |
|
3063 { |
|
3064 locRecord = static_cast<CCDLocationRecord *>(locRS->iRecords[0]); |
|
3065 |
|
3066 locId = locRecord->RecordId(); |
|
3067 } |
|
3068 else |
|
3069 { |
|
3070 CLOG_WRITE( "Loc id not found" ); |
|
3071 User::Leave( KErrNotFound ); |
|
3072 } |
|
3073 |
|
3074 CleanupStack::PopAndDestroy( locRS ); |
|
3075 |
|
3076 return locId; |
|
3077 } |
|
3078 |
|
3079 // --------------------------------------------------------------------------- |
|
3080 // CCmPluginBaseEng::CheckForCommonAttribute |
|
3081 // --------------------------------------------------------------------------- |
|
3082 TUint32 |
|
3083 CCmPluginBaseEng::CheckForCommonAttribute( const TUint32 aAttribute ) const |
|
3084 { |
|
3085 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckForCommonAttribute" ); |
|
3086 |
|
3087 TUint32 convAttr( aAttribute ); |
|
3088 |
|
3089 if ( iPriv->iCommonConvTblArray.Count() && |
|
3090 aAttribute > ECmCommonAttributesStart && |
|
3091 aAttribute < ECmCommonAttributesEnd ) |
|
3092 { |
|
3093 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3094 { |
|
3095 const TCmCommonAttrConvArrayItem* convArray = |
|
3096 iPriv->iCommonConvTblArray[i]; |
|
3097 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3098 { |
|
3099 if ( convArray[item].iCommonAttribId == aAttribute ) |
|
3100 { |
|
3101 return convArray[item].iAttribId; |
|
3102 } |
|
3103 } |
|
3104 } |
|
3105 } |
|
3106 |
|
3107 return convAttr; |
|
3108 } |
|
3109 |
|
3110 // --------------------------------------------------------------------------- |
|
3111 // CCmPluginBaseEng::CommonAttribute |
|
3112 // --------------------------------------------------------------------------- |
|
3113 /*TUint32 CCmPluginBaseEng::CommonAttributeL( const TUint32 aAttribute ) const |
|
3114 { |
|
3115 LOGGER_ENTERFN( "CCmPluginBaseEng::CommonAttribute" ); |
|
3116 |
|
3117 if ( iPriv->iCommonConvTblArray.Count() ) |
|
3118 { |
|
3119 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3120 { |
|
3121 const TCmCommonAttrConvArrayItem* convArray = |
|
3122 iPriv->iCommonConvTblArray[i]; |
|
3123 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3124 { |
|
3125 if ( convArray[item].iAttribId == aAttribute ) |
|
3126 { |
|
3127 return convArray[item].iCommonAttribId; |
|
3128 } |
|
3129 } |
|
3130 } |
|
3131 } |
|
3132 |
|
3133 User::Leave( KErrArgument ); |
|
3134 |
|
3135 return 0; |
|
3136 }*/ |
|
3137 |
|
3138 // --------------------------------------------------------------------------- |
|
3139 // CCmPluginBaseEng::FeatureSupported |
|
3140 // --------------------------------------------------------------------------- |
|
3141 EXPORT_C TBool CCmPluginBaseEng::FeatureSupported( TInt aFeature ) |
|
3142 { |
|
3143 #ifdef _IPV6_DISABLED |
|
3144 if( aFeature == KFeatureIdIPv6 ) |
|
3145 { |
|
3146 return EFalse; |
|
3147 } |
|
3148 #endif |
|
3149 return CCmManagerImpl::FeatureSupported( aFeature ); |
|
3150 } |
|
3151 |
|
3152 // --------------------------------------------------------------------------- |
|
3153 // CCmPluginBaseEng::GlobalBearerPriority |
|
3154 // --------------------------------------------------------------------------- |
|
3155 EXPORT_C TInt |
|
3156 CCmPluginBaseEng::GlobalBearerPriority( const TDesC& aServiceType ) const |
|
3157 { |
|
3158 LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalBearerPriority" ); |
|
3159 |
|
3160 return iCmMgr.GlobalBearerPriority( EFalse, aServiceType ); |
|
3161 } |
|
3162 |
|
3163 // --------------------------------------------------------------------------- |
|
3164 // CCmPluginBaseEng::GlobalUiBearerPriority |
|
3165 // --------------------------------------------------------------------------- |
|
3166 EXPORT_C TInt |
|
3167 CCmPluginBaseEng::GlobalUiBearerPriority( const TDesC& aServiceType ) const |
|
3168 { |
|
3169 LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalUiBearerPriority" ); |
|
3170 |
|
3171 return iCmMgr.GlobalBearerPriority( ETrue, aServiceType ); |
|
3172 } |
|
3173 |
|
3174 // --------------------------------------------------------------------------- |
|
3175 // CCmPluginBaseEng::SetProxyServerNameL |
|
3176 // --------------------------------------------------------------------------- |
|
3177 TBool CCmPluginBaseEng::SetProxyServerNameL( const TDesC& aProxyServer ) |
|
3178 { |
|
3179 LOGGER_ENTERFN( "CCmPluginBaseEng::SetProxyServerNameL" ); |
|
3180 |
|
3181 iProxyRecord->iServerName.SetL( aProxyServer ); |
|
3182 if( !aProxyServer.Length() ) |
|
3183 { |
|
3184 iProxyRecord->iPortNumber = 0; |
|
3185 iProxyRecord->iUseProxyServer = EFalse; |
|
3186 } |
|
3187 else |
|
3188 { |
|
3189 iProxyRecord->iUseProxyServer = ETrue; |
|
3190 } |
|
3191 |
|
3192 return ETrue; |
|
3193 } |
|
3194 |
|
3195 // --------------------------------------------------------------------------- |
|
3196 // CCmPluginBaseEng::ConvTableItemL |
|
3197 // --------------------------------------------------------------------------- |
|
3198 EXPORT_C const TCmAttribConvTable* |
|
3199 CCmPluginBaseEng::ConvTableItem( TUint32 aAttribute ) |
|
3200 { |
|
3201 LOGGER_ENTERFN( "CCmPluginBaseEng::ConvTableItem" ); |
|
3202 |
|
3203 TInt i; |
|
3204 TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute ); |
|
3205 |
|
3206 if( foundItem ) |
|
3207 { |
|
3208 // From 2nd item, because the first one is for the range. |
|
3209 for ( i = 1; foundItem->iConvTable[i].iAttribId; ++i ) |
|
3210 { |
|
3211 if ( foundItem->iConvTable[i].iAttribId == aAttribute ) |
|
3212 { |
|
3213 return &foundItem->iConvTable[i]; |
|
3214 } |
|
3215 } |
|
3216 } |
|
3217 else |
|
3218 { |
|
3219 // I know that this is a not nice solution, but |
|
3220 // I couldn't find any more inteligent way of adding |
|
3221 // ECmBearerSettingName to the array. |
|
3222 const TCmAttribConvTable* item = SUiTable; |
|
3223 |
|
3224 // This is a where use |
|
3225 for ( i = 0; item[i].iAttribId; ++i ) |
|
3226 { |
|
3227 if( item[i].iAttribId == aAttribute ) |
|
3228 { |
|
3229 return &item[i]; |
|
3230 } |
|
3231 } |
|
3232 } |
|
3233 |
|
3234 return NULL; |
|
3235 } |
|
3236 |
|
3237 // --------------------------------------------------------------------------- |
|
3238 // CCmPluginBaseEng::ConversionTable |
|
3239 // --------------------------------------------------------------------------- |
|
3240 TCmAttrConvArrayItem* |
|
3241 CCmPluginBaseEng::ConversionTable( TUint32 aAttribute ) const |
|
3242 { |
|
3243 LOGGER_ENTERFN( "CCmPluginBaseEng::ConversionTable" ); |
|
3244 |
|
3245 TCmAttrConvArrayItem* foundItem = NULL; |
|
3246 TInt i; |
|
3247 |
|
3248 for ( i = 0; i < iPriv->iConvTblArray->Count(); ++i ) |
|
3249 { |
|
3250 TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[i]; |
|
3251 |
|
3252 if ( item->iConvTable[0].iAttribId <= aAttribute && |
|
3253 item->iConvTable[0].iCommsDatId >= aAttribute ) |
|
3254 { |
|
3255 foundItem = item; |
|
3256 break; |
|
3257 } |
|
3258 } |
|
3259 |
|
3260 return foundItem; |
|
3261 } |
|
3262 |
|
3263 // --------------------------------------------------------------------------- |
|
3264 // CCmPluginBaseEng::FieldByAttributeL |
|
3265 // --------------------------------------------------------------------------- |
|
3266 CMDBElement& CCmPluginBaseEng::FieldByAttributeL( |
|
3267 const TCmAttrConvArrayItem* aItem, |
|
3268 const TUint32 aAttribute, |
|
3269 TInt& aIndex ) const |
|
3270 { |
|
3271 LOGGER_ENTERFN( "CCmPluginBaseEng::FieldByAttributeL" ); |
|
3272 |
|
3273 // From 2nd item, because the first one is for the range. |
|
3274 for ( aIndex = 1; aItem->iConvTable[aIndex].iAttribId; ++aIndex ) |
|
3275 { |
|
3276 if ( aItem->iConvTable[aIndex].iAttribId == aAttribute ) |
|
3277 { |
|
3278 return *(*aItem->iRecord)->GetFieldByIdL( |
|
3279 aItem->iConvTable[aIndex].iCommsDatId ); |
|
3280 } |
|
3281 } |
|
3282 |
|
3283 User::Leave( KErrNotFound ); |
|
3284 // Dead code |
|
3285 return *(CMDBElement*)1; |
|
3286 } |
|
3287 |
|
3288 // --------------------------------------------------------------------------- |
|
3289 // CCmPluginBaseEng::SetDNSServerAddressL |
|
3290 // --------------------------------------------------------------------------- |
|
3291 // |
|
3292 EXPORT_C void CCmPluginBaseEng::SetDNSServerAddressL( TUint32 aSrv1Attr, |
|
3293 const TDesC& aSrv1, |
|
3294 TUint32 aSrv2Attr, |
|
3295 const TDesC& aSrv2, |
|
3296 TUint32 aAddrFromSrvAttr, |
|
3297 TBool aIPv6 ) |
|
3298 { |
|
3299 LOGGER_ENTERFN( "CCmPluginBaseEng::SetDNSServerAddressL" ); |
|
3300 |
|
3301 TBool undef1; |
|
3302 TBool undef2; |
|
3303 TPtrC dynamic; |
|
3304 |
|
3305 if( aIPv6 ) |
|
3306 // IPv6 |
|
3307 { |
|
3308 undef1 = ClassifyIPv6Address( aSrv1 ) == EIPv6Unspecified; |
|
3309 undef2 = ClassifyIPv6Address( aSrv2 ) == EIPv6Unspecified; |
|
3310 |
|
3311 dynamic.Set( KDynamicIpv6Address ); |
|
3312 } |
|
3313 else |
|
3314 { |
|
3315 undef1 = IsUnspecifiedIPv4Address( aSrv1 ); |
|
3316 undef2 = IsUnspecifiedIPv4Address( aSrv2 ); |
|
3317 |
|
3318 dynamic.Set( KUnspecifiedIPv4 ); |
|
3319 } |
|
3320 |
|
3321 if( undef1 ) |
|
3322 { |
|
3323 SetStringAttributeL( aSrv1Attr, aSrv2 ); |
|
3324 SetStringAttributeL( aSrv2Attr, dynamic ); |
|
3325 |
|
3326 SetBoolAttributeL( aAddrFromSrvAttr, undef2 ); |
|
3327 } |
|
3328 else |
|
3329 { |
|
3330 SetStringAttributeL( aSrv1Attr, aSrv1 ); |
|
3331 SetStringAttributeL( aSrv2Attr, aSrv2 ); |
|
3332 |
|
3333 SetBoolAttributeL( aAddrFromSrvAttr, EFalse ); |
|
3334 } |
|
3335 } |
|
3336 |
|
3337 // --------------------------------------------------------------------------- |
|
3338 // CCmPluginBaseEng::CheckDNSServerAddressL |
|
3339 // --------------------------------------------------------------------------- |
|
3340 // |
|
3341 EXPORT_C void CCmPluginBaseEng::CheckDNSServerAddressL( TBool aIPv6, |
|
3342 CMDBField<TDesC>& aDNS1, |
|
3343 CMDBField<TDesC>& aDNS2, |
|
3344 CMDBField<TBool>& /*aDNSFromServer*/ ) |
|
3345 { |
|
3346 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckDNSServerAddressL" ); |
|
3347 |
|
3348 // aDNSFromServer is commented out because the API must not set this |
|
3349 // field any more. It is only set from the UI |
|
3350 if( !(aDNS1.ElementId() & KCDChangedFlag) && |
|
3351 !(aDNS2.ElementId() & KCDChangedFlag) ) |
|
3352 // No change |
|
3353 { |
|
3354 return; |
|
3355 } |
|
3356 |
|
3357 if( aIPv6 ) |
|
3358 { |
|
3359 if( ClassifyIPv6Address( aDNS1 ) == EIPv6Unspecified ) |
|
3360 { |
|
3361 if( ClassifyIPv6Address( aDNS2 ) != EIPv6Unspecified ) |
|
3362 { |
|
3363 aDNS1.SetL( aDNS2 ); |
|
3364 aDNS2.SetL( KDynamicIpv6Address ); |
|
3365 } |
|
3366 } |
|
3367 } |
|
3368 else // IPv4 |
|
3369 { |
|
3370 if( IsUnspecifiedIPv4Address( aDNS1 ) ) |
|
3371 { |
|
3372 if( !IsUnspecifiedIPv4Address( aDNS2 ) ) |
|
3373 { |
|
3374 aDNS1.SetL( aDNS2 ); |
|
3375 aDNS2.SetL( KUnspecifiedIPv4 ); |
|
3376 } |
|
3377 } |
|
3378 } |
|
3379 } |
|
3380 |
|
3381 |
|
3382 // --------------------------------------------------------------------------- |
|
3383 // CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL |
|
3384 // --------------------------------------------------------------------------- |
|
3385 // |
|
3386 TBool CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL() const |
|
3387 { |
|
3388 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL" ); |
|
3389 |
|
3390 // OOD handling. If disk space is low user is notified. |
|
3391 RFs fs; |
|
3392 User::LeaveIfError( fs.Connect() ); |
|
3393 CleanupClosePushL<RFs>( fs ); |
|
3394 |
|
3395 // Checks the FFS space "after" addition |
|
3396 TBool belowCL = SysUtil::FFSSpaceBelowCriticalLevelL |
|
3397 ( &fs, KEstimatedOverhead ); |
|
3398 |
|
3399 CleanupStack::PopAndDestroy(); // fs |
|
3400 |
|
3401 if( belowCL ) |
|
3402 { |
|
3403 // Raise a dialog to notify the user. |
|
3404 TCmCommonUi::ShowMemoryFullConfirmationQueryL(); |
|
3405 // It must leave because it is the only way to notify the caller about |
|
3406 // the operation failed. (Its caller does not return indicator.) |
|
3407 // KLeaveWithoutAlert means no more dialog will raise |
|
3408 User::Leave( KLeaveWithoutAlert ); |
|
3409 } |
|
3410 |
|
3411 // Return value keept to have a suitable API |
|
3412 return belowCL; |
|
3413 |
|
3414 } |
|
3415 |
|
3416 // ----------------------------------------------------------------------------- |
|
3417 // CCmPluginBaseEng::IncrementRefCounter |
|
3418 // ----------------------------------------------------------------------------- |
|
3419 void CCmPluginBaseEng::IncrementRefCounter() |
|
3420 { |
|
3421 LOGGER_ENTERFN( "CCmPluginBaseEng::IncrementRefCounter" ); |
|
3422 |
|
3423 iRefCounter++; |
|
3424 } |
|
3425 // ----------------------------------------------------------------------------- |
|
3426 // CCmPluginBaseEng::DecrementRefCounter |
|
3427 // ----------------------------------------------------------------------------- |
|
3428 void CCmPluginBaseEng::DecrementRefCounter() |
|
3429 { |
|
3430 LOGGER_ENTERFN( "CCmPluginBaseEng::DecrementRefCounter" ); |
|
3431 |
|
3432 iRefCounter--; |
|
3433 } |
|
3434 // ----------------------------------------------------------------------------- |
|
3435 // CCmPluginBaseEng::GetRefCounter |
|
3436 // ----------------------------------------------------------------------------- |
|
3437 TInt CCmPluginBaseEng::GetRefCounter() |
|
3438 { |
|
3439 LOGGER_ENTERFN( "CCmPluginBaseEng::GetRefCounter" ); |
|
3440 |
|
3441 return iRefCounter; |
|
3442 } |
|
3443 |
|
3444 // ----------------------------------------------------------------------------- |
|
3445 // CCmPluginBaseEng::IdIsValid |
|
3446 // ----------------------------------------------------------------------------- |
|
3447 TBool CCmPluginBaseEng::IdIsValid() |
|
3448 { |
|
3449 LOGGER_ENTERFN( "CCmPluginBaseEng::IdIsValid" ); |
|
3450 |
|
3451 return iIdIsValid; |
|
3452 } |
|
3453 |
|
3454 |
|
3455 // ----------------------------------------------------------------------------- |
|
3456 // CCmPluginBaseEng::IdIsValid |
|
3457 // ----------------------------------------------------------------------------- |
|
3458 void CCmPluginBaseEng::SetIdValidity(TBool validity) |
|
3459 { |
|
3460 LOGGER_ENTERFN( "CCmPluginBaseEng::SetIdValidity" ); |
|
3461 |
|
3462 iIdIsValid = validity; |
|
3463 } |
|
3464 |
|
3465 |
|
3466 // ----------------------------------------------------------------------------- |
|
3467 // CCmPluginBaseEng::GetRefCounter |
|
3468 // ----------------------------------------------------------------------------- |
|
3469 void CCmPluginBaseEng::GenericStringWriterL( const TUint32 aAttribute, |
|
3470 const TDesC16& aValue ) |
|
3471 { |
|
3472 LOGGER_ENTERFN( "CCmPluginBaseEng::GenericStringWriterL" ); |
|
3473 |
|
3474 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
3475 CMDBField<TDesC>* field; |
|
3476 |
|
3477 TValidationFunctionL func = |
|
3478 FindFieldL( attribute, ECmText, (CMDBElement*&)field ); |
|
3479 |
|
3480 if( func ) |
|
3481 { |
|
3482 func( this, attribute, (const TAny*)&aValue ); |
|
3483 } |
|
3484 |
|
3485 field->SetL( aValue ); |
|
3486 } |
|
3487 |
|
3488 // --------------------------------------------------------------------------- |
|
3489 // CCmPluginBaseEng::MappedCommonAttribute |
|
3490 // --------------------------------------------------------------------------- |
|
3491 TUint32 |
|
3492 CCmPluginBaseEng::MappedCommonAttribute( const TUint32 aAttribute ) const |
|
3493 { |
|
3494 LOGGER_ENTERFN( "CCmPluginBaseEng::MappedCommonAttribute" ); |
|
3495 |
|
3496 TUint32 convAttr( aAttribute ); |
|
3497 |
|
3498 if ( iPriv->iCommonConvTblArray.Count() ) |
|
3499 { |
|
3500 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3501 { |
|
3502 const TCmCommonAttrConvArrayItem* convArray = |
|
3503 iPriv->iCommonConvTblArray[i]; |
|
3504 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3505 { |
|
3506 if ( convArray[item].iAttribId == aAttribute ) |
|
3507 { |
|
3508 return convArray[item].iCommonAttribId; |
|
3509 } |
|
3510 } |
|
3511 } |
|
3512 } |
|
3513 |
|
3514 return convAttr; |
|
3515 } |
|
3516 //----------------------------------------------------------------------------- |
|
3517 // CCmPluginBaseEng::ParentDestination |
|
3518 // ----------------------------------------------------------------------------- |
|
3519 EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::ParentDestination() const |
|
3520 { |
|
3521 LOGGER_ENTERFN( "CCmPluginBaseEng::ParentDestination" ); |
|
3522 |
|
3523 if (iParentDest) |
|
3524 { |
|
3525 CCmDestinationImpl* parentDest = NULL; |
|
3526 TRAPD( err, parentDest = iCmMgr.DestinationL( iParentDest ) ); |
|
3527 if ( !err ) |
|
3528 { |
|
3529 return parentDest; |
|
3530 } |
|
3531 } |
|
3532 |
|
3533 return NULL; |
|
3534 } |
|
3535 |
|
3536 //----------------------------------------------------------------------------- |
|
3537 // CCmPluginBaseEng::GetAdditionalUids |
|
3538 // ----------------------------------------------------------------------------- |
|
3539 EXPORT_C void CCmPluginBaseEng::GetAdditionalUids( RArray<TUint32>& /*aIapIds*/ ) |
|
3540 { |
|
3541 LOGGER_ENTERFN( "CCmPluginBaseEng::GetAdditionalUids" ); |
|
3542 } |
|
3543 |
|
3544 //----------------------------------------------------------------------------- |
|
3545 // CCmPluginBaseEng::SetPreDefinedId |
|
3546 // ----------------------------------------------------------------------------- |
|
3547 EXPORT_C void CCmPluginBaseEng::SetPreDefinedId( const TUint32 aPreDefId ) |
|
3548 { |
|
3549 LOGGER_ENTERFN( "CCmPluginBaseEng::SetPreDefinedId" ); |
|
3550 |
|
3551 iPreDefIapId = aPreDefId; |
|
3552 } |
|
3553 |
|