featuremgmt/featuremgr/src/clientdll/featmgrclient.cpp
changeset 0 08ec8eefde2f
child 10 fa9941cf3867
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32svr.h>
       
    21 #include <s32mem.h>
       
    22 #include "featmgrclient.h"
       
    23 #include "featmgrconfiguration.h"
       
    24 #include "featmgrdebug.h"
       
    25 #include "featmgrclientserver.h"
       
    26 
       
    27 // CONSTANTS
       
    28 const TInt KRetry( 2 );
       
    29 
       
    30 // ============================= LOCAL FUNCTIONS ===============================
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // RFeatMgrClient::RFeatMgrClient
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 RFeatMgrClient::RFeatMgrClient()
       
    41     : RSessionBase(), iFeaturePckg( NULL, 0, 0 )
       
    42     {
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // RFeatMgrClient::Connect
       
    47 // Connects to server
       
    48 // -----------------------------------------------------------------------------
       
    49 //
       
    50 TInt RFeatMgrClient::Connect()
       
    51     {
       
    52     FUNC_LOG
       
    53 
       
    54     // Try this twice
       
    55     TInt retry( KRetry );
       
    56     TInt err( KErrNone );
       
    57 
       
    58     while ( retry > 0 )
       
    59         {
       
    60         // Try to create a FeatMgr Server session
       
    61         err = CreateSession( KServerProcessName, 
       
    62                              ServerVersion(), 
       
    63                              KDefaultAsyncSlots );
       
    64 
       
    65         LOG_IF_ERROR1( err, "RFeatMgrClient::Connect - CreateSession returned: %d", err );
       
    66     
       
    67         if ( err != KErrNotFound && err != KErrServerTerminated )
       
    68             {
       
    69             // KErrNone or unrecoverable error
       
    70             retry = 0;
       
    71             }
       
    72         else
       
    73             {
       
    74             // Return code was KErrNotFound or KErrServerTerminated.
       
    75             // Try to start a new FeatMgr Server
       
    76             err = StartServer();
       
    77 
       
    78             LOG_IF_ERROR1( err, "RFeatMgrClient::Connect - StartServer returned: %d", err );
       
    79 
       
    80             if ( err != KErrNone && err != KErrAlreadyExists )
       
    81                 {
       
    82                 // Unrecoverable error
       
    83                 retry = 0;
       
    84                 }
       
    85             }
       
    86             
       
    87         retry--;
       
    88         }
       
    89             
       
    90     return err;
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // RFeatMgrClient::StartServer
       
    95 // Starts server.
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 TInt RFeatMgrClient::StartServer()
       
    99     {
       
   100     FUNC_LOG
       
   101     TIMESTAMP( "StartServer start: " )
       
   102 
       
   103     RProcess server;
       
   104     const TUidType serverUid( KNullUid, KServerUid2, KNullUid );
       
   105     TInt err = server.Create( KServerExeName, // FeatMgrServer.exe
       
   106                            KNullDesC, // A descriptor containing data passed as 
       
   107                                       // an argument to the thread function of 
       
   108                                       // the new process's main thread, when it 
       
   109                                       // is first scheduled.
       
   110                            serverUid, // FeatMgr server UID
       
   111                            EOwnerProcess ); // Ownership of this process handle 
       
   112 
       
   113     // Return error code if we couldn't create a process
       
   114     if ( err == KErrNone )
       
   115         {
       
   116         // Rendezvous is used to detect server start
       
   117         TRequestStatus stat;
       
   118         server.Rendezvous( stat );
       
   119 
       
   120         if ( stat != KRequestPending )
       
   121             {
       
   122             server.Kill( KErrNone ); // Abort startup
       
   123             }
       
   124         else
       
   125             {
       
   126             server.Resume();  // Logon OK - start the server
       
   127             }
       
   128 
       
   129         INFO_LOG( "RFeatMgrClient::StartServer - Waiting server startup" );
       
   130 
       
   131         User::WaitForRequest( stat ); // Wait for start or death
       
   132 
       
   133         INFO_LOG( "RFeatMgrClient::StartServer - Server startup wait finished" );
       
   134         
       
   135         // We can't use the 'exit reason' if the server paniced as this
       
   136         // is the panic 'reason' and may be '0' which cannot be distinguished
       
   137         // from KErrNone
       
   138         err = (server.ExitType() == EExitPanic)? KErrGeneral : stat.Int();
       
   139 
       
   140         // We can close the handle now
       
   141         server.Close();        
       
   142         }
       
   143 
       
   144     TIMESTAMP( "StartServer end: " )
       
   145 
       
   146     return err;
       
   147     }
       
   148 
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // RFeatMgrClient::ServerVersion
       
   152 // Return version of server
       
   153 // -----------------------------------------------------------------------------
       
   154 //
       
   155 TVersion RFeatMgrClient::ServerVersion() const 
       
   156     {
       
   157     return TVersion( KServerVersionMajor, KServerVersionMinor, KServerVersionBuild );
       
   158     }
       
   159 
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // RFeatMgrClient::FeatureSupported()
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 TInt RFeatMgrClient::FeatureSupported( TFeatureEntry& aFeature ) const
       
   166     {  
       
   167     TPckg<TFeatureEntry> pckg( aFeature );
       
   168     TPckgBuf<TInt> pckgRet;
       
   169     
       
   170     TInt retval = SendReceive(EFeatMgrFeatureSupported, TIpcArgs( &pckg, &pckgRet ));
       
   171     
       
   172     if ( retval != KErrNone )
       
   173         {
       
   174         ERROR_LOG1( "RFeatMgrClient::FeatureSupported - SendReceive error %d", retval );
       
   175         return retval;
       
   176         }
       
   177 
       
   178     INFO_LOG2( "RFeatMgrClient::FeatureSupported - uid %d, supported %d",
       
   179                             aFeature.FeatureUid().iUid, pckgRet() );   
       
   180     return pckgRet();
       
   181     }
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 // RFeatMgrClient::FeaturesSupported()
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 TInt RFeatMgrClient::FeaturesSupported( RFeatureArray& aFeatures )
       
   188     {  
       
   189     TPckgBuf<TInt> pckg;
       
   190     
       
   191     TInt retval( KErrNone );
       
   192     
       
   193     TRAP( retval, SendRcvFeatureArrayL( aFeatures, pckg() ) );
       
   194 
       
   195     if ( retval != KErrNone )
       
   196         {
       
   197         ERROR_LOG1( "RFeatMgrClient::FeaturesSupported - SendReceive error %d", retval );
       
   198         return retval;
       
   199         }
       
   200 
       
   201     INFO_LOG1( "RFeatMgrClient::FeaturesSupported - return %d", pckg() );
       
   202     return pckg();
       
   203     }
       
   204 
       
   205 // -----------------------------------------------------------------------------
       
   206 // RFeatMgrClient::EnableFeature()
       
   207 // -----------------------------------------------------------------------------
       
   208 //
       
   209 TInt RFeatMgrClient::EnableFeature( TUid aFeature ) const
       
   210     {  
       
   211     TPckgBuf<TInt> pckg;
       
   212     
       
   213     TInt retval = SendReceive(EFeatMgrEnableFeature, TIpcArgs(aFeature.iUid, &pckg));
       
   214     
       
   215     if ( retval != KErrNone )
       
   216         {
       
   217         ERROR_LOG1( "RFeatMgrClient::EnableFeature - SendReceive error %d", retval );
       
   218         return retval;
       
   219         }
       
   220 
       
   221     INFO_LOG1( "RFeatMgrClient::EnableFeature - return %d", pckg() );
       
   222     return pckg();
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // RFeatMgrClient::DisableFeature()
       
   227 // -----------------------------------------------------------------------------
       
   228 //
       
   229 TInt RFeatMgrClient::DisableFeature( TUid aFeature ) const
       
   230     {  
       
   231     TPckgBuf<TInt> pckg;
       
   232     
       
   233     TInt retval = SendReceive(EFeatMgrDisableFeature, TIpcArgs(aFeature.iUid, &pckg));
       
   234     
       
   235     if ( retval != KErrNone )
       
   236         {
       
   237         ERROR_LOG1( "RFeatMgrClient::DisableFeature - SendReceive error %d", retval );
       
   238         return retval;
       
   239         }
       
   240 
       
   241     INFO_LOG1( "RFeatMgrClient::DisableFeature - return %d", pckg() );
       
   242     return pckg();
       
   243     }
       
   244     
       
   245 // -----------------------------------------------------------------------------
       
   246 // RFeatMgrClient::SetFeature()
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 TInt RFeatMgrClient::SetFeature( TUid aFeature, TBool aEnable, TInt aData ) const
       
   250     {  
       
   251     TPckgBuf<TInt> pckg;
       
   252     
       
   253     TInt retval = SendReceive(EFeatMgrSetFeatureAndData, TIpcArgs(
       
   254         aFeature.iUid, aEnable, aData, &pckg));
       
   255     
       
   256     if ( retval != KErrNone )
       
   257         {
       
   258         ERROR_LOG1( "RFeatMgrClient::SetFeature - SendReceive error %d", retval );
       
   259         return retval;
       
   260         }
       
   261 
       
   262     INFO_LOG1( "RFeatMgrClient::SetFeature - return %d", pckg() );
       
   263     return pckg();
       
   264     }
       
   265 
       
   266 // -----------------------------------------------------------------------------
       
   267 // RFeatMgrClient::SetFeature()
       
   268 // -----------------------------------------------------------------------------
       
   269 //
       
   270 TInt RFeatMgrClient::SetFeature( TUid aFeature, TInt aData ) const
       
   271     {  
       
   272     TPckgBuf<TInt> pckg;
       
   273     
       
   274     TInt retval = SendReceive(EFeatMgrSetFeatureData, TIpcArgs(
       
   275         aFeature.iUid, aData, &pckg));
       
   276     
       
   277     if ( retval != KErrNone )
       
   278         {
       
   279         ERROR_LOG1( "RFeatMgrClient::SetFeature - SendReceive error %d", retval );
       
   280         return retval;
       
   281         }
       
   282 
       
   283     INFO_LOG1( "RFeatMgrClient::SetFeature - return %d", pckg() );
       
   284     return pckg();
       
   285     }
       
   286 
       
   287 // -----------------------------------------------------------------------------
       
   288 // RFeatMgrClient::AddFeature()
       
   289 // -----------------------------------------------------------------------------
       
   290 //
       
   291 TInt RFeatMgrClient::AddFeature( TFeatureEntry aFeature ) const
       
   292     {  
       
   293     TPckg<TFeatureEntry> pckg( aFeature );
       
   294     TPckgBuf<TInt> pckgRet;
       
   295     
       
   296     TInt retval = SendReceive(EFeatMgrAddFeature, TIpcArgs(&pckg, &pckgRet));
       
   297     
       
   298     if ( retval != KErrNone )
       
   299         {
       
   300         ERROR_LOG1( "RFeatMgrClient::AddFeature - SendReceive error %d", retval );
       
   301         return retval;
       
   302         }
       
   303 
       
   304     INFO_LOG1( "RFeatMgrClient::AddFeature - return %d", pckgRet() );
       
   305     return pckgRet();
       
   306     }
       
   307 
       
   308 // -----------------------------------------------------------------------------
       
   309 // RFeatMgrClient::DeleteFeature()
       
   310 // -----------------------------------------------------------------------------
       
   311 //
       
   312 TInt RFeatMgrClient::DeleteFeature( TUid aFeature ) const
       
   313     {  
       
   314     TPckgBuf<TInt> pckg;
       
   315     
       
   316     TInt retval = SendReceive(EFeatMgrDeleteFeature, TIpcArgs(aFeature.iUid, &pckg));
       
   317     
       
   318     if ( retval != KErrNone )
       
   319         {
       
   320         ERROR_LOG1( "RFeatMgrClient::DeleteFeature - SendReceive error %d", retval );
       
   321         return retval;
       
   322         }
       
   323 
       
   324     INFO_LOG1( "RFeatMgrClient::DeleteFeature - return %d", pckg() );
       
   325     return pckg();
       
   326     }
       
   327 
       
   328 // -----------------------------------------------------------------------------
       
   329 // RFeatMgrClient::ListSupportedFeaturesL()
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 void RFeatMgrClient::ListSupportedFeaturesL( RFeatureUidArray& aSupportedFeatures )
       
   333     {  
       
   334     // Reset as array might contain old data.
       
   335     aSupportedFeatures.Reset();
       
   336     TInt retry( 5 );
       
   337     TInt err( KErrNone );
       
   338     TInt count;
       
   339     TPckg<TInt> sizePckg( count );
       
   340     
       
   341     while ( retry > 0 )
       
   342         {
       
   343         User::LeaveIfError( SendReceive( EFeatMgrNumberOfSupportedFeatures, 
       
   344             TIpcArgs( &sizePckg ) ) );
       
   345         
       
   346         HBufC8* buf = HBufC8::NewLC( count * sizeof( TInt ) );
       
   347         TPtr8 ptr = buf->Des();
       
   348         
       
   349         err = SendReceive( EFeatMgrListSupportedFeatures, TIpcArgs( count, &ptr ) );
       
   350         LOG_IF_ERROR1( err, "RFeatMgrClient::ListSupportedFeaturesL - SendReceive error %d", err );
       
   351         INFO_LOG1( "RFeatMgrClient::ListSupportedFeaturesL - count %d", count );
       
   352 
       
   353         if ( err == KErrNone )
       
   354             {
       
   355             aSupportedFeatures.ReserveL( count );
       
   356                 
       
   357             for ( TInt i = 0; i < count; i++ )
       
   358                 {
       
   359                 TPtrC8 featurePtr = ptr.Mid( i * sizeof( TUid ), sizeof( TUid ) );
       
   360                 TUid featureId = TUid::Uid( 0 );                    
       
   361                 TPckg<TUid> feature( featureId );
       
   362                 feature.Copy( featurePtr );
       
   363                 aSupportedFeatures.AppendL( featureId );
       
   364                 }
       
   365 
       
   366             retry = 0;
       
   367             }
       
   368         else if ( err == KErrServerBusy )
       
   369             {
       
   370             retry--;       
       
   371             }
       
   372         else
       
   373             {
       
   374             User::Leave( err );
       
   375             }
       
   376         CleanupStack::PopAndDestroy( buf );
       
   377         }   
       
   378         
       
   379     User::LeaveIfError( err );
       
   380     }
       
   381 
       
   382 
       
   383 // -----------------------------------------------------------------------------
       
   384 // RFeatMgrClient::ReRequestNotification(TUid&, TRequestStatus&)
       
   385 // -----------------------------------------------------------------------------
       
   386 //
       
   387 TInt RFeatMgrClient::ReRequestNotification( TUid& aFeatUid, TRequestStatus& aStatus )
       
   388     {
       
   389     TPckgBuf<TInt> pckg;
       
   390     TInt retval( KErrNone );
       
   391     
       
   392 	iFeaturePckg.Set( (TUint8*) &aFeatUid.iUid, sizeof(TUid), sizeof(TUid) );
       
   393 	TIpcArgs args( &iFeaturePckg );
       
   394 	SendReceive( EFeatMgrReqNotify, args, aStatus );
       
   395 
       
   396     return retval;
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // RFeatMgrClient::RequestNotification(RFeatureUidArray&, TUid&, TRequestStatus&)
       
   401 // -----------------------------------------------------------------------------
       
   402 //
       
   403 TInt RFeatMgrClient::RequestNotification( RFeatureUidArray& aFeatures, 
       
   404         TUid& aFeatUid, TRequestStatus& aStatus )
       
   405     {
       
   406     TPckgBuf<TInt> pckg;
       
   407     
       
   408     TInt retval( KErrNone );
       
   409     
       
   410     TRAP( retval, SendUidArrayL( aFeatures, pckg() ) );
       
   411 
       
   412     if ( retval == KErrNone )
       
   413         {
       
   414     	iFeaturePckg.Set( (TUint8*) &aFeatUid.iUid, sizeof(TUid), sizeof(TUid) );
       
   415     	TIpcArgs args( &iFeaturePckg );
       
   416         SendReceive( EFeatMgrReqNotify, args, aStatus );
       
   417         }
       
   418     else
       
   419         {
       
   420         ERROR_LOG1( "RFeatMgrClient::RequestNotification - SendReceive error %d", retval );
       
   421         return retval;
       
   422         }
       
   423 
       
   424     INFO_LOG1( "RFeatMgrClient::RequestNotification - return %d", pckg() );
       
   425     return pckg();
       
   426     }
       
   427         
       
   428 // -----------------------------------------------------------------------------
       
   429 // RFeatMgrClient::RequestNotifyCancel(TUid)
       
   430 // -----------------------------------------------------------------------------
       
   431 //
       
   432 TInt RFeatMgrClient::RequestNotifyCancel( TUid aFeature ) const
       
   433     {
       
   434     TPckgBuf<TInt> pckg;
       
   435     
       
   436     TInt retval = SendReceive(EFeatMgrReqNotifyCancel, TIpcArgs(aFeature.iUid, &pckg));
       
   437     
       
   438     if ( retval != KErrNone )
       
   439         {
       
   440         ERROR_LOG1( "RFeatMgrClient::RequestNotifyCancel - SendReceive error %d", retval );
       
   441         return retval;
       
   442         }
       
   443 
       
   444     INFO_LOG1( "RFeatMgrClient::RequestNotifyCancel - return %d", pckg() );
       
   445     return pckg();
       
   446     }
       
   447         
       
   448 // -----------------------------------------------------------------------------
       
   449 // RFeatMgrClient::RequestNotifyCancelAll()
       
   450 // -----------------------------------------------------------------------------
       
   451 //
       
   452 TInt RFeatMgrClient::RequestNotifyCancelAll() const
       
   453     {
       
   454     TPckgBuf<TInt> pckg;
       
   455     
       
   456     TInt retval = SendReceive(EFeatMgrReqNotifyCancelAll, TIpcArgs(&pckg));
       
   457     
       
   458     if ( retval != KErrNone )
       
   459         {
       
   460         ERROR_LOG1( "RFeatMgrClient::RequestNotifyCancelAll - SendReceive error %d", retval );
       
   461         return retval;
       
   462         }
       
   463 
       
   464     INFO_LOG1( "RFeatMgrClient::RequestNotifyCancelAll - return %d", pckg() );
       
   465     return pckg();
       
   466     }
       
   467         
       
   468 // -----------------------------------------------------------------------------
       
   469 // RFeatMgrClient::SendUidArrayL()
       
   470 // -----------------------------------------------------------------------------
       
   471 //
       
   472 void RFeatMgrClient::SendUidArrayL( RFeatureUidArray& aFeatures, TInt &retval)
       
   473     {
       
   474     FUNC_LOG
       
   475     
       
   476     INFO_LOG1( "RFeatMgrClient::SendUidArrayL - Send %d features", aFeatures.Count() );
       
   477 
       
   478     TInt size = aFeatures.Count() * sizeof(TUid);
       
   479 	CBufBase* buffer = CBufFlat::NewL( size );
       
   480 	CleanupStack::PushL( buffer );
       
   481 	buffer->ResizeL( size );
       
   482 
       
   483     RBufWriteStream stream( *buffer );
       
   484     CleanupClosePushL( stream );
       
   485     
       
   486     TInt count = aFeatures.Count();
       
   487     // Write each field in array to stream
       
   488     for(TInt i = 0; i < count; i++)
       
   489         {
       
   490         stream.WriteUint32L( aFeatures[i].iUid );
       
   491         }
       
   492     
       
   493     stream.CommitL();
       
   494     
       
   495     // Write transfer buffer to server
       
   496 	TPtr8 pBuffer(buffer->Ptr(0));
       
   497 	TPckgBuf<TInt> pckg;
       
   498 	TIpcArgs args( count, &pBuffer, &pckg );
       
   499 	TInt sendErr = SendReceive( EFeatMgrReqNotifyUids, args );
       
   500 	
       
   501 	retval = pckg();
       
   502 
       
   503     CleanupStack::PopAndDestroy( &stream );
       
   504     CleanupStack::PopAndDestroy( buffer );
       
   505 	User::LeaveIfError( sendErr );
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // RFeatMgrClient::SendRcvFeatureArrayL()
       
   510 // -----------------------------------------------------------------------------
       
   511 //
       
   512 void RFeatMgrClient::SendRcvFeatureArrayL( RFeatureArray& aFeatures, TInt &retval)
       
   513     {
       
   514     FUNC_LOG
       
   515     
       
   516     INFO_LOG1( "RFeatMgrClient::SendRcvFeatureArrayL - Send %d features", aFeatures.Count() );
       
   517 
       
   518     TInt size = aFeatures.Count() * sizeof(TFeatureEntry);
       
   519 	CBufBase* buffer = CBufFlat::NewL( size );
       
   520 	CleanupStack::PushL( buffer );
       
   521 	buffer->ResizeL( size );
       
   522 
       
   523     RBufWriteStream stream( *buffer );
       
   524     CleanupClosePushL( stream );
       
   525     
       
   526     TInt count = aFeatures.Count();
       
   527     // Write each field in array to stream
       
   528     for(TInt i = 0; i < count; i++)
       
   529         {
       
   530         TFeatureEntry entry( aFeatures[i].FeatureUid(), aFeatures[i].FeatureFlags(), 
       
   531             aFeatures[i].FeatureData() );
       
   532         stream.WriteUint32L( aFeatures[i].FeatureUid().iUid );
       
   533         stream.WriteUint32L( aFeatures[i].FeatureFlags().iFlags );
       
   534         stream.WriteUint32L( aFeatures[i].FeatureData() );
       
   535         stream.WriteUint32L( 0 ); // reserved
       
   536         }
       
   537     
       
   538     stream.CommitL();
       
   539     
       
   540     // Write transfer buffer to server
       
   541 	TPtr8 pBuffer(buffer->Ptr(0));
       
   542 	TPckgBuf<TInt> pckg;
       
   543 	TIpcArgs args( count, &pBuffer, &pckg );
       
   544 	TInt sendErr = SendReceive( EFeatMgrFeaturesSupported, args );
       
   545 
       
   546     if ( sendErr == KErrNone )
       
   547         {
       
   548     	TInt responseCount = pckg();
       
   549         // Read modified feature entries back to array
       
   550         RBufReadStream readStream( *buffer );
       
   551         CleanupClosePushL( readStream );
       
   552         aFeatures.Reset();
       
   553         aFeatures.ReserveL( responseCount );
       
   554             
       
   555         for ( TInt i = 0; i < responseCount; i++ )
       
   556             {
       
   557             TUid uid = TUid::Uid( readStream.ReadUint32L() );
       
   558             TBitFlags32 flags = readStream.ReadUint32L();
       
   559             TUint32 data = readStream.ReadUint32L();
       
   560             readStream.ReadUint32L(); // reserved
       
   561             TFeatureEntry entry( uid, flags, data );
       
   562             aFeatures.AppendL( entry );
       
   563             }
       
   564             
       
   565         CleanupStack::PopAndDestroy( &readStream );
       
   566         }
       
   567 
       
   568 	retval = KErrNone; // Currently no error response exist.
       
   569 
       
   570     CleanupStack::PopAndDestroy( &stream );
       
   571     CleanupStack::PopAndDestroy( buffer );
       
   572 	User::LeaveIfError( sendErr );
       
   573     }
       
   574 
       
   575 // -----------------------------------------------------------------------------
       
   576 // RFeatMgrClient::SWIStart()
       
   577 // -----------------------------------------------------------------------------
       
   578 //
       
   579 TInt RFeatMgrClient::SWIStart() const
       
   580     {
       
   581     TPckgBuf<TInt> pckg;
       
   582     
       
   583     TInt retval = SendReceive(EFeatMgrSWIStart, TIpcArgs(&pckg));
       
   584     
       
   585     if ( retval != KErrNone )
       
   586         {
       
   587         ERROR_LOG1( "RFeatMgrClient::SWIStart - SendReceive error %d", retval );
       
   588         return retval;
       
   589         }
       
   590 
       
   591     INFO_LOG1( "RFeatMgrClient::SWIStart - return %d", pckg() );
       
   592     return pckg();
       
   593     }
       
   594 
       
   595 // -----------------------------------------------------------------------------
       
   596 // RFeatMgrClient::SWIEnd()
       
   597 // -----------------------------------------------------------------------------
       
   598 //
       
   599 TInt RFeatMgrClient::SWIEnd() const
       
   600     {
       
   601     TPckgBuf<TInt> pckg;
       
   602     
       
   603     TInt retval = SendReceive(EFeatMgrSWIEnd, TIpcArgs(&pckg));
       
   604     
       
   605     if ( retval != KErrNone )
       
   606         {
       
   607         ERROR_LOG1( "RFeatMgrClient::SWIEnd - SendReceive error %d", retval );
       
   608         return retval;
       
   609         }
       
   610 
       
   611     INFO_LOG1( "RFeatMgrClient::SWIEnd - return %d", pckg() ); 
       
   612     return pckg();
       
   613     }
       
   614 
       
   615 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   616 
       
   617 
       
   618 
       
   619 // DEBUG only API functions
       
   620 
       
   621 #ifdef EXTENDED_FEATURE_MANAGER_TEST
       
   622 // -----------------------------------------------------------------------------
       
   623 // RFeatMgrClient::NumberOfNotifyFeatures()
       
   624 // -----------------------------------------------------------------------------
       
   625 //
       
   626 TInt RFeatMgrClient::NumberOfNotifyFeatures( void ) const
       
   627     {  
       
   628     TInt count;
       
   629     TPckg<TInt> sizePckg( count );
       
   630     
       
   631     TInt retval = SendReceive( EFeatMgrNumberOfNotifyFeatures, TIpcArgs( &sizePckg ) );
       
   632     if ( KErrNone != retval )
       
   633         {
       
   634         ERROR_LOG1( "RFeatMgrClient::NumberOfNotifyFeatures - SendReceive error %d", retval );
       
   635         return retval;
       
   636         }
       
   637 
       
   638     INFO_LOG1( "RFeatMgrClient::NumberOfNotifyFeatures - return %d", sizePckg() );
       
   639     return sizePckg();
       
   640     }
       
   641 
       
   642 // -----------------------------------------------------------------------------
       
   643 // RFeatMgrClient::CountAllocCells()
       
   644 // -----------------------------------------------------------------------------
       
   645 //
       
   646 TInt RFeatMgrClient::CountAllocCells( void ) const
       
   647     {  
       
   648     TInt count;
       
   649     TPckg<TInt> sizePckg( count );
       
   650     
       
   651     TInt retval = SendReceive( EFeatMgrCountAllocCells, TIpcArgs( &sizePckg ) );
       
   652     if ( KErrNone != retval )
       
   653         {
       
   654         ERROR_LOG1( "RFeatMgrClient::CountAllocCells - SendReceive error %d", retval );
       
   655         return retval;
       
   656         }
       
   657 
       
   658     INFO_LOG1( "RFeatMgrClient::CountAllocCells - return %d", sizePckg() );
       
   659     return sizePckg();
       
   660     }
       
   661 
       
   662 #endif
       
   663 
       
   664 //  End of File