|
1 /* |
|
2 * Copyright (c) 2004 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: DS Settings Provisioning Adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <badesca.h> |
|
22 #include <commdb.h> |
|
23 #include <cdbcols.h> // CommsDB columname defs |
|
24 #include <utf.h> |
|
25 #include <stringresourcereader.h> |
|
26 #include <barsread.h> |
|
27 #include <NSmlDSProvisioningAdapter.rsg> |
|
28 #include <bautils.h> |
|
29 #include <ApUtils.h> |
|
30 #include <barsc.h> |
|
31 |
|
32 #include <nsmlconstants.h> |
|
33 #include <nsmldebug.h> |
|
34 #include <nsmldsconstants.h> |
|
35 #include <CWPCharacteristic.h> |
|
36 #include <CWPParameter.h> |
|
37 #include <CWPEngine.h> |
|
38 #include "NSmlDsProvisioningAdapter.h" |
|
39 #include "implementationinformation.h" |
|
40 #include "NSmlTransportHandler.h" |
|
41 #include <WPAdapterUtil.h> |
|
42 |
|
43 _LIT( KInternetString, "INTERNET" ); |
|
44 #include <data_caging_path_literals.hrh> |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CNSmlDsProvisioningAdapter::CNSmlDsProvisioningAdapter |
|
50 // C++ default constructor can NOT contain any code, that |
|
51 // might leave. |
|
52 // ----------------------------------------------------------------------------- |
|
53 CNSmlDsProvisioningAdapter::CNSmlDsProvisioningAdapter() : |
|
54 CWPAdapter(), iToNapIDInternetIndicator(EFalse) |
|
55 { |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CNSmlDsProvisioningAdapter::ConstructL |
|
60 // Symbian 2nd phase constructor can leave. |
|
61 // ----------------------------------------------------------------------------- |
|
62 void CNSmlDsProvisioningAdapter::ConstructL() |
|
63 { |
|
64 iSession.OpenL(); |
|
65 } |
|
66 |
|
67 // ----------------------------------------------------------------------------- |
|
68 // CNSmlDsProvisioningAdapter::NewL |
|
69 // Two-phased constructor. |
|
70 // ----------------------------------------------------------------------------- |
|
71 CNSmlDsProvisioningAdapter* CNSmlDsProvisioningAdapter::NewL() |
|
72 { |
|
73 _DBG_FILE("CNSmlDsProvisioningAdapter::NewL(): begin"); |
|
74 CNSmlDsProvisioningAdapter* self = new(ELeave) CNSmlDsProvisioningAdapter; |
|
75 CleanupStack::PushL( self ); |
|
76 self->ConstructL(); |
|
77 CleanupStack::Pop( self ); |
|
78 _DBG_FILE("CNSmlDsProvisioningAdapter::NewL(): end"); |
|
79 return self; |
|
80 } |
|
81 |
|
82 // ----------------------------------------------------------------------------- |
|
83 // Destructor |
|
84 // ----------------------------------------------------------------------------- |
|
85 CNSmlDsProvisioningAdapter::~CNSmlDsProvisioningAdapter() |
|
86 { |
|
87 iProfiles.ResetAndDestroy(); |
|
88 iProfiles.Close(); |
|
89 |
|
90 delete iTitle; |
|
91 iSession.Close(); |
|
92 } |
|
93 |
|
94 // ----------------------------------------------------------------------------- |
|
95 // Destructor |
|
96 // ----------------------------------------------------------------------------- |
|
97 CNSmlDataProviderElement::~CNSmlDataProviderElement() |
|
98 { |
|
99 delete iRemoteDBUri; |
|
100 delete iLocalDBUri; |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // Destructor |
|
105 // ----------------------------------------------------------------------------- |
|
106 CNSmlDsProfileElement::~CNSmlDsProfileElement() |
|
107 { |
|
108 iDataProvElement.ResetAndDestroy(); |
|
109 iDataProvElement.Close(); |
|
110 iVisitParameter = 0; |
|
111 |
|
112 delete iHostAddress; |
|
113 delete iPort; |
|
114 delete iHTTPUserName; |
|
115 delete iHTTPPassword; |
|
116 |
|
117 delete iDisplayName; |
|
118 delete iServerId; |
|
119 delete iUsername; |
|
120 delete iPassword; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CNSmlDsProvisioningAdapter::CanSetAsDefault |
|
125 // ----------------------------------------------------------------------------- |
|
126 TBool CNSmlDsProvisioningAdapter::CanSetAsDefault(TInt /*aItem*/) const |
|
127 { |
|
128 return EFalse; |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CNSmlDsProvisioningAdapter::SetAsDefaultL |
|
133 // ----------------------------------------------------------------------------- |
|
134 void CNSmlDsProvisioningAdapter::SetAsDefaultL(TInt /*aItem*/ ) |
|
135 { |
|
136 } |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CNSmlDsProvisioningAdapter::ItemCount |
|
140 // ----------------------------------------------------------------------------- |
|
141 TInt CNSmlDsProvisioningAdapter::ItemCount() const |
|
142 { |
|
143 return iProfiles.Count(); |
|
144 } |
|
145 |
|
146 // ----------------------------------------------------------------------------- |
|
147 // CNSmlDsProvisioningAdapter::SummaryTitle |
|
148 // ----------------------------------------------------------------------------- |
|
149 const TDesC16& CNSmlDsProvisioningAdapter::SummaryTitle(TInt /*aIndex*/) const |
|
150 { |
|
151 return *iTitle; |
|
152 } |
|
153 |
|
154 // ----------------------------------------------------------------------------- |
|
155 // CNSmlDsProvisioningAdapter::SummaryText |
|
156 // ----------------------------------------------------------------------------- |
|
157 const TDesC16& CNSmlDsProvisioningAdapter::SummaryText(TInt aIndex) const |
|
158 { |
|
159 return *iProfiles[aIndex]->iDisplayName; |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CNSmlDsProvisioningAdapter::SaveL |
|
164 // ----------------------------------------------------------------------------- |
|
165 void CNSmlDsProvisioningAdapter::SaveL(TInt aItem) |
|
166 { |
|
167 _DBG_FILE("CNSmlDsProvisioningAdapter::SaveL(): begin"); |
|
168 TPckgBuf<TUint32> uid; |
|
169 |
|
170 RSyncMLDataSyncProfile profile; |
|
171 TBool ret = EFalse; |
|
172 |
|
173 if(iProfiles[aItem]->iServerId != NULL) |
|
174 { |
|
175 RSyncMLDataSyncProfile ProfileToSearch; |
|
176 RArray<TSmlProfileId> arr; |
|
177 iSession.ListProfilesL( arr, ESmlDataSync ); |
|
178 |
|
179 TInt ProfileId = KErrNotFound; |
|
180 CleanupClosePushL(arr); |
|
181 for ( TInt index = 0; index < arr.Count(); index++ ) |
|
182 { |
|
183 TRAPD( error, ProfileToSearch.OpenL(iSession, arr[index], ESmlOpenRead ) ); |
|
184 if ( error == KErrNone ) |
|
185 { |
|
186 if ( ( iProfiles[aItem]->iServerId->Des()).Compare(ProfileToSearch.ServerId() ) == 0 ) |
|
187 { |
|
188 |
|
189 ret = ETrue; |
|
190 ProfileId = (TInt)arr[index]; |
|
191 ProfileToSearch.Close(); |
|
192 break; |
|
193 } |
|
194 } |
|
195 ProfileToSearch.Close(); |
|
196 } |
|
197 CleanupStack::PopAndDestroy( &arr ); |
|
198 |
|
199 if( ret ) |
|
200 { |
|
201 profile.OpenL(iSession, ProfileId , ESmlOpenReadWrite ); |
|
202 } |
|
203 else |
|
204 { |
|
205 profile.CreateL( iSession ); |
|
206 } |
|
207 CleanupClosePushL( profile ); |
|
208 } |
|
209 else |
|
210 { |
|
211 |
|
212 profile.CreateL( iSession ); |
|
213 CleanupClosePushL( profile ); |
|
214 } |
|
215 |
|
216 // ui needs this to be set 0 |
|
217 profile.SetCreatorId(0);//iProfiles[aItem]->iProfile.SetCreatorId(0); |
|
218 profile.SetSanUserInteractionL( iProfiles[aItem]->iServerAlertedAction ); |
|
219 |
|
220 if ( iProfiles[aItem]->iDisplayName ) |
|
221 { |
|
222 profile.SetDisplayNameL( iProfiles[aItem]->iDisplayName->Des() ); |
|
223 } |
|
224 |
|
225 if ( iProfiles[aItem]->iServerId ) |
|
226 { |
|
227 profile.SetServerIdL( iProfiles[aItem]->iServerId->Des() ); |
|
228 } |
|
229 |
|
230 if ( iProfiles[aItem]->iUsername ) |
|
231 { |
|
232 profile.SetUserNameL( iProfiles[aItem]->iUsername->Des() ); |
|
233 } |
|
234 |
|
235 if ( iProfiles[aItem]->iPassword ) |
|
236 { |
|
237 profile.SetPasswordL( iProfiles[aItem]->iPassword->Des() ); |
|
238 } |
|
239 |
|
240 // creates profile -> must be done before opening the connection |
|
241 profile.UpdateL(); |
|
242 |
|
243 RSyncMLConnection connection; |
|
244 connection.OpenL( profile, KUidNSmlMediumTypeInternet.iUid ); |
|
245 CleanupClosePushL( connection ); |
|
246 |
|
247 if ( (iProfiles[aItem]->iVisitParameter |
|
248 && iProfiles[aItem]->iVisitParameter->Data().Length() == uid.MaxLength() ) |
|
249 || iToNapIDInternetIndicator) |
|
250 { |
|
251 TUint apId = 0; |
|
252 TInt ERROR = KErrNone; |
|
253 TInt err1 = KErrNone; |
|
254 |
|
255 if (iToNapIDInternetIndicator) |
|
256 { |
|
257 //Get Access Point from DB or SNAP |
|
258 TRAP(err1, apId = WPAdapterUtil::GetAPIDL()); |
|
259 } |
|
260 |
|
261 else |
|
262 { |
|
263 uid.Copy(iProfiles[aItem]->iVisitParameter->Data() ); |
|
264 |
|
265 CCommsDatabase* commDb = CCommsDatabase::NewL(); |
|
266 CleanupStack::PushL(commDb); |
|
267 CApUtils* aputils = CApUtils::NewLC( *commDb); |
|
268 |
|
269 TRAP( ERROR, apId = aputils->IapIdFromWapIdL( uid() ) ); |
|
270 CleanupStack::PopAndDestroy(2); //commdb, aputils |
|
271 } |
|
272 |
|
273 //Get default access point in failure of getting AP |
|
274 if (ERROR != KErrNone || err1 != KErrNone) |
|
275 { |
|
276 apId = GetDefaultIAPL(); |
|
277 } |
|
278 |
|
279 HBufC8* iapBuf = HBufC8::NewLC( 8 ); |
|
280 TPtr8 ptrBuf = iapBuf->Des(); |
|
281 ptrBuf.Num( apId ); |
|
282 |
|
283 connection.SetPropertyL( KNSmlIAPId, *iapBuf ); |
|
284 |
|
285 CleanupStack::PopAndDestroy(); //iapBuf |
|
286 } |
|
287 |
|
288 if( iProfiles[aItem]->iHostAddress ) |
|
289 { |
|
290 // see if address contains also port |
|
291 TBool portFound = EFalse; |
|
292 TInt startPos(0); |
|
293 if(iProfiles[aItem]->iHostAddress->Find(KNSmlDsProvisioningHTTP)==0) |
|
294 { |
|
295 startPos=KNSmlDsProvisioningHTTP().Length(); |
|
296 } |
|
297 else if(iProfiles[aItem]->iHostAddress->Find(KNSmlDsProvisioningHTTPS)==0) |
|
298 { |
|
299 startPos=KNSmlDsProvisioningHTTPS().Length(); |
|
300 } |
|
301 TPtrC uriPtr = iProfiles[aItem]->iHostAddress->Mid(startPos); |
|
302 |
|
303 if(uriPtr.Locate(KNSmlDMColon)!=KErrNotFound) |
|
304 { |
|
305 portFound = ETrue; |
|
306 } |
|
307 |
|
308 if( portFound == EFalse ) |
|
309 { |
|
310 HBufC *uri = 0; |
|
311 // port not found from URI -> see if it is given separately |
|
312 if( iProfiles[aItem]->iPort ) |
|
313 { |
|
314 // parse address and port into URI |
|
315 |
|
316 if( CombineURILC( iProfiles[aItem]->iHostAddress->Des(), |
|
317 iProfiles[aItem]->iPort->Des(), uri ) == KErrNone ) |
|
318 { |
|
319 if(iProfiles[aItem]->iHostAddress) |
|
320 { |
|
321 delete iProfiles[aItem]->iHostAddress; |
|
322 iProfiles[aItem]->iHostAddress = NULL; |
|
323 } |
|
324 iProfiles[aItem]->iHostAddress = uri->Des().AllocL(); |
|
325 } |
|
326 CleanupStack::PopAndDestroy(); // uri |
|
327 } |
|
328 else |
|
329 { |
|
330 // use default port |
|
331 if( CombineURILC( iProfiles[aItem]->iHostAddress->Des(), |
|
332 KNSmlDsDefaultPort(), uri ) == KErrNone ) |
|
333 { |
|
334 if(iProfiles[aItem]->iHostAddress) |
|
335 { |
|
336 delete iProfiles[aItem]->iHostAddress; |
|
337 iProfiles[aItem]->iHostAddress = NULL; |
|
338 } |
|
339 iProfiles[aItem]->iHostAddress = uri->Des().AllocL(); |
|
340 } |
|
341 CleanupStack::PopAndDestroy(); // uri |
|
342 } |
|
343 } |
|
344 |
|
345 |
|
346 connection.SetServerURIL( ConvertTo8LC( iProfiles[aItem]->iHostAddress->Des() ) ); |
|
347 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
348 } |
|
349 |
|
350 // set authtype, HTTPUserName, HTTPPassword |
|
351 if( iProfiles[aItem]->iHTTPUserName || |
|
352 iProfiles[aItem]->iHTTPPassword ) |
|
353 { |
|
354 connection.SetPropertyL( KNSmlHTTPAuth, KNSmlTrueVal ); |
|
355 |
|
356 if( iProfiles[aItem]->iHTTPUserName ) |
|
357 { |
|
358 connection.SetPropertyL( KNSmlHTTPUsername, iProfiles[aItem]->iHTTPUserName->Des() ); |
|
359 } |
|
360 if( iProfiles[aItem]->iHTTPPassword ) |
|
361 { |
|
362 connection.SetPropertyL( KNSmlHTTPPassword, iProfiles[aItem]->iHTTPPassword->Des() ); |
|
363 } |
|
364 } |
|
365 else |
|
366 { |
|
367 connection.SetPropertyL( KNSmlHTTPAuth, KNSmlFalseVal ); |
|
368 } |
|
369 |
|
370 connection.UpdateL(); |
|
371 CleanupStack::PopAndDestroy(); // connection |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 if(iProfiles[aItem]->iProtocolVersion == ESmlVersion1_1_2 || |
|
378 iProfiles[aItem]->iProtocolVersion == ESmlVersion1_2 ) |
|
379 { |
|
380 profile.SetProtocolVersionL(iProfiles[aItem]->iProtocolVersion); |
|
381 } |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 TInt iDataProvElementCount = iProfiles[aItem]->iDataProvElement.Count(); |
|
389 _DBG_FILE("CNSmlDsProvisioningAdapter::SaveL(): Resource For loop: before Start"); |
|
390 for ( TInt i = 0; i < iDataProvElementCount; i++ ) |
|
391 { |
|
392 _DBG_FILE( |
|
393 "CNSmlDsProvisioningAdapter::SaveL(): Resource For loop: In"); |
|
394 RSyncMLDataProvider dataProvider; |
|
395 |
|
396 TRAPD(error, dataProvider.OpenL(iSession, |
|
397 iProfiles[aItem]->iDataProvElement[i]->iUid)); |
|
398 if (!error) |
|
399 { |
|
400 CleanupClosePushL(dataProvider); |
|
401 if (ret) |
|
402 { |
|
403 RArray<TSmlTaskId> providers; |
|
404 profile.ListTasksL(providers); |
|
405 TInt dataprovcount = providers.Count(); |
|
406 |
|
407 for (TInt i = 0; i < dataprovcount; i++) |
|
408 { |
|
409 TSmlTaskId taskID = providers[i]; |
|
410 RSyncMLTask task; |
|
411 task.OpenL(profile, taskID); |
|
412 CleanupClosePushL(task); |
|
413 |
|
414 if (dataProvider.Identifier() == task.DataProvider()) |
|
415 { |
|
416 profile.DeleteTaskL(taskID); |
|
417 CleanupStack::PopAndDestroy(); |
|
418 break; |
|
419 } |
|
420 |
|
421 CleanupStack::PopAndDestroy(); |
|
422 |
|
423 } |
|
424 providers.Reset(); |
|
425 providers.Close(); |
|
426 |
|
427 } |
|
428 HBufC* localDB = dataProvider.DefaultDataStoreName().AllocLC(); |
|
429 _DBG_FILE("CNSmlDsProvisioningAdapter::SaveL(): DB value"); |
|
430 DBG_ARGS( |
|
431 iProfiles[aItem]->iDataProvElement[i]->iRemoteDBUri->Des().Ptr()); |
|
432 |
|
433 RSyncMLTask task; |
|
434 task.CreateL( |
|
435 profile, |
|
436 iProfiles[aItem]->iDataProvElement[i]->iUid, |
|
437 iProfiles[aItem]->iDataProvElement[i]->iRemoteDBUri->Des(), |
|
438 localDB->Des()); |
|
439 CleanupClosePushL(task); |
|
440 TRAPD(err, task.UpdateL()); |
|
441 if (err != KErrAlreadyExists && err != KErrNone) |
|
442 { |
|
443 User::Leave(err); |
|
444 } |
|
445 CleanupStack::PopAndDestroy(3); // task, localDB, dataProvider |
|
446 } |
|
447 |
|
448 } |
|
449 _DBG_FILE("CNSmlDsProvisioningAdapter::SaveL(): Resource For loop: after End"); |
|
450 |
|
451 profile.UpdateL(); |
|
452 iProfiles[aItem]->iProfileId = profile.Identifier(); |
|
453 CleanupStack::PopAndDestroy( &profile ); |
|
454 _DBG_FILE("CNSmlDsProvisioningAdapter::SaveL(): end"); |
|
455 } |
|
456 |
|
457 // ----------------------------------------------------------------------------- |
|
458 // CNSmlDsProvisioningAdapter::Reserved_1 |
|
459 // ----------------------------------------------------------------------------- |
|
460 TInt CNSmlDsProvisioningAdapter::Reserved_1() |
|
461 { |
|
462 return KErrNotSupported; |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CNSmlDsProvisioningAdapter::Reserved_2 |
|
467 // ----------------------------------------------------------------------------- |
|
468 TInt CNSmlDsProvisioningAdapter::Reserved_2() |
|
469 { |
|
470 return KErrNotSupported; |
|
471 } |
|
472 |
|
473 // ----------------------------------------------------------------------------- |
|
474 // CNSmlDsProvisioningAdapter::VisitL |
|
475 // ----------------------------------------------------------------------------- |
|
476 void CNSmlDsProvisioningAdapter::VisitL( CWPCharacteristic& aCharacteristic ) |
|
477 { |
|
478 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPCharacteristic): begin"); |
|
479 if(aCharacteristic.Type() == KWPApplication) |
|
480 { |
|
481 iState = CNSmlDsProvisioningAdapter::EStateApplication; |
|
482 } |
|
483 else if(aCharacteristic.Type() == KWPAppAuth) |
|
484 { |
|
485 iAuthLevel = CNSmlDsProvisioningAdapter::ENone; |
|
486 if(iState == CNSmlDsProvisioningAdapter::EStateDsSettings) |
|
487 { |
|
488 iState = CNSmlDsProvisioningAdapter::EStateAppAuth; |
|
489 } |
|
490 else |
|
491 { |
|
492 iState = CNSmlDsProvisioningAdapter::EStateNull; |
|
493 } |
|
494 } |
|
495 else if(aCharacteristic.Type() == KWPResource) |
|
496 { |
|
497 if(iState != CNSmlDsProvisioningAdapter::EStateNull ) |
|
498 { |
|
499 iState = CNSmlDsProvisioningAdapter::EStateResource; |
|
500 } |
|
501 else |
|
502 { |
|
503 iState = CNSmlDsProvisioningAdapter::EStateNull; |
|
504 } |
|
505 } |
|
506 else if(aCharacteristic.Type() == KWPAppAddr || aCharacteristic.Type() == KWPPort) |
|
507 { |
|
508 if( iState != CNSmlDsProvisioningAdapter::EStateNull ) |
|
509 { |
|
510 iState = CNSmlDsProvisioningAdapter::EStateDsSettings; |
|
511 } |
|
512 } |
|
513 else |
|
514 { |
|
515 iState = CNSmlDsProvisioningAdapter::EStateNull; |
|
516 } |
|
517 |
|
518 if(iState != CNSmlDsProvisioningAdapter::EStateNull) |
|
519 { |
|
520 aCharacteristic.AcceptL( *this ); |
|
521 } |
|
522 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPCharacteristic): end"); |
|
523 } |
|
524 |
|
525 // ----------------------------------------------------------------------------- |
|
526 // CNSmlDsProvisioningAdapter::VisitL |
|
527 // ----------------------------------------------------------------------------- |
|
528 void CNSmlDsProvisioningAdapter::VisitL( CWPParameter& aParameter) |
|
529 { |
|
530 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): begin"); |
|
531 TInt num; |
|
532 TInt flag =0; |
|
533 |
|
534 |
|
535 if( iState == CNSmlDsProvisioningAdapter::EStateApplication ) |
|
536 { |
|
537 if( aParameter.ID() == EWPParameterAppID && aParameter.Value().Compare( KNSmlDsProvisioningDMAppIdVal ) == 0 ) |
|
538 { |
|
539 iState = CNSmlDsProvisioningAdapter::EStateDsSettings; |
|
540 |
|
541 GetTitleL(); |
|
542 |
|
543 CNSmlDsProfileElement* dsProfileElement = new(ELeave) CNSmlDsProfileElement; |
|
544 CleanupStack::PushL( dsProfileElement ); |
|
545 |
|
546 dsProfileElement->iDisplayName = KNSmlDsProvisioningDefName().AllocL(); |
|
547 dsProfileElement->iServerAlertedAction = ESmlConfirmSync; |
|
548 |
|
549 dsProfileElement->iVisitParameter = 0; |
|
550 |
|
551 iProfiles.AppendL( dsProfileElement ); |
|
552 |
|
553 iProfiles[iProfiles.Count()-1]->iProtocolVersion = ESmlVersion1_2; |
|
554 CleanupStack::Pop( dsProfileElement ); |
|
555 } |
|
556 else |
|
557 { |
|
558 iState = CNSmlDsProvisioningAdapter::EStateNull; |
|
559 } |
|
560 } |
|
561 else if( iState == CNSmlDsProvisioningAdapter::EStateDsSettings ) |
|
562 { |
|
563 switch ( aParameter.ID() ) |
|
564 { |
|
565 case EWPParameterName: |
|
566 case EWPParameterName1: |
|
567 { |
|
568 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): Name"); |
|
569 DBG_ARGS( aParameter.Value().Ptr() ); |
|
570 |
|
571 if ( iProfiles[iProfiles.Count()-1]->iDisplayName ) |
|
572 { |
|
573 delete iProfiles[iProfiles.Count()-1]->iDisplayName; |
|
574 iProfiles[iProfiles.Count()-1]->iDisplayName = NULL; |
|
575 } |
|
576 /*parameter exceeding 50 characters truncate to 50 and save the item*/ |
|
577 if(aParameter.Value().Length()>50) |
|
578 { |
|
579 TPtrC ptr2 = aParameter.Value().Left(50); |
|
580 iProfiles[iProfiles.Count()-1]->iDisplayName = ptr2.AllocL(); |
|
581 } |
|
582 else |
|
583 iProfiles[iProfiles.Count()-1]->iDisplayName = aParameter.Value().AllocL(); |
|
584 |
|
585 |
|
586 /* parameter is NULL set to default value*/ |
|
587 num = iProfiles[iProfiles.Count()-1]->iDisplayName->Length(); |
|
588 |
|
589 |
|
590 TInt i; |
|
591 /*check for white spaces, If all characters are white spaces set to default*/ |
|
592 TPtr temp = iProfiles[iProfiles.Count()-1]->iDisplayName->Des(); |
|
593 for(i=0; i<iProfiles[iProfiles.Count()-1]->iDisplayName->Length(); i++) |
|
594 { |
|
595 |
|
596 |
|
597 if(temp[i] != ' ') |
|
598 break; |
|
599 } |
|
600 |
|
601 if(i == num || num == 0 ) |
|
602 flag =1; |
|
603 |
|
604 if(flag) |
|
605 { |
|
606 if ( iProfiles[iProfiles.Count()-1]->iDisplayName ) |
|
607 { |
|
608 delete iProfiles[iProfiles.Count()-1]->iDisplayName; |
|
609 iProfiles[iProfiles.Count()-1]->iDisplayName = NULL; |
|
610 } |
|
611 iProfiles[iProfiles.Count()-1]->iDisplayName = KNSmlDsProvisioningDefName().AllocL(); |
|
612 } |
|
613 } |
|
614 break; |
|
615 |
|
616 case EWPParameterToProxy: |
|
617 _DBG_FILE("CNSmlDmProvisioningAdapter::VisitL(CWPParameter): ToProxy"); |
|
618 case EWPParameterToNapID: |
|
619 case EWPParameterToNapID1: |
|
620 { |
|
621 TPtrC ptrToNapID(aParameter.Value()); |
|
622 if(ptrToNapID.CompareF(KInternetString)==0) |
|
623 iToNapIDInternetIndicator = ETrue; |
|
624 } |
|
625 break; |
|
626 |
|
627 case EWPParameterPortNbr: |
|
628 case EWPParameterPortNbr1: |
|
629 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): PortNbr"); |
|
630 DBG_ARGS( aParameter.Value().Ptr() ); |
|
631 iProfiles[iProfiles.Count()-1]->iPort = aParameter.Value().AllocL(); |
|
632 break; |
|
633 |
|
634 case EWPParameterAddr: |
|
635 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): Addr"); |
|
636 DBG_ARGS( aParameter.Value().Ptr() ); |
|
637 iProfiles[iProfiles.Count()-1]->iHostAddress = aParameter.Value().AllocL(); |
|
638 break; |
|
639 |
|
640 case EWPParameterProviderID: |
|
641 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): ProviderId"); |
|
642 DBG_ARGS( aParameter.Value().Ptr() ); |
|
643 if(aParameter.Value().Length()<=150) |
|
644 { |
|
645 iProfiles[iProfiles.Count()-1]->iServerId = ConvertTo8LC( aParameter.Value() ).AllocL(); |
|
646 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
647 } |
|
648 break; |
|
649 |
|
650 case EWPParameterAProtocol: |
|
651 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): AProtocol:Version"); |
|
652 DBG_ARGS( aParameter.Value().Ptr() ); |
|
653 //TPtrC ptr(aParameter.Value()); |
|
654 if(aParameter.Value().Compare(KNSmlVersion112)==0) |
|
655 { |
|
656 iProfiles[iProfiles.Count()-1]->iProtocolVersion = ESmlVersion1_1_2; |
|
657 } |
|
658 |
|
659 else |
|
660 if(aParameter.Value().Compare(KNSmlVersion11)==0) |
|
661 { |
|
662 iProfiles[iProfiles.Count()-1]->iProtocolVersion = ESmlVersion1_1_2; |
|
663 } |
|
664 |
|
665 else |
|
666 { |
|
667 iProfiles[iProfiles.Count()-1]->iProtocolVersion = ESmlVersion1_2; |
|
668 } |
|
669 |
|
670 |
|
671 |
|
672 break; |
|
673 default: |
|
674 break; |
|
675 } |
|
676 |
|
677 } |
|
678 else if( iState == CNSmlDsProvisioningAdapter::EStateAppAuth ) |
|
679 { |
|
680 switch ( aParameter.ID() ) |
|
681 { |
|
682 case EWPParameterAAuthType: |
|
683 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): AuthType"); |
|
684 DBG_ARGS( aParameter.Value().Ptr() ); |
|
685 if (( aParameter.Value().Compare( KNSmlDSProvisioningHTTPBasic ) == 0 ) || |
|
686 ( aParameter.Value().Compare( KNSmlDSProvisioningHTTPDigest ) == 0 )) |
|
687 { |
|
688 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): HTTP"); |
|
689 iAuthLevel = CNSmlDsProvisioningAdapter::EHttp; |
|
690 } |
|
691 break; |
|
692 |
|
693 case EWPParameterAAuthName: |
|
694 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): AuthName"); |
|
695 DBG_ARGS( aParameter.Value().Ptr() ); |
|
696 if(aParameter.Value().Length()<=80) |
|
697 { |
|
698 if ( iAuthLevel == CNSmlDsProvisioningAdapter::EHttp ) |
|
699 { |
|
700 iProfiles[iProfiles.Count()-1]->iHTTPUserName = ConvertTo8LC( aParameter.Value() ).AllocL(); |
|
701 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
702 } |
|
703 else |
|
704 { |
|
705 iProfiles[iProfiles.Count()-1]->iUsername = ConvertTo8LC( aParameter.Value() ).AllocL(); |
|
706 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
707 } |
|
708 } |
|
709 break; |
|
710 |
|
711 case EWPParameterAAuthSecret: |
|
712 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): AuthSecret"); |
|
713 DBG_ARGS(aParameter.Value().Ptr()); |
|
714 if(aParameter.Value().Length()<=22) |
|
715 { |
|
716 if ( iAuthLevel == CNSmlDsProvisioningAdapter::EHttp ) |
|
717 { |
|
718 iProfiles[iProfiles.Count()-1]->iHTTPPassword = ConvertTo8LC( aParameter.Value() ).AllocL(); |
|
719 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
720 } |
|
721 else |
|
722 { |
|
723 iProfiles[iProfiles.Count()-1]->iPassword = ConvertTo8LC( aParameter.Value() ).AllocL(); |
|
724 CleanupStack::PopAndDestroy(); // ConvertTo8LC |
|
725 } |
|
726 iState = CNSmlDsProvisioningAdapter::EStateDsSettings; |
|
727 } |
|
728 break; |
|
729 default: |
|
730 break; |
|
731 } |
|
732 } |
|
733 |
|
734 else if( iState == CNSmlDsProvisioningAdapter::EStateResource ) |
|
735 { |
|
736 TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count(); |
|
737 if( iDataProvElementCount == 0 ) |
|
738 { |
|
739 CNSmlDataProviderElement* dataProviderElement = new(ELeave) CNSmlDataProviderElement; |
|
740 CleanupStack::PushL( dataProviderElement ); |
|
741 iProfiles[iProfiles.Count()-1]->iDataProvElement.AppendL( dataProviderElement ); |
|
742 CleanupStack::Pop( dataProviderElement ); |
|
743 } |
|
744 else if ( (iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount-1]->iRemoteDBUri != 0) && |
|
745 (iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount-1]->iUid != 0) && |
|
746 ( ( aParameter.ID() == EWPParameterURI ) || ( aParameter.ID() == EWPParameterAAccept ) ) ) |
|
747 { |
|
748 // another resource element recognized |
|
749 CNSmlDataProviderElement* dataProviderElement = new(ELeave) CNSmlDataProviderElement; |
|
750 CleanupStack::PushL( dataProviderElement ); |
|
751 iProfiles[iProfiles.Count()-1]->iDataProvElement.AppendL( dataProviderElement ); |
|
752 CleanupStack::Pop( dataProviderElement ); |
|
753 } |
|
754 |
|
755 switch ( aParameter.ID() ) |
|
756 { |
|
757 case EWPParameterName: |
|
758 case EWPParameterName1: |
|
759 break; |
|
760 |
|
761 case EWPParameterURI: |
|
762 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): RemoteDBURI"); |
|
763 DBG_ARGS( aParameter.Value().Ptr() ); |
|
764 if(aParameter.Value().Length() <= 125) |
|
765 { |
|
766 iProfiles[iProfiles.Count()-1]->iDataProvElement[iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1]->iRemoteDBUri = |
|
767 aParameter.Value().AllocL(); |
|
768 } |
|
769 break; |
|
770 |
|
771 case EWPParameterAAccept: |
|
772 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): AAccept (mime)"); |
|
773 StoreAttributesL( aParameter.Value() ); |
|
774 iState = CNSmlDsProvisioningAdapter::EStateDsSettings; |
|
775 break; |
|
776 default: |
|
777 break; |
|
778 } |
|
779 } |
|
780 |
|
781 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitL(CWPParameter): end"); |
|
782 } |
|
783 |
|
784 // ----------------------------------------------------------------------------- |
|
785 // CNSmlDsProvisioningAdapter::VisitLinkL |
|
786 // ----------------------------------------------------------------------------- |
|
787 void CNSmlDsProvisioningAdapter::VisitLinkL( CWPCharacteristic& aParameter) |
|
788 { |
|
789 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitLinkL(): begin"); |
|
790 |
|
791 if( ( ( aParameter.Type()==KWPNapDef ) || ( aParameter.Type()==KWPPxLogical ) ) && |
|
792 ( iState != CNSmlDsProvisioningAdapter::EStateNull ) ) |
|
793 { |
|
794 if( iProfiles.Count() > 0 ) |
|
795 { |
|
796 iProfiles[iProfiles.Count()-1]->iVisitParameter = &aParameter; |
|
797 } |
|
798 } |
|
799 _DBG_FILE("CNSmlDsProvisioningAdapter::VisitLinkL(): end"); |
|
800 } |
|
801 |
|
802 // ----------------------------------------------------------------------------- |
|
803 // CNSmlDsProvisioningAdapter::ContextExtension |
|
804 // ----------------------------------------------------------------------------- |
|
805 TInt CNSmlDsProvisioningAdapter::ContextExtension( MWPContextExtension*& aContextExtension ) |
|
806 { |
|
807 _DBG_FILE("CNSmlDsProvisioningAdapter::ContextExtension(): begin"); |
|
808 aContextExtension = this; |
|
809 _DBG_FILE("CNSmlDsProvisioningAdapter::ContextExtension(): end"); |
|
810 return KErrNone; |
|
811 } |
|
812 |
|
813 // ----------------------------------------------------------------------------- |
|
814 // CNSmlDsProvisioningAdapter::SaveDataL |
|
815 // ----------------------------------------------------------------------------- |
|
816 const TDesC8& CNSmlDsProvisioningAdapter::SaveDataL( TInt aIndex ) const |
|
817 { |
|
818 return iProfiles[aIndex]->iProfileId; |
|
819 } |
|
820 |
|
821 // ----------------------------------------------------------------------------- |
|
822 // CNSmlDsProvisioningAdapter::DeleteL |
|
823 // ----------------------------------------------------------------------------- |
|
824 void CNSmlDsProvisioningAdapter::DeleteL( const TDesC8& aSaveData) |
|
825 { |
|
826 _DBG_FILE("CNSmlDsProvisioningAdapter::DeleteL(): begin"); |
|
827 TPckgBuf<TInt> uid; |
|
828 uid.Copy( aSaveData ); |
|
829 iSession.DeleteProfileL( uid() ); |
|
830 _DBG_FILE("CNSmlDsProvisioningAdapter::DeleteL(): end"); |
|
831 } |
|
832 |
|
833 // ----------------------------------------------------------------------------- |
|
834 // CNSmlDsProvisioningAdapter::Uid |
|
835 // ----------------------------------------------------------------------------- |
|
836 TUint32 CNSmlDsProvisioningAdapter::Uid() const |
|
837 { |
|
838 _DBG_FILE("CNSmlDsProvisioningAdapter::Uid(): begin"); |
|
839 return KNSmlDsProvisioningAdapterImplUid; |
|
840 } |
|
841 |
|
842 // ----------------------------------------------------------------------------- |
|
843 // CNSmlDsProvisioningAdapter::DetailsL( ) |
|
844 // ----------------------------------------------------------------------------- |
|
845 TInt CNSmlDsProvisioningAdapter::DetailsL( TInt /*aItem*/, MWPPairVisitor& /*aVisitor*/ ) |
|
846 { |
|
847 return KErrNotSupported; |
|
848 } |
|
849 |
|
850 // ------------------------------------------------------------------------------------- |
|
851 // CNSmlDsProvisioningAdapter::GetDefaultIAPL() |
|
852 // Gets the default NAPId |
|
853 // ------------------------------------------------------------------------------------- |
|
854 TInt CNSmlDsProvisioningAdapter::GetDefaultIAPL() |
|
855 { |
|
856 TInt iapId = KErrNotFound; |
|
857 |
|
858 CCommsDatabase* database = CCommsDatabase::NewL(); |
|
859 CleanupStack::PushL( database ); |
|
860 |
|
861 CCommsDbTableView* tableView = database->OpenTableLC( TPtrC( IAP ) ); |
|
862 |
|
863 TInt errorCode = tableView->GotoFirstRecord(); |
|
864 |
|
865 if ( errorCode == KErrNone ) |
|
866 { |
|
867 TUint32 value; |
|
868 tableView->ReadUintL( TPtrC( COMMDB_ID ), value ); |
|
869 iapId = value; |
|
870 } |
|
871 |
|
872 CleanupStack::PopAndDestroy( 2 ); // database, tableView |
|
873 |
|
874 return iapId; |
|
875 } |
|
876 |
|
877 // ------------------------------------------------------------------------------------------------ |
|
878 // CNSmlDsProvisioningAdapter::CombineURILC() |
|
879 // Combines address and port to URI |
|
880 // ------------------------------------------------------------------------------------------------ |
|
881 TInt CNSmlDsProvisioningAdapter::CombineURILC( const TDesC& aAddr, const TDesC& aPort, HBufC*& aRealURI ) |
|
882 { |
|
883 TInt offset = 0; |
|
884 TInt i = 0; |
|
885 if( aAddr.Find( KNSmlDsProvisioningHTTP ) == 0 ) |
|
886 { |
|
887 offset = KNSmlDsProvisioningHTTP().Length(); |
|
888 } |
|
889 else if( aAddr.Find( KNSmlDsProvisioningHTTPS ) == 0 ) |
|
890 { |
|
891 offset = KNSmlDsProvisioningHTTPS().Length(); |
|
892 } |
|
893 |
|
894 // after skipping double slashes seek next single slash |
|
895 for( i = offset; i < aAddr.Length(); i++ ) |
|
896 { |
|
897 if( aAddr[i] == KNSmlDMUriSeparator ) |
|
898 { |
|
899 break; |
|
900 } |
|
901 } |
|
902 |
|
903 aRealURI = HBufC::NewLC( aAddr.Length() + aPort.Length() + 1 ); |
|
904 TPtr uriPtr = aRealURI->Des(); |
|
905 |
|
906 uriPtr.Copy( aAddr.Ptr(), i ); |
|
907 uriPtr.Append( KNSmlDMColon ); |
|
908 uriPtr.Append( aPort ); |
|
909 uriPtr.Append( aAddr.Right( aAddr.Length() - i ) ); |
|
910 |
|
911 return KErrNone; |
|
912 } |
|
913 |
|
914 // --------------------------------------------------------- |
|
915 // CNSmlDsProvisioningAdapter::StoreAttributesL |
|
916 // --------------------------------------------------------- |
|
917 void CNSmlDsProvisioningAdapter::StoreAttributesL( const TDesC& aType ) |
|
918 { |
|
919 _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): begin"); |
|
920 |
|
921 TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1; |
|
922 // Leave if aType cannot be assigned |
|
923 if( ( aType.Length() > 0 ) && |
|
924 ( iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iRemoteDBUri ) ) |
|
925 { |
|
926 // look through every implementation adapter until one found |
|
927 // which supports MIME type in question |
|
928 |
|
929 // The first one located in ROM is chosen. If none found in ROM then |
|
930 // the first adapter found is chosen. |
|
931 |
|
932 HBufC8 *type = HBufC8::NewLC(aType.Size()); |
|
933 TPtr8 typePtr = type->Des(); |
|
934 CnvUtfConverter::ConvertFromUnicodeToUtf8( typePtr, aType); |
|
935 |
|
936 TBool dataProvIdFoundInZ = FALSE; |
|
937 TSmlDataProviderId firstDataProvIdFound = 0; |
|
938 TSmlDataProviderId uidFound = 0; |
|
939 |
|
940 // get list of dataproviderIds |
|
941 RImplInfoPtrArray implArray; |
|
942 CleanupStack::PushL( PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) ); |
|
943 TUid ifUid = { KNSmlDSInterfaceUid }; |
|
944 REComSession::ListImplementationsL( ifUid, implArray ); |
|
945 |
|
946 TInt countProviders = implArray.Count(); |
|
947 for( TInt i = 0; i < countProviders; i++ ) |
|
948 { |
|
949 CImplementationInformation* implInfo = implArray[i]; |
|
950 |
|
951 RSyncMLDataProvider dataProvider; |
|
952 dataProvider.OpenL( iSession, implInfo->ImplementationUid().iUid ); |
|
953 CleanupClosePushL( dataProvider ); |
|
954 |
|
955 TInt mimeTypeCount = dataProvider.MimeTypeCount(); |
|
956 for( TInt j = 0; j < mimeTypeCount; j++ ) |
|
957 { |
|
958 HBufC* mimeType = dataProvider.MimeType( j ).AllocLC(); |
|
959 TPtrC8 convMimeType = ConvertTo8LC( *mimeType ); |
|
960 if( typePtr.Find( convMimeType ) == 0) |
|
961 { |
|
962 // MIME type in question was found |
|
963 uidFound = implInfo->ImplementationUid().iUid; |
|
964 |
|
965 if( firstDataProvIdFound == 0 ) |
|
966 { |
|
967 // save the first in case of none found from ROM |
|
968 firstDataProvIdFound = uidFound; |
|
969 } |
|
970 |
|
971 // check whether the provider is located in ROM (drive Z) |
|
972 if( implInfo->Drive() == EDriveZ ) |
|
973 { |
|
974 dataProvIdFoundInZ = TRUE; |
|
975 } |
|
976 } |
|
977 |
|
978 CleanupStack::PopAndDestroy(2); // mimetype, ConvertTo8LC |
|
979 |
|
980 if( uidFound ) |
|
981 { |
|
982 break; |
|
983 } |
|
984 } |
|
985 |
|
986 CleanupStack::PopAndDestroy(); // dataProvider |
|
987 |
|
988 if ( dataProvIdFoundInZ ) |
|
989 { |
|
990 break; |
|
991 } |
|
992 else |
|
993 { |
|
994 uidFound = firstDataProvIdFound; |
|
995 } |
|
996 } |
|
997 |
|
998 REComSession::FinalClose(); |
|
999 CleanupStack::PopAndDestroy( 2 ); // type, implArray |
|
1000 |
|
1001 if( uidFound ) |
|
1002 { |
|
1003 iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iUid = uidFound; |
|
1004 } |
|
1005 } |
|
1006 |
|
1007 _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): end"); |
|
1008 } |
|
1009 |
|
1010 // --------------------------------------------------------- |
|
1011 // CNSmlDsProvisioningAdapter::GetTitleL |
|
1012 // --------------------------------------------------------- |
|
1013 void CNSmlDsProvisioningAdapter::GetTitleL() |
|
1014 { |
|
1015 if( iTitle == 0 ) |
|
1016 { |
|
1017 RFs fs; |
|
1018 User::LeaveIfError( fs.Connect() ); |
|
1019 CleanupClosePushL( fs ); |
|
1020 |
|
1021 TFileName fileName; |
|
1022 TParse parse; |
|
1023 parse.Set( KNSmlDsPovisioningDirAndResource, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
1024 fileName = parse.FullName(); |
|
1025 |
|
1026 RResourceFile resourceFile; |
|
1027 BaflUtils::NearestLanguageFile( fs, fileName ); |
|
1028 resourceFile.OpenL( fs, fileName ); |
|
1029 CleanupClosePushL( resourceFile ); |
|
1030 |
|
1031 HBufC8* dataBuffer = resourceFile.AllocReadLC( R_SYNC_PROVISIONING_TITLE ); |
|
1032 |
|
1033 TResourceReader reader; |
|
1034 reader.SetBuffer( dataBuffer ); |
|
1035 iTitle = reader.ReadHBufC16L(); |
|
1036 CleanupStack::PopAndDestroy( 3 ); //fs, resourcefile, databuffer |
|
1037 } |
|
1038 } |
|
1039 |
|
1040 // --------------------------------------------------------- |
|
1041 // CNSmlDsProvisioningAdapter::ConvertTo8LC() |
|
1042 // Converts string value to 8-bit |
|
1043 // --------------------------------------------------------- |
|
1044 TDesC8& CNSmlDsProvisioningAdapter::ConvertTo8LC( const TDesC& aSource ) |
|
1045 { |
|
1046 HBufC8* buf = HBufC8::NewLC( aSource.Length()*2 ); |
|
1047 TPtr8 bufPtr = buf->Des(); |
|
1048 CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); |
|
1049 |
|
1050 return *buf; |
|
1051 } |
|
1052 |
|
1053 // --------------------------------------------------------- |
|
1054 // CNSmlDsProvisioningAdapter::ConvertTo8L() |
|
1055 // Converts string value to 8-bit |
|
1056 // --------------------------------------------------------- |
|
1057 TDesC8& CNSmlDsProvisioningAdapter::ConvertTo8L( const TDesC& aSource ) |
|
1058 { |
|
1059 HBufC8* buf = HBufC8::NewL( aSource.Length()*2 ); |
|
1060 TPtr8 bufPtr = buf->Des(); |
|
1061 CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); |
|
1062 |
|
1063 return *buf; |
|
1064 } |
|
1065 |
|
1066 |
|
1067 // End of File |