connectivitymodules/SeCon/wbxml/conmlhandler/src/sconconmlgenerator.cpp
branchRCL_3
changeset 20 4a793f564d72
parent 0 d0791faffa3f
equal deleted inserted replaced
19:0aa8cc770c8a 20:4a793f564d72
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  ConML parser/generator
       
    15 *
       
    16 */
       
    17 
       
    18 // -----------------------------------------------------------------------------
       
    19 // Includes
       
    20 // -----------------------------------------------------------------------------    
       
    21 #include "sconconmlgenerator.h"
       
    22 #include "sconconmlhandlererror.h"
       
    23 #include "sconconmldtd.h"
       
    24 #include "sconxmlelement.h"
       
    25 #include "debug.h"
       
    26 
       
    27 // -----------------------------------------------------------------------------
       
    28 // CSConConMLGenerator
       
    29 // -----------------------------------------------------------------------------
       
    30 CSConConMLGenerator::CSConConMLGenerator()
       
    31     {
       
    32     }
       
    33     
       
    34 // -----------------------------------------------------------------------------
       
    35 // ~CSConConMLGenerator
       
    36 // -----------------------------------------------------------------------------
       
    37 CSConConMLGenerator::~CSConConMLGenerator()
       
    38     {
       
    39     if (iCmdStack)
       
    40         {
       
    41         iCmdStack->Reset();
       
    42         delete iCmdStack;
       
    43         iCmdStack = NULL;
       
    44         }
       
    45         
       
    46     if ( iWBXMLWorkspace )
       
    47         {
       
    48         delete iWBXMLWorkspace;
       
    49         iWBXMLWorkspace = NULL;
       
    50         }
       
    51         
       
    52     if ( iXMLWorkspace )
       
    53         {
       
    54         delete iXMLWorkspace;
       
    55         iXMLWorkspace = NULL;
       
    56         }
       
    57         
       
    58     if (iCleanupStack)
       
    59         {
       
    60         iCleanupStack->ResetAndDestroy();
       
    61         delete iCleanupStack;
       
    62         iCleanupStack = NULL;
       
    63         }
       
    64 
       
    65     iElemStack.Close();
       
    66     }
       
    67     
       
    68 // -----------------------------------------------------------------------------
       
    69 // NewL
       
    70 // -----------------------------------------------------------------------------
       
    71 CSConConMLGenerator* CSConConMLGenerator::NewL ()
       
    72     {
       
    73     LOGGER_ENTERFN( "CSConConMLGenerator::NewL()" );
       
    74     CSConConMLGenerator* self = new ( ELeave ) CSConConMLGenerator();
       
    75     CleanupStack::PushL(self);
       
    76     self->ConstructL();
       
    77     CleanupStack::Pop(); // self
       
    78     LOGGER_LEAVEFN( "CSConConMLGenerator::NewL()" );
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // ConstructL
       
    84 // -----------------------------------------------------------------------------
       
    85 void CSConConMLGenerator::ConstructL()
       
    86     {
       
    87     LOGGER_ENTERFN( "CSConConMLGenerator::ConstructL()" );
       
    88     iCmdStack = CXMLStack<CXMLElement>::NewL();
       
    89     iCleanupStack = CXMLStack<CXMLElement>::NewL();
       
    90     iWBXMLWorkspace = CXMLWorkspace::NewL();
       
    91     iXMLWorkspace = CXMLWorkspace::NewL();
       
    92     LOGGER_LEAVEFN( "CSConConMLGenerator::ConstructL()" );
       
    93     }
       
    94     
       
    95 // -----------------------------------------------------------------------------
       
    96 // SetCallbacks
       
    97 // -----------------------------------------------------------------------------
       
    98 void CSConConMLGenerator::SetCallback ( MWBXMLConMLCallback* aCallback )
       
    99     {
       
   100     LOGGER_ENTERFN( "CSConConMLGenerator::SetCallbacks()" );
       
   101     iCallback = aCallback;
       
   102     LOGGER_LEAVEFN( "CSConConMLGenerator::SetCallbacks()" );
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // StartDocument
       
   107 // -----------------------------------------------------------------------------    
       
   108 void CSConConMLGenerator::StartDocument( 
       
   109     TUint8 /*aVersion*/, TInt32 /*aPublicId*/, TUint32 /*aCharset*/ )
       
   110     {
       
   111     LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" );
       
   112     iCmdStack->Reset();
       
   113     LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" );
       
   114     }
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // StartDocument
       
   118 // -----------------------------------------------------------------------------
       
   119 void CSConConMLGenerator::StartDocument( 
       
   120     TUint8 /*aVersion*/, const TDesC8& /*aPublicIdStr*/, TUint32 /*aCharset*/ )
       
   121     {
       
   122     LOGGER_ENTERFN( "CSConConMLGenerator::StartDocumentL()" );
       
   123     iCmdStack->Reset();
       
   124     LOGGER_LEAVEFN( "CSConConMLGenerator::StartDocumentL()" );
       
   125     }
       
   126     
       
   127 // -----------------------------------------------------------------------------
       
   128 // StartElementL
       
   129 // -----------------------------------------------------------------------------
       
   130 void CSConConMLGenerator::StartElementL( TWBXMLTag aTag )
       
   131     {
       
   132     LOGGER_ENTERFN( "CSConConMLGenerator::StartElementL()" );
       
   133     if( iCmdStack->Top() != 0 )
       
   134         {
       
   135         AddElement(iCmdStack->Top()->BeginElementL( 
       
   136             aTag, TXMLElementParams(iCallback, iCmdStack, iCleanupStack ) ) );
       
   137         }
       
   138     else
       
   139         {
       
   140         if( aTag == EConML )
       
   141             {
       
   142             AddElement(new (ELeave) ConML_ConML_t());
       
   143             }
       
   144         else
       
   145             {
       
   146             LOGGER_WRITE( "CSConConMLGenerator::StartElementL() : Leave KWBXMLParserErrorInvalidTag" );
       
   147             User::Leave(KWBXMLParserErrorInvalidTag);
       
   148             }
       
   149         }
       
   150     LOGGER_LEAVEFN( "CSConConMLGenerator::StartElementL()" );
       
   151     }
       
   152     
       
   153 // -----------------------------------------------------------------------------
       
   154 // AddElement
       
   155 // -----------------------------------------------------------------------------
       
   156 void CSConConMLGenerator::AddElement( CXMLElement* aElement )
       
   157     {
       
   158     LOGGER_ENTERFN( "CSConConMLGenerator::AddElement()" );
       
   159     if( aElement )
       
   160         {
       
   161         iCmdStack->Push(aElement);
       
   162         if( aElement->NeedsCleanup() )
       
   163             {
       
   164             iCleanupStack->Push(aElement);
       
   165             }
       
   166         }
       
   167     LOGGER_LEAVEFN( "CSConConMLGenerator::AddElement()" );
       
   168     }
       
   169 
       
   170 // -----------------------------------------------------------------------------
       
   171 // CharactersL
       
   172 // -----------------------------------------------------------------------------
       
   173 void CSConConMLGenerator::CharactersL( const TDesC8& aBuffer )
       
   174     {
       
   175     LOGGER_ENTERFN( "CSConConMLGenerator::CharactersL()" );
       
   176     if( iCmdStack->Top() != 0 )
       
   177         {
       
   178         iCmdStack->Top()->SetDataL(aBuffer);
       
   179         }
       
   180     else
       
   181         {
       
   182         LOGGER_WRITE( "CSConConMLGenerator::CharactersL() : Leave KWBXMLParserErrorInvalidTag" );
       
   183         User::Leave(KWBXMLParserErrorInvalidTag);
       
   184         }
       
   185     LOGGER_LEAVEFN( "CSConConMLGenerator::CharactersL()" );
       
   186     }
       
   187     
       
   188 // -----------------------------------------------------------------------------
       
   189 // EndElementL
       
   190 // -----------------------------------------------------------------------------
       
   191 void CSConConMLGenerator::EndElementL( TWBXMLTag aTag )
       
   192     {
       
   193     LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" );
       
   194     if( iCmdStack->Top() != 0 )
       
   195         {
       
   196         CXMLElement::TAction action = iCmdStack->Top()->EndElementL( 
       
   197             iCallback, aTag );
       
   198         if( action != CXMLElement::ENone )
       
   199             {
       
   200             CXMLElement* elem = iCmdStack->Pop();
       
   201             if( iCleanupStack->Top() == elem )
       
   202                 {
       
   203                 iCleanupStack->Pop();
       
   204                 }
       
   205             if( action == CXMLElement::EPopAndDestroy )
       
   206                 {
       
   207                 delete elem;
       
   208                 }
       
   209             }
       
   210         }
       
   211     LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" );
       
   212     }
       
   213     
       
   214 // -----------------------------------------------------------------------------
       
   215 // WriteMUint32L
       
   216 // -----------------------------------------------------------------------------
       
   217 void CSConConMLGenerator::WriteMUint32L( TUint32 aValue )
       
   218     {
       
   219     LOGGER_ENTERFN( "CSConConMLGenerator::WriteMUint32L()" );
       
   220     TUint8 temp[5];
       
   221     TInt i(4);
       
   222     
       
   223     temp[i--] = TUint8(aValue & 0x7F);
       
   224     aValue >>= 7;
       
   225     while( aValue > 0 )
       
   226         {
       
   227         temp[i--] = TUint8((aValue & 0x7F) | 0x80);
       
   228         aValue >>= 7;
       
   229         }
       
   230             
       
   231     while( i < 4 )
       
   232         {
       
   233         iWBXMLWorkspace->WriteL(temp[++i]);
       
   234         }
       
   235     LOGGER_LEAVEFN( "CSConConMLGenerator::WriteMUint32L()" );
       
   236     }
       
   237 
       
   238 // -----------------------------------------------------------------------------
       
   239 // WriteOpaqueDataL
       
   240 // -----------------------------------------------------------------------------
       
   241 void CSConConMLGenerator::WriteOpaqueDataL( const TDesC8& aData )
       
   242     {
       
   243     LOGGER_ENTERFN( "CSConConMLGenerator::WriteOpaqueDataL()" );
       
   244     iWBXMLWorkspace->WriteL( OPAQUE );
       
   245     WriteMUint32L( aData.Size() );
       
   246     iWBXMLWorkspace->WriteL( aData );
       
   247     iXMLWorkspace->WriteL( aData );
       
   248     LOGGER_LEAVEFN( "CSConConMLGenerator::WriteOpaqueDataL()" );
       
   249     }
       
   250     
       
   251 // -----------------------------------------------------------------------------
       
   252 // WriteInlineStringL
       
   253 // -----------------------------------------------------------------------------
       
   254 void CSConConMLGenerator::WriteInlineStringL( const TDesC8& aData )
       
   255     {
       
   256     LOGGER_ENTERFN( "CSConConMLGenerator::WriteInlineStringL()" );
       
   257     iWBXMLWorkspace->WriteL( STR_I );
       
   258     iWBXMLWorkspace->WriteL( aData );
       
   259     iWBXMLWorkspace->WriteL( 0 );
       
   260     iXMLWorkspace->WriteL( aData );
       
   261     LOGGER_LEAVEFN( "CSConConMLGenerator::WriteInlineStringL()" );
       
   262     }
       
   263     
       
   264 // -----------------------------------------------------------------------------
       
   265 // IndentL
       
   266 // -----------------------------------------------------------------------------
       
   267 void CSConConMLGenerator::IndentL()
       
   268     {
       
   269     LOGGER_ENTERFN( "CSConConMLGenerator::IndentL()" );
       
   270     for( TInt i = 0; i < iElemStack.Count() + iInitialIndentLevel; i++ )
       
   271         {
       
   272         iXMLWorkspace->WriteL(KXMLIndent());
       
   273         }
       
   274     LOGGER_LEAVEFN( "CSConConMLGenerator::IndentL()" );
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // TranslateElement
       
   279 // -----------------------------------------------------------------------------    
       
   280 TPtrC8 CSConConMLGenerator::TranslateElement( TUint8 aElement )
       
   281     {
       
   282     LOGGER_ENTERFN( "CSConConMLGenerator::TranslateElement()" );
       
   283     TPtrC8 buf( KConMLElements );
       
   284     while( aElement-- )
       
   285         {
       
   286         TInt pos = buf.Find(KXMLElemenentSeparator());
       
   287         if( pos == KErrNotFound )
       
   288             {
       
   289             return TPtrC8();
       
   290             }
       
   291         buf.Set(buf.Right(buf.Length() - pos - 1));
       
   292         }
       
   293 
       
   294     TInt pos = buf.Find(KXMLElemenentSeparator());
       
   295     
       
   296     if( pos != KErrNotFound )
       
   297         {
       
   298         buf.Set(buf.Left(pos));
       
   299         }
       
   300     LOGGER_LEAVEFN( "CSConConMLGenerator::TranslateElement()" );
       
   301     return buf;
       
   302     }
       
   303     
       
   304 // -----------------------------------------------------------------------------
       
   305 // EndDocument
       
   306 // -----------------------------------------------------------------------------
       
   307 void CSConConMLGenerator::EndDocument()
       
   308     {
       
   309     LOGGER_ENTERFN( "CSConConMLGenerator::EndDocument()" );
       
   310     LOGGER_LEAVEFN( "CSConConMLGenerator::EndDocument()" );
       
   311     }
       
   312 
       
   313     
       
   314 // -----------------------------------------------------------------------------
       
   315 // GenerateConMLDocument
       
   316 // -----------------------------------------------------------------------------
       
   317 TInt CSConConMLGenerator::GenerateConMLDocument ( ConML_ConMLPtr_t aContent )
       
   318     {
       
   319     LOGGER_ENTERFN( "CSConConMLGenerator::GenerateConMLDocument()" );
       
   320     iWBXMLWorkspace->Reset();
       
   321     iWBXMLWorkspace->BeginTransaction();
       
   322     iXMLWorkspace->Reset();
       
   323     iXMLWorkspace->BeginTransaction();
       
   324     TRAPD(result, AppendConMLL(aContent));
       
   325     LOGGER_WRITE_1( "CSConConMLGenerator::GenerateConMLDocument()\
       
   326      : returned %d", result );
       
   327     return HandleResult(result);
       
   328     }
       
   329     
       
   330 // -----------------------------------------------------------------------------
       
   331 // AppendConMLL
       
   332 // -----------------------------------------------------------------------------
       
   333 void CSConConMLGenerator::AppendConMLL( ConML_ConMLPtr_t aContent )
       
   334     {
       
   335     LOGGER_ENTERFN( "CSConConMLGenerator::AppendConMLL()" );
       
   336     BeginDocumentL(KSConConMLVersion, KSConConMLPublicId, KSConConMLUTF8);
       
   337     BeginElementL(EConML, ETrue);
       
   338     AppendExecuteL( aContent->execute );
       
   339     AppendGetStatusL( aContent->getStatus );
       
   340     AppendCancelL( aContent->cancel );
       
   341     AppendStatusL( aContent->status );
       
   342     EndElementL(); // EConML
       
   343     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendConMLL()" );
       
   344     }
       
   345 
       
   346 // -----------------------------------------------------------------------------
       
   347 // AppendExecuteL
       
   348 // -----------------------------------------------------------------------------
       
   349 void CSConConMLGenerator::AppendExecuteL( ConML_ExecutePtr_t aContent )
       
   350     {
       
   351     LOGGER_ENTERFN( "CSConConMLGenerator::AppendExecuteL()" );
       
   352     if ( aContent )
       
   353         {
       
   354         BeginElementL( EConMLExecute, ETrue );
       
   355         AppendPCDataL( EConMLID, aContent->id );
       
   356         AppendInstallL( aContent->install );
       
   357         AppendUnInstallL( aContent->unInstall );
       
   358         AppendListInstalledAppsL( aContent->listInstalledApps );
       
   359         AppendListDataOwnersL( aContent->listDataOwners );
       
   360         AppendSetBURModeL( aContent->setBurMode );
       
   361         AppendGetDataSizeL( aContent->getDataSize );
       
   362         AppendRequestDataL( aContent->requestData );
       
   363         AppendUpdateDeviceInfoL( aContent->updateDeviceInfo );
       
   364         AppendListPublicFilesL( aContent->listPublicFiles );
       
   365         AppendSupplyDataL( aContent->supplyData );
       
   366         AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus );
       
   367         AppendGetMetadataL( aContent->getMetadata );
       
   368         
       
   369         if ( aContent->reboot )
       
   370             {
       
   371             BeginElementL( EConMLReboot );
       
   372             }
       
   373         EndElementL(); // EConMLExecute
       
   374         }
       
   375     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendExecuteL()" );
       
   376     }
       
   377 
       
   378 // -----------------------------------------------------------------------------
       
   379 // AppendSupplyDataL
       
   380 // -----------------------------------------------------------------------------
       
   381 void CSConConMLGenerator::AppendSupplyDataL( ConML_SupplyDataPtr_t aContent )
       
   382     {
       
   383     LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupplyDataL()" );
       
   384     if ( aContent )
       
   385         {
       
   386         BeginElementL( EConMLSupplyData, ETrue );
       
   387         AppendSIDListL( aContent->sid );
       
   388         AppendResultsL( aContent->results );
       
   389         EndElementL(); // EConMLSupplyData
       
   390         }
       
   391     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupplyDataL()" );
       
   392     }
       
   393 // -----------------------------------------------------------------------------
       
   394 // AppendInstallL
       
   395 // -----------------------------------------------------------------------------
       
   396 void CSConConMLGenerator::AppendInstallL( ConML_InstallPtr_t aContent )
       
   397     {
       
   398     LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstallL()" );
       
   399     if ( aContent)
       
   400         {
       
   401         BeginElementL( EConMLInstall, ETrue );
       
   402         AppendPCDataL( EConMLName, aContent->name );
       
   403         if ( aContent->instParams) 
       
   404             {
       
   405             if ( aContent->instParams->param )
       
   406                 {
       
   407                 AppendInstParamsL( aContent->instParams );  
       
   408                 }
       
   409             else 
       
   410                 {
       
   411                 BeginElementL( EConMLInstParams );
       
   412                 }
       
   413             }
       
   414         AppendResultsL( aContent->results );
       
   415         EndElementL(); // EConMLInstall
       
   416         }
       
   417     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstallL()" );
       
   418     }
       
   419 
       
   420 // -----------------------------------------------------------------------------
       
   421 // AppendCancelL
       
   422 // -----------------------------------------------------------------------------    
       
   423 void CSConConMLGenerator::AppendCancelL ( ConML_CancelPtr_t aContent )
       
   424     {
       
   425     LOGGER_ENTERFN( "CSConConMLGenerator::AppendCancelL()" );
       
   426     if ( aContent )
       
   427         {
       
   428         BeginElementL( EConMLCancel, ETrue );
       
   429         AppendPCDataL ( EConMLID, aContent->id );
       
   430         AppendPCDataL( EConMLAll, aContent->all);
       
   431         EndElementL(); // EConMLCancel
       
   432         }
       
   433     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendCancelL()" );
       
   434     }
       
   435 
       
   436 // -----------------------------------------------------------------------------
       
   437 // AppendStatusL
       
   438 // -----------------------------------------------------------------------------
       
   439 void CSConConMLGenerator::AppendStatusL ( ConML_StatusPtr_t aContent )
       
   440     {
       
   441     LOGGER_ENTERFN( "CSConConMLGenerator::AppendStatusL()" );
       
   442     if ( aContent )
       
   443         {
       
   444         if ( aContent->task )
       
   445             {
       
   446             BeginElementL( EConMLStatus, ETrue );
       
   447             AppendTaskListL( aContent->task );
       
   448             EndElementL(); // EConMLStatus
       
   449             }
       
   450         else
       
   451             {
       
   452             BeginElementL( EConMLStatus );  
       
   453             }
       
   454         }
       
   455     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendStatusL()" );
       
   456     }
       
   457     
       
   458 // -----------------------------------------------------------------------------
       
   459 // AppendGetStatusL
       
   460 // -----------------------------------------------------------------------------
       
   461 void CSConConMLGenerator::AppendGetStatusL( ConML_GetStatusPtr_t aContent )
       
   462     {
       
   463     LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" );
       
   464     if ( aContent )
       
   465         {
       
   466         BeginElementL( EConMLGetStatus, ETrue );
       
   467         AppendPCDataL( EConMLID, aContent->id);
       
   468         if ( aContent->all )
       
   469             {
       
   470             BeginElementL( EConMLAll );
       
   471             }
       
   472         EndElementL(); // EConMLGetStatus
       
   473         }
       
   474     LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetStatusL()" );
       
   475     }
       
   476 
       
   477 // -----------------------------------------------------------------------------
       
   478 // AppendRebootL
       
   479 // -----------------------------------------------------------------------------
       
   480 void CSConConMLGenerator::AppendRebootL( ConML_RebootPtr_t aContent )
       
   481     {
       
   482     if ( aContent )
       
   483         {
       
   484         BeginElementL( EConMLReboot, ETrue );
       
   485         AppendResultsL( aContent->results );
       
   486         EndElementL(); // EConMLReboot
       
   487         }
       
   488     }
       
   489     
       
   490 // -----------------------------------------------------------------------------
       
   491 // AppendTaskL
       
   492 // -----------------------------------------------------------------------------
       
   493 void CSConConMLGenerator::AppendTaskL( ConML_TaskPtr_t aContent )
       
   494     {
       
   495     LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskL()" );
       
   496     if ( aContent )
       
   497         {
       
   498         BeginElementL( EConMLTask, ETrue );
       
   499         AppendPCDataL( EConMLID, aContent->id );
       
   500         AppendInstallL(aContent->install );
       
   501         AppendUnInstallL( aContent->unInstall );
       
   502         AppendListInstalledAppsL ( aContent->listInstalledApps );
       
   503         AppendListDataOwnersL ( aContent->listDataOwners );
       
   504         AppendSetBURModeL ( aContent->setBurMode );
       
   505         AppendGetDataSizeL ( aContent->getDataSize );
       
   506         AppendRequestDataL ( aContent->requestData );
       
   507         AppendUpdateDeviceInfoL ( aContent->updateDeviceInfo);
       
   508         AppendListPublicFilesL ( aContent->listPublicFiles );
       
   509         AppendGetDataOwnerStatusL( aContent->getDataOwnerStatus );
       
   510         AppendSupplyDataL( aContent->supplyData );
       
   511         AppendRebootL( aContent->reboot );
       
   512         AppendGetMetadataL( aContent->getMetadata );
       
   513         EndElementL();
       
   514         }
       
   515     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskL()" );
       
   516     }
       
   517     
       
   518 // -----------------------------------------------------------------------------
       
   519 // AppendTaskListL
       
   520 // -----------------------------------------------------------------------------
       
   521 void CSConConMLGenerator::AppendTaskListL( ConML_TaskListPtr_t aContent )
       
   522     {
       
   523     LOGGER_ENTERFN( "CSConConMLGenerator::AppendTaskListL()" );
       
   524     for ( ConML_TaskListPtr_t p = aContent; p && p->data; p=p->next )
       
   525         {
       
   526         AppendTaskL( p->data );
       
   527         }
       
   528     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendTaskListL()" );
       
   529     }
       
   530     
       
   531 // -----------------------------------------------------------------------------
       
   532 // AppendListInstalledAppsL
       
   533 // -----------------------------------------------------------------------------
       
   534 void CSConConMLGenerator::AppendListInstalledAppsL ( 
       
   535     ConML_ListInstalledAppsPtr_t aContent )
       
   536     {
       
   537     LOGGER_ENTERFN( "CSConConMLGenerator::AppendListInstalledAppsL()" );
       
   538     if ( aContent )
       
   539         {
       
   540         BeginElementL( EConMLListInstalledApps, ETrue );
       
   541         AppendDrivesL( aContent->drives );
       
   542         if ( aContent ->all )
       
   543             {
       
   544             BeginElementL( EConMLAll );
       
   545             }
       
   546         AppendResultsL( aContent->results );
       
   547         EndElementL(); // EConMLListInstalledApps
       
   548         }
       
   549     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListInstalledAppsL()" );
       
   550     }
       
   551 
       
   552 // -----------------------------------------------------------------------------
       
   553 // AppendListDataOwnersL
       
   554 // -----------------------------------------------------------------------------
       
   555 void CSConConMLGenerator::AppendListDataOwnersL ( 
       
   556     ConML_ListDataOwnersPtr_t aContent )
       
   557     {
       
   558     LOGGER_ENTERFN( "CSConConMLGenerator::AppendListDataOwnersL()" );
       
   559     if ( aContent )
       
   560         {
       
   561         if ( aContent->results )
       
   562             {
       
   563             BeginElementL( EConMLListDataOwners, ETrue );
       
   564             AppendResultsL( aContent->results );
       
   565             EndElementL(); // EConMLListDataOwners
       
   566             }
       
   567         else
       
   568             {
       
   569             BeginElementL( EConMLListDataOwners );          
       
   570             }
       
   571         }
       
   572     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListDataOwnersL()" );
       
   573     }
       
   574 
       
   575 // -----------------------------------------------------------------------------
       
   576 // CSConConMLGanerator::AppendBUROptionsL
       
   577 // -----------------------------------------------------------------------------
       
   578 void CSConConMLGenerator::AppendBUROptionsL( ConML_BUROptionsPtr_t aContent )
       
   579     {
       
   580     LOGGER_ENTERFN( "CSConConMLGenerator::AppendBUROptionsL()" );
       
   581     if ( aContent )
       
   582         {
       
   583         BeginElementL( EConMLBUROptions, ETrue );
       
   584         if ( aContent->requiresReboot )
       
   585             {
       
   586             BeginElementL( EConMLRequiresReboot );
       
   587             }
       
   588         if ( aContent->hasFiles )
       
   589             {
       
   590             AppendPCDataL( EConMLHasFiles, aContent->hasFiles );
       
   591             }
       
   592         if ( aContent->supportsInc )
       
   593             {
       
   594             BeginElementL( EConMLSupportsInc );
       
   595             }
       
   596         if ( aContent->delayToPrepareData )
       
   597             {
       
   598             BeginElementL( EConMLDelayToPrepareData );
       
   599             }
       
   600         EndElementL(); // EConMLBUROptions
       
   601         }
       
   602     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendBUROptionsL()" );
       
   603     }
       
   604 
       
   605 // -----------------------------------------------------------------------------
       
   606 // AppendSetBURModeL
       
   607 // -----------------------------------------------------------------------------
       
   608 void CSConConMLGenerator::AppendSetBURModeL( ConML_SetBURModePtr_t aContent )
       
   609     {
       
   610     LOGGER_ENTERFN( "CSConConMLGenerator::AppendSetBURModeL()" );
       
   611     if ( aContent )
       
   612         {
       
   613         BeginElementL( EConMLSetBURMode, ETrue );
       
   614         AppendDrivesL( aContent->drives );
       
   615         AppendPCDataL( EConMLPartialType, aContent->partialType );
       
   616         AppendPCDataL( EConMLIncType, aContent->incType );
       
   617         AppendResultsL( aContent->results );
       
   618         EndElementL(); //EConMLSetBURMode
       
   619         }
       
   620     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSetBURModeL()" );
       
   621     }
       
   622     
       
   623 // -----------------------------------------------------------------------------
       
   624 // AppendUnInstallL
       
   625 // -----------------------------------------------------------------------------
       
   626 void CSConConMLGenerator::AppendUnInstallL( ConML_UnInstallPtr_t aContent )
       
   627     {
       
   628     LOGGER_ENTERFN( "CSConConMLGenerator::AppendUnInstallL()" );
       
   629     if ( aContent )
       
   630         {
       
   631         BeginElementL( EConMLUnInstall, ETrue );
       
   632         AppendApplicationsL( aContent->applications );
       
   633         AppendInstParamsL( aContent->instParams );
       
   634         AppendResultsL( aContent->results );
       
   635         EndElementL(); // EConMLUnInstall
       
   636         }
       
   637     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUnInstallL()" );
       
   638     }
       
   639 
       
   640 // -----------------------------------------------------------------------------
       
   641 // AppendGetDataSizeL
       
   642 // -----------------------------------------------------------------------------
       
   643 void CSConConMLGenerator::AppendGetDataSizeL( ConML_GetDataSizePtr_t aContent )
       
   644     {
       
   645     LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetDataSizeL()" );
       
   646     if ( aContent )
       
   647         {
       
   648         BeginElementL( EConMLGetDataSize, ETrue );
       
   649         AppendDataOwnersL( aContent->dataOwners );
       
   650         AppendResultsL( aContent->results );
       
   651         EndElementL(); //EConMLGetDataSize
       
   652         }
       
   653     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendGetDataSizeL()" );
       
   654     }
       
   655 
       
   656 // -----------------------------------------------------------------------------
       
   657 // AppendRequestDataL
       
   658 // -----------------------------------------------------------------------------
       
   659 void CSConConMLGenerator::AppendRequestDataL( ConML_RequestDataPtr_t aContent )
       
   660     {
       
   661     LOGGER_ENTERFN( "CSConConMLGenerator::AppendRequestDataL()" );
       
   662     if ( aContent )
       
   663         {
       
   664         BeginElementL( EConMLRequestData, ETrue );
       
   665         AppendSIDListL( aContent->sid );
       
   666         AppendResultsL( aContent->results );
       
   667         EndElementL();//EConMLRequestData
       
   668         }
       
   669     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendRequestDataL()" );
       
   670     }
       
   671 
       
   672 // -----------------------------------------------------------------------------
       
   673 // AppendUpdateDeviceInfoL
       
   674 // -----------------------------------------------------------------------------
       
   675 void CSConConMLGenerator::AppendUpdateDeviceInfoL( 
       
   676     ConML_UpdateDeviceInfoPtr_t aContent )
       
   677     {
       
   678     LOGGER_ENTERFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" );
       
   679     if ( aContent )
       
   680         {
       
   681         BeginElementL(EConMLUpdateDeviceInfo, ETrue);
       
   682         AppendDeviceInfoL( aContent-> deviceInfo );
       
   683         AppendResultsL( aContent->results );
       
   684         EndElementL();// EConMLUpdateDeviceInfo
       
   685         }
       
   686     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendUpdateDeviceInfoL()" );
       
   687     }
       
   688 
       
   689 // -----------------------------------------------------------------------------
       
   690 // AppendListPublicFilesL
       
   691 // -----------------------------------------------------------------------------
       
   692 void CSConConMLGenerator::AppendListPublicFilesL( 
       
   693     ConML_ListPublicFilesPtr_t aContent )
       
   694     {
       
   695     LOGGER_ENTERFN( "CSConConMLGenerator::AppendListPublicFilesL()" );
       
   696     if ( aContent )
       
   697         {
       
   698         BeginElementL( EConMLListPublicFiles, ETrue );
       
   699         AppendSIDListL ( aContent->sid );
       
   700         AppendResultsL( aContent->results );
       
   701         EndElementL(); // EConMLListPublicFiles
       
   702         }
       
   703     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendListPublicFilesL()" );
       
   704     }
       
   705 
       
   706 // -----------------------------------------------------------------------------
       
   707 // AppendApplicationL
       
   708 // -----------------------------------------------------------------------------
       
   709 void CSConConMLGenerator::AppendApplicationL( ConML_ApplicationPtr_t aContent )
       
   710     {
       
   711     LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationL()" );
       
   712     if ( aContent )
       
   713         {
       
   714         BeginElementL(EConMLApplication, ETrue );
       
   715         AppendPCDataL( EConMLName, aContent->name );
       
   716         AppendPCDataL( EConMLUID, aContent->uid );
       
   717         EndElementL(); //EConMLApplication
       
   718         }
       
   719     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationL()" );
       
   720     }
       
   721 
       
   722 // -----------------------------------------------------------------------------
       
   723 // AppendApplicationListL
       
   724 // -----------------------------------------------------------------------------
       
   725 void CSConConMLGenerator::AppendApplicationListL( 
       
   726     ConML_ApplicationListPtr_t aContent )
       
   727     {
       
   728     LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationListL()" );
       
   729     for ( ConML_ApplicationListPtr_t p = aContent; p && p->data; p = p->next )
       
   730         {
       
   731         AppendApplicationL( p->data );
       
   732         }
       
   733     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationListL()" );
       
   734     }
       
   735 
       
   736 // -----------------------------------------------------------------------------
       
   737 // AppendApplicationsL
       
   738 // -----------------------------------------------------------------------------
       
   739 void CSConConMLGenerator::AppendApplicationsL( 
       
   740     ConML_ApplicationsPtr_t aContent )
       
   741     {
       
   742     LOGGER_ENTERFN( "CSConConMLGenerator::AppendApplicationsL()" );
       
   743     if ( aContent )
       
   744         {
       
   745         BeginElementL( EConMLApplications, ETrue );
       
   746         AppendApplicationListL( aContent->application );
       
   747         EndElementL(); // EConMLApplications
       
   748         }
       
   749     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendApplicationsL()" );
       
   750     }
       
   751 
       
   752 // -----------------------------------------------------------------------------
       
   753 // AppendParamL
       
   754 // -----------------------------------------------------------------------------
       
   755 void CSConConMLGenerator::AppendParamL( ConML_ParamPtr_t aContent )
       
   756     {
       
   757     LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamL()" );
       
   758     if ( aContent )
       
   759         {
       
   760         BeginElementL( EConMLParam, ETrue );
       
   761         AppendPCDataL( EConMLName, aContent->name );
       
   762         AppendPCDataL( EConMLValue, aContent->value );
       
   763         EndElementL(); // EConMLParam
       
   764         }
       
   765     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamL()" );
       
   766     }
       
   767 
       
   768 // -----------------------------------------------------------------------------
       
   769 // AppendParamListL
       
   770 // -----------------------------------------------------------------------------
       
   771 void CSConConMLGenerator::AppendParamListL( ConML_ParamListPtr_t aContent )
       
   772     {
       
   773     LOGGER_ENTERFN( "CSConConMLGenerator::AppendParamListL()" );
       
   774     for ( ConML_ParamListPtr_t p = aContent; p && p->data; p = p->next )
       
   775         {
       
   776         AppendParamL( p-> data );
       
   777         }
       
   778     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendParamListL()" );
       
   779     }
       
   780 
       
   781 // -----------------------------------------------------------------------------
       
   782 // AppendInstParamsL
       
   783 // -----------------------------------------------------------------------------
       
   784 void CSConConMLGenerator::AppendInstParamsL( ConML_InstParamsPtr_t aContent )
       
   785     {
       
   786     LOGGER_ENTERFN( "CSConConMLGenerator::AppendInstParamsLionsL()" );
       
   787     if ( aContent )
       
   788         {
       
   789         BeginElementL( EConMLInstParams, ETrue );
       
   790         AppendParamListL( aContent->param );
       
   791         EndElementL(); //EConMLInstParams
       
   792         }
       
   793     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendInstParamsL()" );
       
   794     }
       
   795 
       
   796 // -----------------------------------------------------------------------------
       
   797 // AppendProgressL
       
   798 // -----------------------------------------------------------------------------
       
   799 void CSConConMLGenerator::AppendProgressL( ConML_ProgressPtr_t aContent )
       
   800     {
       
   801     LOGGER_ENTERFN( "CSConConMLGenerator::AppendProgressL()" );
       
   802     if ( aContent )
       
   803         {
       
   804         BeginElementL( EConMLProgress, ETrue );
       
   805         AppendPCDataL( EConMLValue, aContent->value );
       
   806         EndElementL(); // EconMLProgress
       
   807         }
       
   808     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendProgressL()" );
       
   809     }
       
   810     
       
   811 // -----------------------------------------------------------------------------
       
   812 // AppendResultsL
       
   813 // -----------------------------------------------------------------------------
       
   814 void CSConConMLGenerator::AppendResultsL( ConML_ResultsPtr_t aContent )
       
   815     {
       
   816     LOGGER_ENTERFN( "CSConConMLGenerator::AppendResultsL()" );
       
   817     if ( aContent )
       
   818         {
       
   819         BeginElementL( EConMLResults, ETrue );
       
   820         if ( aContent->complete )
       
   821             {
       
   822             BeginElementL( EConMLComplete );
       
   823             }
       
   824         AppendProgressL( aContent->progress );
       
   825         AppendApplicationsL( aContent->applications );
       
   826         AppendDataOwnersL( aContent->dataOwners );
       
   827         if ( aContent->filename )
       
   828             {
       
   829             AppendPCDataL( EConMLFilename, aContent->filename );
       
   830             }
       
   831         AppendPCDataL( EConMLData, aContent->data );
       
   832         if ( aContent->moreData )
       
   833             {
       
   834             BeginElementL( EConMLMoreData );
       
   835             }
       
   836         AppendDeviceInfoL( aContent->deviceInfo );
       
   837         AppendFilesL( aContent->files );
       
   838         EndElementL(); //EConMLResults
       
   839         }
       
   840     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendResultsL()" );
       
   841     }
       
   842 
       
   843 // -----------------------------------------------------------------------------
       
   844 // AppendDriveL
       
   845 // -----------------------------------------------------------------------------
       
   846 void CSConConMLGenerator::AppendDriveL( ConML_DrivePtr_t aContent )
       
   847     {
       
   848     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveL()" );
       
   849     if ( aContent )
       
   850         {
       
   851         BeginElementL( EConMLDrive, ETrue );
       
   852         AppendPCDataL( EConMLName, aContent->name );
       
   853         EndElementL(); //EConMLDrive
       
   854         }
       
   855     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveL()" );
       
   856     }
       
   857 
       
   858 // -----------------------------------------------------------------------------
       
   859 // AppendDriveListL
       
   860 // -----------------------------------------------------------------------------
       
   861 void CSConConMLGenerator::AppendDriveListL( ConML_DriveListPtr_t aContent )
       
   862     {
       
   863     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDriveListL()" );
       
   864     for ( ConML_DriveListPtr_t p =  aContent; p && p->data; p=p->next )
       
   865         {
       
   866         AppendDriveL( p->data );
       
   867         }
       
   868     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDriveListL()" );
       
   869     }
       
   870 
       
   871 // -----------------------------------------------------------------------------
       
   872 // AppendDrivesL
       
   873 // -----------------------------------------------------------------------------
       
   874 void CSConConMLGenerator::AppendDrivesL( ConML_DrivesPtr_t aContent )
       
   875     {
       
   876     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDrivesL()" );
       
   877     if ( aContent )
       
   878         {
       
   879         BeginElementL( EConMLDrives, ETrue );
       
   880         AppendDriveListL( aContent->drive );
       
   881         EndElementL(); // EConMLDrives
       
   882         }
       
   883     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDrivesL()" );
       
   884     }
       
   885 
       
   886 // -----------------------------------------------------------------------------
       
   887 // AppendDataOwnersL
       
   888 // -----------------------------------------------------------------------------
       
   889 void CSConConMLGenerator::AppendDataOwnersL( ConML_DataOwnersPtr_t aContent )
       
   890     {
       
   891     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnersL()" );
       
   892     if ( aContent )
       
   893         {
       
   894         BeginElementL( EConMLDataOwners, ETrue );
       
   895         AppendSIDListL( aContent->sid );
       
   896         EndElementL(); //EConMLDataOwners
       
   897         }
       
   898     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDataOwnersL()" );
       
   899     }
       
   900 
       
   901 // -----------------------------------------------------------------------------
       
   902 // AppendGetDataOwnerStatusL
       
   903 // -----------------------------------------------------------------------------
       
   904 void CSConConMLGenerator::AppendGetDataOwnerStatusL
       
   905     ( ConML_GetDataOwnerStatusPtr_t aContent )
       
   906     {
       
   907     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" );
       
   908     if ( aContent)
       
   909         {
       
   910         BeginElementL( EConMLGetDataOwnerStatus, ETrue );
       
   911         AppendDataOwnersL( aContent->dataOwners );
       
   912         AppendResultsL( aContent->results );
       
   913         EndElementL(); // EconMLGetDataOwnerStatus
       
   914         }
       
   915     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDataOwnerStatusL()" );
       
   916     }
       
   917 
       
   918 // -----------------------------------------------------------------------------
       
   919 // AppendGetMetadataL
       
   920 // -----------------------------------------------------------------------------
       
   921 void CSConConMLGenerator::AppendGetMetadataL
       
   922     ( ConML_GetMetadataPtr_t aContent )
       
   923     {
       
   924     LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" );
       
   925     if ( aContent)
       
   926         {
       
   927         BeginElementL( EConMLGetMetadata, ETrue );
       
   928         AppendPCDataL( EConMLFilename, aContent->filename );
       
   929         AppendResultsL( aContent->results );
       
   930         EndElementL(); // EConMLGetMetadata
       
   931         }
       
   932     LOGGER_ENTERFN( "CSConConMLGenerator::AppendGetMetadataL()" );
       
   933     }
       
   934 
       
   935 // -----------------------------------------------------------------------------
       
   936 // AppendPackageInfoL
       
   937 // -----------------------------------------------------------------------------
       
   938 void CSConConMLGenerator::AppendPackageInfoL ( ConML_PackageInfoPtr_t aContent )
       
   939     {
       
   940     if ( aContent )
       
   941         {
       
   942         BeginElementL( EConMLPackageInfo, ETrue );
       
   943         AppendPCDataL( EConMLName, aContent->name );
       
   944         EndElementL(); // EConMLPackageInfo
       
   945         }
       
   946     }
       
   947 
       
   948 // -----------------------------------------------------------------------------
       
   949 // AppendSIDL
       
   950 // -----------------------------------------------------------------------------
       
   951 void CSConConMLGenerator::AppendSIDL( ConML_SIDPtr_t aContent )
       
   952     {
       
   953     LOGGER_ENTERFN( "CSConConMLGenerator::AppendSIDL()" );
       
   954     if ( aContent )
       
   955         {
       
   956         BeginElementL( EConMLSID, ETrue );
       
   957         AppendPCDataL( EConMLType, aContent->type );
       
   958         AppendPCDataL( EConMLUID, aContent->uid );
       
   959         AppendPCDataL( EConMLDataOwnerStatus, aContent->dataOwnerStatus );
       
   960         AppendDrivesL( aContent->drives );
       
   961         if ( aContent->size )
       
   962             {
       
   963             AppendPCDataL( EConMLSize, aContent->size ); 
       
   964             }
       
   965         AppendPackageInfoL( aContent->packageInfo );
       
   966         AppendBUROptionsL( aContent->burOptions );
       
   967         AppendPCDataL( EConMLTransferDataType, aContent->transferDataType );
       
   968         AppendPCDataL( EConMLData, aContent->data );
       
   969         if ( aContent->moreData)
       
   970             {
       
   971             BeginElementL(EConMLMoreData );
       
   972             }
       
   973         EndElementL(); // EconMLSID
       
   974         }
       
   975     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDL()" );
       
   976     }
       
   977     
       
   978 // -----------------------------------------------------------------------------
       
   979 // AppendSIDListL
       
   980 // -----------------------------------------------------------------------------
       
   981 void CSConConMLGenerator::AppendSIDListL( ConML_SIDListPtr_t aContent )
       
   982     {
       
   983     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" );
       
   984     for ( ConML_SIDListPtr_t p = aContent; p && p->data; p=p->next )
       
   985         {
       
   986         AppendSIDL( p->data );
       
   987         }
       
   988     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSIDListL()" );
       
   989     }
       
   990 
       
   991 // -----------------------------------------------------------------------------
       
   992 // AppendDeviceInfoL
       
   993 // -----------------------------------------------------------------------------
       
   994 void CSConConMLGenerator::AppendDeviceInfoL( ConML_DeviceInfoPtr_t aContent )
       
   995     {
       
   996     LOGGER_ENTERFN( "CSConConMLGenerator::AppendDeviceInfoL()" );
       
   997     if ( aContent )
       
   998         {
       
   999         BeginElementL( EConMLDeviceInfo, ETrue );
       
  1000         AppendPCDataL( EConMLVersion, aContent->version );
       
  1001         AppendSupportedMethodsL ( aContent->supportedMethods );
       
  1002         AppendPCDataL(EConMLMaxObjectSize, aContent->maxObjectSize );
       
  1003         EndElementL(); // EConMLDeviceInfo
       
  1004         }
       
  1005     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendDeviceInfoL()" );
       
  1006     }
       
  1007 
       
  1008 // -----------------------------------------------------------------------------
       
  1009 // AppendFilesL
       
  1010 // -----------------------------------------------------------------------------
       
  1011 void CSConConMLGenerator::AppendFilesL( ConML_FilesPtr_t aContent )
       
  1012     {
       
  1013     LOGGER_ENTERFN( "CSConConMLGenerator::AppendFilesL()" );
       
  1014     if ( aContent )
       
  1015         {
       
  1016         BeginElementL( EConMLFiles, ETrue );
       
  1017         AppendFileListL( aContent->file );
       
  1018         EndElementL(); // EConMLFiles
       
  1019         }
       
  1020     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFilesL()" );
       
  1021     }
       
  1022 
       
  1023 // -----------------------------------------------------------------------------
       
  1024 // AppendSupportedMethodsL
       
  1025 // -----------------------------------------------------------------------------
       
  1026 void CSConConMLGenerator::AppendSupportedMethodsL
       
  1027     ( ConML_SupportedMethodsPtr_t aContent )
       
  1028     {
       
  1029     LOGGER_ENTERFN( "CSConConMLGenerator::AppendSupportedMethodsL()" );
       
  1030     if ( aContent )
       
  1031         {
       
  1032         BeginElementL( EConMLSupportedMethods, ETrue );
       
  1033         if  ( aContent->install )
       
  1034             {
       
  1035             BeginElementL( EConMLInstall );
       
  1036             }
       
  1037         if ( aContent->unInstall )
       
  1038             {
       
  1039             BeginElementL( EConMLUnInstall );
       
  1040             }
       
  1041         if ( aContent->listInstalledApps )
       
  1042             {
       
  1043             BeginElementL( EConMLListInstalledApps );
       
  1044             }
       
  1045         if ( aContent->listDataOwners )
       
  1046             {
       
  1047             BeginElementL( EConMLListDataOwners );
       
  1048             }
       
  1049         if ( aContent->setBurMode )
       
  1050             {
       
  1051             BeginElementL( EConMLSetBURMode );
       
  1052             }
       
  1053         if ( aContent->getDataSize )
       
  1054             {
       
  1055             BeginElementL( EConMLGetDataSize );
       
  1056             }
       
  1057         if ( aContent->requestData )
       
  1058             {
       
  1059             BeginElementL( EConMLRequestData );
       
  1060             }
       
  1061         if ( aContent->supplyData )
       
  1062             {
       
  1063             BeginElementL( EConMLSupplyData );
       
  1064             }
       
  1065         if ( aContent->reboot )
       
  1066             {
       
  1067             BeginElementL( EConMLReboot );
       
  1068             }
       
  1069         EndElementL(); // EConMLSupportedMethods
       
  1070         }
       
  1071     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendSupportedMethodsL()" );
       
  1072     }
       
  1073 
       
  1074 // -----------------------------------------------------------------------------
       
  1075 // AppendFileListL
       
  1076 // -----------------------------------------------------------------------------
       
  1077 void CSConConMLGenerator::AppendFileListL( ConML_FileListPtr_t  aContent )
       
  1078     {
       
  1079     LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileListL()" );
       
  1080     if ( aContent )
       
  1081         {
       
  1082         for ( ConML_FileListPtr_t p = aContent; p && p->data; p = p->next )
       
  1083             {
       
  1084             AppendFileL(p->data );
       
  1085             }
       
  1086         }
       
  1087     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileListL()" );
       
  1088     }
       
  1089 
       
  1090 // -----------------------------------------------------------------------------
       
  1091 // AppendFileL
       
  1092 // -----------------------------------------------------------------------------
       
  1093 void CSConConMLGenerator::AppendFileL( ConML_FilePtr_t aContent )
       
  1094     {
       
  1095     LOGGER_ENTERFN( "CSConConMLGenerator::AppendFileL()" );
       
  1096     if ( aContent )
       
  1097         {
       
  1098         BeginElementL( EConMLFile, ETrue );
       
  1099         AppendPCDataL( EConMLName, aContent->name );
       
  1100         AppendPCDataL( EConMLModified, aContent->modified );
       
  1101         AppendPCDataL( EConMLSize, aContent->size );
       
  1102         AppendPCDataL( EConMLUserPerm, aContent->userPerm );
       
  1103         EndElementL(); // EConMLFile
       
  1104         }
       
  1105     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendFileL()" );
       
  1106     }
       
  1107 
       
  1108 // -----------------------------------------------------------------------------
       
  1109 // HandleResult
       
  1110 // -----------------------------------------------------------------------------
       
  1111 TInt CSConConMLGenerator::HandleResult( TInt aResult, TInt aTreshold )
       
  1112     {
       
  1113     LOGGER_ENTERFN( "CSConConMLGenerator::HandleResult()" );
       
  1114     switch( aResult )
       
  1115         {
       
  1116         case KErrNone:
       
  1117             if( iWBXMLWorkspace->FreeSize() < aTreshold )
       
  1118                 {               
       
  1119                 iWBXMLWorkspace->Rollback();
       
  1120                 return KWBXMLGeneratorBufferFull;
       
  1121                 }
       
  1122             iWBXMLWorkspace->Commit();
       
  1123             return KWBXMLGeneratorOk;
       
  1124 
       
  1125         case KErrTooBig:
       
  1126             iWBXMLWorkspace->Rollback();
       
  1127             return KWBXMLGeneratorBufferFull;
       
  1128         }
       
  1129     LOGGER_WRITE_1( "CSConConMLGenerator::HandleResult()\
       
  1130      : returned %d", aResult);
       
  1131     return aResult;
       
  1132     }
       
  1133 
       
  1134 // -----------------------------------------------------------------------------
       
  1135 // BeginDocumentL
       
  1136 // -----------------------------------------------------------------------------
       
  1137 void CSConConMLGenerator::BeginDocumentL( 
       
  1138     TUint8 aVersion, 
       
  1139     TInt32 aPublicId, 
       
  1140     TUint32 aCharset, 
       
  1141     const TDesC8& aStringTbl )
       
  1142     {
       
  1143     LOGGER_ENTERFN( "CSConConMLGenerator::BeginDocumentL()" );
       
  1144     iWBXMLWorkspace->WriteL(aVersion);
       
  1145 
       
  1146     if( aPublicId <= 0 )
       
  1147         {
       
  1148         iWBXMLWorkspace->WriteL(0);
       
  1149         WriteMUint32L(-aPublicId);
       
  1150         }
       
  1151     else
       
  1152         {
       
  1153         WriteMUint32L(aPublicId);
       
  1154         }
       
  1155     WriteMUint32L(aCharset);
       
  1156     WriteMUint32L(aStringTbl.Size());
       
  1157     iWBXMLWorkspace->WriteL(aStringTbl);
       
  1158     LOGGER_LEAVEFN( "CSConConMLGenerator::BeginDocumentL()" );
       
  1159     }
       
  1160 
       
  1161 // -----------------------------------------------------------------------------
       
  1162 // BeginElementL
       
  1163 // -----------------------------------------------------------------------------
       
  1164 void CSConConMLGenerator::BeginElementL( 
       
  1165     TUint8 aElement, TBool aHasContent, TBool aHasAttributes )
       
  1166     {
       
  1167     LOGGER_ENTERFN( "CSConConMLGenerator::BeginElementL()" );
       
  1168     IndentL();
       
  1169     iXMLWorkspace->WriteL(KXMLTagStart());
       
  1170     iXMLWorkspace->WriteL(TranslateElement(aElement));
       
  1171         
       
  1172     if( aHasAttributes )
       
  1173         {
       
  1174         aElement |= KWBXMLHasAttributes;
       
  1175         }
       
  1176         
       
  1177     if( aHasContent )
       
  1178         {
       
  1179         iXMLWorkspace->WriteL(KXMLTagEnd());
       
  1180         iElemStack.Insert(aElement, 0);
       
  1181         aElement |= KWBXMLHasContent;
       
  1182         }
       
  1183     else
       
  1184         {
       
  1185         iXMLWorkspace->WriteL(KXMLTagEndNoContent());
       
  1186         }
       
  1187 
       
  1188     if( !iDontNewLine )
       
  1189         {
       
  1190         iXMLWorkspace->WriteL(KXMLNewLine());
       
  1191         }
       
  1192     iDontNewLine = EFalse;
       
  1193 
       
  1194     WriteMUint32L(aElement);
       
  1195     LOGGER_LEAVEFN( "CSConConMLGenerator::BeginElementL()" );
       
  1196     }
       
  1197 
       
  1198 // -----------------------------------------------------------------------------
       
  1199 // EndElementL
       
  1200 // -----------------------------------------------------------------------------
       
  1201 void CSConConMLGenerator::EndElementL()
       
  1202     {
       
  1203     LOGGER_ENTERFN( "CSConConMLGenerator::EndElementL()" );
       
  1204     TUint8 elem = iElemStack[0];
       
  1205     iElemStack.Remove(0);
       
  1206     if( !iDontIndent )
       
  1207         {
       
  1208         IndentL();
       
  1209         }
       
  1210     iDontIndent = EFalse;
       
  1211     iXMLWorkspace->WriteL(KXMLTagStartEndTag());
       
  1212     iXMLWorkspace->WriteL(TranslateElement(elem));
       
  1213     iXMLWorkspace->WriteL(KXMLTagEnd());
       
  1214     iXMLWorkspace->WriteL(KXMLNewLine());
       
  1215     
       
  1216     iWBXMLWorkspace->WriteL(END);
       
  1217     
       
  1218     LOGGER_LEAVEFN( "CSConConMLGenerator::EndElementL()" );
       
  1219     }
       
  1220 
       
  1221 // -----------------------------------------------------------------------------
       
  1222 // AddElementL
       
  1223 // -----------------------------------------------------------------------------
       
  1224 void CSConConMLGenerator::AddElementL( 
       
  1225     TUint8 aElement, const TDesC8& aContent, const TWBXMLContentFormat aFormat )
       
  1226     {
       
  1227     LOGGER_ENTERFN( "CSConConMLGenerator::AddElementL()" );
       
  1228     iDontNewLine = ETrue;
       
  1229     BeginElementL(aElement, ETrue);
       
  1230     if( aFormat == EWBXMLContentFormatOpaque )
       
  1231         {
       
  1232         WriteOpaqueDataL(aContent);
       
  1233         }
       
  1234     else
       
  1235         {
       
  1236         WriteInlineStringL(aContent);
       
  1237         }
       
  1238     iDontIndent = ETrue;
       
  1239     EndElementL();
       
  1240     LOGGER_LEAVEFN( "CSConConMLGenerator::AddElementL()" );
       
  1241     }
       
  1242 
       
  1243 // -----------------------------------------------------------------------------
       
  1244 // AppendPCDataL
       
  1245 // -----------------------------------------------------------------------------
       
  1246 void CSConConMLGenerator::AppendPCDataL( TUint8 aElement, pcdataPtr_t aContent )
       
  1247     {
       
  1248     LOGGER_ENTERFN( "CSConConMLGenerator::AppendPCDataL()" );
       
  1249     if( !aContent )
       
  1250         {
       
  1251         return;
       
  1252         }
       
  1253 
       
  1254     if( aContent->contentType == SML_PCDATA_OPAQUE )
       
  1255         {
       
  1256         AddElementL(aElement, 
       
  1257                     TPtrC8((TUint8*)aContent->content, 
       
  1258                     aContent->length));
       
  1259         }
       
  1260     else
       
  1261         {
       
  1262         LOGGER_WRITE( "CSConConMLGenerator::AppendPCDataL() : Data type not Opaque - ignoring " );
       
  1263         }
       
  1264     LOGGER_LEAVEFN( "CSConConMLGenerator::AppendPCDataL()" );
       
  1265     }
       
  1266     
       
  1267 // -----------------------------------------------------------------------------
       
  1268 // WBXMLDocument
       
  1269 // -----------------------------------------------------------------------------
       
  1270 TPtrC8 CSConConMLGenerator::WBXMLDocument()
       
  1271     {
       
  1272     LOGGER_ENTERFN( "CSConConMLGenerator::WBXMLDocument()" );
       
  1273     LOGGER_LEAVEFN( "CSConConMLGenerator::WBXMLDocument()" );
       
  1274     return iWBXMLWorkspace->Buffer();
       
  1275     }
       
  1276     
       
  1277 // -----------------------------------------------------------------------------
       
  1278 // XMLDocument
       
  1279 // -----------------------------------------------------------------------------
       
  1280 TPtrC8 CSConConMLGenerator::XMLDocument()
       
  1281     {
       
  1282     LOGGER_ENTERFN( "CSConConMLGenerator::XMLDocument()" );
       
  1283     LOGGER_LEAVEFN( "CSConConMLGenerator::XMLDocument()" );
       
  1284     return iXMLWorkspace->Buffer();
       
  1285     }