locationcentre/lcservice/src/lcsyncoperation.cpp
branchRCL_3
changeset 16 4721bd00d3da
parent 14 3a25f69541ff
child 21 e15b7f06eba6
equal deleted inserted replaced
14:3a25f69541ff 16:4721bd00d3da
     1 /*
       
     2 * Copyright (c) 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:  Handles all the Synchronous operations with the Location
       
    15 *                Centre Client Session
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // SYSTEM INCLUDES
       
    21 #include <s32mem.h>
       
    22 
       
    23 // USER INCLUDES
       
    24 #include "lcsyncoperation.h"
       
    25 #include "lcclientsession.h"
       
    26 #include "lcipcparams.h"
       
    27 #include "lcdebug.h"
       
    28 
       
    29 // CONSTANT DEFINTIONS
       
    30 const TInt  KLcLengthofInteger  = 4;
       
    31 
       
    32 // ----- Member funtions for LcSyncOperation ---------------------------------
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CLcLocationAppInfoArray* CLcServiceImpl::GetLocationApplicationsL
       
    36 // ---------------------------------------------------------------------------
       
    37 //    
       
    38 CLcLocationAppInfoArray* LcSyncOperation::GetLocationApplicationsL(
       
    39 											  RLcClientSession&   	aSession,
       
    40 							            const TLcLocationAppFilter& aLocationAppFilter )
       
    41     {
       
    42     DEBUG("+ LcSyncOperation::GetLocationApplicationsL")
       
    43     DEBUG("Filtering")
       
    44     
       
    45     // This function needs to obtain a list of all applications. This would
       
    46     // first require to obtain the length of the buffer that needs to be
       
    47     // passed from the client to the server to pack the array.
       
    48     CBufFlat* lengthBuf = CBufFlat::NewL( KLcLengthofInteger );
       
    49     CleanupStack::PushL( lengthBuf );
       
    50     
       
    51     // Set the size of this buffer to 4. This is required because we dont
       
    52     // actually fill this buffer but expect the server to fill it. In that case
       
    53     // if we dont set the expected length, the server would fail with
       
    54     // KrrBadDescriptor.
       
    55     lengthBuf->ResizeL( KLcLengthofInteger );
       
    56     
       
    57     // Fill the IPC argument structure with the Length buffer, the server
       
    58     // will write the data onto this buffer.
       
    59     TIpcArgs    args;
       
    60     
       
    61     // Pass the filter parameters to the Location Centre Server
       
    62     TPckg< TLcLocationAppFilter >    filterBuffer( aLocationAppFilter );
       
    63     
       
    64     // By the IPC exchange parameter defintion, this must be the first
       
    65     // argument to the IPC message.
       
    66     args.Set( 0, &filterBuffer );
       
    67     
       
    68     // Set the buffer pointer to the start of the Length buffer
       
    69     TPtr8 bufPtr( const_cast< TUint8 *>( lengthBuf->Ptr( 0 ).Ptr()),
       
    70                   0,
       
    71                   KLcLengthofInteger );
       
    72     
       
    73     // This will be the second argument passed to this IPC message.
       
    74     args.Set( 1, &bufPtr);
       
    75     
       
    76     // Send a synchrnous message to the server to obtain the length. On return the
       
    77     // server is expected to pack the length of the Application information
       
    78     // arrays in the LengthBuffer pointer.
       
    79     User::LeaveIfError( aSession.SendReceive( ELcFilteredAppsBufferLength, args ));
       
    80 
       
    81     // If the server has not set the buffer then leave with KErrNotFound
       
    82     if ( !bufPtr.Length())
       
    83         {
       
    84         User::Leave( KErrNotFound );
       
    85         }
       
    86     
       
    87     // Obtain the length from the Length buffer;
       
    88     RBufReadStream  readStream( *lengthBuf, 0 );
       
    89     CleanupClosePushL( readStream );
       
    90     TUint length = readStream.ReadInt32L();
       
    91     CleanupStack::PopAndDestroy( 2, lengthBuf );   // readStream
       
    92     
       
    93     // If the server has returned a length of 0, then there are no applications
       
    94     // registered with Location Centre.
       
    95     if ( !length )
       
    96         {
       
    97         User::Leave( KErrNotFound );
       
    98         }
       
    99     
       
   100     // Now that the length has been obtained. Allocate the descriptor
       
   101     // of suitable length and send it across to the server.
       
   102     CBufFlat* appInfoBuf = CBufFlat::NewL( length );
       
   103     CleanupStack::PushL( appInfoBuf );
       
   104     
       
   105     // Set the actual size to 'length' obtained in the previous IPC. This is required
       
   106     // because we dont actually fill this buffer but expect the server to fill it.
       
   107     // In that case if we dont set the expected length, the server would fail with
       
   108     // KrrBadDescriptor.
       
   109     appInfoBuf->ResizeL( length );
       
   110     
       
   111     // Fill the IPC argument structure with the Application info buffer, the server
       
   112     // will write the data onto this buffer.
       
   113     
       
   114     // Pass the filter parameters to the Location Centre Server
       
   115     // By the IPC exchange parameter defintion, this must be the first
       
   116     // argument to the IPC message.
       
   117     args.Set( 0, &filterBuffer );
       
   118     
       
   119     // Set the buffer pointer to the start of the Length buffer
       
   120     bufPtr.Set( const_cast< TUint8 *>( appInfoBuf->Ptr( 0 ).Ptr()),
       
   121                 0,
       
   122                 length );
       
   123     
       
   124     // This will be the second argument passed to this IPC message.
       
   125     args.Set( 1, &bufPtr);
       
   126     
       
   127     // Send a synchrnous message to the server to obtain the length. On return the
       
   128     // server is expected to pack the length of the Application information
       
   129     // arrays in the LengthBuffer pointer.
       
   130     TInt error =  aSession.SendReceive( ELcFilteredApps, args );
       
   131     
       
   132 	// If the Retrieval function completes with KErrOverflow then there has been
       
   133 	// an update to the registry since the time we obtained the length.
       
   134 	if ( KErrOverflow == error )
       
   135 		{
       
   136 		// Cleanup the current state and Re-issue the same request again
       
   137 		CleanupStack::PopAndDestroy( appInfoBuf );
       
   138 		return GetLocationApplicationsL( aSession, aLocationAppFilter );
       
   139 		}
       
   140 	else if( error )
       
   141 		{
       
   142 		User::Leave( error );
       
   143 		}
       
   144 
       
   145     // If the server has not set the buffer then leave with KErrNotFound
       
   146     if ( !bufPtr.Length())
       
   147         {
       
   148         User::Leave( KErrNotFound );
       
   149         }
       
   150         
       
   151     // Parse the Application information array to obtain the array
       
   152     RBufReadStream  appReadStream( *appInfoBuf, 0 );
       
   153     CleanupClosePushL( appReadStream );
       
   154     
       
   155     CLcLocationAppInfoArray* array = ParseLocAppBufferL( appReadStream );
       
   156     
       
   157     CleanupStack::PopAndDestroy( 2, appInfoBuf );   // appReadStream
       
   158 
       
   159     DEBUG("- LcSyncOperation::GetLocationApplicationsL")
       
   160     
       
   161     return array;
       
   162 
       
   163     }
       
   164 
       
   165 // ---------------------------------------------------------------------------
       
   166 // CLcLocationAppInfoArray* LcSyncOperation::GetLocationApplicationsL
       
   167 // ---------------------------------------------------------------------------
       
   168 //     
       
   169 CLcLocationAppInfoArray* LcSyncOperation::GetLocationApplicationsL(
       
   170                                       RLcClientSession&   		aSession,
       
   171                                       const RArray<TPtrC>&      aAppArray,
       
   172                                             TBool               aIncludeFlag )
       
   173     {
       
   174         
       
   175     // Obtain the array of Application Identifiers in a buffer
       
   176     RLcIpcAppIdArray        idArray;
       
   177     CleanupStack::PushL( TCleanupItem( RLcIpcAppIdArray::ResetAndDestroyIdArray, &idArray ));
       
   178     
       
   179     // Append all the identifiers to the Array    
       
   180     for ( TInt i = 0; i < aAppArray.Count(); i++ )
       
   181         {
       
   182         // Create a new element
       
   183         HBufC* newElement = HBufC::NewLC( aAppArray[i].Length());
       
   184         
       
   185         // Copy the contents to the buffer and append it to the array
       
   186         newElement->Des().Copy( aAppArray[i] );
       
   187         User::LeaveIfError( idArray.Append( newElement ));
       
   188         
       
   189         // Now that the ownership is transferred, the content can be removed from
       
   190         // the Cleanup stack
       
   191         CleanupStack::Pop();
       
   192         }
       
   193     
       
   194     // Create the buffer for packing the Application Information
       
   195     // structure and pack the contents into this buffer
       
   196     CBufFlat* buffer = CBufFlat::NewL( idArray.BufferLength());
       
   197     CleanupStack::PushL( buffer );
       
   198     
       
   199     RBufWriteStream writeStream( *buffer, 0 );
       
   200     CleanupClosePushL( writeStream );                
       
   201     idArray.ExternalizeL( writeStream );
       
   202     CleanupStack::PopAndDestroy(); // writeStream
       
   203                    
       
   204     // This needs to be popped inorder to Close the idArray;
       
   205     CleanupStack::Pop( 2 ); // buffer, idArray
       
   206     idArray.ResetAndDestroy();
       
   207     idArray.Close();
       
   208     
       
   209     // Now reinsert the App buffer back into the Cleanupstack
       
   210     CleanupStack::PushL( buffer );
       
   211        
       
   212     // This function needs to obtain a list of all applications. This would
       
   213     // first require to obtain the length of the buffer that needs to be
       
   214     // passed from the client to the server to pack the array.
       
   215     
       
   216     TIpcArgs    args;
       
   217         
       
   218     // First pack the application id array to the IPC args
       
   219     // By the IPC exchange parameter defintion, this must be the first
       
   220     // argument to the IPC message.
       
   221     TPtr8 appArrayPtr( buffer->Ptr(0));
       
   222       
       
   223     args.Set( 0, &appArrayPtr );
       
   224      
       
   225     // The second argument is the Include flag
       
   226     args.Set( 1, aIncludeFlag );
       
   227                
       
   228     CBufFlat* lengthBuf = CBufFlat::NewL( KLcLengthofInteger );
       
   229     CleanupStack::PushL( lengthBuf );
       
   230     
       
   231     // Set the size of this buffer to 4. This is required because we dont
       
   232     // actually fill this buffer but expect the server to fill it. In that case
       
   233     // if we dont set the expected length, the server would fail with
       
   234     // KrrBadDescriptor.
       
   235     lengthBuf->ResizeL( KLcLengthofInteger );
       
   236  
       
   237     // Set the buffer pointer to the start of the Length buffer
       
   238     TPtr8 bufPtr( const_cast< TUint8 *>( lengthBuf->Ptr( 0 ).Ptr()),
       
   239                   0,
       
   240                   KLcLengthofInteger );
       
   241     
       
   242     // This will be the third argument passed to this IPC message.
       
   243     args.Set( 2, &bufPtr);
       
   244     
       
   245     // Send a synchrnous message to the server to obtain the length. On return the
       
   246     // server is expected to pack the length of the Application information
       
   247     // arrays in the LengthBuffer pointer.
       
   248     User::LeaveIfError( aSession.SendReceive( ELcSpecifiedAppsBufferLength, args ));
       
   249 
       
   250     // If the server has not set the buffer then leave with KErrNotFound
       
   251     if ( !bufPtr.Length())
       
   252         {
       
   253         User::Leave( KErrNotFound );
       
   254         }
       
   255     
       
   256     // Obtain the length from the Length buffer;
       
   257     RBufReadStream  readStream( *lengthBuf, 0 );
       
   258     CleanupClosePushL( readStream );
       
   259     TUint length = readStream.ReadInt32L();
       
   260     CleanupStack::PopAndDestroy( 2, lengthBuf );   // readStream
       
   261     
       
   262     // If the server has returned a length of 0, then there are no applications
       
   263     // registered with Location Centre.
       
   264     if ( !length )
       
   265         {
       
   266         User::Leave( KErrNotFound );
       
   267         }
       
   268     
       
   269     // Now that the length has been obtained. Allocate the descriptor
       
   270     // of suitable length and send it across to the server.
       
   271     CBufFlat* appInfoBuf = CBufFlat::NewL( length );
       
   272     CleanupStack::PushL( appInfoBuf );
       
   273     
       
   274     // Set the actual size to 'length' obtained in the previous IPC. This is required
       
   275     // because we dont actually fill this buffer but expect the server to fill it.
       
   276     // In that case if we dont set the expected length, the server would fail with
       
   277     // KrrBadDescriptor.
       
   278     appInfoBuf->ResizeL( length );
       
   279     
       
   280     // Fill the IPC argument structure with the Application info buffer, the server
       
   281     // will write the data onto this buffer.
       
   282     
       
   283     // Pass the Application ids to the Location Centre Server
       
   284     // By the IPC exchange parameter defintion, this must be the first
       
   285     // argument to the IPC message.
       
   286     args.Set( 0, &appArrayPtr );
       
   287     
       
   288     // The second argument is the Include flag
       
   289     args.Set( 1, aIncludeFlag );
       
   290     
       
   291     // Set the buffer pointer to the start of the Length buffer
       
   292     bufPtr.Set( const_cast< TUint8 *>( appInfoBuf->Ptr( 0 ).Ptr()),
       
   293                 0,
       
   294                 length );
       
   295     
       
   296     // This will be the third argument passed to this IPC message.
       
   297     args.Set( 2, &bufPtr);
       
   298     
       
   299     // Send a synchrnous message to the server to obtain the length. On return the
       
   300     // server is expected to pack the length of the Application information
       
   301     // arrays in the LengthBuffer pointer.
       
   302     TInt error = aSession.SendReceive( ELcSpecifiedApps, args );
       
   303 
       
   304 	// If the Retrieval function completes with KErrOverflow then there has been
       
   305 	// an update to the registry since the time we obtained the length.
       
   306 	if ( KErrOverflow == error )
       
   307 		{
       
   308 		// Cleanup the current state and Re-issue the same request again
       
   309 		CleanupStack::PopAndDestroy( 2, buffer );
       
   310 		return GetLocationApplicationsL( aSession, aAppArray, aIncludeFlag );
       
   311 		}
       
   312 	else if( error )
       
   313 		{
       
   314 		User::Leave( error );
       
   315 		}
       
   316 		
       
   317 		
       
   318     // If the server has not set the buffer then leave with KErrNotFound
       
   319     if ( !bufPtr.Length())
       
   320         {
       
   321         User::Leave( KErrNotFound );
       
   322         }
       
   323         
       
   324     // Parse the Application information array to obtain the array
       
   325     RBufReadStream  appReadStream( *appInfoBuf, 0 );
       
   326     CleanupClosePushL( appReadStream );
       
   327     
       
   328     CLcLocationAppInfoArray* array = LcSyncOperation::ParseLocAppBufferL( appReadStream );
       
   329     
       
   330     CleanupStack::PopAndDestroy( 3, buffer );   // idArray, appInfoBuf and buffer
       
   331 
       
   332     return array;  
       
   333     }
       
   334     
       
   335 // ---------------------------------------------------------------------------
       
   336 // CLcBasicAppInfo* LcSyncOperation::GetLocationAppInfoL
       
   337 // ---------------------------------------------------------------------------
       
   338 // 
       
   339 CLcBasicAppInfo* LcSyncOperation::GetLocationAppInfoL( 
       
   340 									RLcClientSession&   aSession,
       
   341 							  const TDesC&				aIdentifier )
       
   342 	{
       
   343     // This function needs to obtain the Length of the buffer which needs to be
       
   344     // passed to the Server to pack the Location Application Information.
       
   345     CBufFlat* lengthBuf = CBufFlat::NewL( KLcLengthofInteger );
       
   346     CleanupStack::PushL( lengthBuf );
       
   347     
       
   348     // Set the size of this buffer to 4. This is required because we dont
       
   349     // actually fill this buffer but expect the server to fill it. In that case
       
   350     // if we dont set the expected length, the server would fail with
       
   351     // KrrBadDescriptor.
       
   352     lengthBuf->ResizeL( KLcLengthofInteger );
       
   353     
       
   354     // Fill the IPC argument structure with the Length buffer, the server
       
   355     // will write the data onto this buffer.
       
   356     TIpcArgs    args;
       
   357     
       
   358     // By the IPC exchange parameter defintion, the first argument must the
       
   359     // Identifier name
       
   360     args.Set( 0, &aIdentifier );
       
   361     
       
   362     // Set the buffer pointer to the start of the Length buffer
       
   363     TPtr8 bufPtr( const_cast< TUint8 *>( lengthBuf->Ptr( 0 ).Ptr()),
       
   364                   0,
       
   365                   KLcLengthofInteger );
       
   366     
       
   367     // This will be the second argument passed to this IPC message.
       
   368     args.Set( 1, &bufPtr);
       
   369     
       
   370     // Send a synchrnous message to the server to obtain the length. On return the
       
   371     // server is expected to pack the length of the Application information
       
   372     // arrays in the LengthBuffer pointer.
       
   373     User::LeaveIfError( aSession.SendReceive( ELcAppInfoLength, args ));
       
   374 
       
   375     // If the server has not set the buffer then leave with KErrNotFound
       
   376     if ( !bufPtr.Length())
       
   377         {
       
   378         User::Leave( KErrNotFound );
       
   379         }
       
   380     
       
   381     // Obtain the length from the Length buffer;
       
   382     RBufReadStream  readStream( *lengthBuf, 0 );
       
   383     CleanupClosePushL( readStream );
       
   384     TUint length = readStream.ReadInt32L();
       
   385     CleanupStack::PopAndDestroy( 2, lengthBuf );   // readStream
       
   386     
       
   387     // If the server has returned a length of 0, then there are no applications
       
   388     // registered with Location Centre.
       
   389     if ( !length )
       
   390         {
       
   391         User::Leave( KErrNotFound );
       
   392         }
       
   393     
       
   394     // Now that the length has been obtained. Allocate the descriptor
       
   395     // of suitable length and send it across to the server.
       
   396     CBufFlat* appInfoBuf = CBufFlat::NewL( length );
       
   397     CleanupStack::PushL( appInfoBuf );
       
   398     
       
   399     // Set the actual size to 'length' obtained in the previous IPC. This is required
       
   400     // because we dont actually fill this buffer but expect the server to fill it.
       
   401     // In that case if we dont set the expected length, the server would fail with
       
   402     // KrrBadDescriptor.
       
   403     appInfoBuf->ResizeL( length );
       
   404     
       
   405     // Fill the IPC argument structure with the Application info buffer, the server
       
   406     // will write the data onto this buffer.
       
   407     
       
   408     // Pass the Application Identifier to the Location Centre Server
       
   409     // By the IPC exchange parameter defintion, this must be the first
       
   410     // argument to the IPC message.
       
   411     args.Set( 0, &aIdentifier );
       
   412     
       
   413     // Set the buffer pointer to the start of the Length buffer
       
   414     bufPtr.Set( const_cast< TUint8 *>( appInfoBuf->Ptr( 0 ).Ptr()),
       
   415                 0,
       
   416                 length );
       
   417     
       
   418     // This will be the second argument passed to this IPC message.
       
   419     args.Set( 1, &bufPtr);
       
   420     
       
   421     // Send a synchrnous message to the server to obtain the length. On return the
       
   422     // server is expected to pack the length of the Application information
       
   423     // in the buffer pointer.
       
   424     TInt error = aSession.SendReceive( ELcAppInfo, args );
       
   425 
       
   426 	// If the Retrieval function completes with KErrOverflow then there has been
       
   427 	// an update to the registry since the time we obtained the length.
       
   428 	if ( KErrOverflow == error )
       
   429 		{
       
   430 		// Cleanup the current state and Re-issue the same request again
       
   431 		CleanupStack::PopAndDestroy( appInfoBuf );
       
   432 		return GetLocationAppInfoL( aSession, aIdentifier );
       
   433 		}
       
   434 	else if( error )
       
   435 		{
       
   436 		User::Leave( error );
       
   437 		}
       
   438 		
       
   439     // If the server has not set the buffer then leave with KErrNotFound
       
   440     if ( !bufPtr.Length())
       
   441         {
       
   442         User::Leave( KErrNotFound );
       
   443         }
       
   444         
       
   445     // Parse the Application information structure to obtain the Application
       
   446     // information structure
       
   447     RBufReadStream  appReadStream( *appInfoBuf, 0 );
       
   448     CleanupClosePushL( appReadStream );
       
   449     
       
   450     CLcBasicAppInfo* appInfo = CLcBasicAppInfo::NewLC();
       
   451     appInfo->InternalizeL( appReadStream );
       
   452     CleanupStack::Pop( appInfo );
       
   453     
       
   454     CleanupStack::PopAndDestroy( 2, appInfoBuf );   // appReadStream
       
   455 
       
   456     return appInfo;	
       
   457 	}
       
   458 	
       
   459 // ---------------------------------------------------------------------------
       
   460 // CLcLocationAppInfoArray* LcSyncOperation::ParseLocAppBufferL
       
   461 // ---------------------------------------------------------------------------
       
   462 // 
       
   463 CLcLocationAppInfoArray* LcSyncOperation::ParseLocAppBufferL( 
       
   464                                                 RReadStream&   aReadStream )
       
   465     {
       
   466     DEBUG("+ LcSyncOperation::ParseLocAppBufferL")
       
   467         
       
   468     CLcLocationAppInfoArray* appArray = CLcLocationAppInfoArray::NewLC();
       
   469     
       
   470     // Parse the contents into RLcIpcAppInfoArray type.
       
   471     RLcIpcAppInfoArray  ipcArray;
       
   472     CleanupStack::PushL( TCleanupItem( RLcIpcAppInfoArray::ResetAndDestroyAppArray, &ipcArray ));
       
   473     
       
   474     // Internalize the array onto the ipcArray structure.
       
   475     ipcArray.InternalizeL( aReadStream );
       
   476 
       
   477     // Pack the Application info array
       
   478     for ( TInt i = 0; i < ipcArray.Count(); i++ )
       
   479         {
       
   480         
       
   481         // Form the Application information object corresponding to
       
   482         // this ipcAppInfo.
       
   483         
       
   484         // Create a new Application Information object. This object will
       
   485         // be populated and the appended to the appArray.
       
   486         CLcLocationAppInfo* appInfo = CLcLocationAppInfo::NewLC();
       
   487         
       
   488         // Set the Unique identifer for the application
       
   489         appInfo->SetIdL( ipcArray[i]->Id());
       
   490         
       
   491         // Set the display name of the application
       
   492         appInfo->SetNameL( ipcArray[i]->Name());
       
   493         
       
   494         // Set the Launch Mode for the application
       
   495         // There is no need to check the launch mode and compare it with
       
   496         // the values of TLcLaunchMode. Internally its ensured that the 
       
   497         // server would only set the parameter based in TLcLaunchMode.
       
   498         appInfo->SetLaunchMode( static_cast<CLcLocationAppInfo::
       
   499                             TLcLaunchMode>( ipcArray[i]->LaunchMode()));
       
   500         
       
   501         // Set the Application characteristics
       
   502         appInfo->SetApplicationCharacteristics( 
       
   503                             ipcArray[i]->ApplicationCharacteristics());
       
   504         
       
   505         // Set the system characteristics
       
   506         appInfo->SetSystemCharacteristics( ipcArray[i]->SystemCharacteristics());
       
   507          
       
   508         // Load the application Icon Related Data
       
   509         if ( ipcArray[i]->IconFile().Compare( KNullDesC ))
       
   510         	{
       
   511         	// The Icon file name is specified. So Load the icons from the 
       
   512         	// Icon file. So we can set these values for the Icon file.
       
   513         	appInfo->SetIconL( ipcArray[i]->IconFileType(),
       
   514         					   ipcArray[i]->IconFile(),
       
   515         					   ipcArray[i]->FrameNo());
       
   516         	}
       
   517         else if ( ipcArray[i]->ApplicationType() == ELcNativeApplication )
       
   518         	{
       
   519         	// Only native applications are handled here.
       
   520         	// Here we have to pass the Application UID as the Icon data since
       
   521         	// the Icon will be loaded from the App shell
       
   522         	appInfo->SetIconL( ipcArray[i]->IconFileType(),
       
   523         					   ipcArray[i]->ApplicationData());        	
       
   524         	}
       
   525         		   
       
   526         appArray->AppendL( appInfo );
       
   527         CleanupStack::Pop( appInfo );
       
   528         }
       
   529     CleanupStack::PopAndDestroy(); // ipcArray
       
   530     
       
   531     // If there are no elements in the array then that means that there
       
   532     // are no applications registered with LC. So leave with KErrNotFound
       
   533     if ( !appArray->Count())
       
   534         {
       
   535         User::Leave( KErrNotFound );
       
   536         }
       
   537     
       
   538     CleanupStack::Pop( appArray ); 
       
   539     
       
   540     DEBUG("- LcSyncOperation::ParseLocAppBufferL")
       
   541            
       
   542     return appArray;
       
   543     }	                                                                                                            
       
   544 // End of File