telephonyserverplugins/common_tsy/commontsy/src/mmpacket/Cmmpacketservicetsy.cpp
branchRCL_3
changeset 7 fe8b59ab9fa0
parent 0 3553901f7fa8
child 9 2492a6e4aed7
equal deleted inserted replaced
6:fc69e1e37771 7:fe8b59ab9fa0
    34 #include "cmmmbmscontextlist.h"
    34 #include "cmmmbmscontextlist.h"
    35 #include "cmmmbmsmonitoredlist.h"
    35 #include "cmmmbmsmonitoredlist.h"
    36 
    36 
    37 // ======== MEMBER FUNCTIONS ========
    37 // ======== MEMBER FUNCTIONS ========
    38 
    38 
    39 CMmPacketServiceTsy::CMmPacketServiceTsy()
    39 CMmPacketServiceTsy::CMmPacketServiceTsy():
       
    40     iReqHandleType(EMultimodePacketServiceReqHandleUnknown)
    40     {
    41     {
    41     }
    42     }
    42 
    43 
    43 CMmPacketServiceTsy* CMmPacketServiceTsy::NewL(
    44 CMmPacketServiceTsy* CMmPacketServiceTsy::NewL(
    44         CMmPhoneTsy* const aMmPhone,           
    45         CMmPhoneTsy* const aMmPhone,           
   773         CMmPacketServiceTsy::ReqCompleted( reqHandle, aError );
   774         CMmPacketServiceTsy::ReqCompleted( reqHandle, aError );
   774         }
   775         }
   775     if ( RPacketService::EAttachWhenPossible == iAttachMode )
   776     if ( RPacketService::EAttachWhenPossible == iAttachMode )
   776         {
   777         {
   777         SetAttachModeL( &iAttachMode );
   778         SetAttachModeL( &iAttachMode );
       
   779         iReqHandleType = EMultimodePacketServiceReqHandleUnknown;
   778         }
   780         }
   779     }
   781     }
   780     
   782     
   781 //----------------------------------------------------------------------------
   783 //----------------------------------------------------------------------------
   782 // CMmPacketServiceTsy::EnumerateContexts
   784 // CMmPacketServiceTsy::EnumerateContexts
  1964 TFLOGSTRING2("TSY: CMmPacketServiceTsy::ExtFunc. IPC: %d", aIpc );
  1966 TFLOGSTRING2("TSY: CMmPacketServiceTsy::ExtFunc. IPC: %d", aIpc );
  1965 
  1967 
  1966     TInt ret( KErrNone );
  1968     TInt ret( KErrNone );
  1967     TInt trapError( KErrNone );
  1969     TInt trapError( KErrNone );
  1968 
  1970 
  1969     // Reset request handle type
  1971     // Ensure the ReqHandleType is unset.
  1970     iReqHandleType = EMultimodePacketServiceReqHandleUnknown;
  1972     // This will detect cases where this method indirectly calls itself
  1971 
  1973     // (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
       
  1974     // Such cases are not supported because iReqHandleType is in the context of this class instance,
       
  1975     // not this request, and we don't want the values set by the inner request and the outer request
       
  1976     // interfering with each other.
       
  1977     __ASSERT_DEBUG(iReqHandleType==EMultimodePacketServiceReqHandleUnknown, User::Invariant());
       
  1978     
  1972     // Set tsy request handle
  1979     // Set tsy request handle
  1973     iTsyReqHandle = aTsyReqHandle;
  1980     iTsyReqHandle = aTsyReqHandle;
  1974 
  1981 
  1975     // Call DoExtFuncL()
  1982     // Call DoExtFuncL()
  1976     TRAP( trapError, ret = DoExtFuncL( aIpc, aPackage ); );
  1983     TRAP( trapError, ret = DoExtFuncL( aIpc, aPackage ); );
  1991 #ifdef REQHANDLE_TIMER
  1998 #ifdef REQHANDLE_TIMER
  1992         SetTypeOfResponse( iReqHandleType );
  1999         SetTypeOfResponse( iReqHandleType );
  1993 #else
  2000 #else
  1994         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, iTsyReqHandle );
  2001         iTsyReqHandleStore->SetTsyReqHandle( iReqHandleType, iTsyReqHandle );
  1995 #endif // REQHANDLE_TIMER
  2002 #endif // REQHANDLE_TIMER
  1996 
  2003         // We've finished with this value now. Clear it so it doesn't leak
       
  2004         //  up to any other instances of this method down the call stack
       
  2005         iReqHandleType = EMultimodePacketServiceReqHandleUnknown;
  1997         }
  2006         }
  1998 
  2007 
  1999     return KErrNone;
  2008     return KErrNone;
  2000     }
  2009     }
  2001 
  2010 
  2353     {
  2362     {
  2354 TFLOGSTRING3("TSY: CMmPacketServiceTsy::CancelService. IPC: %d Tsy Req Handle:%d", aIpc, aTsyReqHandle);
  2363 TFLOGSTRING3("TSY: CMmPacketServiceTsy::CancelService. IPC: %d Tsy Req Handle:%d", aIpc, aTsyReqHandle);
  2355 
  2364 
  2356     TInt ret( KErrNone );
  2365     TInt ret( KErrNone );
  2357     
  2366     
  2358     // Reset last tsy request type
  2367     // Ensure the ReqHandleType is unset.
  2359     iReqHandleType = EMultimodePacketServiceReqHandleUnknown;
  2368     // This will detect cases where this method indirectly calls itself
       
  2369     // (e.g. servicing a client call that causes a self-reposting notification to complete and thus repost).
       
  2370     // Such cases are not supported because iReqHandleType is in the context of this class instance,
       
  2371     // not this request, and we don't want the values set by the inner request and the outer request
       
  2372     // interfering with each other.
       
  2373     __ASSERT_DEBUG(iReqHandleType==EMultimodePacketServiceReqHandleUnknown, User::Invariant());
  2360 
  2374 
  2361     // When the clients close their sub-sessions (eg. by calling
  2375     // When the clients close their sub-sessions (eg. by calling
  2362     // RPacketService::Close), they may not have cancelled all their
  2376     // RPacketService::Close), they may not have cancelled all their
  2363     // outstanding asynchronous requests before closing.  It is up to the ETel
  2377     // outstanding asynchronous requests before closing.  It is up to the ETel
  2364     // server to clean up in this situation, so the server will find the list
  2378     // server to clean up in this situation, so the server will find the list
  2366     // these outstanding IPC request numbers, one at a time, to the
  2380     // these outstanding IPC request numbers, one at a time, to the
  2367     // CancelService method in the TSY.
  2381     // CancelService method in the TSY.
  2368 
  2382 
  2369     switch ( aIpc )
  2383     switch ( aIpc )
  2370         {
  2384         {
  2371 
       
  2372         case EPacketNotifyContextAdded:
  2385         case EPacketNotifyContextAdded:
  2373             iNotifyDataPointers.iContextAdded = NULL;
  2386             iNotifyDataPointers.iContextAdded = NULL;
  2374             iReqHandleType = EMultimodePacketServiceNotifyContextAdded;
  2387             iReqHandleType = EMultimodePacketServiceNotifyContextAdded;
  2375             break;
  2388             break;
  2376         case EPacketNotifyStatusChange:
  2389         case EPacketNotifyStatusChange:
  2469         // Reset tsy request handle
  2482         // Reset tsy request handle
  2470         iTsyReqHandleStore->ResetTsyReqHandle( iReqHandleType );
  2483         iTsyReqHandleStore->ResetTsyReqHandle( iReqHandleType );
  2471 
  2484 
  2472         // Complete request with KErrCancel
  2485         // Complete request with KErrCancel
  2473         CMmPacketServiceTsy::ReqCompleted( aTsyReqHandle, KErrCancel );
  2486         CMmPacketServiceTsy::ReqCompleted( aTsyReqHandle, KErrCancel );
       
  2487         
       
  2488         // We've finished with this value now. Clear it so it doesn't leak
       
  2489         //  up to any other instances of this method down the call stack
       
  2490         iReqHandleType = EMultimodePacketServiceReqHandleUnknown;
  2474         }
  2491         }
  2475 
  2492 
  2476     return ret;
  2493     return ret;
  2477     }
  2494     }
  2478 
  2495 
  2873  	return ret;	
  2890  	return ret;	
  2874     
  2891     
  2875     }
  2892     }
  2876 
  2893 
  2877 //----------------------------------------------------------------------------
  2894 //----------------------------------------------------------------------------
  2878 // CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceListL
  2895 // CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceList
  2879 // Completes update monitored service list request
  2896 // Completes update monitored service list request
  2880 //----------------------------------------------------------------------------
  2897 //----------------------------------------------------------------------------
  2881 //
  2898 //
  2882 void CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceList( 
  2899 void CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceList( 
  2883     CMmDataPackage* aDataPackage, 
  2900     CMmDataPackage* aDataPackage, 
  2884     const TInt aResult)
  2901     const TInt aResult)
  2885 	{
  2902 	{
  2886 	TFLOGSTRING( "TSY: CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceListL." );
  2903 	TFLOGSTRING( "TSY: CMmPacketServiceTsy::CompleteUpdateMbmsMonitorServiceListL." );
  2887 
  2904 
  2888 	TInt result= aResult;
  2905 	TInt result= aResult;
       
  2906 	TInt err(KErrNone);
  2889 	// Reset request handle. Returns the deleted request handle
  2907 	// Reset request handle. Returns the deleted request handle
  2890 	const TTsyReqHandle reqHandle( iTsyReqHandleStore->ResetTsyReqHandle(
  2908 	const TTsyReqHandle reqHandle( iTsyReqHandleStore->ResetTsyReqHandle(
  2891 	        EMultimodePacketServiceUpdateMBMSMonitorServiceList ) );
  2909 	        EMultimodePacketServiceUpdateMBMSMonitorServiceList ) );
  2892 	        
  2910 	        
  2893 	if( aResult == KErrNone )
  2911 	if( aResult == KErrNone )
  2894 		{
  2912 		{
  2895 		result = iMBMSMonitoredList->ProcessEntriesL(NULL, iActionType);
  2913 		TRAP( err, result = iMBMSMonitoredList->ProcessEntriesL( NULL, iActionType ) );
  2896         CompleteNotifyMbmsServiceAvailabilityChangeL( NULL, aResult );		
  2914 		if ( !err )
       
  2915 		    TRAP( err, CompleteNotifyMbmsServiceAvailabilityChangeL( NULL, aResult ) );		
  2897 		}
  2916 		}
  2898 	//there were problem managing entries
  2917 	//there were problem managing entries
  2899 	else if( (aResult == KErrMbmsImpreciseServiceEntries) && (aDataPackage != NULL) )
  2918 	else if( (aResult == KErrMbmsImpreciseServiceEntries) && (aDataPackage != NULL) )
  2900 		{
  2919 		{
  2901 		CPcktMbmsMonitoredServiceList* failedMonitorEntries = NULL;
  2920 		CPcktMbmsMonitoredServiceList* failedMonitorEntries = NULL;
  2902 		aDataPackage->UnPackData( &failedMonitorEntries ); 
  2921 		aDataPackage->UnPackData( &failedMonitorEntries ); 
  2903 		// there were a problems with some entries, 
  2922 		// there were a problems with some entries, 
  2904 		// Check failed entries exists and add succesful entries to main list
  2923 		// Check failed entries exists and add succesful entries to main list
  2905 		if( failedMonitorEntries != NULL )
  2924 		if( failedMonitorEntries != NULL )
  2906 			{
  2925 			{
  2907 			iMBMSMonitoredList->ProcessEntriesL( failedMonitorEntries, iActionType );
  2926 			TRAP( err, iMBMSMonitoredList->ProcessEntriesL( failedMonitorEntries, iActionType ) );
  2908 			}
  2927 			}
  2909 		else // There was a general error, don't add anything to main list
  2928 		else // There was a general error, don't add anything to main list
  2910 			{
  2929 			{
  2911 			iMBMSMonitoredList->ResetTempListL();
  2930 			TRAP( err, iMBMSMonitoredList->ResetTempListL() );
  2912 			}
  2931 			}
  2913 		}
  2932 		}
  2914 	 if( EMultimodePacketServiceReqHandleUnknown != reqHandle )
  2933 	 if( EMultimodePacketServiceReqHandleUnknown != reqHandle )
  2915 		 {
  2934 		 {
       
  2935          // If there was an error due to a function leaving, complete to the client with that error.
       
  2936          if (err)
       
  2937              {
       
  2938              result = err;
       
  2939              }
  2916 		 //complete with error to client
  2940 		 //complete with error to client
  2917 		 CMmPacketServiceTsy::ReqCompleted( reqHandle, result );
  2941 		 CMmPacketServiceTsy::ReqCompleted( reqHandle, result );
  2918 		 }
  2942 		 }
  2919 	    
  2943 	    
  2920 	}
  2944 	}