|
1 /* |
|
2 * Copyright (c) 2002 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: XML syncml DTD generator |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // ------------------------------------------------------------------------------------------------ |
|
20 // Include |
|
21 // ------------------------------------------------------------------------------------------------ |
|
22 #include "XMLSyncMLGenerator.h" |
|
23 #include "WBXMLGeneratorError.h" |
|
24 #include "XMLWorkspace.h" |
|
25 #include "XMLDevInfGenerator.h" |
|
26 #include "WBXMLDevInfParser.h" |
|
27 #include "WBXMLParser.h" |
|
28 |
|
29 #include "smlsyncmltags.h" |
|
30 #include "smlmetinftags.h" |
|
31 |
|
32 #include <s32mem.h> |
|
33 |
|
34 // FOTA : Correlator added after 'Move' |
|
35 _LIT8( KSyncMLElements, |
|
36 "<0>|<1>|<2>|<3>|<4>|Add|Alert|Archive|Atomic|Chal|Cmd|CmdID|CmdRef|Copy|Cred|Data|Delete|" |
|
37 "Exec|Final|Get|Item|Lang|LocName|LocURI|Map|MapItem|Meta|MsgID|MsgRef|" |
|
38 "NoResp|NoResults|Put|Replace|RespURI|Results|Search|Sequence|SessionID|" |
|
39 "SftDel|Source|SourceRef|Status|Sync|SyncBody|SyncHdr|SyncML|Target|" |
|
40 "TargetRef|<reserved>|VerDTD|VerProto|NumberOfChanges|MoreData|Field|Filter|Record|FilterType|" |
|
41 "SourceParent|TargetParent|Move|Correlator|Data" ); |
|
42 |
|
43 _LIT8( KSyncMLNamespace, "SYNCML:SYNCML"); |
|
44 |
|
45 |
|
46 _LIT8( KMetInfElements, |
|
47 "<0>|<1>|<2>|<3>|<4>|Anchor|EMI|Format|FreeID|FreeMem|Last|Mark|MaxMsgSize|Mem|MetInf|Next|" |
|
48 "NextNonce|SharedMem|Size|Type|Version|MaxObjSize|FieldLevel" ); |
|
49 |
|
50 _LIT8( KMetInfNamespace, "syncml:metinf"); |
|
51 |
|
52 // HYBRID 1.2 CHANGE |
|
53 _LIT8( KDevInfGen, "./devinf" ); |
|
54 // Changes end |
|
55 |
|
56 _LIT8( KDevInfElements, |
|
57 "<0>|<1>|<2>|<3>|<4>|CTCap|CTType|DataStore|DataType|DevID|DevInf|DevTyp|DisplayName|DSMem|Ext|" |
|
58 "FwV|HwV|Man|MaxGUIDSize|MaxID|MaxMem|Mod|OEM|ParamName|PropName|Rx|Rx-Pref|" |
|
59 "SharedMem|MaxSize|SourceRef|SwV|SyncCap|SyncType|Tx|Tx-Pref|ValEnum|VerCT|" |
|
60 "VerDTD|Xnam|Xval|UTC|SupportNumberOfChanges|SupportLargeObjs|" |
|
61 // 1.2 CHANGES: new elements |
|
62 "Property|PropParam|MaxOccur|NoTruncate|Empty|Filter-Rx|FilterCap|FilterKeyword|FieldLevel|SupportHierarchicalSync" ); |
|
63 // changes end |
|
64 |
|
65 // ------------------------------------------------------------------------------------------------ |
|
66 // CXMLSyncMLGenerator |
|
67 // ------------------------------------------------------------------------------------------------ |
|
68 EXPORT_C void CXMLSyncMLGenerator::CreateWorkspaceL() |
|
69 { |
|
70 CXMLGenerator::CreateDynamicWorkspaceL(); |
|
71 // HYBRID 1.2 CHANGE |
|
72 CXMLGenerator::SetTranslateTableL(KSyncMLElements()); |
|
73 } |
|
74 |
|
75 // ------------------------------------------------------------------------------------------------ |
|
76 EXPORT_C void CXMLSyncMLGenerator::InitializeL() |
|
77 { |
|
78 // HYBRID 1.2 CHANGE |
|
79 CXMLGenerator::SetTranslateTableL(KSyncMLElements()); |
|
80 } |
|
81 |
|
82 // ------------------------------------------------------------------------------------------------ |
|
83 EXPORT_C Ret_t CXMLSyncMLGenerator::smlStartMessage( SmlSyncHdrPtr_t aContent ) |
|
84 { |
|
85 // HYBRID 1.2 CHANGE |
|
86 HBufC8* version=NULL; |
|
87 TRAPD(result, version = HBufC8::NewL( KSyncMLNamespace().Length() + aContent->version->Data().Length())); |
|
88 if(version) |
|
89 { |
|
90 TPtr8 versionPtr = version->Des(); |
|
91 versionPtr = KSyncMLNamespace(); |
|
92 versionPtr.Append ( aContent->version->Data() ); |
|
93 TRAP(result,CXMLGenerator::SetNamespaceNameL( versionPtr )); |
|
94 delete version; |
|
95 } |
|
96 |
|
97 Reset(); |
|
98 Workspace()->BeginTransaction(); |
|
99 TRAP(result, doSmlStartMessageL(aContent)); |
|
100 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
101 } |
|
102 |
|
103 // ------------------------------------------------------------------------------------------------ |
|
104 EXPORT_C Ret_t CXMLSyncMLGenerator::smlEndMessage( Boolean_t aFinal ) |
|
105 { |
|
106 Workspace()->BeginTransaction(); |
|
107 TRAPD(result, doSmlEndMessageL(aFinal)); |
|
108 return HandleResult(result); // No safe treshold as this is end of packet! |
|
109 } |
|
110 |
|
111 // ------------------------------------------------------------------------------------------------ |
|
112 EXPORT_C Ret_t CXMLSyncMLGenerator::smlStartSync( SmlSyncPtr_t aContent ) |
|
113 { |
|
114 Workspace()->BeginTransaction(); |
|
115 TRAPD(result, AppendSyncL(aContent)); |
|
116 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
117 } |
|
118 |
|
119 // ------------------------------------------------------------------------------------------------ |
|
120 EXPORT_C Ret_t CXMLSyncMLGenerator::smlEndSync() |
|
121 { |
|
122 Workspace()->BeginTransaction(); |
|
123 TRAPD(result, EndElementL()); |
|
124 return HandleResult(result); |
|
125 } |
|
126 |
|
127 // ------------------------------------------------------------------------------------------------ |
|
128 EXPORT_C Ret_t CXMLSyncMLGenerator::smlAddCmd( SmlAddPtr_t aContent ) |
|
129 { |
|
130 Workspace()->BeginTransaction(); |
|
131 TRAPD(result, AppendAddCmdL(aContent)); |
|
132 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
133 } |
|
134 |
|
135 // ------------------------------------------------------------------------------------------------ |
|
136 EXPORT_C Ret_t CXMLSyncMLGenerator::smlReplaceCmd( SmlReplacePtr_t aContent ) |
|
137 { |
|
138 Workspace()->BeginTransaction(); |
|
139 TRAPD(result, AppendReplaceCmdL(aContent)); |
|
140 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
141 } |
|
142 |
|
143 // ------------------------------------------------------------------------------------------------ |
|
144 EXPORT_C Ret_t CXMLSyncMLGenerator::smlCopyCmd( SmlCopyPtr_t aContent ) |
|
145 { |
|
146 Workspace()->BeginTransaction(); |
|
147 TRAPD(result, AppendCopyCmdL(aContent)); |
|
148 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
149 } |
|
150 |
|
151 // FOTA |
|
152 // ------------------------------------------------------------------------------------------------ |
|
153 EXPORT_C Ret_t CXMLSyncMLGenerator::smlExecCmd( SmlExecPtr_t aContent ) |
|
154 { |
|
155 Workspace()->BeginTransaction(); |
|
156 TRAPD(result, AppendExecCmdL(aContent)); |
|
157 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
158 } |
|
159 // FOTA end |
|
160 //1.2 CHANGES: Move command |
|
161 // ------------------------------------------------------------------------------------------------ |
|
162 EXPORT_C Ret_t CXMLSyncMLGenerator::smlMoveCmd( SmlMovePtr_t aContent ) |
|
163 { |
|
164 Workspace()->BeginTransaction(); |
|
165 TRAPD(result, AppendMoveCmdL(aContent)); |
|
166 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
167 } |
|
168 //Changes end |
|
169 |
|
170 // ------------------------------------------------------------------------------------------------ |
|
171 EXPORT_C Ret_t CXMLSyncMLGenerator::smlDeleteCmd( SmlDeletePtr_t aContent ) |
|
172 { |
|
173 Workspace()->BeginTransaction(); |
|
174 TRAPD(result, AppendDeleteCmdL(aContent)); |
|
175 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
176 } |
|
177 |
|
178 // ------------------------------------------------------------------------------------------------ |
|
179 EXPORT_C Ret_t CXMLSyncMLGenerator::smlAlertCmd( SmlAlertPtr_t aContent ) |
|
180 { |
|
181 Workspace()->BeginTransaction(); |
|
182 TRAPD(result, AppendAlertCmdL(aContent)); |
|
183 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
184 } |
|
185 |
|
186 // ------------------------------------------------------------------------------------------------ |
|
187 EXPORT_C Ret_t CXMLSyncMLGenerator::smlGetCmd( SmlPutPtr_t aContent ) |
|
188 { |
|
189 Workspace()->BeginTransaction(); |
|
190 TRAPD(result, AppendGetCmdL(aContent)); |
|
191 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
192 } |
|
193 |
|
194 // ------------------------------------------------------------------------------------------------ |
|
195 EXPORT_C Ret_t CXMLSyncMLGenerator::smlPutCmd( SmlPutPtr_t aContent ) |
|
196 { |
|
197 Workspace()->BeginTransaction(); |
|
198 TRAPD(result, AppendPutCmdL(aContent)); |
|
199 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
200 } |
|
201 |
|
202 // ------------------------------------------------------------------------------------------------ |
|
203 EXPORT_C Ret_t CXMLSyncMLGenerator::smlMapCmd( SmlMapPtr_t aContent ) |
|
204 { |
|
205 Workspace()->BeginTransaction(); |
|
206 TRAPD(result, AppendMapCmdL(aContent)); |
|
207 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
208 } |
|
209 |
|
210 // ------------------------------------------------------------------------------------------------ |
|
211 EXPORT_C Ret_t CXMLSyncMLGenerator::smlResultsCmd( SmlResultsPtr_t aContent ) |
|
212 { |
|
213 Workspace()->BeginTransaction(); |
|
214 TRAPD(result, AppendResultsCmdL(aContent)); |
|
215 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
216 } |
|
217 |
|
218 // ------------------------------------------------------------------------------------------------ |
|
219 EXPORT_C Ret_t CXMLSyncMLGenerator::smlStatusCmd( SmlStatusPtr_t aContent ) |
|
220 { |
|
221 Workspace()->BeginTransaction(); |
|
222 TRAPD(result, AppendStatusCmdL(aContent)); |
|
223 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
224 } |
|
225 |
|
226 // ------------------------------------------------------------------------------------------------ |
|
227 EXPORT_C Ret_t CXMLSyncMLGenerator::smlStartAtomic( SmlAtomicPtr_t aContent ) |
|
228 { |
|
229 Workspace()->BeginTransaction(); |
|
230 TRAPD(result, AppendStartAtomicL(aContent)); |
|
231 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
232 } |
|
233 |
|
234 // ------------------------------------------------------------------------------------------------ |
|
235 EXPORT_C Ret_t CXMLSyncMLGenerator::smlEndAtomic() |
|
236 { |
|
237 Workspace()->BeginTransaction(); |
|
238 TRAPD(result, AppendEndAtomicL()); |
|
239 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
240 } |
|
241 |
|
242 // ------------------------------------------------------------------------------------------------ |
|
243 EXPORT_C Ret_t CXMLSyncMLGenerator::smlStartSequence( SmlSequencePtr_t aContent ) |
|
244 { |
|
245 Workspace()->BeginTransaction(); |
|
246 TRAPD(result, AppendStartSequenceL(aContent)); |
|
247 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
248 } |
|
249 |
|
250 // ------------------------------------------------------------------------------------------------ |
|
251 EXPORT_C Ret_t CXMLSyncMLGenerator::smlEndSequence() |
|
252 { |
|
253 Workspace()->BeginTransaction(); |
|
254 TRAPD(result, AppendEndSequenceL()); |
|
255 return HandleResult(result, KNSmlXmlBufferSafeTreshold); |
|
256 } |
|
257 |
|
258 // Data chunk functionality |
|
259 |
|
260 // ------------------------------------------------------------------------------------------------ |
|
261 EXPORT_C void CXMLSyncMLGenerator::SetTruncate( TBool aEnabled ) |
|
262 { |
|
263 iUseTruncation = aEnabled; |
|
264 } |
|
265 |
|
266 // ------------------------------------------------------------------------------------------------ |
|
267 EXPORT_C TInt CXMLSyncMLGenerator::ItemIndex() const |
|
268 { |
|
269 return iItemIndex; |
|
270 } |
|
271 |
|
272 // ------------------------------------------------------------------------------------------------ |
|
273 EXPORT_C TInt CXMLSyncMLGenerator::DataConsumed() const |
|
274 { |
|
275 return iDataConsumed; |
|
276 } |
|
277 |
|
278 // ------------------------------------------------------------------------------------------------ |
|
279 EXPORT_C TBool CXMLSyncMLGenerator::WasTruncated() |
|
280 { |
|
281 TBool was(iItemWasTruncated); |
|
282 iItemWasTruncated = EFalse; |
|
283 return was; |
|
284 } |
|
285 |
|
286 // ------------------------------------------------------------------------------------------------ |
|
287 void CXMLSyncMLGenerator::doSmlStartMessageL( SmlSyncHdrPtr_t aContent ) |
|
288 { |
|
289 BeginDocumentL(KNSmlSyncMLVersion, KNSmlSyncMLPublicId, KNSmlSyncMLUTF8); |
|
290 BeginElementL(ESyncML, ETrue); |
|
291 AppendSyncHrdL(aContent); |
|
292 BeginElementL(ESyncBody, ETrue); |
|
293 } |
|
294 |
|
295 // ------------------------------------------------------------------------------------------------ |
|
296 void CXMLSyncMLGenerator::doSmlEndMessageL( Boolean_t aFinal ) |
|
297 { |
|
298 if( aFinal ) |
|
299 { |
|
300 BeginElementL(EFinal); |
|
301 } |
|
302 EndElementL(); // SyncBody |
|
303 EndElementL(); // SyncML |
|
304 } |
|
305 |
|
306 // ------------------------------------------------------------------------------------------------ |
|
307 void CXMLSyncMLGenerator::AppendSyncHrdL( SmlSyncHdrPtr_t aContent ) |
|
308 { |
|
309 BeginElementL(ESyncHdr, ETrue); |
|
310 AppendPCDataL(EVerDTD, aContent->version); |
|
311 AppendPCDataL(EVerProto, aContent->proto); |
|
312 AppendPCDataL(ESessionID, aContent->sessionID); |
|
313 AppendPCDataL(EMsgID, aContent->msgID); |
|
314 AppendTargetL(aContent->target); |
|
315 AppendSourceL(aContent->source); |
|
316 AppendPCDataL(ERespURI, aContent->respURI); |
|
317 if( aContent->flags & SmlNoResp_f ) |
|
318 { |
|
319 BeginElementL(ENoResp); |
|
320 } |
|
321 AppendCredL(aContent->cred); |
|
322 AppendMetaL(aContent->meta); |
|
323 EndElementL(); // ESyncHdr |
|
324 } |
|
325 |
|
326 // ------------------------------------------------------------------------------------------------ |
|
327 void CXMLSyncMLGenerator::DoAppendTargetL( SmlTargetPtr_t aContent ) |
|
328 { |
|
329 AppendPCDataL(ELocURI, aContent->locURI); |
|
330 AppendPCDataL(ELocName, aContent->locName); |
|
331 AppendFilterL(aContent->filter); //1.2 CHANGES: Filter support |
|
332 } |
|
333 |
|
334 //1.2 CHANGES: source & Target separated |
|
335 // ------------------------------------------------------------------------------------------------ |
|
336 void CXMLSyncMLGenerator::DoAppendSourceL( SmlSourcePtr_t aContent ) |
|
337 { |
|
338 AppendPCDataL(ELocURI, aContent->locURI); |
|
339 AppendPCDataL(ELocName, aContent->locName); |
|
340 } |
|
341 //Changes end |
|
342 |
|
343 // ------------------------------------------------------------------------------------------------ |
|
344 void CXMLSyncMLGenerator::AppendTargetL( SmlTargetPtr_t aContent ) |
|
345 { |
|
346 if( !aContent ) |
|
347 { |
|
348 return; |
|
349 } |
|
350 BeginElementL(ETarget, ETrue); |
|
351 DoAppendTargetL(aContent); |
|
352 EndElementL(); // ETarget |
|
353 } |
|
354 |
|
355 // ------------------------------------------------------------------------------------------------ |
|
356 void CXMLSyncMLGenerator::AppendSourceL( SmlSourcePtr_t aContent ) |
|
357 { |
|
358 if( !aContent ) |
|
359 { |
|
360 return; |
|
361 } |
|
362 BeginElementL(ESource, ETrue); |
|
363 DoAppendSourceL(aContent); //1.2 CHANGES: Source & Target separated |
|
364 EndElementL(); // ETarget |
|
365 } |
|
366 |
|
367 //1.2 CHANGES: Source & Target parent |
|
368 // ------------------------------------------------------------------------------------------------ |
|
369 void CXMLSyncMLGenerator::DoAppendSourceOrTargetParentL( SmlSourceOrTargetParentPtr_t aContent ) |
|
370 { |
|
371 AppendPCDataL(ELocURI, aContent->locURI); |
|
372 } |
|
373 |
|
374 // ------------------------------------------------------------------------------------------------ |
|
375 void CXMLSyncMLGenerator::AppendSourceParentL( SmlSourceParentPtr_t aContent ) |
|
376 { |
|
377 if( !aContent ) |
|
378 { |
|
379 return; |
|
380 } |
|
381 BeginElementL(ESourceParent, ETrue); |
|
382 DoAppendSourceOrTargetParentL(aContent); |
|
383 EndElementL(); // ESourceParent |
|
384 } |
|
385 |
|
386 // ------------------------------------------------------------------------------------------------ |
|
387 void CXMLSyncMLGenerator::AppendTargetParentL( SmlTargetParentPtr_t aContent ) |
|
388 { |
|
389 if( !aContent ) |
|
390 { |
|
391 return; |
|
392 } |
|
393 BeginElementL(ETargetParent, ETrue); |
|
394 DoAppendSourceOrTargetParentL(aContent); |
|
395 EndElementL(); // ETargetParent |
|
396 } |
|
397 //Changes end |
|
398 |
|
399 // ------------------------------------------------------------------------------------------------ |
|
400 void CXMLSyncMLGenerator::AppendCredL( SmlCredPtr_t aContent ) |
|
401 { |
|
402 if( !aContent ) |
|
403 { |
|
404 return; |
|
405 } |
|
406 BeginElementL(ECred, ETrue); |
|
407 AppendMetaL(aContent->meta); |
|
408 AppendPCDataL(EData, aContent->data); |
|
409 EndElementL(); // ECred |
|
410 } |
|
411 |
|
412 // ------------------------------------------------------------------------------------------------ |
|
413 void CXMLSyncMLGenerator::AppendSyncL( SmlSyncPtr_t aContent ) |
|
414 { |
|
415 BeginElementL(ESync, ETrue); |
|
416 AppendPCDataL(ECmdID, aContent->cmdID); |
|
417 if( aContent->flags & SmlNoResp_f ) |
|
418 { |
|
419 BeginElementL(ENoResp); |
|
420 } |
|
421 AppendCredL(aContent->cred); |
|
422 AppendTargetL(aContent->target); |
|
423 AppendSourceL(aContent->source); |
|
424 AppendMetaL(aContent->meta); |
|
425 AppendPCDataL(ENumberOfChanges, aContent->noc); |
|
426 } |
|
427 |
|
428 // ------------------------------------------------------------------------------------------------ |
|
429 void CXMLSyncMLGenerator::DoAppendGenericCmdL( SmlGenericCmdPtr_t aContent, Flag_t aMask ) |
|
430 { |
|
431 AppendPCDataL(ECmdID, aContent->cmdID); |
|
432 if( (aContent->flags & SmlNoResp_f) & aMask ) |
|
433 { |
|
434 BeginElementL(ENoResp); |
|
435 } |
|
436 if( (aContent->flags & SmlArchive_f) & aMask ) |
|
437 { |
|
438 BeginElementL(EArchive); |
|
439 } |
|
440 if( (aContent->flags & SmlSftDel_f) & aMask ) |
|
441 { |
|
442 BeginElementL(ESftDel); |
|
443 } |
|
444 AppendCredL(aContent->cred); |
|
445 AppendMetaL(aContent->meta); |
|
446 AppendItemListL(aContent->itemList); |
|
447 } |
|
448 // FOTA |
|
449 // ------------------------------------------------------------------------------------------------ |
|
450 void CXMLSyncMLGenerator::DoAppendExecCmdL( SmlExecPtr_t aContent, Flag_t aMask ) |
|
451 { |
|
452 AppendPCDataL(ECmdID, aContent->cmdID); |
|
453 if( (aContent->flags & SmlNoResp_f) & aMask ) |
|
454 { |
|
455 BeginElementL(ENoResp); |
|
456 } |
|
457 if( (aContent->flags & SmlArchive_f) & aMask ) |
|
458 { |
|
459 BeginElementL(EArchive); |
|
460 } |
|
461 if( (aContent->flags & SmlSftDel_f) & aMask ) |
|
462 { |
|
463 BeginElementL(ESftDel); |
|
464 } |
|
465 AppendCredL(aContent->cred); |
|
466 AppendMetaL(aContent->meta); |
|
467 AppendPCDataL(ECorrelator, aContent->correlator); |
|
468 AppendItemL(aContent->item); |
|
469 } |
|
470 // FOTA end |
|
471 |
|
472 // ------------------------------------------------------------------------------------------------ |
|
473 void CXMLSyncMLGenerator::AppendAddCmdL( SmlAddPtr_t aContent ) |
|
474 { |
|
475 BeginElementL(EAdd, ETrue); |
|
476 DoAppendGenericCmdL(aContent, SmlNoResp_f); |
|
477 EndElementL(); // EAdd |
|
478 } |
|
479 |
|
480 // ------------------------------------------------------------------------------------------------ |
|
481 void CXMLSyncMLGenerator::AppendReplaceCmdL( SmlReplacePtr_t aContent ) |
|
482 { |
|
483 BeginElementL(EReplace, ETrue); |
|
484 DoAppendGenericCmdL(aContent, SmlNoResp_f); |
|
485 EndElementL(); // EReplace |
|
486 } |
|
487 |
|
488 // ------------------------------------------------------------------------------------------------ |
|
489 void CXMLSyncMLGenerator::AppendCopyCmdL( SmlCopyPtr_t aContent ) |
|
490 { |
|
491 BeginElementL(ECopy, ETrue); |
|
492 DoAppendGenericCmdL(aContent, SmlNoResp_f); |
|
493 EndElementL(); // ECopy |
|
494 } |
|
495 // FOTA |
|
496 // ------------------------------------------------------------------------------------------------ |
|
497 void CXMLSyncMLGenerator::AppendExecCmdL( SmlExecPtr_t aContent ) |
|
498 { |
|
499 BeginElementL(EExec, ETrue); |
|
500 DoAppendExecCmdL(aContent, SmlNoResp_f); |
|
501 EndElementL(); // EExec |
|
502 } |
|
503 // FOTA end |
|
504 |
|
505 //1.2 CHANGES: Move command |
|
506 // ------------------------------------------------------------------------------------------------ |
|
507 void CXMLSyncMLGenerator::AppendMoveCmdL( SmlMovePtr_t aContent ) |
|
508 { |
|
509 BeginElementL(EMove, ETrue); |
|
510 DoAppendGenericCmdL(aContent, SmlNoResp_f); |
|
511 EndElementL(); // EMove |
|
512 } |
|
513 //Changes end |
|
514 |
|
515 // ------------------------------------------------------------------------------------------------ |
|
516 void CXMLSyncMLGenerator::AppendDeleteCmdL( SmlDeletePtr_t aContent ) |
|
517 { |
|
518 BeginElementL(EDelete, ETrue); |
|
519 DoAppendGenericCmdL(aContent, SmlNoResp_f|SmlArchive_f|SmlSftDel_f); |
|
520 EndElementL(); // EDelete |
|
521 } |
|
522 |
|
523 // ------------------------------------------------------------------------------------------------ |
|
524 void CXMLSyncMLGenerator::AppendAlertCmdL( SmlAlertPtr_t aContent ) |
|
525 { |
|
526 BeginElementL(EAlert, ETrue); |
|
527 AppendPCDataL(ECmdID, aContent->cmdID); |
|
528 if( aContent->flags & SmlNoResp_f ) |
|
529 { |
|
530 BeginElementL(ENoResp); |
|
531 } |
|
532 AppendCredL(aContent->cred); |
|
533 AppendPCDataL(EData, aContent->data); |
|
534 // FOTA |
|
535 AppendPCDataL(ECorrelator, aContent->correlator); |
|
536 // FOTA end |
|
537 AppendItemListL(aContent->itemList); |
|
538 EndElementL(); // EAlert |
|
539 } |
|
540 |
|
541 // ------------------------------------------------------------------------------------------------ |
|
542 void CXMLSyncMLGenerator::AppendGetCmdL( SmlGetPtr_t aContent ) |
|
543 { |
|
544 BeginElementL(EGet, ETrue); |
|
545 DoAppendPutGetL(aContent); |
|
546 EndElementL(); // EPut |
|
547 } |
|
548 |
|
549 // ------------------------------------------------------------------------------------------------ |
|
550 void CXMLSyncMLGenerator::AppendPutCmdL( SmlPutPtr_t aContent ) |
|
551 { |
|
552 BeginElementL(EPut, ETrue); |
|
553 DoAppendPutGetL(aContent); |
|
554 EndElementL(); // EPut |
|
555 } |
|
556 |
|
557 // ------------------------------------------------------------------------------------------------ |
|
558 void CXMLSyncMLGenerator::DoAppendPutGetL( SmlPutPtr_t aContent ) |
|
559 { |
|
560 AppendPCDataL(ECmdID, aContent->cmdID); |
|
561 if( aContent->flags & SmlNoResp_f ) |
|
562 { |
|
563 BeginElementL(ENoResp); |
|
564 } |
|
565 AppendPCDataL(ELang, aContent->lang); |
|
566 AppendCredL(aContent->cred); |
|
567 AppendMetaL(aContent->meta); |
|
568 AppendItemListL(aContent->itemList); |
|
569 } |
|
570 |
|
571 // ------------------------------------------------------------------------------------------------ |
|
572 EXPORT_C Ret_t CXMLSyncMLGenerator::smlDeviceInfoL( SmlDevInfDevInfPtr_t aContent ) |
|
573 { |
|
574 BeginElementL(EData, ETrue); |
|
575 CXMLDevInfGenerator* devgen = new (ELeave) CXMLDevInfGenerator(); |
|
576 CleanupStack::PushL(devgen); |
|
577 devgen->InitializeL(); |
|
578 devgen->CreateWorkspaceL(); |
|
579 devgen->SetIndentLevel(IndentLevel()); |
|
580 devgen->smlDeviceInfo(aContent); |
|
581 Workspace()->WriteL(devgen->Document()); |
|
582 CleanupStack::PopAndDestroy(); // devgen |
|
583 EndElementL(); // EPut |
|
584 return KErrNone; |
|
585 } |
|
586 |
|
587 // ------------------------------------------------------------------------------------------------ |
|
588 void CXMLSyncMLGenerator::AppendMapCmdL( SmlMapPtr_t aContent ) |
|
589 { |
|
590 BeginElementL(EMap, ETrue); |
|
591 AppendPCDataL(ECmdID, aContent->cmdID); |
|
592 AppendTargetL(aContent->target); |
|
593 AppendSourceL(aContent->source); |
|
594 AppendCredL(aContent->cred); |
|
595 AppendMetaL(aContent->meta); |
|
596 AppendMapItemListL(aContent->mapItemList); |
|
597 EndElementL(); // EMap |
|
598 } |
|
599 |
|
600 // ------------------------------------------------------------------------------------------------ |
|
601 void CXMLSyncMLGenerator::AppendResultsCmdL( SmlResultsPtr_t aContent ) |
|
602 { |
|
603 BeginElementL(EResults, ETrue); |
|
604 AppendPCDataL(ECmdID, aContent->cmdID); |
|
605 AppendPCDataL(EMsgRef, aContent->msgRef); |
|
606 AppendPCDataL(ECmdRef, aContent->cmdRef); |
|
607 AppendMetaL(aContent->meta); |
|
608 AppendPCDataL(ETargetRef, aContent->targetRef); |
|
609 AppendPCDataL(ETargetRef, aContent->sourceRef); |
|
610 AppendItemListL(aContent->itemList); |
|
611 EndElementL(); // EResults |
|
612 } |
|
613 |
|
614 // ------------------------------------------------------------------------------------------------ |
|
615 void CXMLSyncMLGenerator::AppendStatusCmdL( SmlStatusPtr_t aContent ) |
|
616 { |
|
617 BeginElementL(EStatus, ETrue); |
|
618 AppendPCDataL(ECmdID, aContent->cmdID); |
|
619 AppendPCDataL(EMsgRef, aContent->msgRef); |
|
620 AppendPCDataL(ECmdRef, aContent->cmdRef); |
|
621 AppendPCDataL(ECmd, aContent->cmd); |
|
622 if( aContent->targetRefList ) |
|
623 { |
|
624 AppendTargetRefListL(aContent->targetRefList); |
|
625 } |
|
626 if( aContent->sourceRefList ) |
|
627 { |
|
628 AppendSourceRefListL(aContent->sourceRefList); |
|
629 } |
|
630 AppendCredL(aContent->cred); |
|
631 AppendChalL(aContent->chal); |
|
632 AppendPCDataL(EData, aContent->data); |
|
633 if( aContent->itemList ) |
|
634 { |
|
635 AppendItemListL(aContent->itemList); |
|
636 } |
|
637 EndElementL(); // EStatus |
|
638 } |
|
639 |
|
640 // ------------------------------------------------------------------------------------------------ |
|
641 void CXMLSyncMLGenerator::AppendStartAtomicOrSequenceL( SmlAtomicPtr_t aContent ) |
|
642 { |
|
643 AppendPCDataL(ECmdID, aContent->cmdID); |
|
644 if( aContent->flags & SmlNoResp_f ) |
|
645 { |
|
646 BeginElementL(ENoResp); |
|
647 } |
|
648 AppendMetaL(aContent->meta); |
|
649 } |
|
650 |
|
651 // ------------------------------------------------------------------------------------------------ |
|
652 void CXMLSyncMLGenerator::AppendStartAtomicL( SmlAtomicPtr_t aContent ) |
|
653 { |
|
654 BeginElementL(EAtomic, ETrue); |
|
655 AppendStartAtomicOrSequenceL(aContent); |
|
656 } |
|
657 |
|
658 // ------------------------------------------------------------------------------------------------ |
|
659 void CXMLSyncMLGenerator::AppendEndAtomicL() |
|
660 { |
|
661 EndElementL(); // EAtomic |
|
662 } |
|
663 |
|
664 // ------------------------------------------------------------------------------------------------ |
|
665 void CXMLSyncMLGenerator::AppendStartSequenceL( SmlSequencePtr_t aContent ) |
|
666 { |
|
667 BeginElementL(ESequence, ETrue); |
|
668 AppendStartAtomicOrSequenceL(aContent); |
|
669 } |
|
670 |
|
671 // ------------------------------------------------------------------------------------------------ |
|
672 void CXMLSyncMLGenerator::AppendEndSequenceL() |
|
673 { |
|
674 EndElementL(); // ESequence |
|
675 } |
|
676 |
|
677 //1.2 CHANGES: Filter support |
|
678 // ------------------------------------------------------------------------------------------------ |
|
679 void CXMLSyncMLGenerator::AppendFilterL( SmlFilterPtr_t aContent ) |
|
680 { |
|
681 if( !aContent ) |
|
682 { |
|
683 return; |
|
684 } |
|
685 BeginElementL(EFilter, ETrue); |
|
686 AppendMetaL( aContent->meta ); |
|
687 if( aContent->field ) |
|
688 { |
|
689 BeginElementL(EField, ETrue); |
|
690 AppendItemL( aContent->field->item ); |
|
691 EndElementL(); |
|
692 } |
|
693 if( aContent->record ) |
|
694 { |
|
695 BeginElementL(ERecord, ETrue); |
|
696 AppendItemL( aContent->record->item ); |
|
697 EndElementL(); |
|
698 } |
|
699 AppendPCDataL( EFilterType, aContent->filterType ); |
|
700 EndElementL(); |
|
701 } |
|
702 //Changes end |
|
703 |
|
704 // ------------------------------------------------------------------------------------------------ |
|
705 void CXMLSyncMLGenerator::AppendPCDataL( TUint8 aElement, SmlPcdataPtr_t aContent, TInt aAmount ) |
|
706 { |
|
707 if( !aContent ) |
|
708 { |
|
709 return; |
|
710 } |
|
711 |
|
712 TInt contentLength(aAmount == -1 ? aContent->length : aAmount); |
|
713 |
|
714 if( aContent->extension == SML_EXT_METINF ) |
|
715 { |
|
716 BeginElementL(aElement, ETrue); |
|
717 DoAppendMetaL(SmlMetInfMetInfPtr_t(aContent->content)); |
|
718 EndElementL(); |
|
719 } |
|
720 //1.2 CHANGES: Properties |
|
721 else if( aContent->extension == SML_EXT_DEVINFPROP ) |
|
722 { |
|
723 BeginElementL(aElement, ETrue); |
|
724 SmlDevInfCtCapPtr_t ct = (SmlDevInfCtCapPtr_t) aContent->content; |
|
725 AppendPropertyListL( ct->property ); |
|
726 EndElementL(); |
|
727 } |
|
728 // Changes end |
|
729 else if( aContent->contentType == SML_PCDATA_OPAQUE ) |
|
730 { |
|
731 AddElementL(aElement, TPtrC8((TUint8*)aContent->content, contentLength)); |
|
732 } |
|
733 else |
|
734 { |
|
735 AddElementL(aElement, TPtrC8((TUint8*)aContent->content, contentLength), EXMLContentFormatInlineString); |
|
736 } |
|
737 } |
|
738 |
|
739 // ------------------------------------------------------------------------------------------------ |
|
740 void CXMLSyncMLGenerator::AppendPCDataListL( TUint8 aElement, SmlPcdataListPtr_t aList ) |
|
741 { |
|
742 for( SmlPcdataListPtr_t p = aList; p && p->data; p = p->next ) |
|
743 { |
|
744 AppendPCDataL(aElement, p->data); |
|
745 } |
|
746 } |
|
747 |
|
748 // ------------------------------------------------------------------------------------------------ |
|
749 void CXMLSyncMLGenerator::FreeItemSizeAndMetaIfNeeded( SmlItemPtr_t aItem ) |
|
750 { |
|
751 if( aItem->meta ) |
|
752 { |
|
753 // if size element was created by generator -> delete it |
|
754 if( aItem->generatorFlags & SML_PE_SIZE_CREATED_BY_GENERATOR ) |
|
755 { |
|
756 aItem->generatorFlags &= ~SML_PE_SIZE_CREATED_BY_GENERATOR; |
|
757 delete SmlMetInfMetInfPtr_t(aItem->meta->content)->size; |
|
758 SmlMetInfMetInfPtr_t(aItem->meta->content)->size = 0; |
|
759 } |
|
760 |
|
761 // if meta element was created by generator -> delete it |
|
762 if( aItem->generatorFlags & SML_PE_META_CREATED_BY_GENERATOR ) |
|
763 { |
|
764 aItem->generatorFlags &= ~SML_PE_META_CREATED_BY_GENERATOR; |
|
765 delete aItem->meta; |
|
766 aItem->meta = 0; |
|
767 } |
|
768 } |
|
769 } |
|
770 |
|
771 // ------------------------------------------------------------------------------------------------ |
|
772 void CXMLSyncMLGenerator::AppendItemListL( SmlItemListPtr_t aList ) |
|
773 { |
|
774 iItemWasTruncated = EFalse; |
|
775 |
|
776 for( SmlItemListPtr_t p = aList, iItemIndex = 0; p && p->item; p = p->next, iItemIndex++ ) |
|
777 { |
|
778 Workspace()->BeginTransaction(); |
|
779 |
|
780 TRAPD(err, AppendItemL(p->item)); |
|
781 |
|
782 if( ((Workspace()->FreeSize() < KNSmlXmlBufferSafeTreshold) || (err == KErrTooBig)) && iUseTruncation ) |
|
783 { |
|
784 // Rollback everything that was written into buffer |
|
785 Workspace()->Rollback(); |
|
786 |
|
787 SmlItemPtr_t item(p->item); |
|
788 |
|
789 // if this item does not have MoreData flag on --> put it on and add size to meta |
|
790 if( !(item->generatorFlags & SML_PE_SIZE_SENT) ) |
|
791 { |
|
792 if( !item->meta ) |
|
793 { |
|
794 item->generatorFlags |= SML_PE_META_CREATED_BY_GENERATOR; |
|
795 item->meta = new (ELeave) SmlPcdata_t(/*SML_PCDATA_EXTENSION, SML_EXT_METINF*/); |
|
796 item->meta->contentType = SML_PCDATA_EXTENSION; |
|
797 item->meta->extension = SML_EXT_METINF; |
|
798 item->meta->content = new (ELeave) SmlMetInfMetInf_t(); |
|
799 } |
|
800 |
|
801 if( !SmlMetInfMetInfPtr_t(item->meta->content)->size ) |
|
802 { |
|
803 item->generatorFlags |= SML_PE_SIZE_CREATED_BY_GENERATOR; |
|
804 SmlMetInfMetInfPtr_t(item->meta->content)->size = new (ELeave) SmlPcdata_t(); |
|
805 iBuffer.Num(TInt(item->data->length)); |
|
806 SmlMetInfMetInfPtr_t(item->meta->content)->size->SetDataL(iBuffer); |
|
807 } |
|
808 } |
|
809 |
|
810 Workspace()->BeginTransaction(); |
|
811 TRAPD(err, AppendItemBeginL(item)); |
|
812 FreeItemSizeAndMetaIfNeeded(item); |
|
813 if( (err != KErrNone) || (Workspace()->FreeSize() < 3*KNSmlXmlBufferSafeTreshold) ) |
|
814 { |
|
815 Workspace()->Rollback(); |
|
816 User::Leave(KErrTooBig); |
|
817 } |
|
818 Workspace()->Commit(); |
|
819 |
|
820 item->generatorFlags |= SML_PE_SIZE_SENT; |
|
821 |
|
822 // Set dataconsume length |
|
823 iDataConsumed = Workspace()->FreeSize() - 2*KNSmlXmlBufferSafeTreshold; |
|
824 |
|
825 // Now we most of item data in buffer |
|
826 AppendItemDataL(item, iDataConsumed); |
|
827 |
|
828 // Now we most of item data in buffer |
|
829 AppendItemEndL(ETrue); |
|
830 |
|
831 iItemWasTruncated = ETrue; |
|
832 break; |
|
833 } |
|
834 else if( err != KErrNone ) |
|
835 { |
|
836 // Other error --> remove changes |
|
837 Workspace()->Rollback(); |
|
838 User::Leave(err); |
|
839 } |
|
840 |
|
841 // Item added ok -> commit this item |
|
842 Workspace()->Commit(); |
|
843 } |
|
844 } |
|
845 |
|
846 // ------------------------------------------------------------------------------------------------ |
|
847 void CXMLSyncMLGenerator::AppendItemBeginL( SmlItemPtr_t aContent ) |
|
848 { |
|
849 BeginElementL(EItem, ETrue); |
|
850 AppendTargetL(aContent->target); |
|
851 AppendSourceL(aContent->source); |
|
852 //1.2 Changes: SourceTarget & sourceParent |
|
853 AppendSourceParentL(aContent->sourceParent); |
|
854 AppendTargetParentL(aContent->targetParent); |
|
855 //Changes end |
|
856 AppendMetaL(aContent->meta); |
|
857 } |
|
858 |
|
859 // ------------------------------------------------------------------------------------------------ |
|
860 void CXMLSyncMLGenerator::AppendItemEndL( TBool aMoreData ) |
|
861 { |
|
862 //if( aContent->flags & SmlMoreData_f ) |
|
863 if( aMoreData ) |
|
864 { |
|
865 BeginElementL(EMoreData); |
|
866 } |
|
867 EndElementL(); // EItem |
|
868 } |
|
869 |
|
870 // ------------------------------------------------------------------------------------------------ |
|
871 void CXMLSyncMLGenerator::AppendItemDataL( SmlItemPtr_t aContent, TInt aAmount ) |
|
872 { |
|
873 if( aContent->data && aContent->source && aContent->source->locURI ) |
|
874 { |
|
875 TPtrC8 locURI((TUint8*)aContent->source->locURI->content, aContent->source->locURI->length); |
|
876 // HYBRID 1.2 CHANGE |
|
877 if( locURI.Find(KDevInfGen()) != KErrNotFound ) |
|
878 { |
|
879 CWBXMLParser* parser = CWBXMLParser::NewL(); |
|
880 CleanupStack::PushL(parser); |
|
881 CWBXMLDevInfDocHandler* dh = CWBXMLDevInfDocHandler::NewL(this); |
|
882 CleanupStack::PushL(dh); |
|
883 parser->SetDocumentHandler(dh); |
|
884 parser->SetExtensionHandler(dh); |
|
885 RMemReadStream mrs(aContent->data->content, aContent->data->length); |
|
886 parser->SetDocumentL(mrs); |
|
887 |
|
888 while( parser->ParseL() == KWBXMLParserErrorOk ) |
|
889 ; |
|
890 CleanupStack::PopAndDestroy(2); |
|
891 return; |
|
892 } |
|
893 } |
|
894 AppendPCDataL(EData, aContent->data, aAmount); |
|
895 } |
|
896 |
|
897 // ------------------------------------------------------------------------------------------------ |
|
898 void CXMLSyncMLGenerator::AppendItemL( SmlItemPtr_t aContent ) |
|
899 { |
|
900 AppendItemBeginL(aContent); |
|
901 AppendItemDataL(aContent); |
|
902 AppendItemEndL((aContent->flags & SmlMoreData_f) == SmlMoreData_f); |
|
903 } |
|
904 |
|
905 //1.2 CHANGES: Filter support |
|
906 // ------------------------------------------------------------------------------------------------ |
|
907 void CXMLSyncMLGenerator::AppendItemL( SmlPcdataPtr_t aContent ) |
|
908 { |
|
909 if( !aContent ) |
|
910 { |
|
911 return; |
|
912 } |
|
913 SmlItemPtr_t item = (SmlItemPtr_t)aContent->content; |
|
914 AppendItemL(item); |
|
915 } |
|
916 //Changes end |
|
917 |
|
918 // ------------------------------------------------------------------------------------------------ |
|
919 void CXMLSyncMLGenerator::AppendTargetRefListL( SmlTargetRefListPtr_t aList ) |
|
920 { |
|
921 AppendPCDataListL(ETargetRef, (SmlPcdataListPtr_t)aList); |
|
922 } |
|
923 |
|
924 // ------------------------------------------------------------------------------------------------ |
|
925 void CXMLSyncMLGenerator::AppendSourceRefListL( SmlSourceRefListPtr_t aList ) |
|
926 { |
|
927 AppendPCDataListL(ESourceRef, (SmlPcdataListPtr_t)aList); |
|
928 } |
|
929 |
|
930 // ------------------------------------------------------------------------------------------------ |
|
931 void CXMLSyncMLGenerator::AppendChalL( SmlChalPtr_t aContent ) |
|
932 { |
|
933 if( !aContent ) |
|
934 { |
|
935 return; |
|
936 } |
|
937 BeginElementL(EChal, ETrue); |
|
938 AppendMetaL(aContent->meta); |
|
939 EndElementL(); // EChal |
|
940 } |
|
941 |
|
942 // ------------------------------------------------------------------------------------------------ |
|
943 void CXMLSyncMLGenerator::AppendMapItemListL( SmlMapItemListPtr_t aList ) |
|
944 { |
|
945 for( SmlMapItemListPtr_t p = aList; p && p->mapItem; p = p->next ) |
|
946 { |
|
947 AppendMapItemL(p->mapItem); |
|
948 } |
|
949 } |
|
950 |
|
951 // ------------------------------------------------------------------------------------------------ |
|
952 void CXMLSyncMLGenerator::AppendMapItemL( SmlMapItemPtr_t aContent ) |
|
953 { |
|
954 BeginElementL(EMapItem, ETrue); |
|
955 AppendTargetL(aContent->target); |
|
956 AppendSourceL(aContent->source); |
|
957 EndElementL(); // EMapItem |
|
958 } |
|
959 |
|
960 // ------------------------------------------------------------------------------------------------ |
|
961 void CXMLSyncMLGenerator::AppendMetaL( SmlPcdataPtr_t aContent ) |
|
962 { |
|
963 if( !aContent ) |
|
964 { |
|
965 return; |
|
966 } |
|
967 SmlMetInfMetInfPtr_t meta = (SmlMetInfMetInfPtr_t)aContent->content; |
|
968 AppendMetaL(meta); |
|
969 } |
|
970 |
|
971 // ------------------------------------------------------------------------------------------------ |
|
972 void CXMLSyncMLGenerator::AppendMetaL( SmlMetInfMetInfPtr_t aMeta ) |
|
973 { |
|
974 BeginElementL(EMeta, ETrue); |
|
975 DoAppendMetaL(aMeta); |
|
976 EndElementL(); // EMeta |
|
977 } |
|
978 |
|
979 // ------------------------------------------------------------------------------------------------ |
|
980 void CXMLSyncMLGenerator::DoAppendMetaL( SmlMetInfMetInfPtr_t aMeta ) |
|
981 { |
|
982 SwitchCodePageL(ECodePageMetInf); |
|
983 CXMLGenerator::SetNamespaceNameL(KMetInfNamespace(), CXMLGenerator::EAppendToEveryElement); |
|
984 CXMLGenerator::SetTranslateTableL(KMetInfElements()); |
|
985 |
|
986 // FOTA |
|
987 if ( aMeta ) |
|
988 // FOTA end |
|
989 { |
|
990 AppendPCDataL(EFieldLevel, aMeta->fieldLevel); // 1.2 CHANGES: FieldLevel |
|
991 AppendPCDataL(EMetFormat, aMeta->format); |
|
992 AppendPCDataL(EMetType, aMeta->type); |
|
993 AppendPCDataL(EMetMark, aMeta->mark); |
|
994 AppendPCDataL(EMetSize, aMeta->size); |
|
995 |
|
996 if( aMeta->anchor ) |
|
997 { |
|
998 AppendMetAnchorL(aMeta->anchor); |
|
999 } |
|
1000 |
|
1001 AppendPCDataL(EMetVersion, aMeta->version); |
|
1002 AppendPCDataL(EMetNextNonce, aMeta->nextnonce); |
|
1003 AppendPCDataL(EMetMaxMsgSize, aMeta->maxmsgsize); |
|
1004 AppendPCDataL(EMetMaxObjSize, aMeta->maxobjsize); |
|
1005 |
|
1006 if( aMeta->emi ) |
|
1007 { |
|
1008 AppendPCDataListL(EMetEMI, aMeta->emi); |
|
1009 } |
|
1010 if( aMeta->mem ) |
|
1011 { |
|
1012 AppendMetMemL(aMeta->mem); |
|
1013 } |
|
1014 } |
|
1015 |
|
1016 SwitchCodePageL(ECodePageSyncML); |
|
1017 CXMLGenerator::SetNamespaceNameL(KSyncMLNamespace()); |
|
1018 CXMLGenerator::SetTranslateTableL(KSyncMLElements()); |
|
1019 } |
|
1020 |
|
1021 // ------------------------------------------------------------------------------------------------ |
|
1022 void CXMLSyncMLGenerator::AppendMetMemL( SmlMetInfMemPtr_t aContent ) |
|
1023 { |
|
1024 BeginElementL(EMetMem, ETrue); |
|
1025 AppendPCDataL(EMetSharedMem, aContent->shared); |
|
1026 AppendPCDataL(EMetFreeMem, aContent->free); |
|
1027 AppendPCDataL(EMetFreeID, aContent->freeid); |
|
1028 EndElementL(); // EMetMem |
|
1029 } |
|
1030 |
|
1031 // ------------------------------------------------------------------------------------------------ |
|
1032 void CXMLSyncMLGenerator::AppendMetAnchorL( SmlMetInfAnchorPtr_t aContent ) |
|
1033 { |
|
1034 BeginElementL(EMetAnchor, ETrue); |
|
1035 AppendPCDataL(EMetLast, aContent->last); |
|
1036 AppendPCDataL(EMetNext, aContent->next); |
|
1037 EndElementL(); // EMetAnchor |
|
1038 } |
|
1039 |
|
1040 // 1.2 CHANGES: Properties and params for filter. |
|
1041 void CXMLSyncMLGenerator::AppendPropParamL( SmlDevInfPropParamPtr_t aContent) |
|
1042 { |
|
1043 BeginElementL(EDevPropParam, ETrue); |
|
1044 AppendPCDataL(EDevParamName, aContent->paramname); |
|
1045 AppendPCDataL(EDevDataType, aContent->datatype); |
|
1046 AppendPCDataListL(EDevValEnum, aContent->valenum); |
|
1047 AppendPCDataL(EDevDisplayName, aContent->displayname); |
|
1048 EndElementL(); // EDevPropParam |
|
1049 } |
|
1050 void CXMLSyncMLGenerator::AppendPropParamListL( SmlDevInfPropParamListPtr_t aContent) |
|
1051 { |
|
1052 if (aContent && aContent->data) |
|
1053 { |
|
1054 for( SmlDevInfPropParamListPtr_t p = aContent; p && p->data; p = p->next ) |
|
1055 { |
|
1056 AppendPropParamL(p->data); |
|
1057 } |
|
1058 } |
|
1059 } |
|
1060 void CXMLSyncMLGenerator::AppendPropertyL( SmlDevInfPropertyPtr_t aContent ) |
|
1061 { |
|
1062 BeginElementL(EDevProperty, ETrue); |
|
1063 AppendPCDataL(EDevPropName, aContent->propname); |
|
1064 AppendPCDataL(EDevDataType, aContent->datatype); |
|
1065 AppendPCDataL(EDevMaxOccur, aContent->maxoccur); |
|
1066 AppendPCDataL(EDevMaxSize, aContent->maxsize); |
|
1067 if (aContent->notruncate) |
|
1068 { |
|
1069 BeginElementL(EDevNoTruncate); |
|
1070 } |
|
1071 AppendPCDataListL(EDevValEnum, aContent->valenum); |
|
1072 AppendPCDataL(EDevDisplayName, aContent->displayname); |
|
1073 AppendPropParamListL(aContent->propparam); |
|
1074 EndElementL(); // EDevProperty |
|
1075 } |
|
1076 void CXMLSyncMLGenerator::AppendPropertyListL( SmlDevInfPropertyListPtr_t aContent ) |
|
1077 { |
|
1078 SwitchCodePageL(ECodePageDevInf); |
|
1079 CXMLGenerator::SetTranslateTableL(KDevInfElements()); |
|
1080 for( SmlDevInfPropertyListPtr_t p = aContent; p && p->data; p = p->next ) |
|
1081 { |
|
1082 AppendPropertyL(p->data); |
|
1083 } |
|
1084 SwitchCodePageL(ECodePageSyncML); |
|
1085 CXMLGenerator::SetNamespaceNameL(KSyncMLNamespace()); |
|
1086 CXMLGenerator::SetTranslateTableL(KSyncMLElements()); |
|
1087 } |
|
1088 // Changes end |
|
1089 |
|
1090 //End of File |