menufw/hierarchynavigator/hnutilities/src/hnservicehandler.cpp
branchRCL_3
changeset 9 f966699dea19
parent 0 f72a12da539e
equal deleted inserted replaced
5:c743ef5928ba 9:f966699dea19
   117 
   117 
   118     delete iInput;
   118     delete iInput;
   119     delete iConstructor;
   119     delete iConstructor;
   120     delete iCommand;
   120     delete iCommand;
   121     delete iOutputForAS;
   121     delete iOutputForAS;
   122     
   122 
   123     if ( iServiceHandler )
   123     if ( iServiceHandler )
   124         {
   124         {
   125         iServiceHandler->Reset();
   125         iServiceHandler->Reset();
   126         delete iServiceHandler;
   126         delete iServiceHandler;
   127         }
   127         }
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C TBool CHnServiceHandler::ServiceHandlerMatchesModel(
       
   135     const TDesC8& aService,
       
   136     const TDesC8& aInterface,
       
   137     const CLiwGenericParamList* aConstructor ) const
       
   138     {
       
   139     __ASSERT_DEBUG( aConstructor, User::Invariant() );
       
   140     
       
   141     TBool ret = ( aInterface == iInterfaceName && aService == iServiceName );
       
   142 
       
   143     if ( ret )
       
   144         {
       
   145         const TInt count = iConstructor->Count();
       
   146         ret = ( count == aConstructor->Count() );
       
   147         for ( TInt i = 0; ret && i < count; ++i )
       
   148             {
       
   149             ret = ( ( *iConstructor )[i] == ( *aConstructor )[i] );
       
   150             }
       
   151         }
       
   152 
       
   153     return ret;
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 // ---------------------------------------------------------------------------
       
   159 //
       
   160 EXPORT_C void CHnServiceHandler::PrepareForNextExecutionL(
       
   161         const TDesC8& aCommand, TServiceMode aMode,
       
   162         CLiwGenericParamList* aServiceCommand )
       
   163     {
       
   164     __ASSERT_DEBUG( aServiceCommand && aServiceCommand != iCommand,
       
   165             User::Invariant() );
       
   166     
       
   167         { // braces for scope only
       
   168         RBuf8 copy;
       
   169         CleanupClosePushL( copy );
       
   170         copy.CreateL( aCommand );
       
   171         iCommandName.Swap( copy );
       
   172         CleanupStack::PopAndDestroy( &copy );
       
   173         }
       
   174     
       
   175     iMode = aMode;
       
   176     
       
   177     delete iCommand;
       
   178     iCommand = aServiceCommand;
       
   179     // Ownership of aServiceCommand has been taken. Do not add any piece of
       
   180     // code that could leave after this line.
   128     }
   181     }
   129 
   182 
   130 // ---------------------------------------------------------------------------
   183 // ---------------------------------------------------------------------------
   131 //
   184 //
   132 // ---------------------------------------------------------------------------
   185 // ---------------------------------------------------------------------------
   203             }
   256             }
   204         }
   257         }
   205     else
   258     else
   206     	{
   259     	{
   207     	// KErrNone ensures that CHnQueryResultCollector::HandleQueryResultsL()
   260     	// KErrNone ensures that CHnQueryResultCollector::HandleQueryResultsL()
   208     	// is called, empty results are added to list, and 
   261     	// is called, empty results are added to list, and
   209     	// CHnMdItem::ResultsCollectedL doesn't get confused
   262     	// CHnMdItem::ResultsCollectedL doesn't get confused
   210     	User::RequestComplete( iClientStatus, KErrNone );
   263     	User::RequestComplete( iClientStatus, KErrNone );
   211     	}
   264     	}
   212 
   265 
   213     return err;
   266     return err;
   225     // reset
   278     // reset
   226     if( iOutputForAO )
   279     if( iOutputForAO )
   227         {
   280         {
   228         iOutputForAO->Reset();
   281         iOutputForAO->Reset();
   229         iOutputForAO->AppendL( aEventParamList );
   282         iOutputForAO->AppendL( aEventParamList );
   230         
   283 
   231         TLiwGenericParam param;
   284         TLiwGenericParam param;
   232         TInt error(KErrNone);
   285         TInt error(KErrNone);
   233         param.PushL();
   286         param.PushL();
   234         for (TInt i = 0; i < aEventParamList.Count(); i++)
   287         for (TInt i = 0; i < aEventParamList.Count(); i++)
   235             {
   288             {