|
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: Device Management DS Settings adapter header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __NSMLDSSETTINGSADAPTER_H__ |
|
22 #define __NSMLDSSETTINGSADAPTER_H__ |
|
23 |
|
24 // INCLUDES |
|
25 #include <smldmadapter.h> //adapter interface |
|
26 #include <SyncMLClientDS.h> //DS Client API |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KNSmlDSGranularity = 4; |
|
30 const TUint8 KNSmlDMColon = ':'; |
|
31 const TUint8 KNSmlDMUriSeparator = '/'; |
|
32 |
|
33 //DDF accepted DS-fieldnames for DS-profile |
|
34 _LIT8( KNSmlDdfRoot, "SyncML"); |
|
35 _LIT8( KNSmlDdfAddr, "Addr" ); |
|
36 _LIT8( KNSmlDdfAddrType, "AddrType" ); |
|
37 _LIT8( KNSmlDdfPortNbr, "PortNbr" ); |
|
38 _LIT8( KNSmlDdfName, "Name" ); |
|
39 |
|
40 _LIT8( KNSmlDdfDB, "DB" ); |
|
41 _LIT8( KNSmlDdfCTType, "CTType" ); |
|
42 _LIT( KNSmlDdfCTVer, "CTVer" ); |
|
43 _LIT8( KNSmlDdfCTVerL, "CTVerL" ); |
|
44 |
|
45 _LIT8( KNSmlDdfRDBURI, "RDBURI" ); |
|
46 _LIT8( KNSmlDdfLDBURI, "LDBURI" ); |
|
47 |
|
48 _LIT8( KNSmlDdfClientUserName, "ClientUserName" ); |
|
49 _LIT8( KNSmlDdfClientPW, "ClientPW" ); |
|
50 _LIT( KNSmlDdfClientNonce, "ClientNonce" ); |
|
51 _LIT8( KNSmlDdfServerId, "ServerId" ); |
|
52 _LIT8( KNSmlDdfHidden, "Hidden" ); |
|
53 |
|
54 |
|
55 _LIT( KNSmlADdfAdapterId, "AdapterId" ); |
|
56 |
|
57 _LIT8( KNSmlDdfToNAPID, "ToNapID" ); |
|
58 _LIT( KNSmlDdfAdapterType, "/DB/" ); |
|
59 |
|
60 //DDF DS-field descriptions |
|
61 _LIT8( KNSmlDdfRootDescription, "DS-Settings DDF description"); |
|
62 _LIT8( KNSmlDdfAddrDescription, "DS server address" ); |
|
63 _LIT8( KNSmlDdfAddrTypeDescription, "Type of used DS server address" ); |
|
64 _LIT8( KNSmlDdfPortNbrDescription, "DS Server port number" ); |
|
65 _LIT8( KNSmlDdfNameDescription, "Displayable name for the management account" ); |
|
66 |
|
67 _LIT8( KNSmlDdfDBDescription, "DB node is parent to all Database objects" ); |
|
68 _LIT( KNSmlDdfCTDescription, "CT node is parent to all Content objects" ); |
|
69 _LIT8( KNSmlDdfCTTypeDescription, "CTType define supported media content of database" ); |
|
70 _LIT( KNSmlDdfCTVerDescription, "CTVer node is a parent to all Content Version objects" ); |
|
71 _LIT( KNSmlDdfCTVerLDescription, "CTVerL define version of supported contenttype" ); |
|
72 |
|
73 _LIT8( KNSmlDdfRDBURIDescription, "The relative or absolute URI of remote database" ); |
|
74 _LIT8( KNSmlDdfLDBURIDescription, "The relative or absolute URI of local database" ); |
|
75 |
|
76 _LIT8( KNSmlDdfClientUserNameDescription, "DS username" ); |
|
77 _LIT8( KNSmlDdfServerIdDescription, "Server identifier" ); |
|
78 _LIT8( KNSmlDdfClientPWDescription, "A password or secret to authenticate to the server" ); |
|
79 _LIT8( KNSmlDdfToNAPIDDescription, "Logical reference to connectivity information" ); |
|
80 _LIT8( KNSmlDdfHiddenDescription, "Hidden profile (not shown on UI)" ); |
|
81 |
|
82 _LIT8( KNSmlBufExe, "BufExe" ); |
|
83 |
|
84 //Default data values |
|
85 _LIT( KNSmlDefName, "DSAdapterIns" ); |
|
86 _LIT8( KNSmlDefDSAcc, "DSAcc" ); |
|
87 _LIT8( KNSmlDSStart, "SyncML/DSAcc/DSId" ); |
|
88 _LIT( KNSmlDSStartDB, "/DB/" ); |
|
89 _LIT( KNSmlDefDSIAP, "AP" ); |
|
90 _LIT8( KNSmlIAPId, "NSmlIapId" ); |
|
91 _LIT8( KSegmDSAcc2, "CTType/RDBURI/LDBURI" ); |
|
92 |
|
93 _LIT8( KNSmlDSSettingsHTTP, "http://" ); |
|
94 _LIT8( KNSmlDSSettingsHTTPS, "https://" ); |
|
95 const TInt KNSmlDSSettingsHTTPPort = 80; |
|
96 const TInt KNSmlDSSettingsHTTPSPort = 443; |
|
97 _LIT8( KNSmlDSUriDotSlash, "./"); |
|
98 _LIT8( KNSmlDSSlash, "/"); |
|
99 _LIT8(KVersion, "1.1"); |
|
100 _LIT8( KMimeType, "text/plain" ); |
|
101 _LIT8( KDSSettingsTitle, "DS-settings title" ); |
|
102 |
|
103 _LIT8( KDBUri1, "SyncML/DSAcc/*/DB/*" ); |
|
104 _LIT8( KDSAccMatch, "SyncML/DSAcc/*" ); |
|
105 _LIT8( KDSAccMatch2, "SyncML/DSAcc/*/*" ); |
|
106 _LIT8( KDSDBMatch, "SyncML/DSAcc/*/DB/*" ); |
|
107 _LIT8( KDSDBMatch2, "SyncML/DSAcc/*/DB" ); |
|
108 _LIT8( KSegmDSAcc,"Addr/AddrType/PortNbr/Name/DB/ClientUserName/ClientPW/ToNapID/ServerId" ); |
|
109 _LIT8( KDSDBAddMatch, "*DSAcc/*/DB/*" ); |
|
110 _LIT8( KDSDBAddMatch2, "*DSAcc/*/DB/*/*" ); |
|
111 _LIT8( KDSDBAddMatch3, "*DSAcc/*/DB" ); |
|
112 |
|
113 _LIT8( KCTTypeMatch, "*/CTType*" ); |
|
114 _LIT8( KRDBUriMatch, "*/RDBURI*" ); |
|
115 _LIT8( KLDBUriMatch, "*/LDBURI*" ); |
|
116 |
|
117 _LIT8( KDummyTxt, "/Dummy" ); |
|
118 _LIT8( KFormat, "%d" ); |
|
119 _LIT8( KDSAcc1, "SyncML/DSAcc" ); |
|
120 _LIT8( Kprev,"CTId" ); |
|
121 _LIT8( Kprev2, "/CTId" ); |
|
122 _LIT8( KDSprev,"DSId" ); |
|
123 |
|
124 |
|
125 // DATA TYPES |
|
126 enum TNSmlDSFieldType |
|
127 { |
|
128 EStr, |
|
129 EInt, |
|
130 EParam, |
|
131 EWrong |
|
132 }; |
|
133 |
|
134 enum TNSmlDSLeafType |
|
135 { |
|
136 EDSDelete, |
|
137 EDSUnset |
|
138 }; |
|
139 |
|
140 enum TNSmlDSProfileDataID |
|
141 { |
|
142 EProfileName, |
|
143 EProfileIAPId, |
|
144 EProfileMediumType, |
|
145 EProfileSyncServerUsername, |
|
146 EProfileSyncServerPassword, |
|
147 EProfileURL, |
|
148 EProfilePort, |
|
149 EProfileServerId, |
|
150 EHiddenProfile, |
|
151 ESyncAccepted |
|
152 }; |
|
153 |
|
154 enum TNSmlDSMediumType |
|
155 { |
|
156 ENone, |
|
157 EHttp, |
|
158 EWsp, |
|
159 EObex |
|
160 }; |
|
161 |
|
162 struct TNSmlDSAddElement |
|
163 { |
|
164 HBufC8 *iUri; |
|
165 HBufC8 *iData; |
|
166 TInt iStatusRef; |
|
167 TBool iLeaf; |
|
168 TBool iDone; |
|
169 }; |
|
170 |
|
171 struct TNSmlDSBufferElement |
|
172 { |
|
173 CArrayFixFlat<TNSmlDSAddElement> *iNodeBuf; |
|
174 HBufC8* iMappingName; |
|
175 HBufC8* iName; |
|
176 TBool iExecuted; |
|
177 TInt iLuid; |
|
178 }; |
|
179 |
|
180 // FORWARD DECLARATIONS |
|
181 class CNSmlDSSettingsAdapter; |
|
182 |
|
183 /** |
|
184 * CNSmlDSSettingsAdapter class |
|
185 * Contains the whole implementation of the Device Management DS settings adapter. |
|
186 * |
|
187 * @lib nsmldssettingsadapter.dll |
|
188 */ |
|
189 class CNSmlDSSettingsAdapter : public CSmlDmAdapter |
|
190 { |
|
191 public: // Constructors and destructor |
|
192 /** |
|
193 * Two-phased constructor. |
|
194 */ |
|
195 static CNSmlDSSettingsAdapter* NewL(MSmlDmCallback* aDmCallback ); |
|
196 static CNSmlDSSettingsAdapter* NewLC(MSmlDmCallback* aDmCallback ); |
|
197 |
|
198 void ConstructL(); |
|
199 |
|
200 /** |
|
201 * Destructor. |
|
202 */ |
|
203 virtual ~CNSmlDSSettingsAdapter(); |
|
204 |
|
205 public: // Functions from base classes |
|
206 |
|
207 /** |
|
208 * From CSmlDmAdapter DDFVersionL returns current version of the DDF. |
|
209 * @since Series60_3.0 |
|
210 * @param aVersion DDF version of the adapter. |
|
211 * @return none |
|
212 */ |
|
213 void DDFVersionL( CBufBase& aVersion ); |
|
214 |
|
215 /** |
|
216 * From CSmlDmAdapter DDFStructureL for filling the DDF structure of the adapter. |
|
217 * @since Series60_3.0 |
|
218 * @param aDDF Reference to root object. |
|
219 * @return none |
|
220 */ |
|
221 void DDFStructureL( MSmlDmDDFObject& aDDF ); |
|
222 |
|
223 /** |
|
224 * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces |
|
225 * data in existing leaf objects. |
|
226 * @since Series60_3.0 |
|
227 * @param aURI URI of the object |
|
228 * @param aLUID LUID of the object |
|
229 * @param aObject Data of the object |
|
230 * @param aType MIME type of the object |
|
231 * @param aStatusRef Reference to correct command |
|
232 * @return none |
|
233 */ |
|
234 void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
235 const TDesC8& aObject, const TDesC8& aType, |
|
236 const TInt aStatusRef ); |
|
237 |
|
238 /** |
|
239 * From CSmlDmAdapter DeleteObjectL deletes an object and its child objects. |
|
240 * @since Series60_3.0 |
|
241 * @param aURI URI of the object |
|
242 * @param aLUID LUID of the object |
|
243 * @param aStatusRef Reference to correct command |
|
244 * @return none |
|
245 */ |
|
246 void DeleteObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
247 const TInt aStatusRef ); |
|
248 |
|
249 /** |
|
250 * From CSmlDmAdapter FetchLeafObjectL fetches data of a leaf object. |
|
251 * @since Series60_3.0 |
|
252 * @param aURI URI of the object |
|
253 * @param aLUID LUID of the object |
|
254 * @param aType MIME type of the object |
|
255 * @param aResultsRef Reference to correct results |
|
256 * @param aStatusRef Reference to correct command |
|
257 * @return none |
|
258 */ |
|
259 void FetchLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
260 const TDesC8& aType, const TInt aResultsRef, |
|
261 const TInt aStatusRef ); |
|
262 |
|
263 /** |
|
264 * From CSmlDmAdapter ChildURIListL fetches URI list. |
|
265 * @since Series60_3.0 |
|
266 * @param aURI URI of the object |
|
267 * @param aLUID LUID of the object |
|
268 * @param aPreviousURISegmentList URI list with mapping LUID information |
|
269 * @param aResultsRef Reference to correct results |
|
270 * @param aStatusRef Reference to correct command |
|
271 * @return none |
|
272 */ |
|
273 void ChildURIListL( const TDesC8& aURI, const TDesC8& aLUID, |
|
274 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList, |
|
275 const TInt aResultsRef, const TInt aStatusRef ); |
|
276 |
|
277 /** |
|
278 * From CSmlDmAdapter AddNodeObjectL adds node object. |
|
279 * @since Series60_3.0 |
|
280 * @param aURI URI of the object |
|
281 * @param aParentLUID LUID of the parent object |
|
282 * @param aStatusRef Reference to correct command |
|
283 * @return none |
|
284 */ |
|
285 void AddNodeObjectL( const TDesC8& aURI, const TDesC8& aParentLUID, |
|
286 const TInt aStatusRef ); |
|
287 |
|
288 /** |
|
289 * From CSmlDmAdapter UpdateLeafObjectL creates new leaf objects, or replaces |
|
290 * data in existing leaf objects. |
|
291 * @since Series60_3.0 |
|
292 * @param aURI URI of the object |
|
293 * @param aLUID LUID of the object |
|
294 * @param aStream Data of the object |
|
295 * @param aType MIME type of the object |
|
296 * @param aStatusRef Reference to correct command |
|
297 * @return none |
|
298 */ |
|
299 void UpdateLeafObjectL( const TDesC8& aURI, const TDesC8& aLUID, |
|
300 RWriteStream*& aStream, const TDesC8& aType, |
|
301 const TInt aStatusRef ); |
|
302 |
|
303 /** |
|
304 * From CSmlDmAdapter FetchLeafObjectSizeL fetches the size of a leaf object. |
|
305 * @since Series60_3.0 |
|
306 * @param aURI URI of the object |
|
307 * @param aLUID LUID of the object |
|
308 * @param aType MIME type of the object |
|
309 * @param aResultsRef Reference to correct results |
|
310 * @param aStatusRef Reference to correct command |
|
311 * @return none |
|
312 */ |
|
313 void FetchLeafObjectSizeL( const TDesC8& aURI, const TDesC8& aLUID, |
|
314 const TDesC8& aType, const TInt aResultsRef, |
|
315 const TInt aStatusRef ); |
|
316 |
|
317 /** |
|
318 * From CSmlDmAdapter The function implements execute command. |
|
319 * @since Series60_3.0 |
|
320 * @param aURI URI of the object |
|
321 * @param aLUID LUID of the object |
|
322 * @param aArgument Argument for the command |
|
323 * @param aType MIME type of the object |
|
324 * @param aStatusRef Reference to correct command |
|
325 * @return none |
|
326 */ |
|
327 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
328 const TDesC8& aArgument, const TDesC8& aType, |
|
329 const TInt aStatusRef ); |
|
330 |
|
331 /** |
|
332 * From CSmlDmAdapter The function implements execute command. |
|
333 * @since Series60_3.0 |
|
334 * @param aURI URI of the object |
|
335 * @param aLUID LUID of the object |
|
336 * @param aStream Argument for the command |
|
337 * @param aType MIME type of the object |
|
338 * @param aStatusRef Reference to correct command |
|
339 * @return none |
|
340 */ |
|
341 void ExecuteCommandL( const TDesC8& aURI, const TDesC8& aLUID, |
|
342 RWriteStream*& aStream, const TDesC8& aType, |
|
343 const TInt aStatusRef ); |
|
344 |
|
345 /** |
|
346 * From CSmlDmAdapter The function implements execute command. |
|
347 * @since Series60_3.0 |
|
348 * @param aTargetURI Target URI for the command |
|
349 * @param aTargetLUID LUID of the target object |
|
350 * @param aSourceURI Source URI for the command |
|
351 * @param aSourceLUID LUID of the source object |
|
352 * @param aType MIME type of the object |
|
353 * @param aStatusRef Reference to correct command |
|
354 * @return none |
|
355 */ |
|
356 void CopyCommandL( const TDesC8& aTargetURI, const TDesC8& aTargetLUID, |
|
357 const TDesC8& aSourceURI, const TDesC8& aSourceLUID, |
|
358 const TDesC8& aType, TInt aStatusRef ); |
|
359 |
|
360 /** |
|
361 * From CSmlDmAdapter The function indicates start of Atomic command. |
|
362 * @since Series60_3.0 |
|
363 * @param none |
|
364 * @return none |
|
365 */ |
|
366 void StartAtomicL(); |
|
367 |
|
368 /** |
|
369 * From CSmlDmAdapter The function indicates successful end of Atomic command. |
|
370 * @since Series60_3.0 |
|
371 * @param none |
|
372 * @return none |
|
373 */ |
|
374 void CommitAtomicL(); |
|
375 |
|
376 /** |
|
377 * From CSmlDmAdapter The function indicates unsuccessful end of Atomic command. |
|
378 * @since Series60_3.0 |
|
379 * @param none |
|
380 * @return none |
|
381 */ |
|
382 void RollbackAtomicL(); |
|
383 |
|
384 /** |
|
385 * From CSmlDmAdapter Returns ETrue if adapter supports streaming otherwise EFalse. |
|
386 * @since Series60_3.0 |
|
387 * @param aItemSize Size limit for stream usage. |
|
388 * @return ETrue or EFalse |
|
389 */ |
|
390 TBool StreamingSupport( TInt& aItemSize ); |
|
391 |
|
392 /** |
|
393 * From CSmlDmAdapter Called when stream returned from UpdateLeafObjectL or |
|
394 * ExecuteCommandL has been written to and committed. |
|
395 * @since Series60_3.0 |
|
396 * @param none |
|
397 * @return none |
|
398 */ |
|
399 void StreamCommittedL(); |
|
400 |
|
401 /** |
|
402 * From CSmlDmAdapter The function tells the adapter that all the commands of the message that |
|
403 * can be passed to the adapter have now been passed. |
|
404 * @since Series60_3.0 |
|
405 * @param none |
|
406 * @return none |
|
407 */ |
|
408 void CompleteOutstandingCmdsL(); |
|
409 |
|
410 private: |
|
411 |
|
412 /** |
|
413 * C++ default constructor. |
|
414 */ |
|
415 CNSmlDSSettingsAdapter(); |
|
416 CNSmlDSSettingsAdapter( TAny* aEcomArguments ); |
|
417 |
|
418 /** |
|
419 * The function checks if field to be handled is valid. |
|
420 * @param none |
|
421 * @return ETrue if valid field otherwise EFalse. |
|
422 */ |
|
423 TBool AcceptDSField(); |
|
424 |
|
425 /** |
|
426 * The function returns enum value for a field to be handled. |
|
427 * @param none |
|
428 * @return enum value for a field to be handled. |
|
429 */ |
|
430 TInt GetDSField() const; |
|
431 |
|
432 /** |
|
433 * The function checks if field type to be handled is valid. |
|
434 * @param none |
|
435 * @return enum value for a field type. |
|
436 */ |
|
437 TInt GetDSFieldTypeL() const; |
|
438 |
|
439 /** |
|
440 * The function converts LUID to integer. |
|
441 * @param aLUID LUID data to be converted. |
|
442 * @return Integer value for a LUID. |
|
443 */ |
|
444 TInt IntLUID(const TDesC8& aLUID); |
|
445 |
|
446 /** |
|
447 * The function converts data to integer and returns it. |
|
448 * @param aObject Data object to be converted. |
|
449 * @return Integer value for an object. |
|
450 */ |
|
451 TInt GetIntObject( const TDesC8& aObject ); |
|
452 |
|
453 /** |
|
454 * The function converts data to integer and returns it. |
|
455 * @param aObject Data object to be converted. |
|
456 * @return 16-bit integer value for an object. |
|
457 */ |
|
458 TInt GetIntObject16( const TDesC& aObject ); |
|
459 |
|
460 /** |
|
461 * The function stores integer value to buffer and returns reference to it. |
|
462 * @param aObject data to be stored to buffer. |
|
463 * @return reference to data buffer. |
|
464 */ |
|
465 TDesC8& SetIntObjectLC( const TInt& aObject ); |
|
466 |
|
467 /** |
|
468 * The function checks if data length is valid. |
|
469 * @param aProfileItem Field / Leaf ID to be handled. |
|
470 * @param aSource Data to be handled. |
|
471 * @return ETrue if data length is not valid otherwise EFalse. |
|
472 */ |
|
473 TBool NotValidStrLenght( const TInt& aProfileItem, const TDesC8& aSource ); |
|
474 |
|
475 /** |
|
476 * The function finds out the last element of the uri. |
|
477 * @param aSource Uri object that contains all elements. |
|
478 * @return KErrNone if successful. |
|
479 */ |
|
480 TInt SetField( const TDesC8& aSource ); |
|
481 |
|
482 /** |
|
483 * The function converts 16-bit data to 8-bit and returns reference to it. |
|
484 * @param aSource Reference data to be converted. |
|
485 * @return Reference to 8-bit data buffer. |
|
486 */ |
|
487 TDesC8& ConvertTo8LC( const TDesC& aSource ); |
|
488 |
|
489 /** |
|
490 * The function converts 8-bit data to 16-bit and returns reference to it. |
|
491 * @param aSource Reference data to be converted. |
|
492 * @return Reference to 16-bit data buffer. |
|
493 */ |
|
494 TDesC16& ConvertTo16LC( const TDesC8& aSource ); |
|
495 |
|
496 /** |
|
497 * The function adds new dataprovider for a profile. |
|
498 * @param aIntLUID Profile integer LUID. |
|
499 * @param aMIMEType Requested MIME type of the data provider. |
|
500 * @param aDataProviderId Reference to object where new data provider id to be saved. |
|
501 * @return KErrNone if successful otherwise error code. |
|
502 */ |
|
503 TInt AddNewDataProviderL( TInt aIntLUID, const TDesC8& aMIMEType, TInt& aDataProviderId ); |
|
504 |
|
505 /** |
|
506 * The function gets the uri for profile IAP ID. |
|
507 * @param aLUID Profile integer LUID. |
|
508 * @param aObject Reference to object where URI to be stored. |
|
509 * @return KErrNone if successful otherwise error code. |
|
510 */ |
|
511 TInt GetToNAPIDL( const TInt aLUID, CBufBase& aObject ); |
|
512 |
|
513 /** |
|
514 * The function sets the profile IAP id based on URI. |
|
515 * @param aLUID Profile integer LUID. |
|
516 * @param aObject Access point URI. |
|
517 * @return KErrNone if successful otherwise error code. |
|
518 */ |
|
519 TInt SetToNAPIDL( const TInt aLUID, const TDesC8& aObject ); |
|
520 |
|
521 /** |
|
522 * The function sets the new node to buffer (in case of content type). |
|
523 * @param aURI URI of the node. |
|
524 * @param aParentLUID LUID for the parent object. |
|
525 * @param aStatusRef Command status reply reference. |
|
526 * @return none |
|
527 */ |
|
528 void AddNodeBufferL( const TDesC8& aURI, const TDesC8& aParentLUID, |
|
529 const TInt aStatusRef ); |
|
530 |
|
531 /** |
|
532 * The function sets new leaf object to buffer (in case DB level object). |
|
533 * @param aURI URI of the node. |
|
534 * @param aParentLUID LUID for the parent object. |
|
535 * @param aStatusRef Command status reply reference. |
|
536 * @return none |
|
537 */ |
|
538 void AddLeafBufferL( const TDesC8& aURI,const TDesC8& aParentLUID, |
|
539 const TDesC8& aObject, const TInt aStatusRef ); |
|
540 |
|
541 /** |
|
542 * The function finds out the last segment of the URI. |
|
543 * @param aURI URI to be handled. |
|
544 * @return Pointer to last URI segment. |
|
545 */ |
|
546 TPtrC8 LastURISeg( const TDesC8& aURI ); |
|
547 |
|
548 /** |
|
549 * The function removes the last segment of the URI. |
|
550 * @param aURI URI to be handled. |
|
551 * @return Pointer to recontructed URI. |
|
552 */ |
|
553 TPtrC8 RemoveLastURISeg( const TDesC8& aURI ); |
|
554 |
|
555 /** |
|
556 * The function executes command from the buffer based on URI. |
|
557 * @param aURI URI to be handled first. |
|
558 * @return none |
|
559 */ |
|
560 void ExecuteBufferL( const TDesC8& aURI ); |
|
561 |
|
562 /** |
|
563 * The function gets the profile Id (LUID) for given URI. |
|
564 * @param aURI URI which LUID to be fetched. |
|
565 * @return LUID for the URI. |
|
566 */ |
|
567 TInt GetProfileIdFromURIL( const TDesC8& aURI ); |
|
568 |
|
569 /** |
|
570 * The function gets the MIME type for given data provider. |
|
571 * @param aDataProviderId Data provider ID. |
|
572 * @param aProfileLUID Profile LUID. |
|
573 * @param aObject Reference where fetched MIME type to be stored. |
|
574 * @return KErrNone if successful otherwise error cose. |
|
575 */ |
|
576 TInt GetContentTypeL( const TInt aDataProviderId, const TInt aProfileLUID, |
|
577 CBufBase*& aObject ); |
|
578 |
|
579 /** |
|
580 * The function find out the buffer index for given URI. |
|
581 * @param aURI URI which position in the buffer to be solved. |
|
582 * @return Buffer position for given URI. If not found value is -1. |
|
583 */ |
|
584 TInt GetBufferIndex( const TDesC8& aURI ); |
|
585 |
|
586 /** |
|
587 * The function sets the LUID to buffer for given URI. |
|
588 * @param aURI URI which position in the buffer to be solved. |
|
589 * @param aLUID LUID for an URI. |
|
590 * @return Value > 0 if URI found, otherwise value is 0. |
|
591 */ |
|
592 TInt SetBufferLUID( const TDesC8& aURI, const TInt aLUID ); |
|
593 |
|
594 /** |
|
595 * The function find out the port number from URL and stores it to aPort. |
|
596 * @param aRealURI Reference data to be containing the whole URI. |
|
597 * @param aPort Reference variable where port number will be stored. |
|
598 * @return KErrNone if successful otherwise KErrNotFound. |
|
599 */ |
|
600 TInt ParseUri( const TDesC8& aRealURI, TInt& aPort ); |
|
601 |
|
602 /** |
|
603 * The function checks if requested profile ID exits. |
|
604 * @param aIntLUID Integer value for a LUID of the profile. |
|
605 * @return ETrue if profile exits otherwise EFalse. |
|
606 */ |
|
607 TBool FindProfileIdL( const TInt aIntLUID ); |
|
608 |
|
609 /** |
|
610 * The function gets the profile ID from Client API. |
|
611 * @param aIntLUID Integer value for a LUID of the profile. |
|
612 * @param aProfileID Reference to object where profile ID to be stored. |
|
613 * @return KErrNone if successful otherwise KErrNotFound. |
|
614 */ |
|
615 TInt GetProfileIdentifierL( const TInt aIntLUID, TInt& aProfileID ); |
|
616 |
|
617 /** |
|
618 * The function gets the profile data acording to URI leaf. |
|
619 * @param aIntLUID Profile ID. |
|
620 * @param aObject Reference where fetched data to be stored. |
|
621 * @return KErrNone if successful otherwise error code. |
|
622 */ |
|
623 TInt GetDSFieldDataL( const TInt aIntLUID, CBufBase*& aObject ); |
|
624 |
|
625 /** |
|
626 * The function gets the profile medium type value. |
|
627 * @param aIntLUID Reference where data to be stored. |
|
628 * @return Medium type for profile connection. |
|
629 */ |
|
630 TInt GetProfileConnectiontypeL( const TInt aIntLUID ); |
|
631 |
|
632 /** |
|
633 * The function gets the profile Addr leaf value. |
|
634 * @param aIntLUID Profile ID. |
|
635 * @param aURL Reference where fetched data to be stored. |
|
636 * @return KErrNone if successful otherwise error code. |
|
637 */ |
|
638 TInt GetProfileServerURLL( const TInt aIntLUID, CBufBase*& aURL ); |
|
639 |
|
640 /** |
|
641 * The function gets the profile user name value. |
|
642 * @param aIntLUID Profile ID. |
|
643 * @param aUserName Reference where fetched data to be stored. |
|
644 * @return KErrNone if successful otherwise error code. |
|
645 */ |
|
646 TInt GetProfileUserNameL( const TInt aIntLUID, CBufBase*& aUserName ); |
|
647 |
|
648 /** |
|
649 * The function gets the profile user name value. |
|
650 * @param aIntLUID Profile ID. |
|
651 * @param aServerId Reference where fetched data to be stored. |
|
652 * @return KErrNone if successful otherwise error code. |
|
653 */ |
|
654 TInt GetProfileServerIdL( const TInt aIntLUID, CBufBase*& aServerId ); |
|
655 |
|
656 /** |
|
657 * The function gets the profile IAP Id (ToNAPID) value. |
|
658 * @param aIntLUID Profile ID. |
|
659 * @param aIAPid Reference where fetched data to be stored. |
|
660 * @return KErrNone if successful otherwise error code. |
|
661 */ |
|
662 TInt GetProfileIAPIdL( const TInt aIntLUID, TInt& aIAPid ); |
|
663 |
|
664 /** |
|
665 * The function gets the profile Name value. |
|
666 * @param aIntLUID Profile ID. |
|
667 * @param aDisplayName Reference where fetched data to be stored. |
|
668 * @return KErrNone if successful otherwise error code. |
|
669 */ |
|
670 TInt GetProfileDisplayNameL( const TInt aIntLUID, CBufBase*& aDisplayName ); |
|
671 |
|
672 /** |
|
673 * The function creates new DM profile. |
|
674 * @param aPID Reference to variable where new profile Id will be stored. |
|
675 * @return KErrNone if successful otherwise error code. |
|
676 */ |
|
677 TInt CreateNewProfileL( TInt& aPID ); |
|
678 |
|
679 /** |
|
680 * The function sets the profile Addr leaf value. |
|
681 * @param aPID Profile ID. |
|
682 * @param aObj Data to be stored for a profile. |
|
683 * @return KErrNone if successful otherwise error code. |
|
684 */ |
|
685 TInt SetProfileServerURIL( const TInt aPID, const TDesC8& aObj ); |
|
686 |
|
687 /** |
|
688 * The function sets the profile Name leaf value. |
|
689 * @param aPID Profile ID. |
|
690 * @param aObj Data to be stored for a profile. |
|
691 * @return KErrNone if successful otherwise error code. |
|
692 */ |
|
693 TInt SetProfileDisplayNameL( const TInt aPID, const TDesC8& aObj ); |
|
694 |
|
695 /** |
|
696 * The function sets the profile UserName leaf value. |
|
697 * @param aPID Profile ID. |
|
698 * @param aObj Data to be stored for a profile. |
|
699 * @return KErrNone if successful otherwise error code. |
|
700 */ |
|
701 TInt SetProfileUserNameL( const TInt aPID, const TDesC8& aObj ); |
|
702 |
|
703 /** |
|
704 * The function sets the profile UserName leaf value. |
|
705 * @param aPID Profile ID. |
|
706 * @param aObj Data to be stored for a profile. |
|
707 * @return KErrNone if successful otherwise error code. |
|
708 */ |
|
709 TInt SetProfileServerIdL( const TInt aPID, const TDesC8& aObj ); |
|
710 |
|
711 /** |
|
712 * The function sets the profile password leaf value. |
|
713 * @param aPID Profile ID. |
|
714 * @param aObj Data to be stored for a profile. |
|
715 * @return KErrNone if successful otherwise error code. |
|
716 */ |
|
717 TInt SetProfilePasswordL( const TInt aPID, const TDesC8& aObj ); |
|
718 |
|
719 /** |
|
720 * General function that checks which leaf to be handled based on field id. |
|
721 * @param aPID Profile ID. |
|
722 * @param aObj Data to be stored for a profile. |
|
723 * @param aFieldID Internal value for a leaf to be handled. |
|
724 * @return KErrNone if successful otherwise error code. |
|
725 */ |
|
726 TInt SetProfileStrValueL( const TInt aPID, const TDesC8& aObj, |
|
727 const TInt aFieldID ); |
|
728 |
|
729 /** |
|
730 * The function deletes the profile data. |
|
731 * @param aPID Profile ID. |
|
732 * @return KErrNone if successful otherwise error code. |
|
733 */ |
|
734 TInt DeleteProfileL( const TInt aPID ); |
|
735 |
|
736 /** |
|
737 * The function creates list of the content types that profile supports. |
|
738 * @param aURI URI that contains content types. |
|
739 * @param aPID Profile ID. |
|
740 * @param aCurrentURISegmentList Reference to list to be filled. |
|
741 * @param aPreviousURISegmentList Previous, existing list for content types. |
|
742 * @return KErrNone if successful otherwise error code. |
|
743 */ |
|
744 TInt CreateURITaskSegmentListL( const TDesC8& aURI, const TInt aPID, |
|
745 CBufBase*& aCurrentURISegmentList, |
|
746 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList ); |
|
747 |
|
748 /** |
|
749 * The function creates list of the existing profiles. |
|
750 * @param aCurrentURISegmentList Reference to list to be filled. |
|
751 * @param aPreviousURISegmentList Previous, existing list for profiles. |
|
752 * @return KErrNone if successful otherwise error code. |
|
753 */ |
|
754 TInt CreateURIProfileSegmentListL( CBufBase*& aCurrentURISegmentList, |
|
755 const CArrayFix<TSmlDmMappingInfo>& aPreviousURISegmentList ); |
|
756 |
|
757 /** |
|
758 * The function opens the server session and profile via client API. |
|
759 * @param aIntLUID Integer value for a LUID of the profile. |
|
760 * @param aMode Read or Read and Write mode for a profile data. |
|
761 * @return KErrNone if successful otherwise KErrNotFound. |
|
762 */ |
|
763 TInt OpenSyncSessionAndDSProfileL( const TInt aIntLUID, TSmlOpenMode aMode ); |
|
764 |
|
765 /** |
|
766 * The function closes the DS profile session. |
|
767 * @param none. |
|
768 * @return none. |
|
769 */ |
|
770 void CloseDSProfile(); |
|
771 |
|
772 /** |
|
773 * The function checks if profile has the requested task id. |
|
774 * @param aProfLUID Integer value for a LUID of the profile. |
|
775 * @param aDataProviderId DataProvider id to be searched. |
|
776 * @return ETrue if task found otherwise EFalse. |
|
777 */ |
|
778 TBool FindTaskIDL( const TInt aProfLUID, const TInt aDataProviderId ); |
|
779 |
|
780 /** |
|
781 * The function deletes task for given profile. |
|
782 * @param aLUID Integer value for a LUID of the profile. |
|
783 * @param aDataProviderId DataProvider id to be searched. |
|
784 * @return KErrNone if successful otherwise error code. |
|
785 */ |
|
786 TInt DeleteTaskByIDL( const TInt aLUID, const TInt aDataProviderId ); |
|
787 |
|
788 /** |
|
789 * The function gets the LDBURI (local datastore) for given profile. |
|
790 * @param aDataProviderId DataProvider id to be searched. |
|
791 * @param aProfileLUID Profile Id. |
|
792 * @param aObject Reference to object where fetched value to be saved. |
|
793 * @return KErrNone if successful otherwise error code. |
|
794 */ |
|
795 TInt GetClientDataSourceL( const TInt aDataProviderId, const TInt aProfileLUID, |
|
796 CBufBase*& aObject ); |
|
797 /** |
|
798 * The function gets the RDBURI (remote datastore) for given profile. |
|
799 * @param aDataProviderId DataProvider id to be searched. |
|
800 * @param aProfileLUID Profile Id. |
|
801 * @param aObject Reference to object where fetched value to be saved. |
|
802 * @return KErrNone if successful otherwise error code. |
|
803 */ |
|
804 TInt GetServerDataSourceL( const TInt aDataProviderId, const TInt aProfileLUID, |
|
805 CBufBase*& aObject ); |
|
806 |
|
807 /** |
|
808 * The function replaces the LDBURI or RDBURI values for given profile. |
|
809 * @param aProfileLUID Profile Id. |
|
810 * @param aDataProviderId DataProvider id to be searched. |
|
811 * @param aObject Data to be stored. |
|
812 * @param aField Field Id to be handled. |
|
813 * @return KErrNone if successful otherwise error code. |
|
814 */ |
|
815 TInt UpdateDataSourceL( const TInt aProfileLUID, const TInt aDataProviderId, |
|
816 const TDesC8& aObject, const HBufC8& aField ); |
|
817 |
|
818 /** |
|
819 * The function fetches the object (leaf) data based on given URI. |
|
820 * @param aURI URI of the object |
|
821 * @param aLUID LUID of the object |
|
822 * @param aObj Reference to object where fetched data to be saved. |
|
823 * @param aStatusRef Reference to correct command |
|
824 * @return none |
|
825 */ |
|
826 TInt FetchObjectL( const TDesC8& aURI, const TDesC8& aLUID, CBufBase*& aObj, |
|
827 const TInt aStatusRef ); |
|
828 |
|
829 /** |
|
830 * The function fills the node info. |
|
831 * @param aNode Reference to node or leaf which info to be filled. |
|
832 * @param aAccTypes Access rights for a leaf / node. |
|
833 * @param aOccurrence Occurance of the node / leaf. |
|
834 * @param aScope Scope (dynamic / permanent) of the leaf / node. |
|
835 * @param aFormat Data format of the leaf / node. |
|
836 * @param aDescription Description of the node / leaf. |
|
837 * @param aDefaultValue Default value for a leaf or node. |
|
838 * @param aMimeType MIME type for a leaf / node. |
|
839 * @return none |
|
840 */ |
|
841 void FillNodeInfoL( MSmlDmDDFObject& aNode, TSmlDmAccessTypes aAccTypes, |
|
842 MSmlDmDDFObject::TOccurence aOccurrence, |
|
843 MSmlDmDDFObject::TScope aScope, |
|
844 MSmlDmDDFObject::TDFFormat aFormat, |
|
845 const TDesC8& aDescription, |
|
846 const TDesC8& aDefaultValue, const TDesC8& aMimeType ); |
|
847 |
|
848 /** |
|
849 * The function set's the address type / medium type value for a profile. |
|
850 * @param aLUID LUID for a profile. |
|
851 * @param aIntObj Address type value. |
|
852 * @return KErrNone if successful otherwise error code. |
|
853 */ |
|
854 TInt SetProfileAddrTypeL( const TInt aLUID, const TInt aIntObj ); |
|
855 |
|
856 /** |
|
857 * The function adds port number to address URL. |
|
858 * @param aLUID Profile ID. |
|
859 * @param aPort Reference to port number data. |
|
860 * @return KErrNone if successful otherwise error code. |
|
861 */ |
|
862 TInt SetProfileConnectionPortNrL( const TInt aLUID, const TDesC8& aPort ); |
|
863 |
|
864 /** |
|
865 * The function adds port number to address URL. |
|
866 * @param aSrvURI Original address URI. |
|
867 * @param aNewURI New URI when port number has been added or deleted. |
|
868 * @param aPort Reference to port number data. |
|
869 * @return KErrNone if successful otherwise error code. |
|
870 */ |
|
871 void SetPortNrToAddrStr( const TDesC8& aSrvURI, HBufC8* aNewURI, |
|
872 const TDesC8& aPort ); |
|
873 |
|
874 /** |
|
875 * The function checks if MIME type allready exits. |
|
876 * @param aLuid Profile LUID. |
|
877 * @param aMimeType MIME type to be searched. |
|
878 * @return ETrue if MIME type found else EFalse. |
|
879 */ |
|
880 TBool MimeTypeAllreadyExitsL( const TInt aLuid, const TDesC8& aMimeType ); |
|
881 |
|
882 /** |
|
883 * The function sets the RDBURI (remote datastore) to memeber variable. |
|
884 * @param aStore Value for a RDBURI. |
|
885 * @return none. |
|
886 */ |
|
887 void SetRDBDataStore( const TDesC8& aStore ); |
|
888 |
|
889 /** |
|
890 * The function sets the IAP Id value to profile connection data. |
|
891 * @param aLuid Profile LUID. |
|
892 * @param aIAPid Id for an IAP. |
|
893 * @return KErrNone if successful otherwise error code. |
|
894 */ |
|
895 TInt SetProfileIAPIdL( const TInt aLUID, const TInt aIAPid ); |
|
896 |
|
897 /** |
|
898 * The function gets UID for the profile medium type. |
|
899 * @param aIntObj Profile LUID. |
|
900 * @param aMediumType Requested medium type. |
|
901 * @return none. |
|
902 */ |
|
903 void GetMediumTypeL(const TInt aIntObj, TSmlTransportId& aMediumType); |
|
904 |
|
905 /** |
|
906 * The function checks if the URI is of format ./SyncML/DMAcc/DMId<num> |
|
907 * Example ./SyncML/DMAcc/DMId000 |
|
908 * @param aURI aURI. |
|
909 * @return true/false |
|
910 */ |
|
911 TBool IsDSAccUriFormatMatchPredefined(const TDesC8 & aURI); |
|
912 |
|
913 /** |
|
914 * The function constructs ./SyncML/DMAcc/x nodes and |
|
915 * returns the profile ID matching the aURI. |
|
916 * @param aURI aURI. |
|
917 * @return KErrNotFound/ProfileID |
|
918 */ |
|
919 |
|
920 TInt ConstructTreeL(const TDesC8& aURI); |
|
921 |
|
922 private: // Data |
|
923 |
|
924 // Callback interface for returning result or status |
|
925 MSmlDmCallback* iCallBack; |
|
926 // Client API session class |
|
927 RSyncMLSession iSyncSession; |
|
928 // Client API DS profile handling |
|
929 RSyncMLDataSyncProfile iDSProfile; |
|
930 |
|
931 // Buffer for URI leaf element |
|
932 HBufC8* iField; |
|
933 // Pointer to buffer structure |
|
934 CArrayFixFlat<TNSmlDSBufferElement> *iBuffer; |
|
935 |
|
936 // Buffer for URI leaf element |
|
937 HBufC8* iPrevURI; |
|
938 // Buffer for profile port number handling |
|
939 HBufC8* iPortNbr; |
|
940 // Buffer for profile remote data store handling |
|
941 HBufC16* iRdbDataStore; |
|
942 // Information about leaf command |
|
943 TNSmlDSLeafType iLeafType; |
|
944 |
|
945 // LUID to be handled |
|
946 TInt iLUID; |
|
947 // Parent LUID |
|
948 TInt iParentLUID; |
|
949 // For handling profile medium type |
|
950 TInt iObject; |
|
951 // Previously handled LUID |
|
952 TInt iPrevLUID; |
|
953 |
|
954 // Status information if session allready opened |
|
955 TBool iSyncSessionOpen; |
|
956 // Status of command was inside the module from buffer execution |
|
957 TBool iBufferExecution; |
|
958 |
|
959 // buffered data for updating port number |
|
960 HBufC8* iPortBuf; |
|
961 TInt iPortBufLUID; |
|
962 TInt iPortBufStatusRef; |
|
963 }; |
|
964 |
|
965 #endif // __NSmlDSSETTINGSADAPTER_H__ |
|
966 |
|
967 // End of File |