|
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 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
714 CMDBField<TDesC8>* field; |
|
715 |
|
716 FindFieldL( attribute, ECmText8, (CMDBElement*&)field ); |
|
717 |
|
718 if ( !field->IsNull() ) |
|
719 { |
|
720 retVal = field->GetL().AllocL(); |
|
721 } |
|
722 else |
|
723 { |
|
724 retVal = KNullDesC8().AllocL(); |
|
725 } |
|
726 |
|
727 return retVal; |
|
728 } |
|
729 |
|
730 // --------------------------------------------------------------------------- |
|
731 // CCmPluginBaseEng::SetIntAttributeL |
|
732 // --------------------------------------------------------------------------- |
|
733 // |
|
734 EXPORT_C void CCmPluginBaseEng::SetIntAttributeL( const TUint32 aAttribute, |
|
735 TUint32 aValue ) |
|
736 { |
|
737 LOGGER_ENTERFN( "CCmPluginBaseEng::SetIntAttributeL" ); |
|
738 |
|
739 switch ( aAttribute ) |
|
740 { |
|
741 case ECmNamingMethod: |
|
742 { |
|
743 iPriv->iNamingMethod = (TNamingMethod)aValue; |
|
744 } |
|
745 break; |
|
746 |
|
747 case ECmCommsDBBearerType: |
|
748 case ECmElementID: |
|
749 case ECmIapId: |
|
750 case ECmId: |
|
751 { |
|
752 User::Leave( KErrNotSupported ); |
|
753 } |
|
754 break; |
|
755 |
|
756 case ECmSeamlessnessLevel: |
|
757 { |
|
758 if ( aValue == ESeamlessnessConfirmFirst || |
|
759 aValue == ESeamlessnessShowprogress ) |
|
760 { |
|
761 iPriv->iMetaDataRecord->iSeamlessness = aValue; |
|
762 } |
|
763 else |
|
764 { |
|
765 User::Leave( KErrNotSupported ); |
|
766 } |
|
767 } |
|
768 break; |
|
769 |
|
770 case ECmNetworkId: |
|
771 { |
|
772 User::Leave( KErrNotSupported ); |
|
773 } |
|
774 break; |
|
775 |
|
776 default: |
|
777 { |
|
778 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
779 CMDBField<TUint32>* field; |
|
780 |
|
781 TValidationFunctionL func = |
|
782 FindFieldL( attribute, ECmInt, (CMDBElement*&)field ); |
|
783 |
|
784 if( func ) |
|
785 { |
|
786 func( this, attribute, (TAny*)aValue ); |
|
787 } |
|
788 |
|
789 *field = aValue; |
|
790 } |
|
791 break; |
|
792 } |
|
793 |
|
794 } |
|
795 |
|
796 // --------------------------------------------------------------------------- |
|
797 // CCmPluginBaseEng::SetBoolAttributeL |
|
798 // --------------------------------------------------------------------------- |
|
799 // |
|
800 EXPORT_C void CCmPluginBaseEng::SetBoolAttributeL( const TUint32 aAttribute, |
|
801 TBool aValue ) |
|
802 { |
|
803 LOGGER_ENTERFN( "CCmPluginBaseEng::SetBoolAttributeL" ); |
|
804 |
|
805 switch ( aAttribute ) |
|
806 { |
|
807 case ECmProtected: |
|
808 { |
|
809 SetAttribute( iIapRecord, ECDProtectedWrite, aValue ); |
|
810 } |
|
811 break; |
|
812 |
|
813 case ECmHidden: |
|
814 { |
|
815 // Check that this is not Default Connection |
|
816 TCmDefConnValue defConn; |
|
817 iCmMgr.ReadDefConnL( defConn ); |
|
818 if ( defConn.iType == ECmDefConnConnectionMethod && |
|
819 defConn.iId == iIapRecord->RecordId() ) |
|
820 { |
|
821 User::Leave( KErrArgument ); |
|
822 } |
|
823 |
|
824 SetAttribute( iIapRecord, ECDHidden, aValue ); |
|
825 } |
|
826 break; |
|
827 |
|
828 case ECmProxyUsageEnabled: |
|
829 { |
|
830 EnableProxyL( aValue ); |
|
831 } |
|
832 break; |
|
833 |
|
834 case ECmChargeCardUsageEnabled: |
|
835 { |
|
836 EnableChargeCardL( aValue ); |
|
837 } |
|
838 break; |
|
839 |
|
840 case ECmLocationUsageEnabled: |
|
841 { |
|
842 EnableLocationL( aValue ); |
|
843 } |
|
844 break; |
|
845 |
|
846 case ECmMetaHighlight: |
|
847 { |
|
848 if( aValue ) |
|
849 { |
|
850 iPriv->iMetaDataRecord->iMetadata = |
|
851 EMetaHighlight | iPriv->iMetaDataRecord->iMetadata; |
|
852 } |
|
853 else |
|
854 { |
|
855 iPriv->iMetaDataRecord->iMetadata = |
|
856 ~EMetaHighlight & iPriv->iMetaDataRecord->iMetadata; |
|
857 } |
|
858 } |
|
859 break; |
|
860 |
|
861 case ECmMetaHiddenAgent: |
|
862 { |
|
863 if( aValue ) |
|
864 { |
|
865 iPriv->iMetaDataRecord->iMetadata = |
|
866 EMetaHiddenAgent | iPriv->iMetaDataRecord->iMetadata; |
|
867 } |
|
868 else |
|
869 { |
|
870 iPriv->iMetaDataRecord->iMetadata = |
|
871 ~EMetaHiddenAgent & iPriv->iMetaDataRecord->iMetadata; |
|
872 } |
|
873 } |
|
874 break; |
|
875 |
|
876 default: |
|
877 { |
|
878 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
879 CMDBField<TBool>* field; |
|
880 |
|
881 TValidationFunctionL func = |
|
882 FindFieldL( attribute, ECmBool, (CMDBElement*&)field ); |
|
883 |
|
884 if( func ) |
|
885 { |
|
886 func( this, attribute, (const TAny*)aValue ); |
|
887 } |
|
888 |
|
889 |
|
890 *field = aValue; |
|
891 } |
|
892 } |
|
893 } |
|
894 |
|
895 // --------------------------------------------------------------------------- |
|
896 // CCmPluginBaseEng::SetStringAttributeL |
|
897 // --------------------------------------------------------------------------- |
|
898 // |
|
899 EXPORT_C void CCmPluginBaseEng::SetStringAttributeL( const TUint32 aAttribute, |
|
900 const TDesC16& aValue ) |
|
901 { |
|
902 LOGGER_ENTERFN( "CCmPluginBaseEng::SetStringAttributeL" ); |
|
903 |
|
904 TUint32 commonattribute = MappedCommonAttribute( aAttribute ); |
|
905 switch ( commonattribute ) |
|
906 { |
|
907 case ECmStartPage: |
|
908 { |
|
909 iPriv->iWapAPRecord->iWAPStartPage.SetL( aValue ); |
|
910 } |
|
911 break; |
|
912 |
|
913 case ECmName: |
|
914 { |
|
915 SetNameL( aValue ); |
|
916 } |
|
917 break; |
|
918 case ECmIPAddress: |
|
919 { |
|
920 GenericStringWriterL( commonattribute, aValue ); |
|
921 if (( aValue.Compare(KUnspecifiedIPv4) == 0) || ( aValue.Compare(KNullDesC)==0 ) ) |
|
922 { |
|
923 SetBoolAttributeL( ECmIPAddFromServer, ETrue ); |
|
924 } |
|
925 else |
|
926 { |
|
927 SetBoolAttributeL( ECmIPAddFromServer, EFalse ); |
|
928 } |
|
929 } |
|
930 break; |
|
931 default: |
|
932 { |
|
933 GenericStringWriterL( commonattribute, aValue ); |
|
934 } |
|
935 } |
|
936 } |
|
937 |
|
938 // --------------------------------------------------------------------------- |
|
939 // CCmPluginBaseEng::SetString8AttributeL |
|
940 // --------------------------------------------------------------------------- |
|
941 // |
|
942 EXPORT_C void CCmPluginBaseEng::SetString8AttributeL( const TUint32 aAttribute, |
|
943 const TDesC8& aValue ) |
|
944 { |
|
945 LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" ); |
|
946 |
|
947 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
948 CMDBField<TDesC8>* field; |
|
949 |
|
950 TValidationFunctionL func = FindFieldL( attribute, ECmText8, (CMDBElement*&)field ); |
|
951 |
|
952 if( func ) |
|
953 { |
|
954 func( this, attribute, (const TAny*)&aValue ); |
|
955 } |
|
956 |
|
957 field->SetL( aValue ); |
|
958 } |
|
959 |
|
960 // --------------------------------------------------------------------------- |
|
961 // CCmPluginBaseEng::RestoreAttributeL |
|
962 // --------------------------------------------------------------------------- |
|
963 // |
|
964 EXPORT_C void CCmPluginBaseEng::RestoreAttributeL( const TUint32 aAttribute ) |
|
965 { |
|
966 LOGGER_ENTERFN( "CCmPluginBaseEng::RestoreAttributeL" ); |
|
967 |
|
968 TCmAttrConvArrayItem* item = ConversionTable( aAttribute ); |
|
969 |
|
970 TInt index( 0 ); |
|
971 CMDBElement& field = FieldByAttributeL( item, aAttribute, index ); |
|
972 |
|
973 TRAPD( err, field.LoadL( Session() ) ); |
|
974 if( err == KErrNotFound ) |
|
975 { |
|
976 switch ( field.Type() ) |
|
977 { |
|
978 case EText: |
|
979 case EMedText: |
|
980 case ELongText: |
|
981 { |
|
982 CMDBField<TDesC>* textField = static_cast<CMDBField<TDesC>*>( &field ); |
|
983 |
|
984 textField->SetL( KNullDesC ); |
|
985 } |
|
986 break; |
|
987 |
|
988 case EDesC8: |
|
989 { |
|
990 CMDBField<TDesC8>* textField = static_cast<CMDBField<TDesC8>*>( &field ); |
|
991 |
|
992 textField->SetL( KNullDesC8 ); |
|
993 } |
|
994 break; |
|
995 |
|
996 case EUint32: |
|
997 case EInt: |
|
998 case EBool: |
|
999 { |
|
1000 CMDBField<TInt>* intField = static_cast<CMDBField<TInt>*>( &field ); |
|
1001 |
|
1002 intField->SetL( 0 ); |
|
1003 } |
|
1004 break; |
|
1005 |
|
1006 default: |
|
1007 { |
|
1008 User::Leave( KErrArgument ); |
|
1009 } |
|
1010 break; |
|
1011 } |
|
1012 } |
|
1013 else |
|
1014 { |
|
1015 User::LeaveIfError( err ); |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // --------------------------------------------------------------------------- |
|
1020 // CCmPluginBaseEng::Destination |
|
1021 // --------------------------------------------------------------------------- |
|
1022 // |
|
1023 EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::Destination() const |
|
1024 { |
|
1025 LOGGER_ENTERFN( "CCmPluginBaseEng::Destination" ); |
|
1026 |
|
1027 return NULL; |
|
1028 } |
|
1029 |
|
1030 // --------------------------------------------------------------------------- |
|
1031 // CCmPluginBaseEng::UpdateL |
|
1032 // --------------------------------------------------------------------------- |
|
1033 // |
|
1034 EXPORT_C void CCmPluginBaseEng::UpdateL() |
|
1035 { |
|
1036 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateL" ); |
|
1037 |
|
1038 CheckSpaceBelowCriticalLevelL(); |
|
1039 |
|
1040 OpenTransactionLC(); |
|
1041 |
|
1042 PrepareToUpdateRecordsL(); |
|
1043 |
|
1044 UpdateChargeCardRecordL(); |
|
1045 UpdateServiceRecordL(); |
|
1046 |
|
1047 UpdateLocationRecordL(); |
|
1048 UpdateNetworkRecordL(); |
|
1049 |
|
1050 UpdateIAPRecordL(); |
|
1051 |
|
1052 UpdateWapRecordL(); |
|
1053 UpdateProxyRecordL(); |
|
1054 UpdateSeamlessnessRecordL(); |
|
1055 UpdateConnPrefSettingL(); |
|
1056 |
|
1057 UpdateAdditionalRecordsL(); |
|
1058 |
|
1059 CommitTransactionL( 0 ); |
|
1060 iCmMgr.ConnMethodUpdatedL( this ); |
|
1061 iIdIsValid = ETrue; |
|
1062 } |
|
1063 |
|
1064 // --------------------------------------------------------------------------- |
|
1065 // CCmPluginBaseEng::NumOfConnMethodReferencesL |
|
1066 // --------------------------------------------------------------------------- |
|
1067 // |
|
1068 EXPORT_C TInt CCmPluginBaseEng::NumOfConnMethodReferencesL() |
|
1069 { |
|
1070 LOGGER_ENTERFN( "CCmPluginBaseEng::NumOfConnMethodReferencesL" ); |
|
1071 |
|
1072 return iCmMgr.NumOfConnMethodReferencesL( iIapId ); |
|
1073 } |
|
1074 |
|
1075 // --------------------------------------------------------------------------- |
|
1076 // CCmPluginBaseEng::Session |
|
1077 // --------------------------------------------------------------------------- |
|
1078 // |
|
1079 EXPORT_C CMDBSession& CCmPluginBaseEng::Session()const |
|
1080 { |
|
1081 LOGGER_ENTERFN( "CCmPluginBaseEng::Session" ); |
|
1082 |
|
1083 return iCmMgr.Session(); |
|
1084 } |
|
1085 |
|
1086 // --------------------------------------------------------------------------- |
|
1087 // Delete this connection methond. |
|
1088 // Record ids are checked to be sure that we delete only records |
|
1089 // that were loaded before. |
|
1090 // --------------------------------------------------------------------------- |
|
1091 // |
|
1092 EXPORT_C TBool CCmPluginBaseEng::DeleteL( TBool aForced, |
|
1093 TBool aOneRefAllowed ) |
|
1094 { |
|
1095 LOGGER_ENTERFN( "CCmPluginBaseEng::DeleteL" ); |
|
1096 |
|
1097 if ( CheckIfAlreadyConnected() ) |
|
1098 { |
|
1099 User::Leave( KErrInUse ); |
|
1100 } |
|
1101 |
|
1102 if( iPriv->iLoadResult ) |
|
1103 // previous load failed -> do NOT delete this partially loaded cm. |
|
1104 { |
|
1105 User::Leave( KErrNotReady ); |
|
1106 } |
|
1107 |
|
1108 if( GetBoolAttributeL( ECmIsLinked ) ) |
|
1109 { |
|
1110 User::Leave( KErrLocked ); |
|
1111 } |
|
1112 |
|
1113 // If there is no parent destination, we can delete |
|
1114 TBool retVal(ETrue); |
|
1115 |
|
1116 if( !aForced ) |
|
1117 { |
|
1118 TInt refs = NumOfConnMethodReferencesL(); |
|
1119 |
|
1120 switch ( refs ) |
|
1121 { |
|
1122 case 0: |
|
1123 // no referencies to this cm |
|
1124 { |
|
1125 CLOG_WRITE( "No ref -> do delete it" ); |
|
1126 } |
|
1127 break; |
|
1128 |
|
1129 case 1: |
|
1130 // one reference |
|
1131 { |
|
1132 if ( !aOneRefAllowed ) |
|
1133 // this is not a legacy cm -> cannot be deleted. |
|
1134 { |
|
1135 retVal = EFalse; |
|
1136 } |
|
1137 } |
|
1138 break; |
|
1139 |
|
1140 default: |
|
1141 // connection method is multiple referenced from |
|
1142 // destinations -> no delete |
|
1143 { |
|
1144 retVal = EFalse; |
|
1145 } |
|
1146 break; |
|
1147 } |
|
1148 } |
|
1149 |
|
1150 if ( retVal ) |
|
1151 { |
|
1152 TCmDefConnValue deletedItem; |
|
1153 deletedItem.iType = ECmDefConnConnectionMethod; |
|
1154 deletedItem.iId = iIapId; |
|
1155 iCmMgr.HandleDefConnDeletedL( deletedItem ); |
|
1156 |
|
1157 if( aForced ) |
|
1158 { |
|
1159 iCmMgr.RemoveAllReferencesWoTransL( *this ); |
|
1160 } |
|
1161 |
|
1162 OpenTransactionLC(); |
|
1163 // And now we have everything from CommsDat, |
|
1164 // so we delete only those records. |
|
1165 PrepareToDeleteRecordsL(); |
|
1166 |
|
1167 if ( iIapRecord && iIapRecord->RecordId() ) |
|
1168 { |
|
1169 iIapRecord->DeleteL( Session() ); |
|
1170 } |
|
1171 |
|
1172 if ( iProxyRecord && iProxyRecord->RecordId() ) |
|
1173 { |
|
1174 iProxyRecord->DeleteL( Session() ); |
|
1175 } |
|
1176 |
|
1177 if ( iServiceRecord && iServiceRecord->RecordId() ) |
|
1178 { |
|
1179 iServiceRecord->DeleteL( Session() ); |
|
1180 } |
|
1181 |
|
1182 if ( iChargeCardRecord && iChargeCardRecord->RecordId() ) |
|
1183 { |
|
1184 iChargeCardRecord->DeleteL( Session() ); |
|
1185 } |
|
1186 |
|
1187 if ( iNetworkRecord && iNetworkRecord->RecordId() ) |
|
1188 { |
|
1189 iNetworkRecord->DeleteL( Session() ); |
|
1190 } |
|
1191 |
|
1192 if ( iLocationRecord && iLocationRecord->RecordId() ) |
|
1193 { |
|
1194 iLocationRecord->DeleteL( Session() ); |
|
1195 } |
|
1196 |
|
1197 if ( iPriv->iWapAPRecord && |
|
1198 iPriv->iWapAPRecord->RecordId() ) |
|
1199 { |
|
1200 iPriv->iWapAPRecord->DeleteL( Session() ); |
|
1201 } |
|
1202 |
|
1203 if ( iPriv->iWapIPBearerRecord && |
|
1204 iPriv->iWapIPBearerRecord->RecordId() ) |
|
1205 { |
|
1206 iPriv->iWapIPBearerRecord->DeleteL( Session() ); |
|
1207 } |
|
1208 |
|
1209 if ( iPriv->iMetaDataRecord && |
|
1210 iPriv->iMetaDataRecord->RecordId() ) |
|
1211 { |
|
1212 iPriv->iMetaDataRecord->DeleteL( Session() ); |
|
1213 } |
|
1214 |
|
1215 DeleteAdditionalRecordsL(); |
|
1216 |
|
1217 CommitTransactionL( KErrNone ); |
|
1218 } |
|
1219 |
|
1220 return retVal; |
|
1221 } |
|
1222 |
|
1223 // --------------------------------------------------------------------------- |
|
1224 // CCmPluginBaseEng::LoadL |
|
1225 // --------------------------------------------------------------------------- |
|
1226 // |
|
1227 EXPORT_C void CCmPluginBaseEng::LoadL( TUint32 aIapId ) |
|
1228 { |
|
1229 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadL" ); |
|
1230 CLOG_NAME_2( _L("plugin_0x%x_%d"), this, aIapId ); |
|
1231 |
|
1232 OpenTransactionLC(); |
|
1233 |
|
1234 // trap it to set iPriv->iLoadResult |
|
1235 TRAP( iPriv->iLoadResult, DoLoadL( aIapId ) ); |
|
1236 |
|
1237 User::LeaveIfError( iPriv->iLoadResult ); |
|
1238 |
|
1239 RollbackTransaction(); |
|
1240 } |
|
1241 |
|
1242 // --------------------------------------------------------------------------- |
|
1243 // CCmPluginBaseEng::CreateNewL |
|
1244 // --------------------------------------------------------------------------- |
|
1245 // |
|
1246 EXPORT_C void CCmPluginBaseEng::CreateNewL() |
|
1247 { |
|
1248 LOGGER_ENTERFN( "CCmPluginBaseEng::CreateNewL" ); |
|
1249 |
|
1250 CheckSpaceBelowCriticalLevelL(); |
|
1251 |
|
1252 if ( iIapId ) |
|
1253 // we already have IAP id -> |
|
1254 { |
|
1255 User::Leave( KErrAlreadyExists ); |
|
1256 } |
|
1257 |
|
1258 iPreDefIapId = 0; |
|
1259 |
|
1260 // optional record are disable in default |
|
1261 iChargeCardEnabled = EFalse; |
|
1262 iLocationEnabled = EFalse; |
|
1263 |
|
1264 // create mandatory records |
|
1265 iIapRecord = static_cast<CCDIAPRecord *> |
|
1266 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1267 iNetworkRecord = static_cast<CCDNetworkRecord *> |
|
1268 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1269 iProxyRecord = static_cast<CCDProxiesRecord *> |
|
1270 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
1271 NewWapRecordL(); |
|
1272 iPriv->iWapIPBearerRecord->iWAPGatewayAddress.SetL( |
|
1273 KDefWapGatewayIpAddress ); |
|
1274 |
|
1275 iPriv->iMetaDataRecord = NewSeamlessnessRecordL( ETrue ); |
|
1276 |
|
1277 // call plugin to create its own records |
|
1278 CreateNewServiceRecordL(); |
|
1279 CreateAdditionalRecordsL(); |
|
1280 |
|
1281 EnableProxyL( EFalse ); |
|
1282 |
|
1283 // Load default CM name from resource |
|
1284 HBufC* defApName = AllocReadL( R_CMMANAGERENG_DEFAULT_AP_NAME ); |
|
1285 CleanupStack::PushL( defApName ); |
|
1286 |
|
1287 SetNameL( *defApName ); |
|
1288 |
|
1289 CleanupStack::PopAndDestroy( defApName ); |
|
1290 |
|
1291 iIapRecord->iNetworkWeighting = 0; // it's always 0. |
|
1292 } |
|
1293 |
|
1294 // --------------------------------------------------------------------------- |
|
1295 // CCmPluginBaseEng::CreateCopyL |
|
1296 // --------------------------------------------------------------------------- |
|
1297 // |
|
1298 EXPORT_C CCmPluginBaseEng* CCmPluginBaseEng::CreateCopyL() const |
|
1299 { |
|
1300 LOGGER_ENTERFN( "CCmPluginBaseEng::CreateCopyL" ); |
|
1301 CheckSpaceBelowCriticalLevelL(); |
|
1302 |
|
1303 TCmPluginInitParam params( iCmMgr ); |
|
1304 |
|
1305 CCmPluginBaseEng* copyInst = CreateInstanceL( params ); |
|
1306 CleanupStack::PushL( copyInst ); |
|
1307 |
|
1308 copyInst->CreateNewL(); |
|
1309 |
|
1310 TInt err( KErrNone ); |
|
1311 TRAP( err, copyInst->SetBoolAttributeL( ECmChargeCardUsageEnabled, iChargeCardEnabled ) ); |
|
1312 if( err != KErrNotSupported ) |
|
1313 { |
|
1314 User::LeaveIfError( err ); |
|
1315 } |
|
1316 TRAP( err, copyInst->SetBoolAttributeL( ECmLocationUsageEnabled, iLocationEnabled ) ); |
|
1317 if( err != KErrNotSupported ) |
|
1318 { |
|
1319 User::LeaveIfError( err ); |
|
1320 } |
|
1321 copyInst->SetIntAttributeL( ECmNamingMethod, iPriv->iNamingMethod ); |
|
1322 copyInst->SetStringAttributeL( ECmName, TPtrC( iIapRecord->iRecordName ) ); |
|
1323 copyInst->SetStringAttributeL( ECmStartPage, TPtrC( iPriv->iWapAPRecord->iWAPStartPage ) ); |
|
1324 |
|
1325 |
|
1326 PrepareToCopyDataL( *copyInst ); |
|
1327 |
|
1328 for ( TInt tblInd = 0; tblInd < iPriv->iConvTblArray->Count(); ++tblInd ) |
|
1329 { |
|
1330 const TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[tblInd]; |
|
1331 |
|
1332 if ( item->iEnabled && !(*item->iEnabled) ) |
|
1333 // Enabled flag is set to 'disabled' state |
|
1334 { |
|
1335 continue; |
|
1336 } |
|
1337 |
|
1338 if( !item->iRecord || |
|
1339 (item->iRecord && !(*item->iRecord)) ) |
|
1340 // no record |
|
1341 { |
|
1342 continue; |
|
1343 } |
|
1344 |
|
1345 for ( TInt attrInd = 1; item->iConvTable[attrInd].iAttribId; ++attrInd ) |
|
1346 { |
|
1347 if( item->iConvTable[attrInd].iAttribFlags & EConvReadOnly ) |
|
1348 // Read-only flags are not copied. |
|
1349 { |
|
1350 continue; |
|
1351 } |
|
1352 |
|
1353 TInt commsdatid( item->iConvTable[attrInd].iCommsDatId ); |
|
1354 |
|
1355 if ( !commsdatid ) |
|
1356 { // not connected to the DB, calculated field, no copy |
|
1357 continue; |
|
1358 } |
|
1359 |
|
1360 CMDBElement* field = (*item->iRecord)->GetFieldByIdL( commsdatid ); |
|
1361 |
|
1362 if( field->IsNull() ) |
|
1363 { |
|
1364 continue; |
|
1365 } |
|
1366 |
|
1367 switch ( field->Type() ) |
|
1368 { |
|
1369 case EText: |
|
1370 case EMedText: |
|
1371 case ELongText: |
|
1372 { |
|
1373 CMDBField<TDesC>* textField = (CMDBField<TDesC>*)field; |
|
1374 |
|
1375 TRAP( err, copyInst->SetStringAttributeL( |
|
1376 item->iConvTable[attrInd].iAttribId, |
|
1377 *textField ) ); |
|
1378 if( err != KErrNotSupported ) |
|
1379 { |
|
1380 User::LeaveIfError( err ); |
|
1381 } |
|
1382 } |
|
1383 break; |
|
1384 |
|
1385 case EDesC8: |
|
1386 { |
|
1387 CMDBField<TDesC8>* textField = (CMDBField<TDesC8>*)field; |
|
1388 |
|
1389 TRAP( err, copyInst->SetString8AttributeL( |
|
1390 item->iConvTable[attrInd].iAttribId, |
|
1391 *textField ) ); |
|
1392 if( err != KErrNotSupported ) |
|
1393 { |
|
1394 User::LeaveIfError( err ); |
|
1395 } |
|
1396 } |
|
1397 break; |
|
1398 |
|
1399 case EUint32: |
|
1400 case EInt: |
|
1401 { |
|
1402 CMDBField<TUint32>* intField = (CMDBField<TUint32>*)field; |
|
1403 |
|
1404 TRAP( err, copyInst->SetIntAttributeL( |
|
1405 item->iConvTable[attrInd].iAttribId, |
|
1406 *intField ) ); |
|
1407 if ( !(( err == KErrNotSupported ) || ( err == KErrArgument )) ) |
|
1408 { |
|
1409 User::LeaveIfError( err ); |
|
1410 } |
|
1411 } |
|
1412 break; |
|
1413 |
|
1414 case EBool: |
|
1415 { |
|
1416 CMDBField<TBool>* intField = (CMDBField<TBool>*)field; |
|
1417 |
|
1418 TRAP( err, copyInst->SetBoolAttributeL( |
|
1419 item->iConvTable[attrInd].iAttribId, |
|
1420 *intField ) ); |
|
1421 if( err != KErrNotSupported ) |
|
1422 { |
|
1423 User::LeaveIfError( err ); |
|
1424 } |
|
1425 } |
|
1426 break; |
|
1427 |
|
1428 case ELink: // links are not copied! |
|
1429 default: |
|
1430 { |
|
1431 } |
|
1432 break; |
|
1433 } |
|
1434 } |
|
1435 } |
|
1436 |
|
1437 CopyAdditionalDataL( *copyInst ); |
|
1438 |
|
1439 CleanupStack::Pop( copyInst ); |
|
1440 |
|
1441 return copyInst; |
|
1442 } |
|
1443 |
|
1444 // --------------------------------------------------------------------------- |
|
1445 // CCmPluginBaseEng::AddResourceFileL |
|
1446 // --------------------------------------------------------------------------- |
|
1447 // |
|
1448 EXPORT_C void CCmPluginBaseEng::AddResourceFileL( const TDesC& aName ) |
|
1449 { |
|
1450 LOGGER_ENTERFN( "CCmPluginBaseEng::AddResourceFileL" ); |
|
1451 |
|
1452 CLOG_WRITE_1( "[%S]", &aName ); |
|
1453 |
|
1454 TParse fp; |
|
1455 TInt err = fp.Set( aName, |
|
1456 &KDC_RESOURCE_FILES_DIR, |
|
1457 NULL ); |
|
1458 if ( err != KErrNone) |
|
1459 { |
|
1460 User::Leave( err ); |
|
1461 } |
|
1462 |
|
1463 TFileName fName; |
|
1464 |
|
1465 fName.Copy( fp.FullName() ); |
|
1466 |
|
1467 iCmMgr.AddResourceFileL( fName ); |
|
1468 } |
|
1469 |
|
1470 // --------------------------------------------------------------------------- |
|
1471 // CCmPluginBaseEng::RemoveResourceFile |
|
1472 // --------------------------------------------------------------------------- |
|
1473 // |
|
1474 EXPORT_C void CCmPluginBaseEng::RemoveResourceFile( const TDesC& aName ) |
|
1475 { |
|
1476 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveResourceFileL" ); |
|
1477 |
|
1478 TParse fp; |
|
1479 TInt err = fp.Set( aName, |
|
1480 &KDC_RESOURCE_FILES_DIR, |
|
1481 NULL ); |
|
1482 CLOG_WRITE_1( "Set: [%d]", err ); |
|
1483 |
|
1484 TFileName fName; |
|
1485 |
|
1486 fName.Copy( fp.FullName() ); |
|
1487 |
|
1488 iCmMgr.RemoveResourceFile( fName ); |
|
1489 } |
|
1490 |
|
1491 // --------------------------------------------------------------------------- |
|
1492 // CCmPluginBaseEng::AllocReadL |
|
1493 // --------------------------------------------------------------------------- |
|
1494 // |
|
1495 EXPORT_C HBufC* CCmPluginBaseEng::AllocReadL( TInt aResourceId ) const |
|
1496 { |
|
1497 LOGGER_ENTERFN( "CCmPluginBaseEng::AllocReadL" ); |
|
1498 |
|
1499 return iCmMgr.AllocReadL( aResourceId ); |
|
1500 } |
|
1501 |
|
1502 // --------------------------------------------------------------------------- |
|
1503 // CCmPluginBaseEng::OpenTransactionLC |
|
1504 // --------------------------------------------------------------------------- |
|
1505 // |
|
1506 void CCmPluginBaseEng::OpenTransactionLC() |
|
1507 { |
|
1508 LOGGER_ENTERFN( "CCmPluginBaseEng::OpenTransactionL" ); |
|
1509 |
|
1510 iCmMgr.OpenTransactionLC( ETrue ); |
|
1511 } |
|
1512 |
|
1513 // --------------------------------------------------------------------------- |
|
1514 // CCmPluginBaseEng::CommitTransactionL |
|
1515 // --------------------------------------------------------------------------- |
|
1516 // |
|
1517 void CCmPluginBaseEng::CommitTransactionL( TInt aError ) |
|
1518 { |
|
1519 LOGGER_ENTERFN( "CCmPluginBaseEng::CommitTransactionL" ); |
|
1520 |
|
1521 iCmMgr.CommitTransactionL( aError ); |
|
1522 } |
|
1523 |
|
1524 // --------------------------------------------------------------------------- |
|
1525 // CCmPluginBaseEng::RollbackTransaction |
|
1526 // --------------------------------------------------------------------------- |
|
1527 // |
|
1528 void CCmPluginBaseEng::RollbackTransaction() |
|
1529 { |
|
1530 LOGGER_ENTERFN( "CCmPluginBaseEng::RollbackTransaction" ); |
|
1531 |
|
1532 iCmMgr.RollbackTransaction(); |
|
1533 } |
|
1534 |
|
1535 // --------------------------------------------------------------------------- |
|
1536 // CCmPluginBaseEng::PrepareToLoadRecordsL |
|
1537 // --------------------------------------------------------------------------- |
|
1538 // |
|
1539 void CCmPluginBaseEng::DoLoadL( TUint32 aIapId ) |
|
1540 { |
|
1541 LOGGER_ENTERFN( "CCmPluginBaseEng::DoLoadL" ); |
|
1542 |
|
1543 PrepareToLoadRecordsL(); |
|
1544 |
|
1545 LoadIAPRecordL( aIapId ); |
|
1546 LoadWapRecordL(); |
|
1547 LoadSeamlessnessRecordL(); |
|
1548 LoadNetworkSettingL(); |
|
1549 LoadLocationSettingL(); |
|
1550 |
|
1551 // This is a connectionmethodinfo instance, that has no |
|
1552 // service and proxy setting. |
|
1553 if( KDummyBearerType != iBearerType ) |
|
1554 { |
|
1555 LoadServiceSettingL(); |
|
1556 LoadProxySettingL(); |
|
1557 } |
|
1558 |
|
1559 LoadAdditionalRecordsL(); |
|
1560 } |
|
1561 |
|
1562 // --------------------------------------------------------------------------- |
|
1563 // CCmPluginBaseEng::PrepareToLoadRecordsL |
|
1564 // --------------------------------------------------------------------------- |
|
1565 // |
|
1566 EXPORT_C void CCmPluginBaseEng::PrepareToLoadRecordsL() |
|
1567 { |
|
1568 LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToLoadRecordsL" ); |
|
1569 |
|
1570 iChargeCardEnabled = EFalse; |
|
1571 iLocationEnabled = EFalse; |
|
1572 } |
|
1573 |
|
1574 // --------------------------------------------------------------------------- |
|
1575 // CCmPluginBaseEng::LoadIAPRecordL |
|
1576 // --------------------------------------------------------------------------- |
|
1577 // |
|
1578 void CCmPluginBaseEng::LoadIAPRecordL( TUint32 aIapId ) |
|
1579 { |
|
1580 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadIAPRecordL" ); |
|
1581 |
|
1582 iIapId = aIapId; |
|
1583 |
|
1584 // Load IAP record |
|
1585 CCDIAPRecord *iapRecord = static_cast<CCDIAPRecord *> |
|
1586 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
1587 |
|
1588 CleanupStack::PushL( iapRecord ); |
|
1589 |
|
1590 iapRecord->SetRecordId( iIapId ); |
|
1591 |
|
1592 iapRecord->LoadL( Session() ); |
|
1593 |
|
1594 CleanupStack::Pop( iapRecord ); |
|
1595 |
|
1596 iIapRecord = iapRecord; |
|
1597 } |
|
1598 |
|
1599 // --------------------------------------------------------------------------- |
|
1600 // CCmPluginBaseEng::LoadProxySettingL |
|
1601 // --------------------------------------------------------------------------- |
|
1602 // |
|
1603 void CCmPluginBaseEng::LoadProxySettingL() |
|
1604 { |
|
1605 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadProxySettingL" ); |
|
1606 |
|
1607 // Load Proxy record |
|
1608 CMDBRecordSet<CCDProxiesRecord>* proxieRS = |
|
1609 new(ELeave) CMDBRecordSet<CCDProxiesRecord>(KCDTIdProxiesRecord); |
|
1610 CleanupStack::PushL(proxieRS); |
|
1611 |
|
1612 // Now try to find the linked proxy record |
|
1613 // create new record |
|
1614 CCDProxiesRecord* proxyRecord = static_cast<CCDProxiesRecord *> |
|
1615 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
1616 |
|
1617 CleanupStack::PushL( proxyRecord ); |
|
1618 |
|
1619 // Prime record |
|
1620 TPtrC serviceType( iIapRecord->iServiceType ); |
|
1621 |
|
1622 proxyRecord->iServiceType.SetL( serviceType ); |
|
1623 |
|
1624 proxieRS->iRecords.AppendL( proxyRecord ); |
|
1625 |
|
1626 CleanupStack::Pop( proxyRecord ); |
|
1627 |
|
1628 proxyRecord = NULL; |
|
1629 |
|
1630 CLOG_WRITE_1( "Looking for proxy: [%d]", TUint32(iIapRecord->iService) ); |
|
1631 |
|
1632 if ( proxieRS->FindL(Session()) ) |
|
1633 { |
|
1634 TInt i(0); |
|
1635 while( i<proxieRS->iRecords.Count() ) |
|
1636 // Now that we have a list of services with the proper service type |
|
1637 // search for our proxy record and remove it from the array, |
|
1638 // then destroy the array. |
|
1639 { |
|
1640 CCDProxiesRecord* proxyRecord = (*proxieRS)[i]; |
|
1641 |
|
1642 // Compare the record id of these 2 services |
|
1643 if ( TUint32(proxyRecord->iService) == |
|
1644 TUint32(iIapRecord->iService) ) |
|
1645 { |
|
1646 iProxyRecord = proxyRecord; |
|
1647 // take ownership of this record |
|
1648 proxieRS->iRecords.Remove( i ); |
|
1649 break; |
|
1650 } |
|
1651 ++i; |
|
1652 } |
|
1653 } |
|
1654 |
|
1655 proxieRS->iRecords.ResetAndDestroy(); |
|
1656 |
|
1657 if( !iProxyRecord ) |
|
1658 { |
|
1659 // This creates a proxy record, where usage is disabled. |
|
1660 EnableProxyL( EFalse ); |
|
1661 } |
|
1662 |
|
1663 CleanupStack::PopAndDestroy( proxieRS ); |
|
1664 } |
|
1665 |
|
1666 // --------------------------------------------------------------------------- |
|
1667 // CCmPluginBaseEng::LoadServiceSettingL |
|
1668 // --------------------------------------------------------------------------- |
|
1669 // |
|
1670 EXPORT_C void CCmPluginBaseEng::LoadServiceSettingL() |
|
1671 { |
|
1672 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadServiceSettingL" ); |
|
1673 |
|
1674 if ( iServiceRecord ) |
|
1675 { |
|
1676 iServiceRecord->SetRecordId( iIapRecord->iService ); |
|
1677 TRAPD( err, iServiceRecord->LoadL( Session() ) ); |
|
1678 if( err == KErrNotFound ) |
|
1679 // record not found -> create a default one |
|
1680 { |
|
1681 CreateNewServiceRecordL(); |
|
1682 } |
|
1683 else |
|
1684 { |
|
1685 User::LeaveIfError( err ); |
|
1686 } |
|
1687 } |
|
1688 else |
|
1689 { |
|
1690 CLOG_WRITE( "CCmPluginBaseEng::LoadServiceSettingL: No service rec" ); |
|
1691 } |
|
1692 } |
|
1693 |
|
1694 // --------------------------------------------------------------------------- |
|
1695 // CCmPluginBaseEng::LoadChargeCardSettingL |
|
1696 // --------------------------------------------------------------------------- |
|
1697 // |
|
1698 void CCmPluginBaseEng::LoadChargeCardSettingL( TUint32 aRecordId ) |
|
1699 { |
|
1700 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadChargeCardSettingL" ); |
|
1701 |
|
1702 if ( !aRecordId ) |
|
1703 // No charge card is link to this IAP |
|
1704 { |
|
1705 iChargeCardEnabled = EFalse; |
|
1706 |
|
1707 CLOG_WRITE( "CCmPluginBaseEng::LoadChargeCardSettingL: No charge card" ); |
|
1708 return; |
|
1709 } |
|
1710 |
|
1711 iChargeCardRecord = static_cast<CCDChargecardRecord *> |
|
1712 (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord)); |
|
1713 iChargeCardRecord->SetRecordId( aRecordId ); |
|
1714 TRAPD( err, iChargeCardRecord->LoadL( Session() ) ); |
|
1715 if( err == KErrNotFound ) |
|
1716 // referenced but doesn't exist. Try to fix it. |
|
1717 { |
|
1718 iChargeCardRecord->SetRecordId( KCDNewRecordRequest ); |
|
1719 |
|
1720 // if it fails we can't do anything to solve this problem |
|
1721 iChargeCardRecord->StoreL( Session() ); |
|
1722 } |
|
1723 else |
|
1724 { |
|
1725 User::LeaveIfError( err ); |
|
1726 } |
|
1727 |
|
1728 iChargeCardEnabled = ETrue; |
|
1729 } |
|
1730 |
|
1731 // --------------------------------------------------------------------------- |
|
1732 // CCmPluginBaseEng::LoadNetworkSettingL |
|
1733 // --------------------------------------------------------------------------- |
|
1734 // |
|
1735 void CCmPluginBaseEng::LoadNetworkSettingL() |
|
1736 { |
|
1737 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadNetworkSettingL" ); |
|
1738 |
|
1739 CCDNetworkRecord* networkRecord = static_cast<CCDNetworkRecord*> |
|
1740 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1741 CleanupStack::PushL( networkRecord ); |
|
1742 |
|
1743 networkRecord->SetRecordId( iIapRecord->iNetwork ); |
|
1744 TRAPD( err, networkRecord->LoadL( Session() ) ); |
|
1745 if( err == KErrNotFound ) |
|
1746 { |
|
1747 CleanupStack::PopAndDestroy( networkRecord ); |
|
1748 |
|
1749 networkRecord = static_cast<CCDNetworkRecord*> |
|
1750 (CCDRecordBase::RecordFactoryL(KCDTIdNetworkRecord)); |
|
1751 } |
|
1752 else |
|
1753 // KErrNotFound -> doesn't matter. We will do it UpdateL() |
|
1754 { |
|
1755 User::LeaveIfError( err ); |
|
1756 |
|
1757 CleanupStack::Pop( networkRecord ); |
|
1758 } |
|
1759 |
|
1760 iNetworkRecord = networkRecord; |
|
1761 } |
|
1762 |
|
1763 // --------------------------------------------------------------------------- |
|
1764 // CCmPluginBaseEng::LoadLocationSettingL |
|
1765 // --------------------------------------------------------------------------- |
|
1766 // |
|
1767 void CCmPluginBaseEng::LoadLocationSettingL() |
|
1768 { |
|
1769 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadLocationSettingL" ); |
|
1770 |
|
1771 CCDLocationRecord* locationRecord = static_cast<CCDLocationRecord*> |
|
1772 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
1773 |
|
1774 CleanupStack::PushL( locationRecord ); |
|
1775 |
|
1776 locationRecord->SetRecordId( iIapRecord->iLocation ); |
|
1777 if ( locationRecord->FindL(Session()) ) |
|
1778 { |
|
1779 iLocationEnabled = ETrue; |
|
1780 |
|
1781 iLocationRecord = locationRecord; |
|
1782 |
|
1783 CleanupStack::Pop( locationRecord ); |
|
1784 } |
|
1785 else |
|
1786 { |
|
1787 iLocationEnabled = EFalse; |
|
1788 |
|
1789 CleanupStack::PopAndDestroy( locationRecord ); |
|
1790 } |
|
1791 } |
|
1792 |
|
1793 // --------------------------------------------------------------------------- |
|
1794 // CCmPluginBaseEng::PrepareToUpdateRecordsL |
|
1795 // --------------------------------------------------------------------------- |
|
1796 // |
|
1797 EXPORT_C void CCmPluginBaseEng::PrepareToUpdateRecordsL() |
|
1798 { |
|
1799 LOGGER_ENTERFN( "CCmPluginBaseEng::PrepareToUpdateRecordsL" ); |
|
1800 } |
|
1801 |
|
1802 // --------------------------------------------------------------------------- |
|
1803 // CCmPluginBaseEng::UpdateIAPRecordL |
|
1804 // --------------------------------------------------------------------------- |
|
1805 // |
|
1806 void CCmPluginBaseEng::UpdateIAPRecordL() |
|
1807 { |
|
1808 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateIAPRecordL" ); |
|
1809 |
|
1810 if ( !iIapId ) |
|
1811 { |
|
1812 if ( iPreDefIapId ) |
|
1813 { |
|
1814 iIapRecord->SetRecordId( iPreDefIapId ); |
|
1815 iPreDefIapId = 0; |
|
1816 } |
|
1817 else |
|
1818 { |
|
1819 iIapRecord->SetRecordId( KCDNewRecordRequest ); |
|
1820 } |
|
1821 |
|
1822 TUint32 id; |
|
1823 HBufC* name; |
|
1824 |
|
1825 ServiceRecordIdLC( name, id ); |
|
1826 iIapRecord->iService = id; |
|
1827 iIapRecord->iServiceType.SetL( *name ); |
|
1828 CleanupStack::PopAndDestroy( name ); |
|
1829 |
|
1830 BearerRecordIdLC( name, id ); |
|
1831 iIapRecord->iBearer = id; |
|
1832 iIapRecord->iBearerType.SetL( *name ); |
|
1833 CleanupStack::PopAndDestroy( name ); |
|
1834 |
|
1835 iIapRecord->iNetwork = iNetworkRecord->RecordId(); |
|
1836 |
|
1837 if ( iLocationRecord ) |
|
1838 { |
|
1839 iIapRecord->iLocation = iLocationRecord->RecordId(); |
|
1840 } |
|
1841 |
|
1842 iIapRecord->iLocation = GetLocationIdL(); |
|
1843 |
|
1844 iIapRecord->StoreL( Session() ); |
|
1845 iIapId = iIapRecord->RecordId(); |
|
1846 |
|
1847 CLOG_NAME_2( _L("plugin_0x%x_%d"), this, iIapId ); |
|
1848 CLOG_WRITE_1( "New IapId: [%d]", iIapId ); |
|
1849 } |
|
1850 else |
|
1851 { |
|
1852 iIapRecord->ModifyL( Session() ); |
|
1853 } |
|
1854 } |
|
1855 |
|
1856 // --------------------------------------------------------------------------- |
|
1857 // CCmPluginBaseEng::UpdateProxyRecordL |
|
1858 // --------------------------------------------------------------------------- |
|
1859 // |
|
1860 void CCmPluginBaseEng::UpdateProxyRecordL() |
|
1861 { |
|
1862 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateProxyRecordL" ); |
|
1863 |
|
1864 CopyAttributes( iIapRecord, iProxyRecord ); |
|
1865 CheckIfNameModifiedL( iProxyRecord ); |
|
1866 |
|
1867 if ( iProxyRecord->iUseProxyServer ) |
|
1868 { |
|
1869 if ( !iProxyRecord->RecordId() ) |
|
1870 // new proxy setting -> create new record |
|
1871 { |
|
1872 iProxyRecord->iService = iServiceRecord->RecordId(); |
|
1873 iProxyRecord->iServiceType.SetL( iIapRecord->iServiceType ); |
|
1874 |
|
1875 // By default protocol is set to "http" |
|
1876 if ( TPtrC(iProxyRecord->iProtocolName).Length() == 0 ) |
|
1877 { |
|
1878 iProxyRecord->iProtocolName.SetL(KDefProxyProtocolName); |
|
1879 } |
|
1880 |
|
1881 iProxyRecord->SetRecordId( KCDNewRecordRequest ); |
|
1882 |
|
1883 iProxyRecord->StoreL( Session() ); |
|
1884 } |
|
1885 else |
|
1886 // already existing record -> update only |
|
1887 { |
|
1888 iProxyRecord->ModifyL( Session() ); |
|
1889 } |
|
1890 } |
|
1891 else |
|
1892 { |
|
1893 if ( iProxyRecord->RecordId() ) |
|
1894 { |
|
1895 iProxyRecord->DeleteL( Session() ); |
|
1896 } |
|
1897 } |
|
1898 } |
|
1899 |
|
1900 |
|
1901 // --------------------------------------------------------------------------- |
|
1902 // CCmPluginBaseEng::UpdateSeamlessnessRecordL |
|
1903 // --------------------------------------------------------------------------- |
|
1904 // |
|
1905 void CCmPluginBaseEng::UpdateSeamlessnessRecordL() |
|
1906 { |
|
1907 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateSeamlessnessRecordL" ); |
|
1908 |
|
1909 CopyAttributes( iIapRecord, iPriv->iMetaDataRecord ); |
|
1910 CheckIfNameModifiedL( iPriv->iMetaDataRecord ); |
|
1911 |
|
1912 if ( !iPriv->iMetaDataRecord->RecordId() ) |
|
1913 { |
|
1914 iPriv->iMetaDataRecord->iIAP = IAPRecordElementId(); |
|
1915 iPriv->iMetaDataRecord->SetRecordId( KCDNewRecordRequest ); |
|
1916 iPriv->iMetaDataRecord->StoreL( Session() ); |
|
1917 } |
|
1918 else |
|
1919 { |
|
1920 iPriv->iMetaDataRecord->ModifyL( Session() ); |
|
1921 } |
|
1922 } |
|
1923 |
|
1924 // --------------------------------------------------------------------------- |
|
1925 // CCmPluginBaseEng::UpdateChargeCardRecordL |
|
1926 // --------------------------------------------------------------------------- |
|
1927 // |
|
1928 void CCmPluginBaseEng::UpdateChargeCardRecordL() |
|
1929 { |
|
1930 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateChargeCardRecordL" ); |
|
1931 if ( iChargeCardEnabled ) |
|
1932 { |
|
1933 CopyAttributes( iIapRecord, iChargeCardRecord ); |
|
1934 CheckIfNameModifiedL( iChargeCardRecord ); |
|
1935 |
|
1936 if ( !iChargeCardRecord->RecordId() ) |
|
1937 { |
|
1938 iChargeCardRecord->SetRecordId( KCDNewRecordRequest ); |
|
1939 iChargeCardRecord->StoreL( Session() ); |
|
1940 } |
|
1941 else |
|
1942 { |
|
1943 iChargeCardRecord->ModifyL( Session() ); |
|
1944 } |
|
1945 } |
|
1946 else |
|
1947 { |
|
1948 if ( iChargeCardRecord ) |
|
1949 { |
|
1950 iChargeCardRecord->DeleteL( Session() ); |
|
1951 } |
|
1952 } |
|
1953 } |
|
1954 |
|
1955 // --------------------------------------------------------------------------- |
|
1956 // CCmPluginBaseEng::UpdateServiceRecordL |
|
1957 // --------------------------------------------------------------------------- |
|
1958 // |
|
1959 EXPORT_C void CCmPluginBaseEng::UpdateServiceRecordL() |
|
1960 { |
|
1961 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateServiceRecordL" ); |
|
1962 |
|
1963 if ( iServiceRecord ) |
|
1964 { |
|
1965 CopyAttributes( iIapRecord, iServiceRecord ); |
|
1966 CheckIfNameModifiedL( iServiceRecord ); |
|
1967 |
|
1968 if ( !iServiceRecord->RecordId() ) |
|
1969 { |
|
1970 iServiceRecord->SetRecordId( KCDNewRecordRequest ); |
|
1971 iServiceRecord->StoreL( Session() ); |
|
1972 } |
|
1973 else |
|
1974 { |
|
1975 iServiceRecord->ModifyL( Session() ); |
|
1976 } |
|
1977 } |
|
1978 else |
|
1979 { |
|
1980 CLOG_WRITE( "No service record" ); |
|
1981 } |
|
1982 } |
|
1983 |
|
1984 // --------------------------------------------------------------------------- |
|
1985 // CCmPluginBaseEng::UpdateNetworkRecordL |
|
1986 // --------------------------------------------------------------------------- |
|
1987 // |
|
1988 void CCmPluginBaseEng::UpdateNetworkRecordL() |
|
1989 { |
|
1990 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateNetworkRecordL" ); |
|
1991 |
|
1992 CopyAttributes( iIapRecord, iNetworkRecord ); |
|
1993 if ( !iNetworkRecord->RecordId() ) |
|
1994 { |
|
1995 CheckIfNameModifiedL( iNetworkRecord ); |
|
1996 |
|
1997 iNetworkRecord->SetRecordId( KCDNewRecordRequest ); |
|
1998 iNetworkRecord->StoreL( Session() ); |
|
1999 } |
|
2000 else |
|
2001 { |
|
2002 iNetworkRecord->ModifyL( Session() ); |
|
2003 } |
|
2004 } |
|
2005 |
|
2006 // --------------------------------------------------------------------------- |
|
2007 // CCmPluginBaseEng::UpdateLocationRecordL |
|
2008 // --------------------------------------------------------------------------- |
|
2009 // |
|
2010 void CCmPluginBaseEng::UpdateLocationRecordL() |
|
2011 { |
|
2012 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateLocationRecordL" ); |
|
2013 if ( iLocationEnabled ) |
|
2014 { |
|
2015 CopyAttributes( iIapRecord, iLocationRecord ); |
|
2016 CheckIfNameModifiedL( iLocationRecord ); |
|
2017 |
|
2018 if ( !iLocationRecord->RecordId() ) |
|
2019 { |
|
2020 iLocationRecord->SetRecordId( KCDNewRecordRequest ); |
|
2021 iLocationRecord->StoreL( Session() ); |
|
2022 } |
|
2023 else |
|
2024 { |
|
2025 iLocationRecord->ModifyL( Session() ); |
|
2026 } |
|
2027 } |
|
2028 else |
|
2029 { |
|
2030 if ( iLocationRecord ) |
|
2031 { |
|
2032 iLocationRecord->DeleteL( Session() ); |
|
2033 } |
|
2034 } |
|
2035 } |
|
2036 |
|
2037 // --------------------------------------------------------------------------- |
|
2038 // CCmPluginBaseEng::UpdateConnPrefSettingL |
|
2039 // --------------------------------------------------------------------------- |
|
2040 // |
|
2041 void CCmPluginBaseEng::UpdateConnPrefSettingL() |
|
2042 { |
|
2043 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateConnPrefSettingL" ); |
|
2044 } |
|
2045 |
|
2046 // --------------------------------------------------------------------------- |
|
2047 // CCmPluginBaseEng::EnableProxyL |
|
2048 // --------------------------------------------------------------------------- |
|
2049 // |
|
2050 void CCmPluginBaseEng::EnableProxyL( TBool aEnable ) |
|
2051 { |
|
2052 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableProxyL" ); |
|
2053 |
|
2054 if ( !iServiceRecord ) |
|
2055 { |
|
2056 CLOG_WRITE( "No service record -> no proxy" ); |
|
2057 User::Leave( KErrNotSupported ); |
|
2058 } |
|
2059 |
|
2060 if( !iProxyRecord ) |
|
2061 { |
|
2062 iProxyRecord = static_cast<CCDProxiesRecord *> |
|
2063 (CCDRecordBase::RecordFactoryL(KCDTIdProxiesRecord)); |
|
2064 } |
|
2065 |
|
2066 iProxyRecord->iUseProxyServer = aEnable; |
|
2067 } |
|
2068 |
|
2069 // --------------------------------------------------------------------------- |
|
2070 // CCmPluginBaseEng::EnableChargeCardL |
|
2071 // --------------------------------------------------------------------------- |
|
2072 // |
|
2073 void CCmPluginBaseEng::EnableChargeCardL( TBool aEnable ) |
|
2074 { |
|
2075 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableChargeCardL" ); |
|
2076 |
|
2077 if ( aEnable ) |
|
2078 { |
|
2079 if ( !iChargeCardRecord ) |
|
2080 { |
|
2081 iChargeCardRecord = static_cast<CCDChargecardRecord *> |
|
2082 (CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord)); |
|
2083 } |
|
2084 } |
|
2085 else |
|
2086 // charge card is disabled. To be deleted in UpdateL |
|
2087 // Nothing to do here |
|
2088 { |
|
2089 } |
|
2090 |
|
2091 iChargeCardEnabled = aEnable; |
|
2092 } |
|
2093 |
|
2094 // --------------------------------------------------------------------------- |
|
2095 // CCmPluginBaseEng::EnableLocationL |
|
2096 // --------------------------------------------------------------------------- |
|
2097 // |
|
2098 void CCmPluginBaseEng::EnableLocationL( TBool aEnable ) |
|
2099 { |
|
2100 LOGGER_ENTERFN( "CCmPluginBaseEng::EnableLocationL" ); |
|
2101 |
|
2102 if ( aEnable ) |
|
2103 { |
|
2104 if ( !iLocationRecord ) |
|
2105 { |
|
2106 iLocationRecord = static_cast<CCDLocationRecord *> |
|
2107 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
2108 } |
|
2109 } |
|
2110 else |
|
2111 // location is disabled. To be deleted in UpdateL. |
|
2112 // Nothing to do here |
|
2113 { |
|
2114 } |
|
2115 |
|
2116 iLocationEnabled = aEnable; |
|
2117 } |
|
2118 |
|
2119 // --------------------------------------------------------------------------- |
|
2120 // CCmPluginBaseEng::LoadWapRecordL |
|
2121 // --------------------------------------------------------------------------- |
|
2122 // |
|
2123 void CCmPluginBaseEng::LoadWapRecordL() |
|
2124 { |
|
2125 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadWapRecordL" ); |
|
2126 |
|
2127 iPriv->iWapIPBearerRecord = FindWAPRecordL(); |
|
2128 if ( iPriv->iWapIPBearerRecord ) |
|
2129 { |
|
2130 CCDWAPAccessPointRecord *wapApRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2131 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2132 |
|
2133 CleanupStack::PushL( wapApRecord ); |
|
2134 |
|
2135 wapApRecord->SetRecordId( |
|
2136 iPriv->iWapIPBearerRecord->iWAPAccessPointId ); |
|
2137 TRAPD( err, wapApRecord->LoadL( Session() ) ); |
|
2138 if( err == KErrNotFound ) |
|
2139 { |
|
2140 CleanupStack::PopAndDestroy( wapApRecord ); |
|
2141 |
|
2142 wapApRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2143 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2144 } |
|
2145 else |
|
2146 { |
|
2147 CLOG_WRITE( "WAP bearer record found, WAP AP Not??" ); |
|
2148 |
|
2149 User::LeaveIfError( err ); |
|
2150 |
|
2151 CleanupStack::Pop( wapApRecord ); |
|
2152 } |
|
2153 |
|
2154 iPriv->iWapAPRecord = wapApRecord; |
|
2155 } |
|
2156 else |
|
2157 // No WAP record found -> create a new one |
|
2158 { |
|
2159 NewWapRecordL(); |
|
2160 } |
|
2161 } |
|
2162 |
|
2163 // --------------------------------------------------------------------------- |
|
2164 // CCmPluginBaseEng::LoadSeamlessnessRecordL |
|
2165 // --------------------------------------------------------------------------- |
|
2166 // |
|
2167 void CCmPluginBaseEng::LoadSeamlessnessRecordL() |
|
2168 { |
|
2169 LOGGER_ENTERFN( "CCmPluginBaseEng::LoadSeamlessnessRecordL" ); |
|
2170 |
|
2171 iPriv->iMetaDataRecord = FindSeamlessnessRecordL(); |
|
2172 } |
|
2173 |
|
2174 // --------------------------------------------------------------------------- |
|
2175 // CCmPluginBaseEng::UpdateWapRecordL |
|
2176 // --------------------------------------------------------------------------- |
|
2177 // |
|
2178 void CCmPluginBaseEng::UpdateWapRecordL() |
|
2179 { |
|
2180 LOGGER_ENTERFN( "CCmPluginBaseEng::UpdateWapRecordL" ); |
|
2181 |
|
2182 if ( !iPriv->iWapIPBearerRecord ) |
|
2183 // nothing to update |
|
2184 { |
|
2185 return; |
|
2186 } |
|
2187 |
|
2188 // we have the bearer but to make sure that we have WAP_AP, too. |
|
2189 NewWapRecordL(); |
|
2190 |
|
2191 CopyAttributes( iIapRecord, iPriv->iWapAPRecord ); |
|
2192 CopyAttributes( iIapRecord, iPriv->iWapIPBearerRecord ); |
|
2193 |
|
2194 CheckIfNameModifiedL( iPriv->iWapAPRecord ); |
|
2195 CheckIfNameModifiedL( iPriv->iWapIPBearerRecord ); |
|
2196 |
|
2197 if ( !iPriv->iWapAPRecord->RecordId() ) |
|
2198 { |
|
2199 iPriv->iWapAPRecord->SetRecordId( KCDNewRecordRequest ); |
|
2200 iPriv->iWapAPRecord->StoreL( Session() ); |
|
2201 } |
|
2202 else |
|
2203 { |
|
2204 iPriv->iWapAPRecord->ModifyL( Session() ); |
|
2205 } |
|
2206 |
|
2207 if ( !iPriv->iWapIPBearerRecord->RecordId() ) |
|
2208 { |
|
2209 iPriv->iWapIPBearerRecord->iWAPAccessPointId = iPriv->iWapAPRecord->RecordId(); |
|
2210 iPriv->iWapIPBearerRecord->iWAPIAP = iIapId; |
|
2211 |
|
2212 iPriv->iWapIPBearerRecord->SetRecordId( KCDNewRecordRequest ); |
|
2213 iPriv->iWapIPBearerRecord->StoreL( Session() ); |
|
2214 } |
|
2215 else |
|
2216 { |
|
2217 iPriv->iWapIPBearerRecord->ModifyL( Session() ); |
|
2218 } |
|
2219 } |
|
2220 |
|
2221 // --------------------------------------------------------------------------- |
|
2222 // CCmPluginBaseEng::NewWapRecordL |
|
2223 // --------------------------------------------------------------------------- |
|
2224 // |
|
2225 void CCmPluginBaseEng::NewWapRecordL() |
|
2226 { |
|
2227 LOGGER_ENTERFN( "CCmPluginBaseEng::NewWapBearerRecordL" ); |
|
2228 |
|
2229 if ( !iPriv->iWapIPBearerRecord ) |
|
2230 { |
|
2231 iPriv->iWapIPBearerRecord = static_cast<CCDWAPIPBearerRecord *> |
|
2232 (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
2233 iPriv->iWapIPBearerRecord->iWAPProxyPort = 0; |
|
2234 iPriv->iWapIPBearerRecord->iWAPWSPOption = ECmWapWspOptionConnectionOriented; |
|
2235 iPriv->iWapIPBearerRecord->iWAPSecurity = EFalse; |
|
2236 } |
|
2237 |
|
2238 if ( !iPriv->iWapAPRecord ) |
|
2239 { |
|
2240 iPriv->iWapAPRecord = static_cast<CCDWAPAccessPointRecord *> |
|
2241 (CCDRecordBase::RecordFactoryL(KCDTIdWAPAccessPointRecord)); |
|
2242 // SMS bearer is not supported by this version |
|
2243 iPriv->iWapAPRecord->iWAPCurrentBearer.SetL( |
|
2244 TPtrC(KCDTypeNameWAPIPBearer) ); |
|
2245 } |
|
2246 } |
|
2247 |
|
2248 // --------------------------------------------------------------------------- |
|
2249 // CCmPluginBaseEng::NewSeamlessnessRecordL |
|
2250 // --------------------------------------------------------------------------- |
|
2251 // |
|
2252 CCDIAPMetadataRecord* CCmPluginBaseEng::NewSeamlessnessRecordL( TBool aSetDef ) |
|
2253 { |
|
2254 LOGGER_ENTERFN( "CCmPluginBaseEng::NewSeamlessnessRecordL" ); |
|
2255 |
|
2256 CCDIAPMetadataRecord* record = new (ELeave) CCDIAPMetadataRecord( |
|
2257 iCmMgr.SeamlessnessTableId() ); |
|
2258 |
|
2259 if( aSetDef ) |
|
2260 { |
|
2261 record->iSeamlessness = ESeamlessnessConfirmFirst; |
|
2262 } |
|
2263 |
|
2264 return record; |
|
2265 } |
|
2266 |
|
2267 // --------------------------------------------------------------------------- |
|
2268 // CCmPluginBaseEng::SetAttribute |
|
2269 // --------------------------------------------------------------------------- |
|
2270 // |
|
2271 void CCmPluginBaseEng::SetAttribute( CCDRecordBase* aRecord, |
|
2272 TUint32 aAttribute, |
|
2273 TBool aSet ) |
|
2274 { |
|
2275 LOGGER_ENTERFN( "CCmPluginBaseEng::SetAttribute" ); |
|
2276 |
|
2277 if ( aSet ) |
|
2278 { |
|
2279 aRecord->SetAttributes( aAttribute ); |
|
2280 } |
|
2281 else |
|
2282 { |
|
2283 aRecord->ClearAttributes( aAttribute ); |
|
2284 } |
|
2285 } |
|
2286 |
|
2287 // --------------------------------------------------------------------------- |
|
2288 // CCmPluginBaseEng::CopyAttributes |
|
2289 // --------------------------------------------------------------------------- |
|
2290 // |
|
2291 void CCmPluginBaseEng::CopyAttributes( CCDRecordBase* aSrcRecord, |
|
2292 CCDRecordBase* aDstRecord ) |
|
2293 { |
|
2294 LOGGER_ENTERFN( "CCmPluginBaseEng::CopyAttributes" ); |
|
2295 |
|
2296 TMDBAttributeFlags attr( aSrcRecord->Attributes() ); |
|
2297 |
|
2298 aDstRecord->SetAttributes( attr ); |
|
2299 } |
|
2300 |
|
2301 // --------------------------------------------------------------------------- |
|
2302 // CCmPluginBaseEng::FindWAPRecordL |
|
2303 // --------------------------------------------------------------------------- |
|
2304 // |
|
2305 CCDWAPIPBearerRecord* CCmPluginBaseEng::FindWAPRecordL() |
|
2306 { |
|
2307 LOGGER_ENTERFN( "CCmPluginBaseEng::FindWAPRecordL" ); |
|
2308 |
|
2309 CMDBRecordSet<CCDWAPIPBearerRecord>* wapRS = |
|
2310 new(ELeave) |
|
2311 CMDBRecordSet<CCDWAPIPBearerRecord>(KCDTIdWAPIPBearerRecord); |
|
2312 CleanupStack::PushL( wapRS ); |
|
2313 |
|
2314 CCDWAPIPBearerRecord* wapBearerRecord = static_cast<CCDWAPIPBearerRecord *> |
|
2315 (CCDRecordBase::RecordFactoryL(KCDTIdWAPIPBearerRecord)); |
|
2316 |
|
2317 CleanupStack::PushL( wapBearerRecord ); |
|
2318 |
|
2319 wapBearerRecord->iWAPIAP = iIapId; |
|
2320 wapRS->iRecords.AppendL( wapBearerRecord ); |
|
2321 |
|
2322 CleanupStack::Pop( wapBearerRecord ); |
|
2323 wapBearerRecord = NULL; |
|
2324 |
|
2325 if ( wapRS->FindL(Session()) ) |
|
2326 { |
|
2327 CLOG_WRITE( "WAP bearer record found" ); |
|
2328 |
|
2329 wapBearerRecord = |
|
2330 static_cast<CCDWAPIPBearerRecord *>(wapRS->iRecords[0]); |
|
2331 |
|
2332 // we take over the ownership of this record |
|
2333 wapRS->iRecords.Remove( 0 ); |
|
2334 } |
|
2335 |
|
2336 CleanupStack::PopAndDestroy( wapRS ); |
|
2337 |
|
2338 return wapBearerRecord; |
|
2339 } |
|
2340 |
|
2341 // --------------------------------------------------------------------------- |
|
2342 // CCmPluginBaseEng::FindSeamlessnessRecordL |
|
2343 // --------------------------------------------------------------------------- |
|
2344 // |
|
2345 CCDIAPMetadataRecord* CCmPluginBaseEng::FindSeamlessnessRecordL() |
|
2346 { |
|
2347 LOGGER_ENTERFN( "CCmPluginBaseEng::FindSeamlessnessRecordL" ); |
|
2348 |
|
2349 CMDBRecordSet<CCDIAPMetadataRecord>* slnRS = |
|
2350 new(ELeave) CMDBRecordSet<CCDIAPMetadataRecord>(iCmMgr.SeamlessnessTableId()); |
|
2351 CleanupStack::PushL( slnRS ); |
|
2352 |
|
2353 CCDIAPMetadataRecord* slnRecord = |
|
2354 new (ELeave) CCDIAPMetadataRecord( iCmMgr.SeamlessnessTableId() ); |
|
2355 |
|
2356 slnRecord->iIAP = IAPRecordElementId(); |
|
2357 slnRS->iRecords.AppendL( slnRecord ); |
|
2358 |
|
2359 slnRecord = NULL; |
|
2360 |
|
2361 if ( slnRS->FindL(Session()) ) |
|
2362 { |
|
2363 CMDBRecordBase* record = slnRS->iRecords[0]; |
|
2364 |
|
2365 slnRecord = NewSeamlessnessRecordL( EFalse ); |
|
2366 slnRecord->SetRecordId( record->RecordId() ); |
|
2367 |
|
2368 // This can leave only in case of OOM. |
|
2369 slnRecord->LoadL( Session() ); |
|
2370 } |
|
2371 else |
|
2372 { |
|
2373 slnRecord = NewSeamlessnessRecordL( ETrue ); |
|
2374 } |
|
2375 |
|
2376 CleanupStack::PopAndDestroy( slnRS ); |
|
2377 |
|
2378 return slnRecord; |
|
2379 } |
|
2380 |
|
2381 // --------------------------------------------------------------------------- |
|
2382 // CCmPluginBaseEng::DoMakeValidNameL |
|
2383 // --------------------------------------------------------------------------- |
|
2384 // |
|
2385 HBufC* CCmPluginBaseEng::DoMakeValidNameL( const TDesC& aName ) |
|
2386 { |
|
2387 LOGGER_ENTERFN( "CCmPluginBaseEng::DoMakeValidNameL" ); |
|
2388 |
|
2389 TBool changed( EFalse ); |
|
2390 HBufC* temp = HBufC::NewLC( KApMaxConnNameLength ); |
|
2391 HBufC* temp2 = HBufC::NewLC( KApMaxConnNameLength ); |
|
2392 |
|
2393 HBufC* corrname = EnsureMaxLengthLC( aName, changed ); |
|
2394 *temp = *corrname; |
|
2395 TInt postfix( 0 ); |
|
2396 TInt pf( 0 ); |
|
2397 TInt i( 0 ); |
|
2398 TBool valid ( EFalse ); |
|
2399 |
|
2400 TPtrC prefix = GetPrefix( *corrname ); |
|
2401 |
|
2402 postfix = GetPostfix( *temp, prefix ); |
|
2403 postfix = -1; |
|
2404 do |
|
2405 { |
|
2406 valid = IsValidNameL( *temp ); |
|
2407 if ( !valid ) |
|
2408 { |
|
2409 changed = ETrue; |
|
2410 postfix++; |
|
2411 // check the length of postfix, check text length accordingly |
|
2412 pf = postfix; |
|
2413 for (i=1; i<10; i++) |
|
2414 { |
|
2415 pf /= 10; |
|
2416 if ( !pf ) |
|
2417 { |
|
2418 break; |
|
2419 } |
|
2420 } |
|
2421 TPtr sgdptr( temp->Des() ); |
|
2422 TPtr sgdptr2( temp2->Des() ); |
|
2423 if ( postfix ) |
|
2424 { |
|
2425 if ( postfix < 10 ) |
|
2426 { |
|
2427 sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 3 ); |
|
2428 } |
|
2429 else |
|
2430 { |
|
2431 sgdptr2 = prefix.Left( KApMaxConnNameLength - i - 2 ); |
|
2432 } |
|
2433 } |
|
2434 else |
|
2435 { |
|
2436 sgdptr2 = prefix.Left( KApMaxConnNameLength ); |
|
2437 } |
|
2438 if ( postfix ) |
|
2439 { |
|
2440 TBuf< KMaxPostfixLength > postfixString; |
|
2441 if ( postfix > 9 ) |
|
2442 { |
|
2443 postfixString.Format( KFormatLargePostfix, postfix ); |
|
2444 AknTextUtils::LanguageSpecificNumberConversion( postfixString ); |
|
2445 } |
|
2446 else |
|
2447 { |
|
2448 postfixString.Format( KFormatPostfix, postfix ); |
|
2449 AknTextUtils::LanguageSpecificNumberConversion( postfixString ); |
|
2450 } |
|
2451 sgdptr.Format( KFormatNameWithPostfix, &sgdptr2, |
|
2452 &postfixString ); |
|
2453 } |
|
2454 else |
|
2455 { |
|
2456 sgdptr.Format( KFormatNoPostfix, &sgdptr2 ); |
|
2457 } |
|
2458 } |
|
2459 } while ( !valid ); |
|
2460 |
|
2461 CleanupStack::PopAndDestroy( corrname ); |
|
2462 CleanupStack::PopAndDestroy( temp2 ); |
|
2463 |
|
2464 if ( changed ) |
|
2465 { |
|
2466 CLOG_WRITE_1( "New name: [%S]", temp ); |
|
2467 CleanupStack::Pop( temp ); |
|
2468 } |
|
2469 else |
|
2470 { |
|
2471 CleanupStack::PopAndDestroy( temp ); |
|
2472 temp = NULL; |
|
2473 } |
|
2474 |
|
2475 return temp; |
|
2476 } |
|
2477 |
|
2478 // --------------------------------------------------------------------------- |
|
2479 // CCmPluginBaseEng::EnsureMaxLengthLC |
|
2480 // --------------------------------------------------------------------------- |
|
2481 // |
|
2482 HBufC* CCmPluginBaseEng::EnsureMaxLengthLC( const TDesC& aName, |
|
2483 TBool& aChanged ) |
|
2484 { |
|
2485 LOGGER_ENTERFN( "CCmPluginBaseEng::EnsureMaxLengthLC" ); |
|
2486 |
|
2487 TInt length = aName.Length(); |
|
2488 |
|
2489 aChanged = EFalse; |
|
2490 |
|
2491 if ( !length ) |
|
2492 { |
|
2493 // Name is required. |
|
2494 User::Leave( KErrArgument ); |
|
2495 } |
|
2496 |
|
2497 HBufC* corrname; |
|
2498 if ( KApMaxConnNameLength < length ) |
|
2499 { // name too long, truncate. |
|
2500 corrname = aName.Left( KApMaxConnNameLength ).AllocLC(); |
|
2501 aChanged = ETrue; |
|
2502 } |
|
2503 else |
|
2504 { |
|
2505 corrname = aName.AllocLC(); |
|
2506 corrname->Des().Trim(); |
|
2507 if ( corrname->Length() == 0 ) |
|
2508 { |
|
2509 User::Leave( KErrArgument ); |
|
2510 } |
|
2511 // comes here only if name is valid |
|
2512 if ( corrname->Length() != aName.Length() ) |
|
2513 { |
|
2514 aChanged = ETrue; |
|
2515 } |
|
2516 } |
|
2517 |
|
2518 return corrname; |
|
2519 } |
|
2520 |
|
2521 // --------------------------------------------------------------------------- |
|
2522 // Given aName in the format <prefix> or <prefix><brace><integer><brace>, |
|
2523 // return a pointer to the leading part. |
|
2524 // That is, if there is trailing <space><integer>, |
|
2525 // then that is excluded; if there is no trailing part, then the original |
|
2526 // decriptor is returned. |
|
2527 // Examples: |
|
2528 // - "Foo" returns "Foo"; |
|
2529 // - "Foo 12" returns "Foo 12"; |
|
2530 // - "Foo(12)" returns "Foo"; |
|
2531 // - "Foo 12 (34)" returns "Foo 12 "; |
|
2532 // - "Foo bar" returns "Foo bar"; |
|
2533 // - "Foo " returns "Foo ". |
|
2534 // --------------------------------------------------------------------------- |
|
2535 TPtrC CCmPluginBaseEng::GetPrefix( const TDesC& aName ) |
|
2536 { |
|
2537 LOGGER_ENTERFN( "CCmPluginBaseEng::GetPrefix" ); |
|
2538 |
|
2539 TPtrC prefix = aName; |
|
2540 TInt lastBrace = aName.LocateReverse('('); |
|
2541 if ( lastBrace != KErrNotFound ) |
|
2542 { |
|
2543 // aName looks like "<prefix><brace><something>". |
|
2544 // See if <something> is an integer number. |
|
2545 TPtrC num = aName.Right( aName.Length() - lastBrace - 1 ); |
|
2546 TInt val; |
|
2547 TLex lex( num ); |
|
2548 if ( lex.Val( val ) == KErrNone ) |
|
2549 { |
|
2550 // Yes, the trailer is an integer. |
|
2551 prefix.Set( aName.Left( lastBrace ) ); |
|
2552 } |
|
2553 } |
|
2554 return prefix; |
|
2555 } |
|
2556 |
|
2557 |
|
2558 // --------------------------------------------------------------------------- |
|
2559 // If aName is constructed from aPrefix with a postfix, get the numeric |
|
2560 // value of the postfix, e.g: |
|
2561 // - GetPostfix( "Foo (3)", "Foo" ) == 3 |
|
2562 // - GetPostfix( "Foo 23 (45)", "Foo 23" ) == 45 |
|
2563 // If aName is the same as aPrefix, return 0, e.g.: |
|
2564 // - GetPostfix( "Foo", "Foo" ) == 0 |
|
2565 // If aName is not constructed from aPrefix, return -1, e.g.: |
|
2566 // - GetPostfix( "Foobar", "Foo" ) == -1 |
|
2567 // - GetPostfix( "Fo 23 45", "Foo" ) == -1 |
|
2568 // --------------------------------------------------------------------------- |
|
2569 TInt CCmPluginBaseEng::GetPostfix( const TDesC& aName, const TDesC& aPrefix ) |
|
2570 { |
|
2571 LOGGER_ENTERFN( "CCmPluginBaseEng::GetPostfix" ); |
|
2572 TInt postfix( KErrNotFound ); |
|
2573 TInt nameLength = aName.Length(); |
|
2574 TInt prefixLength = aPrefix.Length(); |
|
2575 if ( nameLength >= prefixLength && aName.FindF( aPrefix ) == 0 ) |
|
2576 { |
|
2577 // aName is longer or equal length, and |
|
2578 // aPrefix can be found in the beginning of aName. |
|
2579 if ( nameLength == prefixLength ) |
|
2580 { |
|
2581 // They have the same length; they equal. |
|
2582 postfix = 0; |
|
2583 } |
|
2584 else |
|
2585 { |
|
2586 if ( prefixLength > 0 ) |
|
2587 { |
|
2588 if ( aName[ prefixLength ] == '(' ) |
|
2589 { |
|
2590 // (Now we know that aName is longer than aPrefix.) |
|
2591 // aName looks like "aPrefix<brace><something>". |
|
2592 // See if <something> is an integer number. |
|
2593 TPtrC num = aName.Right( nameLength - prefixLength - 1 ); |
|
2594 TBuf< KApMaxConnNameLength > pf; |
|
2595 pf = num; |
|
2596 AknTextUtils::ConvertDigitsTo( pf, EDigitTypeWestern ); |
|
2597 TInt val; |
|
2598 TLex lex( pf ); |
|
2599 if ( lex.Val( val ) == KErrNone ) |
|
2600 { |
|
2601 // Yes, the trailer is an integer. |
|
2602 if ( val > 0 ) |
|
2603 { |
|
2604 postfix = val; |
|
2605 } |
|
2606 else |
|
2607 { |
|
2608 // signal that it is invalid... |
|
2609 postfix = -1; |
|
2610 } |
|
2611 } |
|
2612 } |
|
2613 } |
|
2614 else |
|
2615 { |
|
2616 postfix = -1; |
|
2617 } |
|
2618 } |
|
2619 } |
|
2620 return postfix; |
|
2621 } |
|
2622 |
|
2623 // --------------------------------------------------------------------------- |
|
2624 // CCmPluginBaseEng::IsValidNameL |
|
2625 // --------------------------------------------------------------------------- |
|
2626 // |
|
2627 TBool CCmPluginBaseEng::IsValidNameL( const TDesC& aNameText ) |
|
2628 { |
|
2629 LOGGER_ENTERFN( "CCmPluginBaseEng::IsValidNameL" ); |
|
2630 |
|
2631 TBool retVal( ETrue ); |
|
2632 |
|
2633 OpenTransactionLC(); |
|
2634 |
|
2635 CMDBRecordSet<CCDIAPRecord>* iapRS = |
|
2636 new(ELeave) CMDBRecordSet<CCDIAPRecord>(KCDTIdIAPRecord); |
|
2637 CleanupStack::PushL(iapRS); |
|
2638 |
|
2639 CCDIAPRecord* iapRecord = static_cast<CCDIAPRecord *> |
|
2640 (CCDRecordBase::RecordFactoryL(KCDTIdIAPRecord)); |
|
2641 |
|
2642 CleanupStack::PushL( iapRecord ); |
|
2643 |
|
2644 // Prime record |
|
2645 iapRecord->iRecordName.SetL( aNameText ); |
|
2646 |
|
2647 iapRS->iRecords.AppendL( iapRecord ); |
|
2648 |
|
2649 CleanupStack::Pop( iapRecord ); |
|
2650 |
|
2651 iapRecord = NULL; |
|
2652 |
|
2653 if ( iapRS->FindL(Session()) ) |
|
2654 { |
|
2655 if ( iIapId ) |
|
2656 // this is not a new CM |
|
2657 { |
|
2658 for ( TInt i = 0; i < iapRS->iRecords.Count(); ++i ) |
|
2659 { |
|
2660 if ( iapRS->iRecords[i]->RecordId() != iIapId ) |
|
2661 // duplication because it's not our name |
|
2662 { |
|
2663 retVal = EFalse; |
|
2664 break; |
|
2665 } |
|
2666 } |
|
2667 } |
|
2668 else |
|
2669 // new CM -> any occurence is a duplication |
|
2670 { |
|
2671 retVal = EFalse; |
|
2672 } |
|
2673 } |
|
2674 |
|
2675 CleanupStack::PopAndDestroy( iapRS ); |
|
2676 |
|
2677 RollbackTransaction(); |
|
2678 |
|
2679 return retVal; |
|
2680 } |
|
2681 |
|
2682 // --------------------------------------------------------------------------- |
|
2683 // CCmPluginBaseEng::EscapeTextLC |
|
2684 // --------------------------------------------------------------------------- |
|
2685 // |
|
2686 HBufC* CCmPluginBaseEng::EscapeTextLC( const TDesC& aLiteral ) |
|
2687 { |
|
2688 LOGGER_ENTERFN( "CCmPluginBaseEng::EscapeTextLC" ); |
|
2689 |
|
2690 TInt l( aLiteral.Length() ); |
|
2691 //> 2*, to ensure correct esc. even if ALL chars are quotes... |
|
2692 HBufC* retbuf = HBufC::NewLC( 2*l ); |
|
2693 TPtr ret = retbuf->Des(); |
|
2694 TUint quote( '\'' ); // TChar gives warnings in THUMB & ARMI |
|
2695 TInt i( 0 ); |
|
2696 |
|
2697 for ( i=0; i<l; i++ ) |
|
2698 { |
|
2699 ret.Append( aLiteral[i] ); |
|
2700 if ( aLiteral[i] == quote ) |
|
2701 { |
|
2702 // Duplicate quote. |
|
2703 ret.Append( quote ); |
|
2704 } |
|
2705 } |
|
2706 return retbuf; |
|
2707 } |
|
2708 |
|
2709 // --------------------------------------------------------------------------- |
|
2710 // CCmPluginBaseEng::SetNameL |
|
2711 // --------------------------------------------------------------------------- |
|
2712 // |
|
2713 void CCmPluginBaseEng::SetNameL( const TDesC& aName ) |
|
2714 { |
|
2715 LOGGER_ENTERFN( "CCmPluginBaseEng::SetNameL" ); |
|
2716 |
|
2717 if ( iPriv->iNamingMethod == ENamingNothing ) |
|
2718 { |
|
2719 iIapRecord->iRecordName.SetL( aName ); |
|
2720 } |
|
2721 else if ( iPriv->iNamingMethod == ENamingUnique ) |
|
2722 { |
|
2723 HBufC* newName = DoMakeValidNameL( aName ); |
|
2724 |
|
2725 if ( newName ) |
|
2726 // name converted to unique |
|
2727 { |
|
2728 CleanupStack::PushL( newName ); |
|
2729 iIapRecord->iRecordName.SetL( *newName ); |
|
2730 CleanupStack::PopAndDestroy( newName ); |
|
2731 } |
|
2732 else |
|
2733 { |
|
2734 iIapRecord->iRecordName.SetL( aName ); |
|
2735 } |
|
2736 } |
|
2737 else if ( iPriv->iNamingMethod == ENamingNotAccept ) |
|
2738 { |
|
2739 if ( IsValidNameL( aName ) ) |
|
2740 { |
|
2741 iIapRecord->iRecordName.SetL( aName ); |
|
2742 } |
|
2743 else |
|
2744 { |
|
2745 User::Leave( KErrArgument ); |
|
2746 } |
|
2747 } |
|
2748 else |
|
2749 { |
|
2750 User::Leave( KErrCorrupt ); |
|
2751 } |
|
2752 |
|
2753 CLOG_WRITE_1( "Finale name: [%S]", &FIELD_TO_TDESC(iIapRecord->iRecordName) ); |
|
2754 } |
|
2755 |
|
2756 // --------------------------------------------------------------------------- |
|
2757 // CCmPluginBaseEng::AddConverstionTableL |
|
2758 // --------------------------------------------------------------------------- |
|
2759 // |
|
2760 EXPORT_C void CCmPluginBaseEng::AddConverstionTableL( CCDRecordBase* *aRecord, |
|
2761 TBool* aEnabled, |
|
2762 const TCmAttribConvTable* aConvTable ) |
|
2763 { |
|
2764 LOGGER_ENTERFN( "CCmPluginBaseEng::AddConverstionTableL" ); |
|
2765 TCmAttrConvArrayItem* item = new (ELeave) TCmAttrConvArrayItem; |
|
2766 |
|
2767 item->iRecord = aRecord; |
|
2768 item->iEnabled = aEnabled; |
|
2769 item->iConvTable = aConvTable; |
|
2770 |
|
2771 iPriv->iConvTblArray->AppendL( item ); |
|
2772 } |
|
2773 |
|
2774 // --------------------------------------------------------------------------- |
|
2775 // CCmPluginBaseEng::AddCommonConversionTableL |
|
2776 // --------------------------------------------------------------------------- |
|
2777 // |
|
2778 EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( |
|
2779 const TCmCommonAttrConvArrayItem* aConvTable ) |
|
2780 { |
|
2781 LOGGER_ENTERFN( "CCmPluginBaseEng::AddCommonConversionTableL" ); |
|
2782 |
|
2783 User::LeaveIfError( iPriv->iCommonConvTblArray.Append( aConvTable ) ); |
|
2784 } |
|
2785 |
|
2786 // --------------------------------------------------------------------------- |
|
2787 // CCmPluginBaseEng::RemoveConversionTable |
|
2788 // --------------------------------------------------------------------------- |
|
2789 // |
|
2790 EXPORT_C void CCmPluginBaseEng::RemoveConversionTable( |
|
2791 const TCmAttribConvTable* aConvTable ) |
|
2792 { |
|
2793 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveConversionTable" ); |
|
2794 |
|
2795 for ( TInt i = 0; i < iPriv->iConvTblArray->Count(); ++i ) |
|
2796 { |
|
2797 if ( (*iPriv->iConvTblArray)[i]->iConvTable == aConvTable ) |
|
2798 { |
|
2799 delete (*iPriv->iConvTblArray)[i]; |
|
2800 iPriv->iConvTblArray->Delete( i ); |
|
2801 } |
|
2802 } |
|
2803 } |
|
2804 |
|
2805 // --------------------------------------------------------------------------- |
|
2806 // CCmPluginBaseEng::RemoveCommonConversionTable |
|
2807 // --------------------------------------------------------------------------- |
|
2808 // |
|
2809 EXPORT_C void CCmPluginBaseEng::RemoveCommonConversionTable( |
|
2810 const TCmCommonAttrConvArrayItem* aConvTable ) |
|
2811 { |
|
2812 LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" ); |
|
2813 |
|
2814 // When calling Remove(), it's safer to loop starting from end. |
|
2815 for ( TInt i = iPriv->iCommonConvTblArray.Count()-1; i >= 0; i-- ) |
|
2816 { |
|
2817 if ( iPriv->iCommonConvTblArray[i] == aConvTable ) |
|
2818 { |
|
2819 iPriv->iCommonConvTblArray.Remove( i ); |
|
2820 } |
|
2821 } |
|
2822 } |
|
2823 |
|
2824 // --------------------------------------------------------------------------- |
|
2825 // CCmPluginBaseEng::FindFieldL |
|
2826 // --------------------------------------------------------------------------- |
|
2827 // |
|
2828 TValidationFunctionL CCmPluginBaseEng::FindFieldL( TUint32 aAttribute, |
|
2829 TCMFieldTypes aType, |
|
2830 CMDBElement* &aElement ) const |
|
2831 { |
|
2832 LOGGER_ENTERFN( "CCmPluginBaseEng::FindFieldL" ); |
|
2833 |
|
2834 TValidationFunctionL func = NULL; |
|
2835 const TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute ); |
|
2836 |
|
2837 aElement = NULL; |
|
2838 |
|
2839 if( !foundItem ) |
|
2840 { |
|
2841 User::Leave( KErrNotSupported ); |
|
2842 } |
|
2843 |
|
2844 if ( foundItem->iEnabled ) |
|
2845 { |
|
2846 if ( !(*foundItem->iEnabled) ) |
|
2847 { |
|
2848 User::Leave( KErrNotSupported ); |
|
2849 } |
|
2850 } |
|
2851 |
|
2852 if ( !(*foundItem->iRecord) ) |
|
2853 { |
|
2854 User::Leave( KErrNotSupported ); |
|
2855 } |
|
2856 |
|
2857 TInt index( 0 ); |
|
2858 CMDBElement& field = FieldByAttributeL( foundItem, aAttribute, index ); |
|
2859 switch ( field.Type() ) |
|
2860 { |
|
2861 case EText: |
|
2862 case EMedText: |
|
2863 case ELongText: |
|
2864 { |
|
2865 if ( aType == ECmText ) |
|
2866 { |
|
2867 aElement = &field; |
|
2868 } |
|
2869 } |
|
2870 break; |
|
2871 |
|
2872 case EDesC8: |
|
2873 { |
|
2874 if ( aType == ECmText8 ) |
|
2875 { |
|
2876 aElement = &field; |
|
2877 } |
|
2878 } |
|
2879 break; |
|
2880 |
|
2881 case EUint32: |
|
2882 case EInt: |
|
2883 case EBool: |
|
2884 { |
|
2885 if ( aType == ECmInt || |
|
2886 aType == ECmBool ) |
|
2887 { |
|
2888 aElement = &field; |
|
2889 } |
|
2890 } |
|
2891 break; |
|
2892 |
|
2893 default: |
|
2894 { |
|
2895 User::Leave( KErrArgument ); |
|
2896 } |
|
2897 break; |
|
2898 } |
|
2899 |
|
2900 if( aElement ) |
|
2901 { |
|
2902 func = foundItem->iConvTable[index].iValidFuncL; |
|
2903 } |
|
2904 else |
|
2905 { |
|
2906 User::Leave( KErrNotSupported ); |
|
2907 } |
|
2908 |
|
2909 return func; |
|
2910 } |
|
2911 |
|
2912 // --------------------------------------------------------------------------- |
|
2913 // CCmPluginBaseEng::Reset |
|
2914 // --------------------------------------------------------------------------- |
|
2915 // |
|
2916 EXPORT_C void CCmPluginBaseEng::Reset() |
|
2917 { |
|
2918 LOGGER_ENTERFN( "CCmPluginBaseEng::Reset" ); |
|
2919 |
|
2920 iIapId = 0; |
|
2921 |
|
2922 delete iIapRecord; iIapRecord = NULL; |
|
2923 delete iProxyRecord; iProxyRecord = NULL; |
|
2924 delete iServiceRecord; iServiceRecord = NULL; |
|
2925 delete iChargeCardRecord; iChargeCardRecord = NULL; |
|
2926 delete iNetworkRecord; iNetworkRecord = NULL; |
|
2927 delete iLocationRecord; iLocationRecord = NULL; |
|
2928 if ( iPriv ) |
|
2929 { |
|
2930 iPriv->iLoadResult = KErrNone; |
|
2931 delete iPriv->iWapAPRecord; iPriv->iWapAPRecord = NULL; |
|
2932 delete iPriv->iWapIPBearerRecord; iPriv->iWapIPBearerRecord = NULL; |
|
2933 delete iPriv->iMetaDataRecord; iPriv->iMetaDataRecord = NULL; |
|
2934 } |
|
2935 |
|
2936 iChargeCardEnabled = EFalse; |
|
2937 iLocationEnabled = EFalse; |
|
2938 } |
|
2939 |
|
2940 |
|
2941 // --------------------------------------------------------------------------- |
|
2942 // CCmPluginBaseEng::CheckIfAlreadyConnected |
|
2943 // --------------------------------------------------------------------------- |
|
2944 EXPORT_C TBool CCmPluginBaseEng::CheckIfAlreadyConnected() const |
|
2945 { |
|
2946 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfAlreadyConnected" ); |
|
2947 |
|
2948 TBool retVal( EFalse ); |
|
2949 RSocketServ serv; |
|
2950 RConnection connection; |
|
2951 TUint count; |
|
2952 |
|
2953 if ( serv.Connect() == KErrNone ) |
|
2954 { |
|
2955 if ( connection.Open( serv, KAfInet ) == KErrNone ) |
|
2956 { |
|
2957 if ( connection.EnumerateConnections( count ) == KErrNone ) |
|
2958 { |
|
2959 TPckgBuf<TConnectionInfo> connInfo; |
|
2960 |
|
2961 for ( TUint32 i = 1; i <= count; ++i ) |
|
2962 { |
|
2963 connection.GetConnectionInfo( i, connInfo ); |
|
2964 |
|
2965 if ( connInfo().iIapId == iIapId ) |
|
2966 { |
|
2967 CLOG_WRITE( "Found connection" ); |
|
2968 retVal = ETrue; |
|
2969 break; |
|
2970 } |
|
2971 } |
|
2972 } |
|
2973 |
|
2974 connection.Close(); |
|
2975 } |
|
2976 |
|
2977 serv.Close(); |
|
2978 } |
|
2979 |
|
2980 return retVal; |
|
2981 } |
|
2982 |
|
2983 // --------------------------------------------------------------------------- |
|
2984 // CCmPluginBaseEng::CheckIfNameModifiedL |
|
2985 // --------------------------------------------------------------------------- |
|
2986 EXPORT_C void |
|
2987 CCmPluginBaseEng::CheckIfNameModifiedL( CCDRecordBase* aRecord ) const |
|
2988 { |
|
2989 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckIfNameModifiedL" ); |
|
2990 |
|
2991 if ( !TPtrC(iIapRecord->iRecordName).CompareF( TPtrC(aRecord->iRecordName)) ) |
|
2992 // names matche |
|
2993 { |
|
2994 return; |
|
2995 } |
|
2996 |
|
2997 aRecord->iRecordName.SetL( TPtrC(iIapRecord->iRecordName) ); |
|
2998 } |
|
2999 |
|
3000 // --------------------------------------------------------------------------- |
|
3001 // CCmPluginBaseEng::IAPRecordElementId |
|
3002 // --------------------------------------------------------------------------- |
|
3003 TMDBElementId CCmPluginBaseEng::IAPRecordElementId() const |
|
3004 { |
|
3005 LOGGER_ENTERFN( "CCmPluginBaseEng::IAPRecordElementId" ); |
|
3006 |
|
3007 return ( KCDMaskShowField & iIapRecord->ElementId() ); |
|
3008 } |
|
3009 |
|
3010 // --------------------------------------------------------------------------- |
|
3011 // CCmPluginBaseEng::IsProtected |
|
3012 // --------------------------------------------------------------------------- |
|
3013 TBool CCmPluginBaseEng::IsProtected() const |
|
3014 { |
|
3015 LOGGER_ENTERFN( "CCmPluginBaseEng::IsProtected" ); |
|
3016 |
|
3017 return ( iIapRecord->Attributes() & ECDProtectedWrite ); |
|
3018 } |
|
3019 |
|
3020 // --------------------------------------------------------------------------- |
|
3021 // CCmPluginBaseEng::GetLocationIdL |
|
3022 // --------------------------------------------------------------------------- |
|
3023 TUint32 CCmPluginBaseEng::GetLocationIdL() const |
|
3024 { |
|
3025 LOGGER_ENTERFN( "CCmPluginBaseEng::GetLocationIdL" ); |
|
3026 |
|
3027 TUint32 locId( 0 ); |
|
3028 CMDBRecordSet<CCDLocationRecord>* locRS = |
|
3029 new(ELeave) CMDBRecordSet<CCDLocationRecord>(KCDTIdLocationRecord); |
|
3030 CleanupStack::PushL( locRS ); |
|
3031 |
|
3032 CCDLocationRecord* locRecord = static_cast<CCDLocationRecord *> |
|
3033 (CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord)); |
|
3034 |
|
3035 CleanupStack::PushL( locRecord ); |
|
3036 locRecord->iRecordName.SetL( KLocationName ); |
|
3037 locRS->iRecords.AppendL( locRecord ); |
|
3038 CleanupStack::Pop( locRecord ); |
|
3039 |
|
3040 if ( locRS->FindL(Session()) ) |
|
3041 { |
|
3042 locRecord = static_cast<CCDLocationRecord *>(locRS->iRecords[0]); |
|
3043 |
|
3044 locId = locRecord->RecordId(); |
|
3045 } |
|
3046 else |
|
3047 { |
|
3048 CLOG_WRITE( "Loc id not found" ); |
|
3049 User::Leave( KErrNotFound ); |
|
3050 } |
|
3051 |
|
3052 CleanupStack::PopAndDestroy( locRS ); |
|
3053 |
|
3054 return locId; |
|
3055 } |
|
3056 |
|
3057 // --------------------------------------------------------------------------- |
|
3058 // CCmPluginBaseEng::CheckForCommonAttribute |
|
3059 // --------------------------------------------------------------------------- |
|
3060 TUint32 |
|
3061 CCmPluginBaseEng::CheckForCommonAttribute( const TUint32 aAttribute ) const |
|
3062 { |
|
3063 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckForCommonAttribute" ); |
|
3064 |
|
3065 TUint32 convAttr( aAttribute ); |
|
3066 |
|
3067 if ( iPriv->iCommonConvTblArray.Count() && |
|
3068 aAttribute > ECmCommonAttributesStart && |
|
3069 aAttribute < ECmCommonAttributesEnd ) |
|
3070 { |
|
3071 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3072 { |
|
3073 const TCmCommonAttrConvArrayItem* convArray = |
|
3074 iPriv->iCommonConvTblArray[i]; |
|
3075 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3076 { |
|
3077 if ( convArray[item].iCommonAttribId == aAttribute ) |
|
3078 { |
|
3079 return convArray[item].iAttribId; |
|
3080 } |
|
3081 } |
|
3082 } |
|
3083 } |
|
3084 |
|
3085 return convAttr; |
|
3086 } |
|
3087 |
|
3088 // --------------------------------------------------------------------------- |
|
3089 // CCmPluginBaseEng::CommonAttribute |
|
3090 // --------------------------------------------------------------------------- |
|
3091 /*TUint32 CCmPluginBaseEng::CommonAttributeL( const TUint32 aAttribute ) const |
|
3092 { |
|
3093 LOGGER_ENTERFN( "CCmPluginBaseEng::CommonAttribute" ); |
|
3094 |
|
3095 if ( iPriv->iCommonConvTblArray.Count() ) |
|
3096 { |
|
3097 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3098 { |
|
3099 const TCmCommonAttrConvArrayItem* convArray = |
|
3100 iPriv->iCommonConvTblArray[i]; |
|
3101 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3102 { |
|
3103 if ( convArray[item].iAttribId == aAttribute ) |
|
3104 { |
|
3105 return convArray[item].iCommonAttribId; |
|
3106 } |
|
3107 } |
|
3108 } |
|
3109 } |
|
3110 |
|
3111 User::Leave( KErrArgument ); |
|
3112 |
|
3113 return 0; |
|
3114 }*/ |
|
3115 |
|
3116 // --------------------------------------------------------------------------- |
|
3117 // CCmPluginBaseEng::FeatureSupported |
|
3118 // --------------------------------------------------------------------------- |
|
3119 EXPORT_C TBool CCmPluginBaseEng::FeatureSupported( TInt aFeature ) |
|
3120 { |
|
3121 #ifdef _IPV6_DISABLED |
|
3122 if( aFeature == KFeatureIdIPv6 ) |
|
3123 { |
|
3124 return EFalse; |
|
3125 } |
|
3126 #endif |
|
3127 return CCmManagerImpl::FeatureSupported( aFeature ); |
|
3128 } |
|
3129 |
|
3130 // --------------------------------------------------------------------------- |
|
3131 // CCmPluginBaseEng::GlobalBearerPriority |
|
3132 // --------------------------------------------------------------------------- |
|
3133 EXPORT_C TInt |
|
3134 CCmPluginBaseEng::GlobalBearerPriority( const TDesC& aServiceType ) const |
|
3135 { |
|
3136 LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalBearerPriority" ); |
|
3137 |
|
3138 return iCmMgr.GlobalBearerPriority( EFalse, aServiceType ); |
|
3139 } |
|
3140 |
|
3141 // --------------------------------------------------------------------------- |
|
3142 // CCmPluginBaseEng::GlobalUiBearerPriority |
|
3143 // --------------------------------------------------------------------------- |
|
3144 EXPORT_C TInt |
|
3145 CCmPluginBaseEng::GlobalUiBearerPriority( const TDesC& aServiceType ) const |
|
3146 { |
|
3147 LOGGER_ENTERFN( "CCmPluginBaseEng::GlobalUiBearerPriority" ); |
|
3148 |
|
3149 return iCmMgr.GlobalBearerPriority( ETrue, aServiceType ); |
|
3150 } |
|
3151 |
|
3152 // --------------------------------------------------------------------------- |
|
3153 // CCmPluginBaseEng::SetProxyServerNameL |
|
3154 // --------------------------------------------------------------------------- |
|
3155 TBool CCmPluginBaseEng::SetProxyServerNameL( const TDesC& aProxyServer ) |
|
3156 { |
|
3157 LOGGER_ENTERFN( "CCmPluginBaseEng::SetProxyServerNameL" ); |
|
3158 |
|
3159 iProxyRecord->iServerName.SetL( aProxyServer ); |
|
3160 if( !aProxyServer.Length() ) |
|
3161 { |
|
3162 iProxyRecord->iPortNumber = 0; |
|
3163 iProxyRecord->iUseProxyServer = EFalse; |
|
3164 } |
|
3165 else |
|
3166 { |
|
3167 iProxyRecord->iUseProxyServer = ETrue; |
|
3168 } |
|
3169 |
|
3170 return ETrue; |
|
3171 } |
|
3172 |
|
3173 // --------------------------------------------------------------------------- |
|
3174 // CCmPluginBaseEng::ConvTableItemL |
|
3175 // --------------------------------------------------------------------------- |
|
3176 EXPORT_C const TCmAttribConvTable* |
|
3177 CCmPluginBaseEng::ConvTableItem( TUint32 aAttribute ) |
|
3178 { |
|
3179 LOGGER_ENTERFN( "CCmPluginBaseEng::ConvTableItem" ); |
|
3180 |
|
3181 TInt i; |
|
3182 TCmAttrConvArrayItem* foundItem = ConversionTable( aAttribute ); |
|
3183 |
|
3184 if( foundItem ) |
|
3185 { |
|
3186 // From 2nd item, because the first one is for the range. |
|
3187 for ( i = 1; foundItem->iConvTable[i].iAttribId; ++i ) |
|
3188 { |
|
3189 if ( foundItem->iConvTable[i].iAttribId == aAttribute ) |
|
3190 { |
|
3191 return &foundItem->iConvTable[i]; |
|
3192 } |
|
3193 } |
|
3194 } |
|
3195 else |
|
3196 { |
|
3197 // I know that this is a not nice solution, but |
|
3198 // I couldn't find any more inteligent way of adding |
|
3199 // ECmBearerSettingName to the array. |
|
3200 const TCmAttribConvTable* item = SUiTable; |
|
3201 |
|
3202 // This is a where use |
|
3203 for ( i = 0; item[i].iAttribId; ++i ) |
|
3204 { |
|
3205 if( item[i].iAttribId == aAttribute ) |
|
3206 { |
|
3207 return &item[i]; |
|
3208 } |
|
3209 } |
|
3210 } |
|
3211 |
|
3212 return NULL; |
|
3213 } |
|
3214 |
|
3215 // --------------------------------------------------------------------------- |
|
3216 // CCmPluginBaseEng::ConversionTable |
|
3217 // --------------------------------------------------------------------------- |
|
3218 TCmAttrConvArrayItem* |
|
3219 CCmPluginBaseEng::ConversionTable( TUint32 aAttribute ) const |
|
3220 { |
|
3221 LOGGER_ENTERFN( "CCmPluginBaseEng::ConversionTable" ); |
|
3222 |
|
3223 TCmAttrConvArrayItem* foundItem = NULL; |
|
3224 TInt i; |
|
3225 |
|
3226 for ( i = 0; i < iPriv->iConvTblArray->Count(); ++i ) |
|
3227 { |
|
3228 TCmAttrConvArrayItem* item = (*iPriv->iConvTblArray)[i]; |
|
3229 |
|
3230 if ( item->iConvTable[0].iAttribId <= aAttribute && |
|
3231 item->iConvTable[0].iCommsDatId >= aAttribute ) |
|
3232 { |
|
3233 foundItem = item; |
|
3234 break; |
|
3235 } |
|
3236 } |
|
3237 |
|
3238 return foundItem; |
|
3239 } |
|
3240 |
|
3241 // --------------------------------------------------------------------------- |
|
3242 // CCmPluginBaseEng::FieldByAttributeL |
|
3243 // --------------------------------------------------------------------------- |
|
3244 CMDBElement& CCmPluginBaseEng::FieldByAttributeL( |
|
3245 const TCmAttrConvArrayItem* aItem, |
|
3246 const TUint32 aAttribute, |
|
3247 TInt& aIndex ) const |
|
3248 { |
|
3249 LOGGER_ENTERFN( "CCmPluginBaseEng::FieldByAttributeL" ); |
|
3250 |
|
3251 // From 2nd item, because the first one is for the range. |
|
3252 for ( aIndex = 1; aItem->iConvTable[aIndex].iAttribId; ++aIndex ) |
|
3253 { |
|
3254 if ( aItem->iConvTable[aIndex].iAttribId == aAttribute ) |
|
3255 { |
|
3256 return *(*aItem->iRecord)->GetFieldByIdL( |
|
3257 aItem->iConvTable[aIndex].iCommsDatId ); |
|
3258 } |
|
3259 } |
|
3260 |
|
3261 User::Leave( KErrNotFound ); |
|
3262 // Dead code |
|
3263 return *(CMDBElement*)1; |
|
3264 } |
|
3265 |
|
3266 // --------------------------------------------------------------------------- |
|
3267 // CCmPluginBaseEng::SetDNSServerAddressL |
|
3268 // --------------------------------------------------------------------------- |
|
3269 // |
|
3270 EXPORT_C void CCmPluginBaseEng::SetDNSServerAddressL( TUint32 aSrv1Attr, |
|
3271 const TDesC& aSrv1, |
|
3272 TUint32 aSrv2Attr, |
|
3273 const TDesC& aSrv2, |
|
3274 TUint32 aAddrFromSrvAttr, |
|
3275 TBool aIPv6 ) |
|
3276 { |
|
3277 LOGGER_ENTERFN( "CCmPluginBaseEng::SetDNSServerAddressL" ); |
|
3278 |
|
3279 TBool undef1; |
|
3280 TBool undef2; |
|
3281 TPtrC dynamic; |
|
3282 |
|
3283 if( aIPv6 ) |
|
3284 // IPv6 |
|
3285 { |
|
3286 undef1 = ClassifyIPv6Address( aSrv1 ) == EIPv6Unspecified; |
|
3287 undef2 = ClassifyIPv6Address( aSrv2 ) == EIPv6Unspecified; |
|
3288 |
|
3289 dynamic.Set( KDynamicIpv6Address ); |
|
3290 } |
|
3291 else |
|
3292 { |
|
3293 undef1 = IsUnspecifiedIPv4Address( aSrv1 ); |
|
3294 undef2 = IsUnspecifiedIPv4Address( aSrv2 ); |
|
3295 |
|
3296 dynamic.Set( KUnspecifiedIPv4 ); |
|
3297 } |
|
3298 |
|
3299 if( undef1 ) |
|
3300 { |
|
3301 SetStringAttributeL( aSrv1Attr, aSrv2 ); |
|
3302 SetStringAttributeL( aSrv2Attr, dynamic ); |
|
3303 |
|
3304 SetBoolAttributeL( aAddrFromSrvAttr, undef2 ); |
|
3305 } |
|
3306 else |
|
3307 { |
|
3308 SetStringAttributeL( aSrv1Attr, aSrv1 ); |
|
3309 SetStringAttributeL( aSrv2Attr, aSrv2 ); |
|
3310 |
|
3311 SetBoolAttributeL( aAddrFromSrvAttr, EFalse ); |
|
3312 } |
|
3313 } |
|
3314 |
|
3315 // --------------------------------------------------------------------------- |
|
3316 // CCmPluginBaseEng::CheckDNSServerAddressL |
|
3317 // --------------------------------------------------------------------------- |
|
3318 // |
|
3319 EXPORT_C void CCmPluginBaseEng::CheckDNSServerAddressL( TBool aIPv6, |
|
3320 CMDBField<TDesC>& aDNS1, |
|
3321 CMDBField<TDesC>& aDNS2, |
|
3322 CMDBField<TBool>& /*aDNSFromServer*/ ) |
|
3323 { |
|
3324 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckDNSServerAddressL" ); |
|
3325 |
|
3326 // aDNSFromServer is commented out because the API must not set this |
|
3327 // field any more. It is only set from the UI |
|
3328 if( !(aDNS1.ElementId() & KCDChangedFlag) && |
|
3329 !(aDNS2.ElementId() & KCDChangedFlag) ) |
|
3330 // No change |
|
3331 { |
|
3332 return; |
|
3333 } |
|
3334 |
|
3335 if( aIPv6 ) |
|
3336 { |
|
3337 if( ClassifyIPv6Address( aDNS1 ) == EIPv6Unspecified ) |
|
3338 { |
|
3339 if( ClassifyIPv6Address( aDNS2 ) != EIPv6Unspecified ) |
|
3340 { |
|
3341 aDNS1.SetL( aDNS2 ); |
|
3342 aDNS2.SetL( KDynamicIpv6Address ); |
|
3343 } |
|
3344 } |
|
3345 } |
|
3346 else // IPv4 |
|
3347 { |
|
3348 if( IsUnspecifiedIPv4Address( aDNS1 ) ) |
|
3349 { |
|
3350 if( !IsUnspecifiedIPv4Address( aDNS2 ) ) |
|
3351 { |
|
3352 aDNS1.SetL( aDNS2 ); |
|
3353 aDNS2.SetL( KUnspecifiedIPv4 ); |
|
3354 } |
|
3355 } |
|
3356 } |
|
3357 } |
|
3358 |
|
3359 |
|
3360 // --------------------------------------------------------------------------- |
|
3361 // CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL |
|
3362 // --------------------------------------------------------------------------- |
|
3363 // |
|
3364 TBool CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL() const |
|
3365 { |
|
3366 LOGGER_ENTERFN( "CCmPluginBaseEng::CheckSpaceBelowCriticalLevelL" ); |
|
3367 |
|
3368 // OOD handling. If disk space is low user is notified. |
|
3369 RFs fs; |
|
3370 User::LeaveIfError( fs.Connect() ); |
|
3371 CleanupClosePushL<RFs>( fs ); |
|
3372 |
|
3373 // Checks the FFS space "after" addition |
|
3374 TBool belowCL = SysUtil::FFSSpaceBelowCriticalLevelL |
|
3375 ( &fs, KEstimatedOverhead ); |
|
3376 |
|
3377 CleanupStack::PopAndDestroy(); // fs |
|
3378 |
|
3379 if( belowCL ) |
|
3380 { |
|
3381 // Raise a dialog to notify the user. |
|
3382 TCmCommonUi::ShowMemoryFullConfirmationQueryL(); |
|
3383 // It must leave because it is the only way to notify the caller about |
|
3384 // the operation failed. (Its caller does not return indicator.) |
|
3385 // KLeaveWithoutAlert means no more dialog will raise |
|
3386 User::Leave( KLeaveWithoutAlert ); |
|
3387 } |
|
3388 |
|
3389 // Return value keept to have a suitable API |
|
3390 return belowCL; |
|
3391 |
|
3392 } |
|
3393 |
|
3394 // ----------------------------------------------------------------------------- |
|
3395 // CCmPluginBaseEng::IncrementRefCounter |
|
3396 // ----------------------------------------------------------------------------- |
|
3397 void CCmPluginBaseEng::IncrementRefCounter() |
|
3398 { |
|
3399 LOGGER_ENTERFN( "CCmPluginBaseEng::IncrementRefCounter" ); |
|
3400 |
|
3401 iRefCounter++; |
|
3402 } |
|
3403 // ----------------------------------------------------------------------------- |
|
3404 // CCmPluginBaseEng::DecrementRefCounter |
|
3405 // ----------------------------------------------------------------------------- |
|
3406 void CCmPluginBaseEng::DecrementRefCounter() |
|
3407 { |
|
3408 LOGGER_ENTERFN( "CCmPluginBaseEng::DecrementRefCounter" ); |
|
3409 |
|
3410 iRefCounter--; |
|
3411 } |
|
3412 // ----------------------------------------------------------------------------- |
|
3413 // CCmPluginBaseEng::GetRefCounter |
|
3414 // ----------------------------------------------------------------------------- |
|
3415 TInt CCmPluginBaseEng::GetRefCounter() |
|
3416 { |
|
3417 LOGGER_ENTERFN( "CCmPluginBaseEng::GetRefCounter" ); |
|
3418 |
|
3419 return iRefCounter; |
|
3420 } |
|
3421 |
|
3422 // ----------------------------------------------------------------------------- |
|
3423 // CCmPluginBaseEng::IdIsValid |
|
3424 // ----------------------------------------------------------------------------- |
|
3425 TBool CCmPluginBaseEng::IdIsValid() |
|
3426 { |
|
3427 LOGGER_ENTERFN( "CCmPluginBaseEng::IdIsValid" ); |
|
3428 |
|
3429 return iIdIsValid; |
|
3430 } |
|
3431 |
|
3432 |
|
3433 // ----------------------------------------------------------------------------- |
|
3434 // CCmPluginBaseEng::IdIsValid |
|
3435 // ----------------------------------------------------------------------------- |
|
3436 void CCmPluginBaseEng::SetIdValidity(TBool validity) |
|
3437 { |
|
3438 LOGGER_ENTERFN( "CCmPluginBaseEng::SetIdValidity" ); |
|
3439 |
|
3440 iIdIsValid = validity; |
|
3441 } |
|
3442 |
|
3443 |
|
3444 // ----------------------------------------------------------------------------- |
|
3445 // CCmPluginBaseEng::GetRefCounter |
|
3446 // ----------------------------------------------------------------------------- |
|
3447 void CCmPluginBaseEng::GenericStringWriterL( const TUint32 aAttribute, |
|
3448 const TDesC16& aValue ) |
|
3449 { |
|
3450 LOGGER_ENTERFN( "CCmPluginBaseEng::GenericStringWriterL" ); |
|
3451 |
|
3452 TUint32 attribute = CheckForCommonAttribute( aAttribute ); |
|
3453 CMDBField<TDesC>* field; |
|
3454 |
|
3455 TValidationFunctionL func = |
|
3456 FindFieldL( attribute, ECmText, (CMDBElement*&)field ); |
|
3457 |
|
3458 if( func ) |
|
3459 { |
|
3460 func( this, attribute, (const TAny*)&aValue ); |
|
3461 } |
|
3462 |
|
3463 field->SetL( aValue ); |
|
3464 } |
|
3465 |
|
3466 // --------------------------------------------------------------------------- |
|
3467 // CCmPluginBaseEng::MappedCommonAttribute |
|
3468 // --------------------------------------------------------------------------- |
|
3469 TUint32 |
|
3470 CCmPluginBaseEng::MappedCommonAttribute( const TUint32 aAttribute ) const |
|
3471 { |
|
3472 LOGGER_ENTERFN( "CCmPluginBaseEng::MappedCommonAttribute" ); |
|
3473 |
|
3474 TUint32 convAttr( aAttribute ); |
|
3475 |
|
3476 if ( iPriv->iCommonConvTblArray.Count() ) |
|
3477 { |
|
3478 for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i ) |
|
3479 { |
|
3480 const TCmCommonAttrConvArrayItem* convArray = |
|
3481 iPriv->iCommonConvTblArray[i]; |
|
3482 for ( TInt item = 0; convArray[item].iCommonAttribId; ++item ) |
|
3483 { |
|
3484 if ( convArray[item].iAttribId == aAttribute ) |
|
3485 { |
|
3486 return convArray[item].iCommonAttribId; |
|
3487 } |
|
3488 } |
|
3489 } |
|
3490 } |
|
3491 |
|
3492 return convAttr; |
|
3493 } |
|
3494 //----------------------------------------------------------------------------- |
|
3495 // CCmPluginBaseEng::ParentDestination |
|
3496 // ----------------------------------------------------------------------------- |
|
3497 EXPORT_C CCmDestinationImpl* CCmPluginBaseEng::ParentDestination() const |
|
3498 { |
|
3499 LOGGER_ENTERFN( "CCmPluginBaseEng::ParentDestination" ); |
|
3500 |
|
3501 if (iParentDest) |
|
3502 { |
|
3503 CCmDestinationImpl* parentDest = NULL; |
|
3504 TRAPD( err, parentDest = iCmMgr.DestinationL( iParentDest ) ); |
|
3505 if ( !err ) |
|
3506 { |
|
3507 return parentDest; |
|
3508 } |
|
3509 } |
|
3510 |
|
3511 return NULL; |
|
3512 } |
|
3513 |
|
3514 //----------------------------------------------------------------------------- |
|
3515 // CCmPluginBaseEng::GetAdditionalUids |
|
3516 // ----------------------------------------------------------------------------- |
|
3517 EXPORT_C void CCmPluginBaseEng::GetAdditionalUids( RArray<TUint32>& /*aIapIds*/ ) |
|
3518 { |
|
3519 LOGGER_ENTERFN( "CCmPluginBaseEng::GetAdditionalUids" ); |
|
3520 } |
|
3521 |
|
3522 //----------------------------------------------------------------------------- |
|
3523 // CCmPluginBaseEng::SetPreDefinedId |
|
3524 // ----------------------------------------------------------------------------- |
|
3525 EXPORT_C void CCmPluginBaseEng::SetPreDefinedId( const TUint32 aPreDefId ) |
|
3526 { |
|
3527 LOGGER_ENTERFN( "CCmPluginBaseEng::SetPreDefinedId" ); |
|
3528 |
|
3529 iPreDefIapId = aPreDefId; |
|
3530 } |
|
3531 |