1 /* |
|
2 * Copyright (c) 2005 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: DM-settings adapter |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include "NSmlDMSettingsAdapter.h" |
|
23 #include "nsmldebug.h" |
|
24 #include "nsmlconstants.h" |
|
25 #include "nsmldmconstants.h" |
|
26 #include "nsmldmimpluids.h" |
|
27 #include "nsmldmiapmatcher.h" |
|
28 #include "nsmldmauthinfo.h" |
|
29 #include <featmgr.h> |
|
30 #include <implementationproxy.h> |
|
31 #include <SyncMLClientDM.h> |
|
32 #include <SyncMLTransportProperties.h> |
|
33 |
|
34 |
|
35 #ifndef __WINS__ |
|
36 // This lowers the unnecessary compiler warning (armv5) to remark. |
|
37 // "Warning: #174-D: expression has no effect..." is caused by |
|
38 // DBG_ARGS8 macro in no-debug builds. |
|
39 #pragma diag_remark 174 |
|
40 #endif |
|
41 |
|
42 |
|
43 // ============================ MEMBER FUNCTIONS =============================== |
|
44 |
|
45 // ----------------------------------------------------------------------------- |
|
46 // CNSmlDMSettingsAdapter::NewL |
|
47 // Two-phased constructor. |
|
48 // ----------------------------------------------------------------------------- |
|
49 CNSmlDMSettingsAdapter* CNSmlDMSettingsAdapter::NewL( MSmlDmCallback* aDmCallback ) |
|
50 { |
|
51 _DBG_FILE("CNSmlDMSettingsAdapter::NewL(): begin"); |
|
52 |
|
53 CNSmlDMSettingsAdapter* self = NewLC( aDmCallback ); |
|
54 CleanupStack::Pop(); |
|
55 |
|
56 _DBG_FILE("CNSmlDMSettingsAdapter::NewL(): end"); |
|
57 return self; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CNSmlDMSettingsAdapter::NewLC( ) |
|
62 // Loads the CNSmlDMSettingsAdapter class and pushes it to clenupstack. |
|
63 // ----------------------------------------------------------------------------- |
|
64 CNSmlDMSettingsAdapter* CNSmlDMSettingsAdapter::NewLC( MSmlDmCallback* aDmCallback ) |
|
65 { |
|
66 _DBG_FILE( "CNSmlDMSettingsAdapter::NewLC(): begin" ); |
|
67 CNSmlDMSettingsAdapter* self = new ( ELeave ) CNSmlDMSettingsAdapter( aDmCallback ); |
|
68 CleanupStack::PushL( self ); |
|
69 self->iCallBack = aDmCallback; |
|
70 self->ConstructL(); |
|
71 self->iLeafType = EDMUnset; |
|
72 |
|
73 _DBG_FILE( "CNSmlDMSettingsAdapter::NewLC(): end" ); |
|
74 return self; |
|
75 } |
|
76 |
|
77 // ----------------------------------------------------------------------------- |
|
78 // CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter() |
|
79 // Default constructor. |
|
80 // ----------------------------------------------------------------------------- |
|
81 CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter( TAny* aEcomArguments) : |
|
82 CSmlDmAdapter(aEcomArguments ) |
|
83 { |
|
84 _DBG_FILE( "CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter(): begin" ); |
|
85 _DBG_FILE( "CNSmlDMSettingsAdapter::CNSmlDMSettingsAdapter(): end" ); |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter() |
|
90 // Destructor. |
|
91 // ----------------------------------------------------------------------------- |
|
92 CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter() |
|
93 { |
|
94 _DBG_FILE( "CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter(): begin" ); |
|
95 |
|
96 delete iField; |
|
97 |
|
98 // Client API Session & Profile |
|
99 iProfile.Close(); |
|
100 iSyncSession.Close(); |
|
101 iSyncSessionOpen = EFalse; |
|
102 |
|
103 // In Case the Buffer isnt cleared |
|
104 if ( iBuffer) |
|
105 { |
|
106 for (TInt val =0; val<iBuffer->Count ();val++) |
|
107 { |
|
108 delete iBuffer->At(val).iMappingName; |
|
109 |
|
110 ClearBuffer ( iBuffer->At(val).iLeafBuf); |
|
111 delete iBuffer->At(val).iLeafBuf; |
|
112 } |
|
113 |
|
114 iBuffer->Reset (); |
|
115 delete iBuffer; |
|
116 } |
|
117 delete iPortNbr; |
|
118 iPortBuffer.Reset(); |
|
119 iPortBuffer.Close(); |
|
120 iPrivateApi.Close(); |
|
121 |
|
122 iCallBack = 0; |
|
123 |
|
124 _DBG_FILE( "CNSmlDMSettingsAdapter::~CNSmlDMSettingsAdapter(): end" ); |
|
125 } |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // CNSmlDMSettingsAdapter::ConstructL() |
|
129 // Second phase constructor. |
|
130 // ----------------------------------------------------------------------------- |
|
131 void CNSmlDMSettingsAdapter::ConstructL() |
|
132 { |
|
133 iField = HBufC8::NewL( KNSmlMaxURLLength ); |
|
134 iSyncSessionOpen = EFalse; |
|
135 // variables used for Buffering |
|
136 iBufOn = EFalse; |
|
137 iComplete = EFalse; |
|
138 iExecutionIndex = -1; |
|
139 // initialising iBuffer |
|
140 iBuffer = new (ELeave) CArrayFixFlat <TNSmlDMBufferElement> (KNSmlDMGranularity); |
|
141 } |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CNSmlDMSettingsAdapter::DDFVersionL() |
|
145 // Returns the DDF version number. |
|
146 // ----------------------------------------------------------------------------- |
|
147 void CNSmlDMSettingsAdapter::DDFVersionL( CBufBase& aVersion ) |
|
148 { |
|
149 _DBG_FILE( |
|
150 "CNSmlDMSettingsAdapter::DDFVersionL(CBufBase& aDDFVersion): begin" ); |
|
151 aVersion.InsertL( 0, KVersion ); |
|
152 _DBG_FILE( |
|
153 "CNSmlDMSettingsAdapter::DDFVersionL(CBufBase& aDDFVersion): end" ); |
|
154 } |
|
155 |
|
156 // ----------------------------------------------------------------------------- |
|
157 // CNSmlDMSettingsAdapter::DDFStructureL() |
|
158 // Fills the DDF structure of the adapter. |
|
159 // ----------------------------------------------------------------------------- |
|
160 void CNSmlDMSettingsAdapter::DDFStructureL( MSmlDmDDFObject& aDDF ) |
|
161 { |
|
162 _DBG_FILE( "CNSmlDMSettingsAdapter::DDFStructureL(): begin" ); |
|
163 |
|
164 MSmlDmDDFObject* ddfRoot = &aDDF; |
|
165 MSmlDmDDFObject& ddf = ddfRoot->AddChildObjectL( KSyncMLText ); |
|
166 |
|
167 TSmlDmAccessTypes *aclTypes = new ( ELeave ) TSmlDmAccessTypes(); |
|
168 CleanupStack::PushL( aclTypes ); |
|
169 |
|
170 // Set Get as acceptable operations |
|
171 aclTypes->SetGet(); |
|
172 |
|
173 ddf.SetDFTitleL( KNSmlDMadapterTitle ); |
|
174 FillNodeInfoL( ddf, *aclTypes, MSmlDmDDFObject::EOne, |
|
175 MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, |
|
176 KNSmlDMadapterDesc, KNullDesC8, KNullDesC8 ); |
|
177 |
|
178 |
|
179 MSmlDmDDFObject& nDmDDF = ddf.AddChildObjectL( KNSmlDefDMAcc ); |
|
180 FillNodeInfoL( nDmDDF, *aclTypes, MSmlDmDDFObject::EOne, |
|
181 MSmlDmDDFObject::EPermanent, MSmlDmDDFObject::ENode, |
|
182 KNullDesC8, KNullDesC8, KNullDesC8 ); |
|
183 |
|
184 aclTypes->SetAdd(); |
|
185 // Set rest acceptable operations for data itself |
|
186 aclTypes->SetReplace(); |
|
187 aclTypes->SetDelete(); |
|
188 |
|
189 TSmlDmAccessTypes aclTypesNoGet; |
|
190 aclTypesNoGet.SetReplace(); |
|
191 aclTypesNoGet.SetAdd(); |
|
192 aclTypesNoGet.SetDelete(); |
|
193 |
|
194 TSmlDmAccessTypes aclTypesAR; |
|
195 aclTypesAR.SetReplace(); |
|
196 aclTypesAR.SetAdd(); |
|
197 |
|
198 TSmlDmAccessTypes aclTypesARG; |
|
199 aclTypesARG.SetReplace(); |
|
200 aclTypesARG.SetAdd(); |
|
201 aclTypesARG.SetGet(); |
|
202 |
|
203 TSmlDmAccessTypes aclTypesAG; |
|
204 aclTypesAG.SetGet(); |
|
205 aclTypesAG.SetAdd(); |
|
206 |
|
207 MSmlDmDDFObject& nProDDF = nDmDDF.AddChildObjectGroupL(); |
|
208 FillNodeInfoL( nProDDF, *aclTypes, MSmlDmDDFObject::EZeroOrMore, |
|
209 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::ENode, |
|
210 KNullDesC8, KNullDesC8, KMimeType ); |
|
211 |
|
212 MSmlDmDDFObject& nAddrDDF = nProDDF.AddChildObjectL( KNSmlDdfAddr ); // Addr |
|
213 FillNodeInfoL( nAddrDDF, *aclTypes, MSmlDmDDFObject::EOne, |
|
214 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
215 KNSmlDdfAddrDescription, KNullDesC8, KMimeType ); |
|
216 |
|
217 MSmlDmDDFObject& nAddrTypeDDF = nProDDF.AddChildObjectL( KNSmlDdfAddrType ); // AddrType |
|
218 FillNodeInfoL( nAddrTypeDDF, *aclTypes, MSmlDmDDFObject::EOne, |
|
219 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
220 KNSmlDdfAddrTypeDescription, KNullDesC8, KMimeType ); |
|
221 |
|
222 MSmlDmDDFObject& nPortNbrDDF = nProDDF.AddChildObjectL( KNSmlDdfPortNbr ); // PortNbr |
|
223 FillNodeInfoL( nPortNbrDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, |
|
224 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EInt, |
|
225 KNSmlDdfPortNbrDescription, KNullDesC8, KMimeType ); |
|
226 |
|
227 MSmlDmDDFObject& nAuthSchemeDDF = nProDDF.AddChildObjectL( KNSmlDdfAuthScheme ); // AuthPref |
|
228 FillNodeInfoL( nAuthSchemeDDF, *aclTypes, MSmlDmDDFObject::EOne, |
|
229 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
230 KNSmlDdfAuthSchemeDescription, KNullDesC8, KMimeType ); |
|
231 |
|
232 MSmlDmDDFObject& nServerIdDDF = nProDDF.AddChildObjectL( KNSmlDdfServerId ); // ServerId |
|
233 FillNodeInfoL( nServerIdDDF, aclTypesAG, MSmlDmDDFObject::EOne, |
|
234 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
235 KNSmlDdfServerIdDescription, KNullDesC8, KMimeType ); |
|
236 |
|
237 MSmlDmDDFObject& nServerPWDDF = nProDDF.AddChildObjectL( KNSmlDdfServerPW ); // ServerPW |
|
238 FillNodeInfoL( nServerPWDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, |
|
239 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
240 KNSmlDdfServerPWDescription, KNullDesC8, KMimeType ); |
|
241 |
|
242 MSmlDmDDFObject& nServerNonceDDF = nProDDF.AddChildObjectL( KNSmlDdfServerNonce );// ServerNonce |
|
243 FillNodeInfoL( nServerNonceDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, |
|
244 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
245 KNSmlDdfServerNonceDescription, KNullDesC8, KMimeType ); |
|
246 |
|
247 MSmlDmDDFObject& nClientUserNameDDF = nProDDF.AddChildObjectL( KNSmlDdfClientUserName ); // ClientUserName |
|
248 FillNodeInfoL( nClientUserNameDDF, *aclTypes, MSmlDmDDFObject::EOne, |
|
249 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
250 KNSmlDdfClientUserNameDescription, KNullDesC8, KMimeType ); |
|
251 |
|
252 MSmlDmDDFObject& nClientPWDDF = nProDDF.AddChildObjectL( KNSmlDdfClientPW ); // ClientPW |
|
253 FillNodeInfoL( nClientPWDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, |
|
254 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
255 KNSmlDdfClientPWDescription, KNullDesC8, KMimeType ); |
|
256 |
|
257 MSmlDmDDFObject& nClientNonceDDF = nProDDF.AddChildObjectL( KNSmlDdfClientNonce ); // ClientNonce |
|
258 FillNodeInfoL( nClientNonceDDF, aclTypesNoGet, MSmlDmDDFObject::EOne, |
|
259 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
260 KNSmlDdfClientNonceDescription, KNullDesC8, KMimeType ); |
|
261 |
|
262 MSmlDmDDFObject& nNameDDF = nProDDF.AddChildObjectL( KNSmlDdfName ); // Name |
|
263 FillNodeInfoL( nNameDDF, *aclTypes, MSmlDmDDFObject::EZeroOrOne, |
|
264 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
265 KNSmlDdfNameDescription, KNullDesC8, KMimeType ); |
|
266 |
|
267 MSmlDmDDFObject& nConRefDDF = nProDDF.AddChildObjectL( KNSmlDdfConRef ); // ConRef |
|
268 FillNodeInfoL( nConRefDDF, aclTypesARG, MSmlDmDDFObject::EOne, |
|
269 MSmlDmDDFObject::EDynamic, MSmlDmDDFObject::EChr, |
|
270 KNSmlDdfConRefDescription, KNullDesC8, KMimeType ); |
|
271 |
|
272 CleanupStack::PopAndDestroy(); //aclTypes |
|
273 |
|
274 _DBG_FILE("CNSmlDMSettingsAdapter::DDFStructureL(): end"); |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // CNSmlDMSettingsAdapter::UpdateLeafObjectL |
|
279 // Updates profile leaf object data based on URI. |
|
280 // ----------------------------------------------------------------------------- |
|
281 void CNSmlDMSettingsAdapter::UpdateLeafObjectL( const TDesC8& aURI, |
|
282 const TDesC8& aLUID, |
|
283 const TDesC8& aObject, |
|
284 const TDesC8& /*aType*/, |
|
285 const TInt aStatusRef ) |
|
286 { |
|
287 _DBG_FILE("CNSmlDMSettingsAdapter::UpdateLeafObjectL(): begin"); |
|
288 TInt index = -1; |
|
289 if ( !iBufOn) |
|
290 { |
|
291 for (TInt val = 0; val<iBuffer->Count (); val++) |
|
292 { |
|
293 TPtrC8 firstUri = ParentURI (aURI); |
|
294 if ( iBuffer->At(val).iMappingName->Compare (firstUri)== 0) |
|
295 { |
|
296 index = iExecutionIndex = val; |
|
297 break; |
|
298 } |
|
299 } |
|
300 } |
|
301 if ( index >= 0) |
|
302 AddLeafBufferL (aURI, aObject, aStatusRef); |
|
303 else |
|
304 { |
|
305 if( aLUID.Length() == 0 ) |
|
306 { |
|
307 _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL( ): ENotFound end" ); |
|
308 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
309 return; |
|
310 } |
|
311 TInt parentLUID = GetIntObject( aLUID ); |
|
312 if( parentLUID != iParentLUID ) |
|
313 { |
|
314 if( FindProfileIdL( parentLUID ) != EFalse ) |
|
315 { |
|
316 iParentLUID = parentLUID; |
|
317 } |
|
318 else |
|
319 { |
|
320 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
321 return; |
|
322 } |
|
323 } |
|
324 SetField( aURI ); |
|
325 if( !AcceptDMField() ) |
|
326 { |
|
327 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): KErr field end" ); |
|
328 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); |
|
329 return; |
|
330 } |
|
331 |
|
332 // Get Database field type |
|
333 TNSmlDMFieldType fType = GetDMFieldType(); |
|
334 if ( fType == EWrong ) |
|
335 { |
|
336 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); |
|
337 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
338 return; |
|
339 } |
|
340 TNSmlDMProfileData fData = GetDMField(); |
|
341 if( fData == ESyncAccepted ) |
|
342 { |
|
343 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); |
|
344 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
345 return; |
|
346 } |
|
347 if( NotValidStrLenght( fData, aObject ) ) |
|
348 { |
|
349 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): KErr length end" ); |
|
350 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); |
|
351 return; |
|
352 } |
|
353 //Authentication data leafs to be handled |
|
354 if ( fData == EAuthenticationRequired || fData == EClientNonce |
|
355 || fData == EServerNonce ) |
|
356 { |
|
357 //Check if replace command and replace data as defined |
|
358 |
|
359 TInt replaceStatus = KErrGeneral; |
|
360 SetAuthInfoL( iParentLUID + KMaxDataSyncID, fData, aObject, replaceStatus ); |
|
361 if ( replaceStatus == KErrNone ) |
|
362 { |
|
363 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
364 } |
|
365 else if ( replaceStatus == KErrNotFound ) |
|
366 { |
|
367 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
368 } |
|
369 else |
|
370 { |
|
371 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
372 } |
|
373 |
|
374 _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL():end" ); |
|
375 return; |
|
376 } |
|
377 |
|
378 TInt rValue = SetDMFieldDataL( iParentLUID, aObject, fData ); |
|
379 if ( fData == EProfilePort ) |
|
380 { |
|
381 // in case port is updated, save status ref to be used in |
|
382 // CompleteOutstandingCmdsL |
|
383 if(rValue==KErrNone) |
|
384 { |
|
385 iPortBuffer[iPortBuffer.Count()-1].iPortBufStatusRef = aStatusRef; |
|
386 } |
|
387 else if( rValue == KErrOverflow) |
|
388 { |
|
389 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ETooLargeObject ); |
|
390 } |
|
391 else |
|
392 { |
|
393 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
394 } |
|
395 } |
|
396 else |
|
397 { |
|
398 if( rValue != KErrNone ) |
|
399 { |
|
400 if( rValue == KErrNotFound ) |
|
401 { |
|
402 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
403 } |
|
404 else if( rValue == KErrInUse ) |
|
405 { |
|
406 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); |
|
407 } |
|
408 else if( rValue == KErrNoMemory ) |
|
409 { |
|
410 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); |
|
411 } |
|
412 else |
|
413 { |
|
414 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
415 } |
|
416 } |
|
417 else |
|
418 { |
|
419 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
420 } |
|
421 } |
|
422 } |
|
423 |
|
424 _DBG_FILE( "CNSmlDMSettingsAdapter::UpdateLeafObjectL():end" ); |
|
425 return; |
|
426 } |
|
427 |
|
428 // ----------------------------------------------------------------------------- |
|
429 // CNSmlDMSettingsAdapter::DeleteObjectL |
|
430 // Deletes whole profile or leaf object data acording to aURI. |
|
431 // ----------------------------------------------------------------------------- |
|
432 void CNSmlDMSettingsAdapter::DeleteObjectL( const TDesC8& aURI, |
|
433 const TDesC8& aLUID, |
|
434 const TInt aStatusRef ) |
|
435 { |
|
436 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): begin" ); |
|
437 |
|
438 if( aURI.Find( KNSmlDdfConRef ) != KErrNotFound ) |
|
439 { |
|
440 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL(): NOT ALLOWED end" ); |
|
441 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
442 return; |
|
443 } |
|
444 |
|
445 // Check which field going to be handled |
|
446 SetField( aURI ); |
|
447 |
|
448 // Check if valid field |
|
449 if( !AcceptDMField() ) |
|
450 { |
|
451 |
|
452 // Delete whole profile if aURI called for node |
|
453 TInt last = aURI.LocateReverse( '/' ); |
|
454 TInt pos = aURI.Find( KNSmlDefDMAcc ); |
|
455 if( last - 5 == pos ) |
|
456 { |
|
457 |
|
458 // If called for node means that profile will deleted from database |
|
459 iLUID = IntLUID( aLUID ); |
|
460 DBG_ARGS8( _S8("DeleteObjectL: URI %S LUID = %d"), &aURI, iLUID ); |
|
461 |
|
462 if( FindProfileIdL( iLUID ) == EFalse ) |
|
463 { |
|
464 _DBG_FILE( |
|
465 "CNSmlDMSettingsAdapter::DeleteObjectL( ): notfound end"); |
|
466 |
|
467 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
468 return; |
|
469 } |
|
470 else |
|
471 { |
|
472 TInt sRet = DeleteProfileL( iLUID + KMaxDataSyncID ); |
|
473 if ( sRet != KErrNone ) |
|
474 { |
|
475 if( sRet == KErrNotFound ) |
|
476 { |
|
477 iCallBack->SetStatusL( aStatusRef, |
|
478 CSmlDmAdapter::ENotFound ); |
|
479 } |
|
480 else if( sRet == KErrInUse ) |
|
481 { |
|
482 iCallBack->SetStatusL( aStatusRef, |
|
483 CSmlDmAdapter::EObjectInUse ); |
|
484 } |
|
485 else |
|
486 { |
|
487 iCallBack->SetStatusL( aStatusRef, |
|
488 CSmlDmAdapter::EError ); |
|
489 } |
|
490 return; |
|
491 } |
|
492 else |
|
493 { |
|
494 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): EOk end" ); |
|
495 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
496 return; |
|
497 } |
|
498 } |
|
499 } |
|
500 else |
|
501 { |
|
502 _DBG_FILE( |
|
503 "CNSmlDMSettingsAdapter::DeleteObjectL( ): EInvalidObject end" ); |
|
504 iCallBack->SetStatusL( aStatusRef,CSmlDmAdapter::EInvalidObject ); |
|
505 return; |
|
506 } |
|
507 }//Delete whole Profile |
|
508 |
|
509 iLUID = IntLUID( aLUID ); |
|
510 if ( iLUID != iParentLUID ) |
|
511 { |
|
512 if( FindProfileIdL( iLUID ) == EFalse ) |
|
513 { |
|
514 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): end" ); |
|
515 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
516 return; |
|
517 } |
|
518 iParentLUID = iLUID; |
|
519 } |
|
520 |
|
521 if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) |
|
522 { |
|
523 DeleteDMAuthInfoL( iLUID, EAuthenticationRequired ); |
|
524 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
525 return; |
|
526 } |
|
527 else if( iField->Compare( KNSmlDdfClientNonce ) == 0 ) |
|
528 { |
|
529 DeleteDMAuthInfoL( iLUID, EClientNonce ); |
|
530 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
531 return; |
|
532 } |
|
533 else if( iField->Compare(KNSmlDdfServerNonce) == 0 ) |
|
534 { |
|
535 DeleteDMAuthInfoL( iLUID, EServerNonce ); |
|
536 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
537 return; |
|
538 } |
|
539 |
|
540 // Sets default value if not null field |
|
541 HBufC8* dataObject = HBufC8::NewLC( 15 ); |
|
542 dataObject->Des().Format( KNullDesC8 ); |
|
543 |
|
544 _LIT8(aType, "text/plain"); |
|
545 iLeafType = EDMDelete; |
|
546 UpdateLeafObjectL( aURI, aLUID, *dataObject, aType, aStatusRef ); |
|
547 CleanupStack::PopAndDestroy(); //dataObject |
|
548 iLeafType = EDMUnset; |
|
549 |
|
550 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteObjectL( ): end" ); |
|
551 return; |
|
552 } |
|
553 |
|
554 // ----------------------------------------------------------------------------- |
|
555 // CNSmlDMSettingsAdapter::FetchLeafObjectL |
|
556 // Fetches profile leaf object data acordint to aURI. |
|
557 // ----------------------------------------------------------------------------- |
|
558 void CNSmlDMSettingsAdapter::FetchLeafObjectL( const TDesC8& aURI, |
|
559 const TDesC8& aLUID, |
|
560 const TDesC8& aType, |
|
561 const TInt aResultsRef, |
|
562 const TInt aStatusRef ) |
|
563 { |
|
564 |
|
565 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): begin" ); |
|
566 DBG_ARGS(_S16( "DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); |
|
567 |
|
568 iLUID = IntLUID( aLUID ); |
|
569 if ( iLUID >= 0 ) |
|
570 { |
|
571 if( FindProfileIdL( iLUID ) == EFalse ) |
|
572 { |
|
573 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
574 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
575 return; |
|
576 } |
|
577 } |
|
578 else |
|
579 { |
|
580 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
581 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
582 return; |
|
583 } |
|
584 |
|
585 // Check which field going to be handled |
|
586 SetField(aURI); |
|
587 |
|
588 // Check if valid field |
|
589 if( !AcceptDMField() ) |
|
590 { |
|
591 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EInvalidObject end" ); |
|
592 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); |
|
593 return; |
|
594 } |
|
595 |
|
596 // Get Database field type |
|
597 TInt fType = GetDMFieldType(); |
|
598 if ( fType == EWrong ) |
|
599 { |
|
600 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EError end" ); |
|
601 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
602 return; |
|
603 } |
|
604 |
|
605 TNSmlDMProfileData fieldId = GetDMField(); |
|
606 if( fieldId == ESyncAccepted ) |
|
607 { |
|
608 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafObjectL(): EError end" ); |
|
609 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
610 return; |
|
611 } |
|
612 CBufBase *lObject = CBufFlat::NewL( 128 ); |
|
613 CleanupStack::PushL( lObject ); |
|
614 lObject->Reset(); |
|
615 |
|
616 CSmlDmAdapter::TError status; |
|
617 |
|
618 if ( fType == EStr || fType == EInt || fType == EBin ) |
|
619 { |
|
620 TInt rValue = GetObjectL( iLUID, fieldId, *lObject ); |
|
621 if( rValue != KErrNone ) |
|
622 { |
|
623 if( rValue == KErrNotFound ) |
|
624 { |
|
625 status = CSmlDmAdapter::ENotFound; |
|
626 } |
|
627 else if( rValue == KErrInUse ) |
|
628 { |
|
629 status = CSmlDmAdapter::EObjectInUse; |
|
630 } |
|
631 else if( rValue == KErrNoMemory ) |
|
632 { |
|
633 status = CSmlDmAdapter::ENoMemory; |
|
634 } |
|
635 else |
|
636 { |
|
637 status = CSmlDmAdapter::EError; |
|
638 } |
|
639 } |
|
640 else |
|
641 { |
|
642 status = CSmlDmAdapter::EOk; |
|
643 } |
|
644 } |
|
645 else |
|
646 { |
|
647 CleanupStack::PopAndDestroy(); //lObject |
|
648 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
649 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
650 iProfile.Close(); |
|
651 iSyncSession.Close(); |
|
652 iSyncSessionOpen = EFalse; |
|
653 return; |
|
654 } |
|
655 iCallBack->SetStatusL( aStatusRef, status ); |
|
656 |
|
657 if(status==CSmlDmAdapter::EOk) |
|
658 { |
|
659 iCallBack->SetResultsL( aResultsRef, *lObject, aType ); |
|
660 } |
|
661 |
|
662 CleanupStack::PopAndDestroy(); //lObject |
|
663 iProfile.Close(); |
|
664 iSyncSession.Close(); |
|
665 iSyncSessionOpen = EFalse; |
|
666 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): end" ); |
|
667 return; |
|
668 } |
|
669 |
|
670 // ----------------------------------------------------------------------------- |
|
671 // CSmlDmSettingsAdapter::ChildURIListL |
|
672 // Function returns the list of profiles or leafs of the profile |
|
673 // acording to aURI. |
|
674 // ----------------------------------------------------------------------------- |
|
675 void CNSmlDMSettingsAdapter::ChildURIListL( const TDesC8& aURI, |
|
676 const TDesC8& aLUID, |
|
677 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
678 const TInt aResultsRef, |
|
679 const TInt aStatusRef ) |
|
680 { |
|
681 _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): begin" ); |
|
682 CBufBase *currentURISegmentList = CBufFlat::NewL( 128 ); |
|
683 CleanupStack::PushL( currentURISegmentList ); |
|
684 |
|
685 if( aURI.Match( KDmAccMatch ) != KErrNotFound ) |
|
686 { |
|
687 // Check if Profile exists |
|
688 TInt checkLUID = GetIntObject( aLUID ); |
|
689 if( FindProfileIdL( checkLUID ) ) |
|
690 { |
|
691 currentURISegmentList->InsertL( currentURISegmentList->Size(), KSegmDMAcc ); |
|
692 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
693 iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); |
|
694 } |
|
695 else |
|
696 { |
|
697 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
698 } |
|
699 |
|
700 CleanupStack::PopAndDestroy( ); // currentURISegmentList |
|
701 _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); |
|
702 return; |
|
703 } |
|
704 else if( aURI.Match( KDmAccMatch2 ) != KErrNotFound ) |
|
705 { |
|
706 if( iSyncSessionOpen == EFalse ) |
|
707 { |
|
708 iSyncSession.OpenL(); |
|
709 iSyncSessionOpen = ETrue; |
|
710 } |
|
711 RArray<TSmlProfileId> profileIdArray; |
|
712 CleanupClosePushL( profileIdArray ); |
|
713 TSmlUsageType usageType = ESmlDevMan; |
|
714 iSyncSession.ListProfilesL( profileIdArray, usageType ); |
|
715 |
|
716 for( TInt p = 0; p < profileIdArray.Count(); p++ ) |
|
717 { |
|
718 TBool notInList = ETrue; |
|
719 TInt newline = 0; |
|
720 TInt ddId = profileIdArray[p] - KMaxDataSyncID; |
|
721 |
|
722 while( notInList && newline < aPreviousURISegmentList.Count() ) |
|
723 { |
|
724 TInt ppId = GetIntObject( aPreviousURISegmentList.At(newline).iURISegLUID ); |
|
725 if( ppId == ddId ) |
|
726 { |
|
727 notInList = EFalse; |
|
728 break; |
|
729 } |
|
730 newline++; |
|
731 } |
|
732 if( notInList ) |
|
733 { |
|
734 _LIT8( Kprev, "DMId" ); |
|
735 TBuf8<7> addNAME(Kprev); // DMIdnnn , nnn = profileid |
|
736 TInt fixedProfId = profileIdArray[p] - KMaxDataSyncID; //fit to 3 decimal |
|
737 addNAME.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); |
|
738 |
|
739 currentURISegmentList->InsertL( currentURISegmentList->Size(), addNAME ); |
|
740 currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); |
|
741 DBG_ARGS8( _S8("notInList: Id = %d Name %S"), p, &addNAME ); |
|
742 |
|
743 // KNSmlDMStart includes start text for URISeg |
|
744 TBuf8<20> addURI; // SyncML/DMAcc/DMIdnnn , nnn = profileid |
|
745 addURI.Append( KNSmlDMStart ); |
|
746 addURI.AppendNumFixedWidth( fixedProfId, EDecimal, 3 ); |
|
747 |
|
748 TBuf8<3> addLUID; |
|
749 addLUID.Num( fixedProfId ); |
|
750 |
|
751 // Also added to mapping |
|
752 iCallBack->SetMappingL( addURI, addLUID ); |
|
753 } |
|
754 else |
|
755 { // Add those in PreviousList which are on database |
|
756 currentURISegmentList->InsertL( currentURISegmentList->Size(), |
|
757 aPreviousURISegmentList.At(newline).iURISeg ); |
|
758 currentURISegmentList->InsertL( currentURISegmentList->Size(), KSmlDmSlash ); |
|
759 // DBG_ARGS8( _S8("InList: Id = %d Name %S"), newline, |
|
760 // aPreviousURISegmentList.At(newline).iURISeg ); |
|
761 } |
|
762 } |
|
763 CleanupStack::PopAndDestroy( 1 );//profileIdArray |
|
764 } |
|
765 else |
|
766 { |
|
767 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); |
|
768 CleanupStack::PopAndDestroy( 1 ); // currentURISegmentList |
|
769 return; |
|
770 } |
|
771 |
|
772 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk ); |
|
773 iCallBack->SetResultsL( aResultsRef, *currentURISegmentList, KNullDesC8 ); |
|
774 CleanupStack::PopAndDestroy(); // currentURISegmentList |
|
775 _DBG_FILE( "CNSmlDMSettingsAdapter::ChildURIListL(): end" ); |
|
776 return; |
|
777 } |
|
778 |
|
779 // ----------------------------------------------------------------------------- |
|
780 // CNSmlDMSettingsAdapter::AddNodeObjectL |
|
781 // Adds new DM-settings profile to database |
|
782 // ----------------------------------------------------------------------------- |
|
783 void CNSmlDMSettingsAdapter::AddNodeObjectL( const TDesC8& aURI, |
|
784 const TDesC8& aParentLUID, |
|
785 const TInt aStatusRef ) |
|
786 { |
|
787 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): begin" ); |
|
788 |
|
789 if( aParentLUID.Length() > 0 ) |
|
790 { |
|
791 iParentLUID = GetIntObject( aParentLUID ); |
|
792 if( FindProfileIdL( iParentLUID ) != EFalse )// iProfile != NULL) |
|
793 { |
|
794 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): EAlreadyExists end" ); |
|
795 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EAlreadyExists ); |
|
796 return; |
|
797 } |
|
798 } |
|
799 AddNodeBufferL (aURI, aStatusRef); |
|
800 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeObjectL(): end" ); |
|
801 return; |
|
802 } |
|
803 |
|
804 // ----------------------------------------------------------------------------- |
|
805 // CNSmlDMSettingsAdapter::UpdateLeafObjectL() |
|
806 // ----------------------------------------------------------------------------- |
|
807 void CNSmlDMSettingsAdapter::UpdateLeafObjectL( const TDesC8&, const TDesC8&, |
|
808 RWriteStream*&, const TDesC8&, |
|
809 const TInt ) |
|
810 { |
|
811 //Not supported because data streaming is not supported by this adapter. |
|
812 } |
|
813 |
|
814 // ----------------------------------------------------------------------------- |
|
815 // CNSmlDMSettingsAdapter::FetchLeafObjectSizeL |
|
816 // This function fetches leaf object and returns its size. |
|
817 // ----------------------------------------------------------------------------- |
|
818 void CNSmlDMSettingsAdapter::FetchLeafObjectSizeL( const TDesC8& aURI, |
|
819 const TDesC8& aLUID, |
|
820 const TDesC8& aType, |
|
821 const TInt aResultsRef, |
|
822 const TInt aStatusRef ) |
|
823 { |
|
824 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectSizeL() : begin" ); |
|
825 DBG_ARGS( _S16("DM:Fetch aURI - %S - %S"), &aURI, &aLUID ); |
|
826 |
|
827 iLUID = IntLUID( aLUID ); |
|
828 if ( iLUID >= 0 ) |
|
829 { |
|
830 if( FindProfileIdL( iLUID ) == EFalse ) |
|
831 { |
|
832 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
833 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
834 return; |
|
835 } |
|
836 } |
|
837 else |
|
838 { |
|
839 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
840 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
841 return; |
|
842 } |
|
843 |
|
844 // Check which field going to be handled |
|
845 SetField( aURI ); |
|
846 |
|
847 // Check if valid field |
|
848 if( !AcceptDMField() ) |
|
849 { |
|
850 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EInvalidObject end" ); |
|
851 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EInvalidObject ); |
|
852 return; |
|
853 } |
|
854 |
|
855 // Get Database field type |
|
856 TInt fType = GetDMFieldType(); |
|
857 if ( fType == EWrong ) |
|
858 { |
|
859 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): EError end" ); |
|
860 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
861 return; |
|
862 } |
|
863 |
|
864 CBufBase *lObject = CBufFlat::NewL( 128 ); |
|
865 CleanupStack::PushL( lObject ); |
|
866 lObject->Reset(); |
|
867 |
|
868 if ( fType == EStr || fType == EInt || fType == EBin ) |
|
869 { |
|
870 TInt rValue = GetObjectL( iLUID, GetDMField(), *lObject ); |
|
871 if( lObject->Size() == 0 || rValue != KErrNone ) |
|
872 { |
|
873 if( rValue == KErrNotFound ) |
|
874 { |
|
875 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
876 } |
|
877 else if( rValue == KErrInUse ) |
|
878 { |
|
879 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EObjectInUse ); |
|
880 } |
|
881 else if( rValue == KErrNoMemory ) |
|
882 { |
|
883 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENoMemory ); |
|
884 } |
|
885 else |
|
886 { |
|
887 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EError ); |
|
888 } |
|
889 } |
|
890 } |
|
891 else |
|
892 { |
|
893 CleanupStack::PopAndDestroy();//lObject |
|
894 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectL(): ENotFound end" ); |
|
895 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::ENotFound ); |
|
896 return; |
|
897 } |
|
898 TInt objSizeInBytes = lObject->Size(); |
|
899 TBuf8<16> stringObjSizeInBytes; |
|
900 stringObjSizeInBytes.Num( objSizeInBytes ); |
|
901 |
|
902 lObject->Reset(); |
|
903 lObject->InsertL( 0, stringObjSizeInBytes ); |
|
904 iCallBack->SetResultsL( aResultsRef, *lObject, aType ); |
|
905 iCallBack->SetStatusL( aStatusRef, CSmlDmAdapter::EOk); |
|
906 |
|
907 CleanupStack::PopAndDestroy( 1 ); //lObject |
|
908 _DBG_FILE( "CNSmlDMSettingsAdapter::FetchLeafObjectSizeL(): end" ); |
|
909 return; |
|
910 } |
|
911 |
|
912 // ----------------------------------------------------------------------------- |
|
913 // CNSmlDMSettingsAdapter::ExecuteCommandL() |
|
914 // ----------------------------------------------------------------------------- |
|
915 void CNSmlDMSettingsAdapter::ExecuteCommandL( const TDesC8&, const TDesC8&, |
|
916 const TDesC8&, const TDesC8&, |
|
917 const TInt ) |
|
918 { |
|
919 //Not supported. Command execution via DM settings adapter not possible. |
|
920 } |
|
921 |
|
922 // ----------------------------------------------------------------------------- |
|
923 // CNSmlDMSettingsAdapter::ExecuteCommandL() |
|
924 // ----------------------------------------------------------------------------- |
|
925 void CNSmlDMSettingsAdapter::ExecuteCommandL( const TDesC8&, const TDesC8&, |
|
926 RWriteStream*&, const TDesC8&, |
|
927 const TInt ) |
|
928 { |
|
929 //Not supported. Command execution via DM settings adapter not possible. |
|
930 } |
|
931 |
|
932 // ----------------------------------------------------------------------------- |
|
933 // CNSmlDMSettingsAdapter::CopyCommandL() |
|
934 // ----------------------------------------------------------------------------- |
|
935 void CNSmlDMSettingsAdapter::CopyCommandL( const TDesC8&, const TDesC8&, |
|
936 const TDesC8&, const TDesC8&, |
|
937 const TDesC8&, TInt ) |
|
938 { |
|
939 //Not supported. |
|
940 } |
|
941 |
|
942 // ----------------------------------------------------------------------------- |
|
943 // CNSmlDMSettingsAdapter::StartAtomicL() |
|
944 // ----------------------------------------------------------------------------- |
|
945 void CNSmlDMSettingsAdapter::StartAtomicL() |
|
946 { |
|
947 //Not supported. Handling Atomic command cycles not supported by the adapter. |
|
948 } |
|
949 |
|
950 // ----------------------------------------------------------------------------- |
|
951 // CNSmlDMSettingsAdapter::CommitAtomicL() |
|
952 // ----------------------------------------------------------------------------- |
|
953 void CNSmlDMSettingsAdapter::CommitAtomicL() |
|
954 { |
|
955 //Not supported. Handling Atomic command cycles not supported by the adapter. |
|
956 } |
|
957 |
|
958 // ----------------------------------------------------------------------------- |
|
959 // CNSmlDMSettingsAdapter::RollbackAtomicL() |
|
960 // ----------------------------------------------------------------------------- |
|
961 void CNSmlDMSettingsAdapter::RollbackAtomicL() |
|
962 { |
|
963 //Not supported. Handling Atomic command cycles not supported by the adapter. |
|
964 } |
|
965 |
|
966 // ----------------------------------------------------------------------------- |
|
967 // CNSmlDMSettingsAdapter::StreamingSupport() |
|
968 // Indicates if streaming is supported. |
|
969 // ----------------------------------------------------------------------------- |
|
970 TBool CNSmlDMSettingsAdapter::StreamingSupport( TInt& /*aItemSize*/ ) |
|
971 { |
|
972 return EFalse; |
|
973 } |
|
974 |
|
975 // ----------------------------------------------------------------------------- |
|
976 // CNSmlDMSettingsAdapter::StreamCommittedL() |
|
977 // ----------------------------------------------------------------------------- |
|
978 void CNSmlDMSettingsAdapter::StreamCommittedL() |
|
979 { |
|
980 //Not supported. Streaming not supported by the DM settings adapter. |
|
981 } |
|
982 // ----------------------------------------------------------------------------- |
|
983 // CNSmlDMSettingsAdapter::CompleteOutstandingCmdsL() |
|
984 // If buffering used, commands must be executed before returning this function. |
|
985 // ----------------------------------------------------------------------------- |
|
986 void CNSmlDMSettingsAdapter::CompleteOutstandingCmdsL() |
|
987 { |
|
988 // Check if Buffered |
|
989 for (int val=0; val<iBuffer->Count ();val++) |
|
990 { |
|
991 if ( !iBuffer->At(val).iExecuted) |
|
992 { |
|
993 TInt count = iBuffer->At(val).iLeafBuf->Count ()-1; |
|
994 iExecutionIndex = val; |
|
995 iComplete = ETrue; |
|
996 ExecuteBufferL (); |
|
997 } |
|
998 } |
|
999 // if port was updated, set it |
|
1000 for (TInt i = 0;i<iPortBuffer.Count(); i++) |
|
1001 { |
|
1002 TInt err = SetProfileConnectionPortNrL( iPortBuffer[i].iPortBufLUID, iPortBuffer[i].iPortBuf ); |
|
1003 |
|
1004 // set status |
|
1005 if ( err != KErrNone ) |
|
1006 { |
|
1007 iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EError ); |
|
1008 } |
|
1009 else |
|
1010 { |
|
1011 iCallBack->SetStatusL( iPortBuffer[i].iPortBufStatusRef, CSmlDmAdapter::EOk ); |
|
1012 } |
|
1013 |
|
1014 } |
|
1015 iPortBuffer.Reset(); |
|
1016 iComplete = EFalse; |
|
1017 } |
|
1018 |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // CNSmlDMSettingsAdapter::AcceptDMField |
|
1021 // This function checks if field to be handled is valid. |
|
1022 // ----------------------------------------------------------------------------- |
|
1023 TBool CNSmlDMSettingsAdapter::AcceptDMField() |
|
1024 { |
|
1025 _DBG_FILE("CNSmlDMSettingsAdapter::AcceptDMField(): begin"); |
|
1026 |
|
1027 if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) |
|
1028 { |
|
1029 return ETrue; |
|
1030 } |
|
1031 else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) |
|
1032 { |
|
1033 return ETrue; |
|
1034 } |
|
1035 else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) |
|
1036 { |
|
1037 return ETrue; |
|
1038 } |
|
1039 else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) |
|
1040 { |
|
1041 return ETrue; |
|
1042 } |
|
1043 else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) |
|
1044 { |
|
1045 return ETrue; |
|
1046 } |
|
1047 else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) |
|
1048 { |
|
1049 return ETrue; |
|
1050 } |
|
1051 else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) |
|
1052 { |
|
1053 return ETrue; |
|
1054 } |
|
1055 else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) |
|
1056 { |
|
1057 return ETrue; |
|
1058 } |
|
1059 else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) |
|
1060 { |
|
1061 return ETrue; |
|
1062 } |
|
1063 else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) |
|
1064 { |
|
1065 return ETrue; |
|
1066 } |
|
1067 else if ( iField->Compare( KNSmlDdfName ) == 0 ) |
|
1068 { |
|
1069 return ETrue; |
|
1070 } |
|
1071 else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) |
|
1072 { |
|
1073 return ETrue; |
|
1074 } |
|
1075 else if ( iField->Compare( KNSmlDdfId ) == 0 ) |
|
1076 { |
|
1077 return ETrue; |
|
1078 } |
|
1079 |
|
1080 _DBG_FILE( "CNSmlDMSettingsAdapter::AcceptDMField(): end" ); |
|
1081 return EFalse; // Not a valid Type |
|
1082 } |
|
1083 |
|
1084 // ----------------------------------------------------------------------------- |
|
1085 // CNSmlDMSettingsAdapter::GetDMField |
|
1086 // Matches URI fieldname to DM-database. |
|
1087 // ----------------------------------------------------------------------------- |
|
1088 TNSmlDMProfileData CNSmlDMSettingsAdapter::GetDMField() const |
|
1089 { |
|
1090 |
|
1091 if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) |
|
1092 { |
|
1093 return EProfileMediumType; |
|
1094 } |
|
1095 else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) |
|
1096 { |
|
1097 return EProfileURL; |
|
1098 } |
|
1099 else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) |
|
1100 { |
|
1101 return EProfilePort; |
|
1102 } |
|
1103 else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) |
|
1104 { |
|
1105 return EAuthenticationRequired; |
|
1106 } |
|
1107 else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) |
|
1108 { |
|
1109 return EServerId; |
|
1110 } |
|
1111 else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) |
|
1112 { |
|
1113 return ESharedSecret; |
|
1114 } |
|
1115 else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) |
|
1116 { |
|
1117 return EServerNonce; |
|
1118 } |
|
1119 else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) |
|
1120 { |
|
1121 return EProfileDMServerUsername; |
|
1122 } |
|
1123 else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) |
|
1124 { |
|
1125 return EProfileDMServerPassword; |
|
1126 } |
|
1127 else if ( iField->Compare( KNSmlDdfClientNonce ) == 0 ) |
|
1128 { |
|
1129 return EClientNonce; |
|
1130 } |
|
1131 else if ( iField->Compare( KNSmlDdfName ) == 0 ) |
|
1132 { |
|
1133 return EProfileName; |
|
1134 } |
|
1135 else if ( iField->Compare( KNSmlDdfId ) == 0 ) |
|
1136 { |
|
1137 return EProfileId; |
|
1138 } |
|
1139 else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) |
|
1140 { |
|
1141 return EProfileIAPId; |
|
1142 } |
|
1143 |
|
1144 _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMField(): Error" ); |
|
1145 return ESyncAccepted; |
|
1146 } |
|
1147 |
|
1148 // ----------------------------------------------------------------------------- |
|
1149 // CNSmlDMSettingsAdapter::GetDMFieldType |
|
1150 // Gets field data type. |
|
1151 // ----------------------------------------------------------------------------- |
|
1152 TNSmlDMFieldType CNSmlDMSettingsAdapter::GetDMFieldType() const |
|
1153 { |
|
1154 if ( iField->Compare( KNSmlDdfAddrType ) == 0 ) |
|
1155 { |
|
1156 return EInt; |
|
1157 } |
|
1158 else if ( iField->Compare( KNSmlDdfAddr ) == 0 ) |
|
1159 { |
|
1160 return EStr; |
|
1161 } |
|
1162 else if ( iField->Compare( KNSmlDdfPortNbr ) == 0 ) |
|
1163 { |
|
1164 return EInt; |
|
1165 } |
|
1166 else if ( iField->Compare( KNSmlDdfAuthScheme ) == 0 ) |
|
1167 { |
|
1168 return EInt; |
|
1169 } |
|
1170 else if ( iField->Compare( KNSmlDdfServerId ) == 0 ) |
|
1171 { |
|
1172 return EStr; |
|
1173 } |
|
1174 else if ( iField->Compare( KNSmlDdfServerPW ) == 0 ) |
|
1175 { |
|
1176 return EStr; |
|
1177 } |
|
1178 else if ( iField->Compare( KNSmlDdfServerNonce ) == 0 ) |
|
1179 { |
|
1180 return EBin; |
|
1181 } |
|
1182 else if ( iField->Compare( KNSmlDdfClientUserName ) == 0 ) |
|
1183 { |
|
1184 return EStr; |
|
1185 } |
|
1186 else if ( iField->Compare( KNSmlDdfClientPW ) == 0 ) |
|
1187 { |
|
1188 return EStr; |
|
1189 } |
|
1190 else if (iField->Compare(KNSmlDdfClientNonce) == 0) |
|
1191 { |
|
1192 return EBin; |
|
1193 } |
|
1194 else if ( iField->Compare( KNSmlDdfName ) == 0 ) |
|
1195 { |
|
1196 return EStr; |
|
1197 } |
|
1198 else if ( iField->Compare( KNSmlDdfConRef ) == 0 ) |
|
1199 { |
|
1200 return EInt; |
|
1201 } |
|
1202 else if ( iField->Compare( KNSmlDdfId ) == 0 ) |
|
1203 { |
|
1204 return EInt; |
|
1205 } |
|
1206 |
|
1207 _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMFieldType(): Error" ); |
|
1208 return EWrong; |
|
1209 } |
|
1210 |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // CNSmlDMSettingsAdapter::IntLUID |
|
1213 // Returns integer value for a profile LUID. |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 TInt CNSmlDMSettingsAdapter::IntLUID( const TDesC8& aLUID ) |
|
1216 { |
|
1217 TLex8 lLex( aLUID ); |
|
1218 |
|
1219 if( lLex.Val( iLUID ) == KErrNone ) |
|
1220 { |
|
1221 return iLUID; |
|
1222 } |
|
1223 else |
|
1224 { |
|
1225 return -1; |
|
1226 } |
|
1227 } |
|
1228 |
|
1229 // ----------------------------------------------------------------------------- |
|
1230 // CNSmlDMSettingsAdapter::GetIntObject |
|
1231 // Returns integer value for a aObject. |
|
1232 // ----------------------------------------------------------------------------- |
|
1233 TInt CNSmlDMSettingsAdapter::GetIntObject( const TDesC8& aObject ) |
|
1234 { |
|
1235 TLex8 lLex( aObject ); |
|
1236 |
|
1237 TInt value = 0; |
|
1238 |
|
1239 if( lLex.Val( value ) != KErrNone ) |
|
1240 { |
|
1241 return KErrNotFound; |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 return value; |
|
1246 } |
|
1247 } |
|
1248 |
|
1249 // ----------------------------------------------------------------------------- |
|
1250 // CNSmlDMSettingsAdapter::GetIntObject16() |
|
1251 // Returns Integer Value for a 16 bit data object. |
|
1252 // ----------------------------------------------------------------------------- |
|
1253 TInt CNSmlDMSettingsAdapter::GetIntObject16( const TDesC& aObject ) |
|
1254 { |
|
1255 TLex16 lLex( aObject ); |
|
1256 |
|
1257 TInt value = 0; |
|
1258 |
|
1259 if( lLex.Val( value ) == KErrNone ) |
|
1260 { |
|
1261 return value; |
|
1262 } |
|
1263 else |
|
1264 { |
|
1265 return value; |
|
1266 } |
|
1267 } |
|
1268 |
|
1269 // ----------------------------------------------------------------------------- |
|
1270 // CNSmlDMSettingsAdapter::SetIntObjectLC |
|
1271 // Converts integer to HBufC8 type buffer and returns reference to it. |
|
1272 // ----------------------------------------------------------------------------- |
|
1273 TDesC8& CNSmlDMSettingsAdapter::SetIntObjectLC( const TInt& aObject ) |
|
1274 { |
|
1275 HBufC8* buf = HBufC8::NewLC( 8 ); |
|
1276 TPtr8 ptrBuf = buf->Des(); |
|
1277 |
|
1278 ptrBuf.Num( aObject ); |
|
1279 return *buf; |
|
1280 } |
|
1281 |
|
1282 // ----------------------------------------------------------------------------- |
|
1283 // CNSmlDMSettingsAdapter::NotValidStrLenght |
|
1284 // Checks if data length is valid. |
|
1285 // ----------------------------------------------------------------------------- |
|
1286 TBool CNSmlDMSettingsAdapter::NotValidStrLenght( const TNSmlDMProfileData& aProfileItem, |
|
1287 const TDesC8& aSource ) |
|
1288 { |
|
1289 TInt lLen = aSource.Length(); |
|
1290 TBool lBool = EFalse; |
|
1291 |
|
1292 switch ( aProfileItem ) |
|
1293 { |
|
1294 case ( EProfileName ) : |
|
1295 { |
|
1296 if( lLen > KNSmlMaxProfileNameLength ) |
|
1297 { |
|
1298 lBool = ETrue; |
|
1299 } |
|
1300 } |
|
1301 break; |
|
1302 |
|
1303 case ( EProfileDMServerUsername ) : |
|
1304 { |
|
1305 if( lLen > KNSmlMaxUsernameLength ) |
|
1306 { |
|
1307 lBool = ETrue; |
|
1308 } |
|
1309 } |
|
1310 break; |
|
1311 |
|
1312 case ( EProfileDMServerPassword ) : |
|
1313 { |
|
1314 if( lLen > KNSmlMaxPasswordLength ) |
|
1315 { |
|
1316 lBool = ETrue; |
|
1317 } |
|
1318 } |
|
1319 break; |
|
1320 |
|
1321 case ( ESharedSecret ) : |
|
1322 { |
|
1323 if( lLen > KNSmlDmSharedSecretMaxLength ) |
|
1324 { |
|
1325 lBool = ETrue; |
|
1326 } |
|
1327 } |
|
1328 break; |
|
1329 |
|
1330 case ( EProfileURL ) : |
|
1331 { |
|
1332 if( lLen > KNSmlMaxURLLength ) |
|
1333 { |
|
1334 lBool = ETrue; |
|
1335 } |
|
1336 } |
|
1337 break; |
|
1338 |
|
1339 case ( EServerId ) : |
|
1340 { |
|
1341 if( lLen > KNSmlDmServerIdMaxLength ) |
|
1342 { |
|
1343 lBool = ETrue; |
|
1344 } |
|
1345 } |
|
1346 break; |
|
1347 |
|
1348 case ( EProfileIAPId ) : |
|
1349 { |
|
1350 if( lLen > KNSmlMaxURLLength ) |
|
1351 { |
|
1352 lBool = ETrue; |
|
1353 } |
|
1354 } |
|
1355 break; |
|
1356 |
|
1357 case ( EAuthenticationRequired ) : |
|
1358 { |
|
1359 if( lLen > 20 ) |
|
1360 { |
|
1361 lBool = ETrue; |
|
1362 } |
|
1363 } |
|
1364 break; |
|
1365 |
|
1366 case ( EProfileId ) : |
|
1367 case ( EProfilePort ) : |
|
1368 case ( EProfileMediumType ) : |
|
1369 { |
|
1370 if( lLen > 8 ) |
|
1371 { |
|
1372 lBool = ETrue; |
|
1373 } |
|
1374 } |
|
1375 break; |
|
1376 |
|
1377 case ( EServerNonce ) : |
|
1378 case ( EClientNonce ) : |
|
1379 { |
|
1380 lBool = EFalse; |
|
1381 } |
|
1382 break; |
|
1383 |
|
1384 default: |
|
1385 { |
|
1386 lBool = ETrue; |
|
1387 } |
|
1388 } |
|
1389 |
|
1390 return lBool; |
|
1391 } |
|
1392 |
|
1393 // ----------------------------------------------------------------------------- |
|
1394 // CNSmlDMSettingsAdapter::SetField |
|
1395 // Last element of the URI (after last '/') is returned. |
|
1396 // ----------------------------------------------------------------------------- |
|
1397 TInt CNSmlDMSettingsAdapter::SetField( const TDesC8& aSource ) |
|
1398 { |
|
1399 if ( aSource.LocateReverse( KNSmlDMUriSeparator ) == KErrNotFound ) |
|
1400 { |
|
1401 iField->Des().Format( aSource ); |
|
1402 } |
|
1403 else |
|
1404 { |
|
1405 iField->Des().Format( aSource.Mid( aSource.LocateReverse( KNSmlDMUriSeparator ) + 1 ) ); |
|
1406 } |
|
1407 |
|
1408 return KErrNone; |
|
1409 } |
|
1410 |
|
1411 // ----------------------------------------------------------------------------- |
|
1412 // CNSmlDMSettingsAdapter::ConvertTo8LC |
|
1413 // Converts string value to 8-bit and returns reference. |
|
1414 // ----------------------------------------------------------------------------- |
|
1415 TDesC8& CNSmlDMSettingsAdapter::ConvertTo8LC( const TDesC& aSource ) |
|
1416 { |
|
1417 HBufC8* buf = HBufC8::NewLC( aSource.Length() * 2 ); |
|
1418 TPtr8 bufPtr = buf->Des(); |
|
1419 CnvUtfConverter::ConvertFromUnicodeToUtf8( bufPtr, aSource ); |
|
1420 |
|
1421 return *buf; |
|
1422 } |
|
1423 |
|
1424 // ----------------------------------------------------------------------------- |
|
1425 // CNSmlDMSettingsAdapter::ConvertTo16LC |
|
1426 // Converts string value to 16-bit and returns reference. |
|
1427 // ----------------------------------------------------------------------------- |
|
1428 TDesC16& CNSmlDMSettingsAdapter::ConvertTo16LC( const TDesC8& aSource) |
|
1429 { |
|
1430 HBufC16* buf16 = HBufC16::NewLC( aSource.Length() ); |
|
1431 TPtr16 bufPtr16 = buf16->Des(); |
|
1432 |
|
1433 CnvUtfConverter::ConvertToUnicodeFromUtf8( bufPtr16, aSource ); |
|
1434 |
|
1435 return *buf16; |
|
1436 } |
|
1437 |
|
1438 // ------------------------------------------------------------------------------------- |
|
1439 // CNSmlDMSettingsAdapter::GetConRefL |
|
1440 // Gets the URI for given aObject (IAP ID). |
|
1441 // ------------------------------------------------------------------------------------- |
|
1442 TInt CNSmlDMSettingsAdapter::GetConRefL( CBufBase& aObject ) |
|
1443 { |
|
1444 _DBG_FILE( "CNSmlDMSettingsAdapter::GetConRefL() : begin" ); |
|
1445 TInt profIAPid = -1; |
|
1446 TInt apIdResponse = GetProfileIAPIdL( profIAPid ); |
|
1447 if( profIAPid < 0 ) |
|
1448 { |
|
1449 return KErrNone; |
|
1450 } |
|
1451 if( apIdResponse != KErrNone ) |
|
1452 { |
|
1453 return KErrNotFound; |
|
1454 } |
|
1455 CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); |
|
1456 CleanupStack::PushL( apmatch ); |
|
1457 HBufC8* uri8 = apmatch->URIFromIAPIdL( profIAPid ); |
|
1458 if( uri8 ) |
|
1459 { |
|
1460 CleanupStack::PushL( uri8 ); |
|
1461 aObject.InsertL( aObject.Size(), uri8->Des() ); |
|
1462 CleanupStack::PopAndDestroy(); // uri8 |
|
1463 } |
|
1464 else |
|
1465 { |
|
1466 CleanupStack::PopAndDestroy(); // apMatch |
|
1467 return KErrGeneral; |
|
1468 } |
|
1469 CleanupStack::PopAndDestroy(); // iapMatch |
|
1470 _DBG_FILE( "CNSmlDSSettingsAdapter::GetToNAPIDL() : end" ); |
|
1471 return KErrNone; |
|
1472 } |
|
1473 |
|
1474 // ------------------------------------------------------------------------------------- |
|
1475 // CNSmlDMSettingsAdapter::SetConRefL() |
|
1476 // Set the profile IAP Id value according to given URI. |
|
1477 // ------------------------------------------------------------------------------------- |
|
1478 TInt CNSmlDMSettingsAdapter::SetConRefL( const TInt aLUID, const TDesC8& aObject ) |
|
1479 { |
|
1480 _DBG_FILE( "CNSmlDMSettingsAdapter::SetConRefL() : begin" ); |
|
1481 CNSmlDMIAPMatcher* apmatch = CNSmlDMIAPMatcher::NewL( iCallBack ); |
|
1482 CleanupStack::PushL( apmatch ); |
|
1483 TInt lIAPid = apmatch->IAPIdFromURIL( aObject ); |
|
1484 CleanupStack::PopAndDestroy(); // iapmatch |
|
1485 if(aObject.Length() >0 && lIAPid == KErrNotFound) |
|
1486 { |
|
1487 return KErrGeneral; |
|
1488 } |
|
1489 TInt apIdResponse = SetProfileConnectionPropertyL( aLUID, lIAPid ); |
|
1490 _DBG_FILE( "CNSmlDMSettingsAdapter::SetConRefL() : end" ); |
|
1491 return apIdResponse; |
|
1492 } |
|
1493 |
|
1494 // ------------------------------------------------------------------------------------------------ |
|
1495 // CNSmlDMSettingsAdapter::ParseUri |
|
1496 // Resolves portnbr (separated with ':') as integer from Uri. |
|
1497 // ------------------------------------------------------------------------------------------------ |
|
1498 TInt CNSmlDMSettingsAdapter::ParseUri( const TDesC8& aRealURI, TInt& aPort ) |
|
1499 { |
|
1500 TInt offset=0; |
|
1501 //http: |
|
1502 if( aRealURI.Find( KNSmlDMSettingsHTTP )==0 )//http: |
|
1503 { |
|
1504 offset = KNSmlDMSettingsHTTP().Length(); |
|
1505 } |
|
1506 else if( aRealURI.Find( KNSmlDMSettingsHTTPS )==0 )//https: |
|
1507 { |
|
1508 offset = KNSmlDMSettingsHTTPS().Length(); |
|
1509 } |
|
1510 |
|
1511 TBool portFound=EFalse; |
|
1512 ////123.234.345.456:80/syncml |
|
1513 for( TInt i = offset; i < aRealURI.Length(); i++ ) |
|
1514 { |
|
1515 if( aRealURI[i] == KNSmlDMColon )// ':' |
|
1516 { |
|
1517 portFound = ETrue; |
|
1518 offset=i; |
|
1519 } |
|
1520 if( portFound && aRealURI[i] == KNSmlDMUriSeparator ) // '/' |
|
1521 { |
|
1522 aPort = GetIntObject( aRealURI.Mid( (offset + 1), (i - offset-1) ) ); |
|
1523 } |
|
1524 else if ( portFound && i == aRealURI.Length() - 1 ) // last char |
|
1525 { |
|
1526 // port is from offset to the end |
|
1527 aPort = GetIntObject( aRealURI.Right( aRealURI.Length() - offset - 1 ) ); |
|
1528 } |
|
1529 } |
|
1530 |
|
1531 if( aPort != 0 ) |
|
1532 { |
|
1533 return KErrNone; |
|
1534 } |
|
1535 else |
|
1536 { |
|
1537 return KErrNotFound; |
|
1538 } |
|
1539 } |
|
1540 // ----------------------------------------------------------------------------- |
|
1541 // CNSmlDMSettingsAdapter::OpenSyncSessionAndDSProfileL |
|
1542 // The function opens the server session and DM profile. |
|
1543 // ----------------------------------------------------------------------------- |
|
1544 TInt CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL( const TInt aIntLUID, |
|
1545 TSmlOpenMode aMode ) |
|
1546 { |
|
1547 _DBG_FILE( "CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL(): begin" ); |
|
1548 if( iSyncSessionOpen == EFalse ) |
|
1549 { |
|
1550 iSyncSession.OpenL(); |
|
1551 iSyncSessionOpen = ETrue; |
|
1552 } |
|
1553 TInt trueLuid = aIntLUID + KMaxDataSyncID; |
|
1554 TInt rValue(KErrNone); |
|
1555 |
|
1556 if(trueLuid!=iCurrentProfile) |
|
1557 { |
|
1558 RArray<TSmlProfileId> profileIdArray; |
|
1559 CleanupClosePushL( profileIdArray ); |
|
1560 TSmlUsageType usageType = ESmlDevMan; |
|
1561 iSyncSession.ListProfilesL( profileIdArray, usageType ); |
|
1562 TInt index = profileIdArray.Find( trueLuid ); |
|
1563 CleanupStack::PopAndDestroy(); //profileIdArray |
|
1564 if( index == KErrNotFound ) |
|
1565 { |
|
1566 return KErrNotFound; |
|
1567 } |
|
1568 TRAP( rValue, iProfile.OpenL( iSyncSession, trueLuid, aMode ) ); |
|
1569 iCurrentProfile = trueLuid; |
|
1570 if( rValue != KErrNone ) |
|
1571 { |
|
1572 iCurrentProfile = 0; |
|
1573 iProfile.Close(); |
|
1574 iSyncSession.Close(); |
|
1575 iSyncSessionOpen = EFalse; |
|
1576 } |
|
1577 } |
|
1578 _DBG_FILE( "CNSmlDMSettingsAdapter::OpenSyncSessionAndProfileL(): end" ); |
|
1579 return rValue; |
|
1580 } |
|
1581 |
|
1582 // ----------------------------------------------------------------------------- |
|
1583 // CNSmlDMSettingsAdapter::FindProfileId |
|
1584 // Function checks if profile can be found. |
|
1585 // ----------------------------------------------------------------------------- |
|
1586 TBool CNSmlDMSettingsAdapter::FindProfileIdL( const TInt aIntLUID ) |
|
1587 { |
|
1588 _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): begin" ); |
|
1589 if( iSyncSessionOpen == EFalse ) |
|
1590 { |
|
1591 iSyncSession.OpenL(); |
|
1592 iSyncSessionOpen = ETrue; |
|
1593 } |
|
1594 |
|
1595 RArray <TSmlProfileId> profileList; |
|
1596 CleanupClosePushL( profileList ); |
|
1597 TSmlUsageType usageType = ESmlDevMan; |
|
1598 iSyncSession.ListProfilesL( profileList, usageType ); |
|
1599 if( profileList.Count() == 0 ) |
|
1600 { |
|
1601 CleanupStack::PopAndDestroy(); //profileList |
|
1602 return EFalse; |
|
1603 } |
|
1604 TInt item = profileList.Find( aIntLUID + KMaxDataSyncID ); |
|
1605 CleanupStack::PopAndDestroy(); //profileList |
|
1606 if( item != KErrNotFound ) |
|
1607 { |
|
1608 _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): end" ); |
|
1609 return ETrue; |
|
1610 } |
|
1611 _DBG_FILE( "CNSmlDMSettingsAdapter::FindProfileIdL(): end" ); |
|
1612 return EFalse; |
|
1613 } |
|
1614 // ----------------------------------------------------------------------------- |
|
1615 // CNSmlDMSettingsAdapter::CreateNewProfileL |
|
1616 // The function creates new DM profile via client API. |
|
1617 // ----------------------------------------------------------------------------- |
|
1618 TInt CNSmlDMSettingsAdapter::CreateNewProfileL( TInt& aPID ) |
|
1619 { |
|
1620 _DBG_FILE("CNSmlDMSettingsAdapter::CreateNewProfileL(): begin"); |
|
1621 if( iSyncSessionOpen == EFalse ) |
|
1622 { |
|
1623 iSyncSession.OpenL(); |
|
1624 iSyncSessionOpen = ETrue; |
|
1625 } |
|
1626 TRAPD( value1, iProfile.CreateL( iSyncSession ) ); |
|
1627 if( value1 != KErrNone ) |
|
1628 { |
|
1629 iCurrentProfile = 0; |
|
1630 iProfile.Close(); |
|
1631 iSyncSession.Close(); |
|
1632 iSyncSessionOpen = EFalse; |
|
1633 return value1; |
|
1634 } |
|
1635 |
|
1636 TRAPD( value2, iProfile.UpdateL() ); |
|
1637 if( value2 != KErrNone ) |
|
1638 { |
|
1639 iCurrentProfile = 0; |
|
1640 iProfile.Close(); |
|
1641 iSyncSession.Close(); |
|
1642 iSyncSessionOpen = EFalse; |
|
1643 return value2; |
|
1644 } |
|
1645 |
|
1646 aPID = iProfile.Identifier(); |
|
1647 iCurrentProfile = 0; |
|
1648 iProfile.Close(); |
|
1649 _DBG_FILE( "CNSmlDMSettingsAdapter::CreateNewProfileL(): end" ); |
|
1650 return KErrNone; |
|
1651 } |
|
1652 // ----------------------------------------------------------------------------- |
|
1653 // CNSmlDMSettingsAdapter::SetProfileServerURIL() |
|
1654 // The function sets the server URL for a profile. |
|
1655 // ----------------------------------------------------------------------------- |
|
1656 TInt CNSmlDMSettingsAdapter::SetProfileServerURIL( const TInt aPID, |
|
1657 const TDesC8& aObj ) |
|
1658 { |
|
1659 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerURIL(): begin" ); |
|
1660 TInt retVal = KErrNone; |
|
1661 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1662 if( retVal != KErrNone ) |
|
1663 { |
|
1664 iCurrentProfile = 0; |
|
1665 iProfile.Close(); |
|
1666 return retVal; |
|
1667 } |
|
1668 RArray<TSmlTransportId> transportIdArray; |
|
1669 CleanupClosePushL( transportIdArray ); |
|
1670 iProfile.ListConnectionsL( transportIdArray ); |
|
1671 if( transportIdArray.Count() == 0 ) |
|
1672 { |
|
1673 CleanupStack::PopAndDestroy();//transportIdArray |
|
1674 iCurrentProfile = 0; |
|
1675 iProfile.Close(); |
|
1676 return KErrGeneral; |
|
1677 } |
|
1678 |
|
1679 TInt newPort(0); |
|
1680 |
|
1681 RSyncMLConnection conn; |
|
1682 CleanupClosePushL( conn ); |
|
1683 conn.OpenL( iProfile, transportIdArray[0] ); |
|
1684 |
|
1685 if(ParseUri(aObj,newPort)==KErrNotFound) |
|
1686 { |
|
1687 TInt port = 0; |
|
1688 ParseUri(conn.ServerURI(),port); |
|
1689 if(port==0) |
|
1690 { |
|
1691 port = 80; |
|
1692 } |
|
1693 |
|
1694 TBuf8<5> buf; |
|
1695 buf.Num( port ); |
|
1696 |
|
1697 TInt totalSize = aObj.Length() + buf.Length() + 1; |
|
1698 HBufC8* newServerURI = HBufC8::NewLC( totalSize ); |
|
1699 SetPortNrToAddrStr( aObj, newServerURI, buf ); |
|
1700 conn.SetServerURIL( *newServerURI ); |
|
1701 conn.UpdateL(); |
|
1702 CleanupStack::PopAndDestroy( newServerURI ); |
|
1703 } |
|
1704 else |
|
1705 { |
|
1706 conn.SetServerURIL( aObj ); |
|
1707 conn.UpdateL(); |
|
1708 } |
|
1709 |
|
1710 |
|
1711 iProfile.UpdateL(); |
|
1712 |
|
1713 CleanupStack::PopAndDestroy( 2 ); //transportIdArray, conn |
|
1714 iCurrentProfile = 0; |
|
1715 iProfile.Close(); |
|
1716 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerURIL(): end" ); |
|
1717 return KErrNone; |
|
1718 } |
|
1719 // ----------------------------------------------------------------------------- |
|
1720 // CNSmlDMSettingsAdapter::SetProfileDisplayNameL() |
|
1721 // The function sets the display name for a profile. |
|
1722 // ----------------------------------------------------------------------------- |
|
1723 TInt CNSmlDMSettingsAdapter::SetProfileDisplayNameL( const TInt aPID, |
|
1724 const TDesC8& aObj ) |
|
1725 { |
|
1726 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileDisplayNameL(): begin" ); |
|
1727 TInt retVal = KErrNone; |
|
1728 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1729 if( retVal != KErrNone ) |
|
1730 { |
|
1731 iCurrentProfile = 0; |
|
1732 iProfile.Close(); |
|
1733 return retVal; |
|
1734 } |
|
1735 iProfile.SetDisplayNameL( ConvertTo16LC( aObj ) ); |
|
1736 iProfile.UpdateL(); |
|
1737 CleanupStack::PopAndDestroy(); //ConvertTo16LC |
|
1738 iCurrentProfile = 0; |
|
1739 iProfile.Close(); |
|
1740 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileDisplayNameL(): end" ); |
|
1741 return KErrNone; |
|
1742 } |
|
1743 |
|
1744 // ----------------------------------------------------------------------------- |
|
1745 // CNSmlDMSettingsAdapter::SetProfileUserNameL |
|
1746 // The function sets the profile user name. |
|
1747 // ----------------------------------------------------------------------------- |
|
1748 TInt CNSmlDMSettingsAdapter::SetProfileUserNameL( const TInt aPID, |
|
1749 const TDesC8& aObj ) |
|
1750 { |
|
1751 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileUserNameL(): begin" ); |
|
1752 TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1753 if( retVal != KErrNone ) |
|
1754 { |
|
1755 iCurrentProfile = 0; |
|
1756 iProfile.Close(); |
|
1757 return KErrGeneral; |
|
1758 } |
|
1759 iProfile.SetUserNameL( aObj ); |
|
1760 iProfile.UpdateL(); |
|
1761 iCurrentProfile = 0; |
|
1762 iProfile.Close(); |
|
1763 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileUserNameL(): end" ); |
|
1764 return KErrNone; |
|
1765 } |
|
1766 |
|
1767 // ----------------------------------------------------------------------------- |
|
1768 // CNSmlDMSettingsAdapter::SetProfileProtocolVersionL |
|
1769 // The function sets the protocol version to be supported. |
|
1770 // ----------------------------------------------------------------------------- |
|
1771 TInt CNSmlDMSettingsAdapter::SetProfileProtocolVersionL( const TInt aPID, |
|
1772 const TDesC8& ) |
|
1773 { |
|
1774 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileProtocolVersionL(): begin" ); |
|
1775 TInt retVal = KErrNone; |
|
1776 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1777 if( retVal != KErrNone ) |
|
1778 { |
|
1779 iCurrentProfile = 0; |
|
1780 iProfile.Close(); |
|
1781 return retVal; |
|
1782 } |
|
1783 //The syncSession to Sync server is open. |
|
1784 TSmlProtocolVersion protocol = ESmlVersion1_2; |
|
1785 iProfile.SetProtocolVersionL( protocol ); |
|
1786 TRAPD( iError, iProfile.UpdateL() ); |
|
1787 iCurrentProfile = 0; |
|
1788 iProfile.Close(); |
|
1789 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileProtocolVersionL(): begin" ); |
|
1790 return iError; |
|
1791 } |
|
1792 |
|
1793 // ----------------------------------------------------------------------------- |
|
1794 // CNSmlDMSettingsAdapter::SetProfileServerIdL |
|
1795 // The function sets the profile ServerId value. |
|
1796 // ----------------------------------------------------------------------------- |
|
1797 TInt CNSmlDMSettingsAdapter::SetProfileServerIdL( const TInt aPID, |
|
1798 const TDesC8& aObj ) |
|
1799 { |
|
1800 _DBG_FILE("CNSmlDMSettingsAdapter::SetProfileServerIdL(): begin"); |
|
1801 TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1802 if( retVal != KErrNone ) |
|
1803 { |
|
1804 iCurrentProfile = 0; |
|
1805 iProfile.Close(); |
|
1806 return KErrGeneral; |
|
1807 } |
|
1808 iProfile.SetServerIdL( aObj ); |
|
1809 TRAP(retVal,iProfile.UpdateL() ); |
|
1810 iCurrentProfile = 0; |
|
1811 iProfile.Close(); |
|
1812 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerIdL(): end" ); |
|
1813 return retVal; |
|
1814 } |
|
1815 |
|
1816 // ----------------------------------------------------------------------------- |
|
1817 // CNSmlDMSettingsAdapter::SetProfileServerPasswordL |
|
1818 // The function sets the profile server password. |
|
1819 // ----------------------------------------------------------------------------- |
|
1820 TInt CNSmlDMSettingsAdapter::SetProfileServerPasswordL( const TInt aPID, |
|
1821 const TDesC8& aObj ) |
|
1822 { |
|
1823 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerPasswordL(): begin" ); |
|
1824 TInt retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1825 if( retVal != KErrNone ) |
|
1826 { |
|
1827 iCurrentProfile = 0; |
|
1828 iProfile.Close(); |
|
1829 return KErrGeneral; |
|
1830 } |
|
1831 iProfile.SetServerPasswordL( aObj ); |
|
1832 iProfile.UpdateL(); |
|
1833 iCurrentProfile = 0; |
|
1834 iProfile.Close(); |
|
1835 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileServerPasswordL(): end" ); |
|
1836 return KErrNone; |
|
1837 } |
|
1838 |
|
1839 // ----------------------------------------------------------------------------- |
|
1840 // CNSmlDMSettingsAdapter::SetProfilePasswordL |
|
1841 // The function sets the profile password. |
|
1842 // ----------------------------------------------------------------------------- |
|
1843 TInt CNSmlDMSettingsAdapter::SetProfilePasswordL( const TInt aPID, |
|
1844 const TDesC8& aObj ) |
|
1845 { |
|
1846 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfilePasswordL(): begin" ); |
|
1847 TInt retVal = KErrNone; |
|
1848 retVal = OpenSyncSessionAndProfileL( aPID, ESmlOpenReadWrite ); |
|
1849 if( retVal != KErrNone ) |
|
1850 { |
|
1851 iCurrentProfile = 0; |
|
1852 iProfile.Close(); |
|
1853 return retVal; |
|
1854 } |
|
1855 iProfile.SetPasswordL( aObj ); |
|
1856 iProfile.UpdateL(); |
|
1857 iCurrentProfile = 0; |
|
1858 iProfile.Close(); |
|
1859 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfilePasswordL(): begin" ); |
|
1860 return KErrNone; |
|
1861 } |
|
1862 |
|
1863 // ----------------------------------------------------------------------------- |
|
1864 // CNSmlDMSettingsAdapter::SetProfileConnectionPropertyL |
|
1865 // This function sets the profile IAP id. |
|
1866 // ----------------------------------------------------------------------------- |
|
1867 TInt CNSmlDMSettingsAdapter::SetProfileConnectionPropertyL( const TInt aLUID, |
|
1868 const TInt aIAPid ) |
|
1869 { |
|
1870 TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); |
|
1871 if( retVal != KErrNone ) |
|
1872 { |
|
1873 iCurrentProfile = 0; |
|
1874 iProfile.Close(); |
|
1875 return retVal; |
|
1876 } |
|
1877 RArray<TSmlTransportId> connIdArray; |
|
1878 CleanupClosePushL( connIdArray ); |
|
1879 iProfile.ListConnectionsL( connIdArray ); |
|
1880 if( connIdArray.Count() == 1 ) |
|
1881 { |
|
1882 RSyncMLTransport transport; |
|
1883 CleanupClosePushL( transport ); |
|
1884 transport.OpenL( iSyncSession, connIdArray[0] ); |
|
1885 const CSyncMLTransportPropertiesArray& props = transport.Properties(); |
|
1886 TInt index = props.Find( KNSmlIAPId ); |
|
1887 if( index > 0 ) |
|
1888 { |
|
1889 RSyncMLConnection conn; |
|
1890 CleanupClosePushL( conn ); |
|
1891 conn.OpenL( iProfile, connIdArray[0] ); |
|
1892 HBufC8* apIdBuffer = HBufC8::NewLC( 4 ); |
|
1893 TPtr8 ptrIapIdBuf = apIdBuffer->Des(); |
|
1894 ptrIapIdBuf.Num( aIAPid ); |
|
1895 conn.SetPropertyL( KNSmlIAPId, ptrIapIdBuf ); |
|
1896 conn.UpdateL(); |
|
1897 CleanupStack::PopAndDestroy( 2 ); //conn, apIdBuffer |
|
1898 retVal = KErrNone; |
|
1899 } |
|
1900 else |
|
1901 { |
|
1902 retVal = KErrNotFound; |
|
1903 } |
|
1904 CleanupStack::PopAndDestroy( 1 ); //transport |
|
1905 } |
|
1906 else |
|
1907 { |
|
1908 retVal = KErrNotFound; |
|
1909 } |
|
1910 iCurrentProfile = 0; |
|
1911 iProfile.Close(); |
|
1912 CleanupStack::PopAndDestroy(); //connIdArray |
|
1913 return retVal; |
|
1914 } |
|
1915 |
|
1916 // ----------------------------------------------------------------------------- |
|
1917 // CNSmlDMSettingsAdapter::DeleteProfileL |
|
1918 // The function deleted the profile from DM database. |
|
1919 // ----------------------------------------------------------------------------- |
|
1920 TInt CNSmlDMSettingsAdapter::DeleteProfileL( const TInt aPID ) |
|
1921 { |
|
1922 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteProfileL(): begin" ); |
|
1923 if( iSyncSessionOpen == EFalse ) |
|
1924 { |
|
1925 iSyncSession.OpenL(); |
|
1926 iSyncSessionOpen = ETrue; |
|
1927 } |
|
1928 |
|
1929 RArray<TSmlProfileId> profileIdArray; |
|
1930 CleanupClosePushL( profileIdArray ); |
|
1931 TSmlUsageType usageType = ESmlDevMan; |
|
1932 iSyncSession.ListProfilesL( profileIdArray, usageType ); |
|
1933 TInt index = profileIdArray.Find( aPID ); |
|
1934 if ( index == KErrNotFound ) |
|
1935 { |
|
1936 //No match |
|
1937 CleanupStack::PopAndDestroy();//profileIdArray |
|
1938 return KErrNotFound; |
|
1939 } |
|
1940 iSyncSession.DeleteProfileL( aPID ); |
|
1941 iSyncSession.Close(); |
|
1942 iSyncSessionOpen = EFalse; |
|
1943 CleanupStack::PopAndDestroy();//profileIdArray |
|
1944 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteProfileL(): end" ); |
|
1945 return KErrNone; |
|
1946 } |
|
1947 |
|
1948 // ----------------------------------------------------------------------------- |
|
1949 // CNSmlDMSettingsAdapter::GetObjectL |
|
1950 // The function checks which leaf data to be fetched. |
|
1951 // ----------------------------------------------------------------------------- |
|
1952 TInt CNSmlDMSettingsAdapter::GetObjectL( TInt aLUID, TNSmlDMProfileData aDMField, |
|
1953 CBufBase& aObject ) |
|
1954 { |
|
1955 TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenRead ); |
|
1956 if( retVal != KErrNone ) |
|
1957 { |
|
1958 iCurrentProfile = 0; |
|
1959 iProfile.Close(); |
|
1960 return retVal; |
|
1961 } |
|
1962 switch ( aDMField ) |
|
1963 { |
|
1964 case ( EProfileName ) : |
|
1965 { |
|
1966 GetProfileNameL( aObject ); |
|
1967 } |
|
1968 break; |
|
1969 |
|
1970 case ( EProfileDMServerUsername ) : |
|
1971 { |
|
1972 GetProfileUserNameL( aObject ); |
|
1973 } |
|
1974 break; |
|
1975 |
|
1976 case ( EProfileURL ) : |
|
1977 { |
|
1978 GetProfileServerURLL( aObject ); |
|
1979 TInt port(0); |
|
1980 if(ParseUri(aObject.Ptr(0),port)==KErrNone) |
|
1981 { |
|
1982 HBufC8* addr = aObject.Ptr(0).AllocLC(); |
|
1983 aObject.Reset(); |
|
1984 TInt portStart = addr->LocateReverse(KNSmlDMColon); |
|
1985 aObject.InsertL(aObject.Size(),addr->Left(portStart)); |
|
1986 |
|
1987 TInt portLen=addr->Mid(portStart).Locate(KNSmlDMUriSeparator); |
|
1988 if(portLen!=KErrNotFound) |
|
1989 { |
|
1990 aObject.InsertL(aObject.Size(),addr->Mid(portStart+portLen)); |
|
1991 } |
|
1992 |
|
1993 CleanupStack::PopAndDestroy(); //addr |
|
1994 } |
|
1995 } |
|
1996 break; |
|
1997 |
|
1998 case ( EServerId ) : |
|
1999 { |
|
2000 GetServerIdL( aObject ); |
|
2001 } |
|
2002 break; |
|
2003 |
|
2004 case ( EProfileIAPId ) : |
|
2005 { |
|
2006 retVal = GetConRefL( aObject ); |
|
2007 } |
|
2008 break; |
|
2009 |
|
2010 case ( EProfilePort ) : |
|
2011 { |
|
2012 GetProfileServerURLL( aObject ); |
|
2013 if ( aObject.Size() == 0 ) |
|
2014 { |
|
2015 retVal = KErrNone; |
|
2016 break; |
|
2017 } |
|
2018 GetProfilePortNumberL ( aObject ); |
|
2019 } |
|
2020 break; |
|
2021 |
|
2022 case ( EProfileDMServerPassword ) : |
|
2023 { |
|
2024 retVal = EInvalidObject; |
|
2025 } |
|
2026 break; |
|
2027 |
|
2028 case ( ESharedSecret ) : |
|
2029 {//ServerPW |
|
2030 retVal = EInvalidObject; |
|
2031 } |
|
2032 break; |
|
2033 case ( EProfileId ) : |
|
2034 break; |
|
2035 case ( EProfileMediumType ) : |
|
2036 { |
|
2037 retVal = GetProfileConnectiontypeL( aObject ); |
|
2038 } |
|
2039 break; |
|
2040 |
|
2041 case ( EAuthenticationRequired ) : |
|
2042 case ( EServerNonce ) : |
|
2043 case ( EClientNonce ) : |
|
2044 { |
|
2045 retVal = GetDMAuthInfoL( aLUID, aDMField, aObject ); |
|
2046 } |
|
2047 break; |
|
2048 |
|
2049 default: |
|
2050 { |
|
2051 User::Panic( KNSmlIndexOutOfBoundStr, KNSmlPanicIndexOutOfBound ); |
|
2052 } |
|
2053 } |
|
2054 iCurrentProfile = 0; |
|
2055 iProfile.Close(); |
|
2056 return retVal; |
|
2057 } |
|
2058 |
|
2059 // ----------------------------------------------------------------------------- |
|
2060 // CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL() |
|
2061 // The function sets the profile port number. |
|
2062 // ----------------------------------------------------------------------------- |
|
2063 TInt CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL( const TInt aLUID, |
|
2064 const TDesC8& aPort ) |
|
2065 { |
|
2066 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): begin" ); |
|
2067 TInt retVal = KErrNone; |
|
2068 |
|
2069 if( iPortNbr ) |
|
2070 { |
|
2071 delete iPortNbr; |
|
2072 iPortNbr = NULL; |
|
2073 } |
|
2074 iPortNbr = HBufC8::NewL( aPort.Length() ); |
|
2075 TPtr8 newPortNbr = iPortNbr->Des(); |
|
2076 newPortNbr.Append( aPort ); |
|
2077 |
|
2078 retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); |
|
2079 if( retVal != KErrNone ) |
|
2080 { |
|
2081 iCurrentProfile = 0; |
|
2082 iProfile.Close(); |
|
2083 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); |
|
2084 return retVal; |
|
2085 } |
|
2086 |
|
2087 RArray<TSmlTransportId> transportIdArray; |
|
2088 CleanupClosePushL( transportIdArray ); |
|
2089 iProfile.ListConnectionsL( transportIdArray ); |
|
2090 |
|
2091 RSyncMLConnection conn; |
|
2092 CleanupClosePushL( conn ); |
|
2093 conn.OpenL( iProfile, transportIdArray[0] ); |
|
2094 |
|
2095 HBufC8* serverURI = conn.ServerURI().AllocLC(); |
|
2096 if( serverURI->Length() == 0 ) |
|
2097 { |
|
2098 iCurrentProfile = 0; |
|
2099 iProfile.Close(); |
|
2100 CleanupStack::PopAndDestroy( 3 ); //transportIdArray, conn, serverURI |
|
2101 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); |
|
2102 return retVal; |
|
2103 } |
|
2104 TInt totalSize = serverURI->Size() + newPortNbr.Size() + 1; |
|
2105 HBufC8* newServerURI = HBufC8::NewL( totalSize ); |
|
2106 CleanupStack::PushL( newServerURI ); |
|
2107 SetPortNrToAddrStr( *serverURI, newServerURI, newPortNbr ); |
|
2108 |
|
2109 conn.SetServerURIL( *newServerURI ); |
|
2110 conn.UpdateL(); |
|
2111 |
|
2112 CleanupStack::PopAndDestroy( 4 ); //transportIdArray, conn, serverURI, newServerURI |
|
2113 iCurrentProfile = 0; |
|
2114 iProfile.Close(); |
|
2115 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileConnectionPortNrL(): end" ); |
|
2116 return retVal; |
|
2117 } |
|
2118 |
|
2119 // ------------------------------------------------------------------------------------------------ |
|
2120 // CNSmlDMSettingsAdapter::SetPortNrToAddrStr |
|
2121 // Sets a portnbr (separated with ':') to profile server URI. |
|
2122 // ------------------------------------------------------------------------------------------------ |
|
2123 void CNSmlDMSettingsAdapter::SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, |
|
2124 const TDesC8& aPort ) |
|
2125 { |
|
2126 TInt offset=0; |
|
2127 if( aSrvURI.Find( KNSmlDMSettingsHTTP ) == 0 )//http:// |
|
2128 { |
|
2129 offset = KNSmlDMSettingsHTTP().Length(); |
|
2130 } |
|
2131 else if( aSrvURI.Find( KNSmlDMSettingsHTTPS ) == 0 )//https:// |
|
2132 { |
|
2133 offset = KNSmlDMSettingsHTTPS().Length(); |
|
2134 } |
|
2135 TInt portStart = -1; |
|
2136 TInt separatorPos = aSrvURI.Length(); |
|
2137 TInt i = 0; |
|
2138 for( i = offset; i < aSrvURI.Length(); i++ ) |
|
2139 { |
|
2140 if( aSrvURI[i] == KNSmlDMColon )// ':' |
|
2141 { |
|
2142 portStart = i; |
|
2143 } |
|
2144 if( aSrvURI[i] == KNSmlDMUriSeparator )// '/' |
|
2145 { |
|
2146 separatorPos = i; |
|
2147 break; |
|
2148 } |
|
2149 } |
|
2150 |
|
2151 TPtr8 ptrNewSrvURI = aNewURI->Des(); |
|
2152 if( portStart < 0 && separatorPos > 0 && iLeafType != EDMDelete ) |
|
2153 { |
|
2154 ptrNewSrvURI.Append( aSrvURI.Left( separatorPos ) );//http://123.234.345.456 |
|
2155 ptrNewSrvURI.Append( KNSmlDMColon ); |
|
2156 ptrNewSrvURI.Append( aPort ); |
|
2157 ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); |
|
2158 } |
|
2159 else if ( portStart > 0 && separatorPos > 0 && iLeafType != EDMDelete ) |
|
2160 { |
|
2161 ptrNewSrvURI.Append( aSrvURI.Left( portStart + 1 ) );//123.234.345.456: |
|
2162 ptrNewSrvURI.Append( aPort );//123.234.345.456:xx(x) |
|
2163 ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); |
|
2164 } |
|
2165 else if ( portStart > 0 && iLeafType == EDMDelete ) //delete port number from uri |
|
2166 { |
|
2167 ptrNewSrvURI.Append( aSrvURI.Left( portStart ) );//123.234.345.456 |
|
2168 ptrNewSrvURI.Append( aSrvURI.Right( aSrvURI.Length() - separatorPos ) ); |
|
2169 } |
|
2170 else |
|
2171 { |
|
2172 ptrNewSrvURI.Append( aSrvURI ); |
|
2173 } |
|
2174 return; |
|
2175 } |
|
2176 |
|
2177 // ------------------------------------------------------------------------------------------------ |
|
2178 // CNSmlDMSettingsAdapter::SetDMFieldDataL |
|
2179 // Selects and Sets value to a field based on field id got from URI. |
|
2180 // ------------------------------------------------------------------------------------------------ |
|
2181 TInt CNSmlDMSettingsAdapter::SetDMFieldDataL( const TInt aLUID, const TDesC8& aObject, |
|
2182 const TNSmlDMProfileData aField ) |
|
2183 { |
|
2184 TInt rValue = KErrGeneral; |
|
2185 switch ( aField ) |
|
2186 { |
|
2187 case ( EProfileURL ) : |
|
2188 { |
|
2189 rValue = SetProfileServerURIL( aLUID, aObject ); |
|
2190 } |
|
2191 break; |
|
2192 case ( EServerId ) : |
|
2193 { |
|
2194 rValue = SetProfileServerIdL( aLUID, aObject ); |
|
2195 } |
|
2196 break; |
|
2197 case ( ESharedSecret ) : |
|
2198 { |
|
2199 rValue = SetProfileServerPasswordL( aLUID, aObject ); |
|
2200 } |
|
2201 break; |
|
2202 case ( EProfileDMServerUsername ) : |
|
2203 { |
|
2204 rValue = SetProfileUserNameL( aLUID, aObject ); |
|
2205 } |
|
2206 break; |
|
2207 case ( EProfileDMServerPassword ) : |
|
2208 { |
|
2209 rValue = SetProfilePasswordL( aLUID, aObject ); |
|
2210 } |
|
2211 break; |
|
2212 case ( EProfileName ) : |
|
2213 { |
|
2214 rValue = SetProfileDisplayNameL( aLUID, aObject ); |
|
2215 } |
|
2216 break; |
|
2217 case ( EProfileIAPId ) : |
|
2218 { |
|
2219 rValue = SetConRefL( aLUID, aObject ); |
|
2220 } |
|
2221 break; |
|
2222 case ( EProfileId ) : |
|
2223 { |
|
2224 } |
|
2225 break; |
|
2226 case ( EProfilePort ) : |
|
2227 { |
|
2228 if(aObject.Size()<=5) |
|
2229 { |
|
2230 TInt port = GetIntObject(aObject); |
|
2231 if( port > KPortMinSize && port < KPortMaxSize ) |
|
2232 { |
|
2233 TPortBuffer element; |
|
2234 element.iPortBuf=aObject; |
|
2235 element.iPortBufLUID = aLUID; |
|
2236 iPortBuffer.Append(element); |
|
2237 rValue=KErrNone; |
|
2238 } |
|
2239 else |
|
2240 { |
|
2241 if (port <= KPortMinSize ) |
|
2242 rValue = KErrUnderflow; |
|
2243 else |
|
2244 rValue=KErrOverflow; |
|
2245 } |
|
2246 } |
|
2247 else |
|
2248 { |
|
2249 rValue=KErrOverflow; |
|
2250 } |
|
2251 // save information of the port |
|
2252 } |
|
2253 break; |
|
2254 case ( EProfileMediumType ) : |
|
2255 { |
|
2256 if ( iLeafType == EDMDelete ) |
|
2257 { |
|
2258 return KErrNone; |
|
2259 } |
|
2260 iObject = GetIntObject( aObject ); |
|
2261 if(iObject<0) |
|
2262 { |
|
2263 iObject = EHttp; |
|
2264 } |
|
2265 rValue = SetProfileAddrTypeL( aLUID, iObject ); |
|
2266 } |
|
2267 break; |
|
2268 case ( EAuthenticationRequired ) : |
|
2269 case ( EClientNonce ) : |
|
2270 case ( EServerNonce ) : |
|
2271 break; |
|
2272 |
|
2273 default: |
|
2274 rValue = KErrNotSupported; |
|
2275 } |
|
2276 return rValue; |
|
2277 } |
|
2278 |
|
2279 // ----------------------------------------------------------------------------- |
|
2280 // CNSmlDMSettingsAdapter::FillNodeInfoL |
|
2281 // The function fills the node or leaf information. |
|
2282 // ----------------------------------------------------------------------------- |
|
2283 void CNSmlDMSettingsAdapter::FillNodeInfoL( MSmlDmDDFObject& aNode, |
|
2284 TSmlDmAccessTypes aAccTypes, |
|
2285 MSmlDmDDFObject::TOccurence aOccurrence, |
|
2286 MSmlDmDDFObject::TScope aScope, |
|
2287 MSmlDmDDFObject::TDFFormat aFormat, |
|
2288 const TDesC8& aDescription, |
|
2289 const TDesC8& aDefaultValue, |
|
2290 const TDesC8& aMimeType ) |
|
2291 { |
|
2292 aNode.AddDFTypeMimeTypeL( aMimeType ); |
|
2293 aNode.SetAccessTypesL( aAccTypes ); |
|
2294 aNode.SetDescriptionL( aDescription ); |
|
2295 aNode.SetOccurenceL( aOccurrence ); |
|
2296 aNode.SetDefaultValueL( aDefaultValue ); |
|
2297 aNode.SetScopeL( aScope ); |
|
2298 aNode.SetDFFormatL( aFormat ); |
|
2299 return; |
|
2300 } |
|
2301 |
|
2302 // ----------------------------------------------------------------------------- |
|
2303 // CNSmlDMSettingsAdapter::GetDMAuthInfoL |
|
2304 // This function gets authentication data from private API. |
|
2305 // ----------------------------------------------------------------------------- |
|
2306 TInt CNSmlDMSettingsAdapter::GetDMAuthInfoL( const TInt aLUID, |
|
2307 const TNSmlDMProfileData aField, |
|
2308 CBufBase& aObject ) |
|
2309 { |
|
2310 _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMAuthInfoL(): begin" ); |
|
2311 |
|
2312 CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo; |
|
2313 CleanupStack::PushL( authInfo ); |
|
2314 |
|
2315 authInfo->iProfileId = aLUID + KMaxDataSyncID; |
|
2316 iPrivateApi.OpenL(); |
|
2317 TInt ret = KErrNone; |
|
2318 |
|
2319 TRAPD(err,iPrivateApi.GetDMAuthInfoL( *authInfo )); |
|
2320 |
|
2321 if(err==KErrNone) |
|
2322 { |
|
2323 if ( aField == EServerNonce ) |
|
2324 { |
|
2325 aObject.InsertL( aObject.Size(), *authInfo->iServerNonce ); |
|
2326 } |
|
2327 else if ( aField == EClientNonce ) |
|
2328 { |
|
2329 aObject.InsertL( aObject.Size(), *authInfo->iClientNonce ); |
|
2330 } |
|
2331 else if ( aField == EAuthenticationRequired ) |
|
2332 { |
|
2333 TUint authPref = authInfo->iAuthPref; |
|
2334 if( authPref == ENoAuth ) |
|
2335 { |
|
2336 aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefNoAuth ); |
|
2337 } |
|
2338 else if( authPref == EBasic ) |
|
2339 { |
|
2340 aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefBasic ); |
|
2341 } |
|
2342 else if( authPref == EMD5 ) |
|
2343 { |
|
2344 aObject.InsertL( aObject.Size(), KNSmlDMAuthPrefMD5 ); |
|
2345 } |
|
2346 else |
|
2347 { |
|
2348 aObject.InsertL( aObject.Size(), KNullDesC8 ); |
|
2349 ret = KErrGeneral; |
|
2350 } |
|
2351 } |
|
2352 } |
|
2353 iPrivateApi.Close(); |
|
2354 CleanupStack::PopAndDestroy(authInfo); |
|
2355 _DBG_FILE( "CNSmlDMSettingsAdapter::GetDMAuthInfoL(): end" ); |
|
2356 return ret; |
|
2357 } |
|
2358 |
|
2359 // ----------------------------------------------------------------------------- |
|
2360 // CNSmlDMSettingsAdapter::DeleteDMAuthInfoL |
|
2361 // This function resets the authentication data. |
|
2362 // ----------------------------------------------------------------------------- |
|
2363 TInt CNSmlDMSettingsAdapter::DeleteDMAuthInfoL( const TInt aLUID, |
|
2364 const TNSmlDMProfileData aField ) |
|
2365 { |
|
2366 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteDMAuthInfoL(): begin" ); |
|
2367 CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo;; |
|
2368 CleanupStack::PushL( authInfo ); |
|
2369 authInfo->iProfileId = aLUID; |
|
2370 iPrivateApi.OpenL(); |
|
2371 iPrivateApi.GetDMAuthInfoL( *authInfo ); |
|
2372 if( aField == EServerNonce ) |
|
2373 { |
|
2374 authInfo->iServerNonce->Des().Delete( 0, authInfo->iServerNonce->Des().Size() ); |
|
2375 authInfo->iServerNonce->Des().Insert( 0, KNullDesC8 ); |
|
2376 } |
|
2377 else if( aField == EClientNonce ) |
|
2378 { |
|
2379 authInfo->iClientNonce->Des().Delete( 0, authInfo->iClientNonce->Des().Size() ); |
|
2380 authInfo->iClientNonce->Des().Insert( 0, KNullDesC8 ); |
|
2381 } |
|
2382 else if( aField == EAuthenticationRequired ) |
|
2383 { |
|
2384 authInfo->iAuthPref = 0; |
|
2385 } |
|
2386 iPrivateApi.SetDMAuthInfoL( *authInfo ); |
|
2387 iPrivateApi.Close(); |
|
2388 CleanupStack::PopAndDestroy(authInfo); |
|
2389 _DBG_FILE( "CNSmlDMSettingsAdapter::DeleteDMAuthInfoL(): end" ); |
|
2390 return KErrNone; |
|
2391 } |
|
2392 |
|
2393 // ----------------------------------------------------------------------------- |
|
2394 // CNSmlDMSettingsAdapter::SetProfileAddrTypeL |
|
2395 // This function sets the AddrType value. |
|
2396 // ----------------------------------------------------------------------------- |
|
2397 TInt CNSmlDMSettingsAdapter::SetProfileAddrTypeL( const TInt aLUID, |
|
2398 const TInt aIntObj ) |
|
2399 { |
|
2400 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): begin" ); |
|
2401 TInt retVal = OpenSyncSessionAndProfileL( aLUID, ESmlOpenReadWrite ); |
|
2402 if( retVal != KErrNone ) |
|
2403 { |
|
2404 iCurrentProfile = 0; |
|
2405 iProfile.Close(); |
|
2406 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): end" ); |
|
2407 return retVal; |
|
2408 } |
|
2409 TInt mediumType = ENone; |
|
2410 GetMediumTypeL( aIntObj, mediumType ); |
|
2411 if( mediumType == ENone ) |
|
2412 { |
|
2413 iCurrentProfile = 0; |
|
2414 iProfile.Close(); |
|
2415 return KErrGeneral; |
|
2416 } |
|
2417 RArray<TSmlTransportId> transportIdArray; |
|
2418 CleanupClosePushL( transportIdArray ); |
|
2419 iProfile.ListConnectionsL( transportIdArray ); |
|
2420 RSyncMLConnection conn; |
|
2421 CleanupClosePushL( conn ); |
|
2422 conn.OpenL( iProfile, transportIdArray[0] ); |
|
2423 if(mediumType!=transportIdArray[0]) |
|
2424 { |
|
2425 if ( !FeatureManager::FeatureSupported( KFeatureIdSyncMlDmObex ) ) |
|
2426 { |
|
2427 CleanupStack::PopAndDestroy( 2 );//transportIdArray, conn |
|
2428 return EInvalidObject; |
|
2429 } |
|
2430 else |
|
2431 { |
|
2432 conn.CreateL(iProfile,mediumType); |
|
2433 } |
|
2434 } |
|
2435 HBufC8* sURI = conn.ServerURI().AllocLC(); |
|
2436 conn.SetServerURIL( *sURI ); |
|
2437 conn.UpdateL(); |
|
2438 CleanupStack::PopAndDestroy( 3 );//transportIdArray, conn, sURI |
|
2439 iCurrentProfile = 0; |
|
2440 iProfile.Close(); |
|
2441 _DBG_FILE( "CNSmlDMSettingsAdapter::SetProfileAddrTypeL(): end" ); |
|
2442 return KErrNone; |
|
2443 } |
|
2444 |
|
2445 // ----------------------------------------------------------------------------- |
|
2446 // CNSmlDMSettingsAdapter::GetProfileConnectiontypeL |
|
2447 // The function gets the profile medium type. |
|
2448 // ----------------------------------------------------------------------------- |
|
2449 TInt CNSmlDMSettingsAdapter::GetProfileConnectiontypeL( CBufBase& aObject ) |
|
2450 { |
|
2451 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileConnectiontypeL(): begin" ); |
|
2452 RArray<TSmlTransportId> transportIdArray; |
|
2453 CleanupClosePushL( transportIdArray ); |
|
2454 iProfile.ListConnectionsL( transportIdArray ); |
|
2455 TInt transportItems = transportIdArray.Count(); |
|
2456 if( transportItems == 0 ) |
|
2457 { |
|
2458 //No matching items |
|
2459 CleanupStack::PopAndDestroy(); //transportIdArray |
|
2460 return KErrGeneral; |
|
2461 } |
|
2462 else if( transportItems > 1 ) |
|
2463 { |
|
2464 //Error case : against specification |
|
2465 CleanupStack::PopAndDestroy(); //transportIdArray |
|
2466 return KErrGeneral; |
|
2467 } |
|
2468 TInt mediumType = ENone; |
|
2469 if ( transportIdArray[0] == KUidNSmlMediumTypeInternet.iUid ) |
|
2470 { |
|
2471 mediumType = EHttp; |
|
2472 } |
|
2473 else if ( transportIdArray[0] == KUidNSmlMediumTypeBluetooth.iUid || |
|
2474 transportIdArray[0] == KUidNSmlMediumTypeUSB.iUid || |
|
2475 transportIdArray[0] == KUidNSmlMediumTypeIrDA.iUid ) |
|
2476 { |
|
2477 mediumType = EObex; |
|
2478 } |
|
2479 aObject.InsertL( aObject.Size(), SetIntObjectLC( mediumType ) ); |
|
2480 CleanupStack::PopAndDestroy( 2 ); //transportIdArray, SetIntObjectLC |
|
2481 return KErrNone; |
|
2482 } |
|
2483 |
|
2484 // ----------------------------------------------------------------------------- |
|
2485 // CNSmlDMSettingsAdapter::GetProfileIAPIdL |
|
2486 // The function gets the profile IAP Id. |
|
2487 // ----------------------------------------------------------------------------- |
|
2488 TInt CNSmlDMSettingsAdapter::GetProfileIAPIdL( TInt& aIAPid ) |
|
2489 { |
|
2490 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileIAPIdL(): begin" ); |
|
2491 TInt retVal = KErrGeneral; |
|
2492 aIAPid = -1; |
|
2493 RArray<TSmlTransportId> connIdArray; |
|
2494 CleanupClosePushL( connIdArray ); |
|
2495 iProfile.ListConnectionsL( connIdArray ); |
|
2496 if( connIdArray.Count() == 1 ) |
|
2497 { |
|
2498 RSyncMLTransport transport; |
|
2499 CleanupClosePushL( transport ); |
|
2500 transport.OpenL( iSyncSession, connIdArray[0] ); |
|
2501 const CSyncMLTransportPropertiesArray& props = transport.Properties(); |
|
2502 TInt index = props.Find( KNSmlIAPId ); |
|
2503 if( index > 0 ) |
|
2504 { |
|
2505 RSyncMLConnection conn; |
|
2506 CleanupClosePushL( conn ); |
|
2507 conn.OpenL( iProfile, connIdArray[0] ); |
|
2508 HBufC8* apId = conn.GetPropertyL( KNSmlIAPId ).AllocLC(); |
|
2509 aIAPid = GetIntObject( *apId ); |
|
2510 CleanupStack::PopAndDestroy( 2 ); //conn, apId |
|
2511 retVal = KErrNone; |
|
2512 } |
|
2513 else |
|
2514 { |
|
2515 retVal = KErrNotFound; |
|
2516 } |
|
2517 CleanupStack::PopAndDestroy( 1 ); //transport |
|
2518 iCurrentProfile = 0; |
|
2519 iProfile.Close(); |
|
2520 } |
|
2521 else |
|
2522 { |
|
2523 retVal = KErrNotFound; |
|
2524 } |
|
2525 CleanupStack::PopAndDestroy(); //connIdArray |
|
2526 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileIAPIdL(): end" ); |
|
2527 return retVal; |
|
2528 } |
|
2529 |
|
2530 // ----------------------------------------------------------------------------- |
|
2531 // CNSmlDMSettingsAdapter::GetProfileServerURLL |
|
2532 // The function gets the profile Server URI. |
|
2533 // ----------------------------------------------------------------------------- |
|
2534 void CNSmlDMSettingsAdapter::GetProfileServerURLL( CBufBase& aURL ) |
|
2535 { |
|
2536 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileServerURLL(): begin" ); |
|
2537 RArray<TSmlTransportId> transportIdArray; |
|
2538 CleanupClosePushL( transportIdArray ); |
|
2539 iProfile.ListConnectionsL( transportIdArray ); |
|
2540 if( transportIdArray.Count() > 0 ) |
|
2541 { |
|
2542 RSyncMLConnection profConn; |
|
2543 CleanupClosePushL( profConn ); |
|
2544 profConn.OpenL( iProfile, transportIdArray[0] ); |
|
2545 HBufC8* sURI = profConn.ServerURI().AllocL(); |
|
2546 CleanupStack::PushL( sURI ); |
|
2547 TPtr8 uriPtr = sURI->Des(); |
|
2548 if( uriPtr.Length() > 0 ) |
|
2549 { |
|
2550 aURL.InsertL( aURL.Size(),uriPtr ); |
|
2551 } |
|
2552 else |
|
2553 { |
|
2554 aURL.InsertL( aURL.Size(), KNullDesC8 ); |
|
2555 } |
|
2556 CleanupStack::PopAndDestroy( 2 );//profConn, sURI |
|
2557 } |
|
2558 CleanupStack::PopAndDestroy(); //transportIdArray |
|
2559 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileServerURLL(): end" ); |
|
2560 return; |
|
2561 } |
|
2562 |
|
2563 // ----------------------------------------------------------------------------- |
|
2564 // CNSmlDMSettingsAdapter::GetMediumTypeL |
|
2565 // Checks the requested medium type. |
|
2566 // ----------------------------------------------------------------------------- |
|
2567 void CNSmlDMSettingsAdapter::GetMediumTypeL( const TInt aIntObj, |
|
2568 TInt& aMediumType ) |
|
2569 { |
|
2570 _DBG_FILE( "CNSmlDMSettingsAdapter::GetMediumTypeL(): begin" ); |
|
2571 if( aIntObj == EHttp || aIntObj == EWsp ) |
|
2572 { |
|
2573 aMediumType = KUidNSmlMediumTypeInternet.iUid; |
|
2574 return; |
|
2575 } |
|
2576 RArray<TSmlTransportId> transportIdArray; |
|
2577 CleanupClosePushL( transportIdArray ); |
|
2578 iSyncSession.ListTransportsL( transportIdArray ); |
|
2579 |
|
2580 if ( transportIdArray.Find( KUidNSmlMediumTypeBluetooth.iUid ) != KErrNotFound ) |
|
2581 { |
|
2582 aMediumType = KUidNSmlMediumTypeBluetooth.iUid; |
|
2583 } |
|
2584 else if ( transportIdArray.Find( KUidNSmlMediumTypeUSB.iUid ) != KErrNotFound ) |
|
2585 { |
|
2586 aMediumType = KUidNSmlMediumTypeUSB.iUid; |
|
2587 } |
|
2588 else if ( transportIdArray.Find( KUidNSmlMediumTypeIrDA.iUid ) != KErrNotFound ) |
|
2589 { |
|
2590 aMediumType = KUidNSmlMediumTypeIrDA.iUid; |
|
2591 } |
|
2592 CleanupStack::PopAndDestroy(); //transportIdArray |
|
2593 _DBG_FILE( "CNSmlDMSettingsAdapter::GetMediumTypeL(): end" ); |
|
2594 return; |
|
2595 } |
|
2596 |
|
2597 // ----------------------------------------------------------------------------- |
|
2598 // CNSmlDMSettingsAdapter::GetServerIdL |
|
2599 // Gets the server id value. |
|
2600 // ----------------------------------------------------------------------------- |
|
2601 void CNSmlDMSettingsAdapter::GetServerIdL( CBufBase& aObject ) |
|
2602 { |
|
2603 _DBG_FILE( "CNSmlDMSettingsAdapter::GetServerIdL(): begin" ); |
|
2604 HBufC8* serverId = iProfile.ServerId().AllocL(); |
|
2605 CleanupStack::PushL( serverId ); |
|
2606 aObject.InsertL( aObject.Size(), *serverId ); |
|
2607 CleanupStack::PopAndDestroy( 1 ); //serverId |
|
2608 _DBG_FILE( "CNSmlDMSettingsAdapter::GetServerIdL(): end" ); |
|
2609 return; |
|
2610 } |
|
2611 |
|
2612 // ----------------------------------------------------------------------------- |
|
2613 // CNSmlDMSettingsAdapter::GetProfileNameL |
|
2614 // Gets the display name value. |
|
2615 // ----------------------------------------------------------------------------- |
|
2616 void CNSmlDMSettingsAdapter::GetProfileNameL( CBufBase& aObject ) |
|
2617 { |
|
2618 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileNameL(): begin" ); |
|
2619 HBufC16* dataBuf = iProfile.DisplayName().AllocL(); |
|
2620 CleanupStack::PushL( dataBuf ); |
|
2621 TPtr16 ptrDisplayName = dataBuf->Des(); |
|
2622 HBufC8* dataBuf8 = HBufC8::NewL( ptrDisplayName.Length() * 2 ); |
|
2623 CleanupStack::PushL( dataBuf8 ); |
|
2624 |
|
2625 TPtr8 ptrDisplayName8 = dataBuf8->Des(); |
|
2626 ptrDisplayName8 = ConvertTo8LC( ptrDisplayName ); |
|
2627 aObject.InsertL( aObject.Size(), ptrDisplayName8 ); |
|
2628 CleanupStack::PopAndDestroy( 3 );//dataBuf, ConvertTo8LC |
|
2629 _DBG_FILE("CNSmlDMSettingsAdapter::GetProfileNameL(): end"); |
|
2630 return; |
|
2631 } |
|
2632 |
|
2633 // ----------------------------------------------------------------------------- |
|
2634 // CNSmlDMSettingsAdapter::GetProfileUserNameL |
|
2635 // Gets the profile user name value. |
|
2636 // ----------------------------------------------------------------------------- |
|
2637 void CNSmlDMSettingsAdapter::GetProfileUserNameL( CBufBase& aObject ) |
|
2638 { |
|
2639 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileUserNameL(): begin" ); |
|
2640 HBufC8* dataBuf = iProfile.UserName().AllocL(); |
|
2641 CleanupStack::PushL( dataBuf ); |
|
2642 TPtr8 ptrUserName = dataBuf->Des(); |
|
2643 aObject.InsertL( aObject.Size(), ptrUserName ); |
|
2644 CleanupStack::PopAndDestroy();//dataBuf |
|
2645 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfileUserNameL(): end" ); |
|
2646 return; |
|
2647 } |
|
2648 |
|
2649 // ----------------------------------------------------------------------------- |
|
2650 // CNSmlDMSettingsAdapter::GetProfilePortNumberL |
|
2651 // Gets the port number value. |
|
2652 // ----------------------------------------------------------------------------- |
|
2653 void CNSmlDMSettingsAdapter::GetProfilePortNumberL( CBufBase& aObject ) |
|
2654 { |
|
2655 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfilePortNumberL(): begin" ); |
|
2656 TInt bSize = aObject.Size(); |
|
2657 TInt portNum = 0; |
|
2658 HBufC8* bufStorage = HBufC8::NewLC( bSize ); |
|
2659 TPtr8 bufStoragePtr = bufStorage->Des(); |
|
2660 aObject.Read( 0, bufStoragePtr, aObject.Size() ); |
|
2661 aObject.Reset(); |
|
2662 |
|
2663 //find out the port number |
|
2664 ParseUri( *bufStorage, portNum ); |
|
2665 aObject.InsertL( aObject.Size(), SetIntObjectLC( portNum ) ); |
|
2666 |
|
2667 CleanupStack::PopAndDestroy( 2 ); //bufStorage, SetIntObjectLC() |
|
2668 _DBG_FILE( "CNSmlDMSettingsAdapter::GetProfilePortNumberL(): end" ); |
|
2669 return; |
|
2670 } |
|
2671 |
|
2672 // ----------------------------------------------------------------------------- |
|
2673 // CNSmlDMSettingsAdapter::SetAuthInfoL |
|
2674 // The function checks if authinfo already exits. If exits command is replace. |
|
2675 // ----------------------------------------------------------------------------- |
|
2676 void CNSmlDMSettingsAdapter::SetAuthInfoL( const TInt aLUID, |
|
2677 const TNSmlDMProfileData aField, |
|
2678 const TDesC8& aObject, TInt& aStatus ) |
|
2679 { |
|
2680 _DBG_FILE( "CNSmlDMSettingsAdapter::SetAuthInfoL(): begin" ); |
|
2681 |
|
2682 CNSmlDMAuthInfo* authInfo = new (ELeave) CNSmlDMAuthInfo(); |
|
2683 CleanupStack::PushL( authInfo ); |
|
2684 authInfo->iProfileId = aLUID; |
|
2685 |
|
2686 iPrivateApi.OpenL(); |
|
2687 TRAPD( err, iPrivateApi.GetDMAuthInfoL( *authInfo ) ); |
|
2688 |
|
2689 if ( err ) |
|
2690 { |
|
2691 CleanupStack::PopAndDestroy( authInfo ); |
|
2692 iPrivateApi.Close(); |
|
2693 aStatus = err; |
|
2694 return; |
|
2695 } |
|
2696 |
|
2697 CNSmlDMAuthInfo* newAuthInfo = new (ELeave) CNSmlDMAuthInfo(); |
|
2698 CleanupStack::PushL( newAuthInfo ); |
|
2699 newAuthInfo->iProfileId = aLUID; |
|
2700 |
|
2701 if ( aField == EServerNonce ) |
|
2702 { |
|
2703 newAuthInfo->iServerNonce = aObject.Alloc(); |
|
2704 newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); |
|
2705 newAuthInfo->iAuthPref = authInfo->iAuthPref; |
|
2706 |
|
2707 iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); |
|
2708 } |
|
2709 else if ( aField == EClientNonce ) |
|
2710 { |
|
2711 newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); |
|
2712 newAuthInfo->iClientNonce = aObject.Alloc(); |
|
2713 newAuthInfo->iAuthPref = authInfo->iAuthPref; |
|
2714 |
|
2715 iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); |
|
2716 } |
|
2717 else if ( aField == EAuthenticationRequired ) |
|
2718 { |
|
2719 if ( aObject.Match( KNSmlDMAuthPrefNoAuth ) != KErrNotFound ) |
|
2720 { |
|
2721 newAuthInfo->iAuthPref = ENoAuth; |
|
2722 } |
|
2723 else if ( aObject.Match( KNSmlDMAuthPrefBasic ) != KErrNotFound ) |
|
2724 { |
|
2725 newAuthInfo->iAuthPref = EBasic; |
|
2726 } |
|
2727 else if ( aObject.Match( KNSmlDMAuthPrefMD5 ) != KErrNotFound ) |
|
2728 { |
|
2729 newAuthInfo->iAuthPref = EMD5; |
|
2730 } |
|
2731 newAuthInfo->iServerNonce = authInfo->iServerNonce->Des().Alloc(); |
|
2732 newAuthInfo->iClientNonce = authInfo->iClientNonce->Des().Alloc(); |
|
2733 |
|
2734 iPrivateApi.SetDMAuthInfoL( *newAuthInfo ); |
|
2735 } |
|
2736 |
|
2737 CleanupStack::PopAndDestroy( newAuthInfo ); |
|
2738 CleanupStack::PopAndDestroy( authInfo ); |
|
2739 |
|
2740 iPrivateApi.Close(); |
|
2741 aStatus = KErrNone; |
|
2742 _DBG_FILE( "CNSmlDMSettingsAdapter::SetAuthInfoL(): end" ); |
|
2743 return; |
|
2744 } |
|
2745 //------------------------------------------------------------------------------ |
|
2746 // CNSmlDMSettingsAdapter::AddNodeBufferL() |
|
2747 // Buffers Node Object |
|
2748 //------------------------------------------------------------------------------ |
|
2749 void CNSmlDMSettingsAdapter::AddNodeBufferL( const TDesC8& aURI, |
|
2750 const TInt aStatusRef) |
|
2751 { |
|
2752 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): begin" ); |
|
2753 TInt index = -1; |
|
2754 |
|
2755 for (TInt i = 0; i<iBuffer->Count (); i++) |
|
2756 { |
|
2757 if ( iBuffer->At(i).iMappingName->Compare (aURI)== 0) |
|
2758 { |
|
2759 index = i; |
|
2760 //CallBack for duplicate |
|
2761 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): EAlreadyExists end" ); |
|
2762 iCallBack->SetStatusL ( aStatusRef, CSmlDmAdapter::EAlreadyExists); |
|
2763 break; |
|
2764 } |
|
2765 } |
|
2766 |
|
2767 if ( index<0) |
|
2768 { |
|
2769 TNSmlDMBufferElement newNode; |
|
2770 newNode.iMappingName = aURI.AllocLC (); |
|
2771 newNode.iLeafBuf = new (ELeave) CArrayFixFlat <TNSmlDMLeafElement> (4); |
|
2772 newNode.iExecuted = EFalse; |
|
2773 newNode.iDMBuffStatusref = aStatusRef; |
|
2774 newNode.iAddr = EFalse; |
|
2775 newNode.iServerId = EFalse; |
|
2776 newNode.iUName = EFalse; |
|
2777 newNode.iServerName = EFalse; |
|
2778 |
|
2779 iBuffer->AppendL (newNode); |
|
2780 //newNode.iMappingName |
|
2781 CleanupStack::Pop (); |
|
2782 } |
|
2783 _DBG_FILE( "CNSmlDMSettingsAdapter::AddNodeBufferL(): end" ); |
|
2784 } |
|
2785 //------------------------------------------------------------------------------ |
|
2786 // CNSmlDMSettingsAdapter::AddLeafBufferL() |
|
2787 // Buffers Leaf Obj & checks for Mandatory fields |
|
2788 //------------------------------------------------------------------------------ |
|
2789 void CNSmlDMSettingsAdapter::AddLeafBufferL( const TDesC8& aURI, |
|
2790 const TDesC8& aObject, const TInt aStatusRef) |
|
2791 { |
|
2792 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafBufferL(): begin" ); |
|
2793 TNSmlDMLeafElement newCommand; |
|
2794 |
|
2795 newCommand.iUri = aURI.AllocLC (); |
|
2796 newCommand.iData = aObject.AllocLC (); |
|
2797 newCommand.iLuid = HBufC8::NewLC (8); //Allocate Mem. for iLUID |
|
2798 newCommand.iStatusRef = aStatusRef; |
|
2799 //Add Leaf to the index updated by UpdateLeafObj |
|
2800 iBuffer->At(iExecutionIndex).iLeafBuf->AppendL (newCommand); |
|
2801 // iUri, iData, ILuid |
|
2802 CleanupStack::Pop (3); |
|
2803 SetField ( aURI); |
|
2804 |
|
2805 if ( iField->Compare (KNSmlDdfAddr)== 0) |
|
2806 { |
|
2807 iBuffer->At(iExecutionIndex).iAddr = ETrue; |
|
2808 } |
|
2809 else |
|
2810 if ( iField->Compare (KNSmlDdfServerId)== 0) |
|
2811 { |
|
2812 iBuffer->At(iExecutionIndex).iServerId = ETrue; |
|
2813 } |
|
2814 else |
|
2815 if ( iField->Compare (KNSmlDdfClientUserName)== 0) |
|
2816 { |
|
2817 iBuffer->At(iExecutionIndex).iUName = ETrue; |
|
2818 } |
|
2819 else |
|
2820 if ( iField->Compare (KNSmlDdfName)== 0) |
|
2821 { |
|
2822 iBuffer->At(iExecutionIndex).iServerName = ETrue; |
|
2823 } |
|
2824 |
|
2825 // If Address,ServerId,ServerName,UserName then Add |
|
2826 |
|
2827 if ( iBuffer->At(iExecutionIndex).iAddr && iBuffer->At(iExecutionIndex).iServerId &&iBuffer->At(iExecutionIndex).iUName && iBuffer->At(iExecutionIndex).iServerName) |
|
2828 { |
|
2829 ExecuteBufferL (); |
|
2830 iExecutionIndex = -1; |
|
2831 } |
|
2832 _DBG_FILE( "CNSmlDMSettingsAdapter::AddLeafBufferL(): end" ); |
|
2833 return; |
|
2834 } |
|
2835 |
|
2836 //------------------------------------------------------------------------------ |
|
2837 // CNSmlDMSettingsAdapter::ExecuteBufferL() |
|
2838 // Adds the Node/Leaf obj to the db |
|
2839 //------------------------------------------------------------------------------ |
|
2840 void CNSmlDMSettingsAdapter::ExecuteBufferL() |
|
2841 { |
|
2842 _DBG_FILE( "CNSmlDMSettingsAdapter::ExecuteBufferL(): begin" ); |
|
2843 TBuf8<8> newLUID; |
|
2844 TInt rValue; |
|
2845 //Buffer is being Executed |
|
2846 iBufOn = ETrue; |
|
2847 |
|
2848 // Robustness check |
|
2849 if ( iExecutionIndex<0) |
|
2850 { |
|
2851 return; |
|
2852 } |
|
2853 |
|
2854 //Execute BufferL is called from CompleteOutstandingCmdsL only when |
|
2855 //Mandatory fields are not set. Dont update Node/Leaf to the db, return a failure |
|
2856 |
|
2857 if ( !iComplete) |
|
2858 rValue = CreateNewProfileL (iLUID); |
|
2859 else |
|
2860 rValue = CSmlDmAdapter::EError; |
|
2861 |
|
2862 iBuffer->At(iExecutionIndex).iExecuted = ETrue; |
|
2863 |
|
2864 if ( rValue != KErrNone) |
|
2865 { |
|
2866 if ( rValue == KErrNoMemory) |
|
2867 { |
|
2868 iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::ENoMemory); |
|
2869 } |
|
2870 else |
|
2871 if ( rValue == KErrNotSupported) |
|
2872 { |
|
2873 iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, |
|
2874 CSmlDmAdapter::EInvalidObject); |
|
2875 } |
|
2876 else |
|
2877 if ( rValue == KErrInUse) |
|
2878 { |
|
2879 iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, |
|
2880 CSmlDmAdapter::EObjectInUse); |
|
2881 } |
|
2882 else |
|
2883 if ( rValue == KErrDiskFull) |
|
2884 { |
|
2885 iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, |
|
2886 CSmlDmAdapter::EDiskFull); |
|
2887 } |
|
2888 else |
|
2889 { |
|
2890 iCallBack->SetStatusL ( iBuffer->At(iExecutionIndex).iDMBuffStatusref, |
|
2891 CSmlDmAdapter::EError); |
|
2892 } |
|
2893 // dont return, UpdateLeafObjectL will update the callback status for leaf Nodes |
|
2894 } |
|
2895 else |
|
2896 { |
|
2897 if ( iLUID >= KMaxDataSyncID) |
|
2898 { |
|
2899 newLUID.Num ( iLUID - KMaxDataSyncID); |
|
2900 } |
|
2901 else |
|
2902 { |
|
2903 newLUID.Num ( iLUID); |
|
2904 } |
|
2905 |
|
2906 iCallBack->SetMappingL ( *iBuffer->At(iExecutionIndex).iMappingName, newLUID); |
|
2907 |
|
2908 iCallBack->SetStatusL (iBuffer->At(iExecutionIndex).iDMBuffStatusref, CSmlDmAdapter::EOk); |
|
2909 } |
|
2910 |
|
2911 for (TInt val= 0; val < iBuffer->At(iExecutionIndex).iLeafBuf->Count ();val++) |
|
2912 { |
|
2913 //Update the LUID data in the Leaf structure with the Profile LUID before calling UpdateLeafObj |
|
2914 TPtr8 tempLUID(iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid->Des ()); |
|
2915 tempLUID.Append (newLUID); |
|
2916 UpdateLeafObjectL (*iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iUri, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iLuid, *iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iData, *iBuffer->At(iExecutionIndex).iMappingName, iBuffer->At(iExecutionIndex).iLeafBuf->At(val).iStatusRef); |
|
2917 } |
|
2918 |
|
2919 // Delete the dynamically allocated buffers (Node/Leaf obj) |
|
2920 |
|
2921 ClearBuffer ( iBuffer->At(iExecutionIndex).iLeafBuf); |
|
2922 |
|
2923 delete iBuffer->At(iExecutionIndex).iLeafBuf; |
|
2924 |
|
2925 if ( iBuffer->At(iExecutionIndex).iMappingName) |
|
2926 { |
|
2927 delete iBuffer->At(iExecutionIndex).iMappingName; |
|
2928 iBuffer->At(iExecutionIndex).iMappingName = NULL; |
|
2929 } |
|
2930 |
|
2931 iBuffer->Delete (iExecutionIndex); |
|
2932 iBuffer->Compress (); |
|
2933 |
|
2934 iBufOn = EFalse; |
|
2935 _DBG_FILE( "CNSmlDMSettingsAdapter::ExecuteBufferL(): end" ); |
|
2936 } |
|
2937 |
|
2938 //------------------------------------------------------------------------------ |
|
2939 // TPtrC8 CNSmlDMSettingsAdapter::ParentURI(const TDesC8& aURI) |
|
2940 // returns parent uri, i.e. removes last uri segment |
|
2941 // Searches till the third "/" is reached |
|
2942 //------------------------------------------------------------------------------ |
|
2943 TPtrC8 CNSmlDMSettingsAdapter::ParentURI(const TDesC8& aURI) |
|
2944 { |
|
2945 _DBG_FILE( "CNSmlDMSettingsAdapter::ParentURI(): begin" ); |
|
2946 TInt count; |
|
2947 TInt flag = 0; |
|
2948 for (count=0; count<=aURI.Length ()-1;count++) |
|
2949 { |
|
2950 |
|
2951 if ( aURI[count]=='/') |
|
2952 { |
|
2953 flag++; |
|
2954 if ( flag == KDynNodePosn) //KDynNodePosn =3 --> SyncML/DMAcc/DMIDxx |
|
2955 break; |
|
2956 } |
|
2957 } |
|
2958 |
|
2959 _DBG_FILE( "CNSmlDMSettingsAdapter::ParentURI(): end" ); |
|
2960 return aURI.Left (count); |
|
2961 } |
|
2962 |
|
2963 //----------------------------------------------------------------------------------------- |
|
2964 // Clears the elements of the passed in LeafElement Structure |
|
2965 //---------------------------------------------------------------------------------------- |
|
2966 void CNSmlDMSettingsAdapter::ClearBuffer( |
|
2967 CArrayFixFlat<TNSmlDMLeafElement>* aBuffer) |
|
2968 { |
|
2969 _DBG_FILE( "CNSmlDMSettingsAdapter::ClearBuffer(): begin" ); |
|
2970 for (TInt i = 0; i < aBuffer->Count (); i++) |
|
2971 { |
|
2972 delete aBuffer->At(i).iUri; |
|
2973 aBuffer->At(i).iUri = NULL; |
|
2974 |
|
2975 delete aBuffer->At(i).iData; |
|
2976 aBuffer->At(i).iData = NULL; |
|
2977 |
|
2978 delete aBuffer->At(i).iLuid; |
|
2979 aBuffer->At(i).iLuid = NULL; |
|
2980 } |
|
2981 |
|
2982 aBuffer->Reset (); |
|
2983 _DBG_FILE( "CNSmlDMSettingsAdapter::ClearBuffer(): end" ); |
|
2984 } |
|
2985 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2986 |
|
2987 #ifndef IMPLEMENTATION_PROXY_ENTRY |
|
2988 #define IMPLEMENTATION_PROXY_ENTRY(aUid, aFuncPtr) {{aUid},(aFuncPtr)} |
|
2989 #endif |
|
2990 |
|
2991 const TImplementationProxy ImplementationTable[] = |
|
2992 { |
|
2993 IMPLEMENTATION_PROXY_ENTRY( KNSmlDMSettingsAdapterImplUid, CNSmlDMSettingsAdapter::NewL ) |
|
2994 }; |
|
2995 |
|
2996 |
|
2997 // ----------------------------------------------------------------------------- |
|
2998 // TImplementationProxy* ImplementationGroupProxy() |
|
2999 // ----------------------------------------------------------------------------- |
|
3000 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
3001 { |
|
3002 _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: begin" ); |
|
3003 |
|
3004 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
3005 |
|
3006 _DBG_FILE( "ImplementationGroupProxy() for CNSmlDMSettingsAdapter: end" ); |
|
3007 return ImplementationTable; |
|
3008 } |
|
3009 |
|
3010 // End of File |
|
3011 |
|