contentcontrolsrv/ccsrv/src/ccsrvsession.cpp
branchRCL_3
changeset 101 9e077f9a342c
parent 78 1b207dd38b72
equal deleted inserted replaced
82:ace62b58f4b2 101:9e077f9a342c
   383 // -----------------------------------------------------------------------
   383 // -----------------------------------------------------------------------
   384 //
   384 //
   385 void CCcSrvSession::HandleGetMsgDataL(
   385 void CCcSrvSession::HandleGetMsgDataL(
   386     RMessage2& aMessage )
   386     RMessage2& aMessage )
   387     {
   387     {
   388     // Read sender and receiver of a response
   388     // Read transaction id which message data is requested
   389     TPckgBuf<TUint32> pckg;    
   389     TPckgBuf<TUint32> pckg;    
   390     aMessage.ReadL( 0, pckg );                        
   390     aMessage.ReadL( 0, pckg );                        
   391     TUint32 trId = pckg();
   391     TUint32 trId = pckg();
   392     
   392     
   393     CCcSrvMsg* req( NULL );
   393     CCcSrvMsg* req( NULL );
   394     TInt index( 0 );
   394     TBool found( EFalse );
   395     for( TInt i = 0; i < iRequests.Count() && !req; i++ )
   395     for( TInt i = 0; i < iRequests.Count() && !found; i++ )
   396         {
   396         {
   397         if ( iRequests[ i ]->TrId() == trId )
   397         req = iRequests[ i ];
   398             {
   398         if ( req->Function() == ECcGetMsgData &&
   399             req = iRequests[ i ];
   399              req->TrId() == trId )
   400             index = i;
   400             {
       
   401             iRequests.Remove( i );
       
   402             found = ETrue;
   401             }
   403             }
   402         }
   404         }
   403     
   405     
   404     TInt err( KErrNone );
   406     TInt err( KErrNone );
   405     if ( req )
   407     if ( found )
   406         {
   408         {
       
   409         CleanupStack::PushL( req );
       
   410         
   407         // Write message data
   411         // Write message data
   408         aMessage.WriteL( 1, req->Data(), 0);
   412         aMessage.WriteL( 1, req->Data(), 0);
   409         // Remove request
   413         
   410         iRequests.Remove( index );
   414         CleanupStack::PopAndDestroy( req );
   411         delete req;
       
   412         }
   415         }
   413     else
   416     else
   414         {
   417         {
   415         err = KErrNotFound;
   418         err = KErrNotFound;
   416         }
   419         }
   472             // Pending WaitForApiReq transaction found
   475             // Pending WaitForApiReq transaction found
   473             iRequests.Remove( i );
   476             iRequests.Remove( i );
   474             found = ETrue;
   477             found = ETrue;
   475             }
   478             }
   476         else if ( aMessage.Function() == ECcApiResp &&
   479         else if ( aMessage.Function() == ECcApiResp &&
   477                   req->TrId() == aMessage.TrId() )
   480                   req->Function() == ECcApiReq &&
       
   481                   req->TrId() == aMessage.TrId() &&
       
   482                   !req->Message().IsNull() )
   478             {
   483             {
   479             // Pending ApiReq transaction found
   484             // Pending ApiReq transaction found
   480             iRequests.Remove( i );
   485             iRequests.Remove( i );
   481             found = ETrue;
   486             found = ETrue;
   482             }
   487             }
   534              aMessage.Function() == ECcApiNtf ) )
   539              aMessage.Function() == ECcApiNtf ) )
   535         {
   540         {
   536         // Store message to handled later
   541         // Store message to handled later
   537         CCcSrvMsg* msg = CCcSrvMsg::NewL();
   542         CCcSrvMsg* msg = CCcSrvMsg::NewL();
   538         CleanupStack::PushL( msg );
   543         CleanupStack::PushL( msg );
   539         msg->SetFunction( aMessage.Function() );
   544         if ( found && aMessage.DataSize() )
       
   545             {
       
   546             msg->SetFunction( ECcGetMsgData );
       
   547             }
       
   548         else
       
   549             {
       
   550             msg->SetFunction( aMessage.Function() );
       
   551             }
   540         msg->SetSender( aMessage.Sender() );
   552         msg->SetSender( aMessage.Sender() );
   541         msg->SetReceiver( aMessage.Receiver() );
   553         msg->SetReceiver( aMessage.Receiver() );
   542         msg->SetMsgId( aMessage.MsgId() );
   554         msg->SetMsgId( aMessage.MsgId() );
   543         msg->SetTrId( aMessage.TrId() );
   555         msg->SetTrId( aMessage.TrId() );
   544         msg->SetStatus( aMessage.Status() );
   556         msg->SetStatus( aMessage.Status() );