phoneengine/servicehandling/src/cpeservicehandling.cpp
branchRCL_3
changeset 24 41a7f70b3818
parent 6 38529f706030
child 25 5266b1f337bd
--- a/phoneengine/servicehandling/src/cpeservicehandling.cpp	Thu Aug 19 09:54:27 2010 +0300
+++ b/phoneengine/servicehandling/src/cpeservicehandling.cpp	Tue Aug 31 15:14:29 2010 +0300
@@ -20,8 +20,8 @@
 #include <mpedatastore.h>
 #include <pevirtualengine.h>
 #include <e32debug.h>
-#include <talogger.h>
 
+#include "talogger.h"
 #include "cpeservicehandling.h"
 
 // ======== MEMBER FUNCTIONS ========
@@ -75,223 +75,28 @@
 EXPORT_C CPEServiceHandling::~CPEServiceHandling()
     {
     TEFLOGSTRING( KTAOBJECT, "PE CPEServiceHandling::~CPEServiceHandling" );
-    delete iCchClient;
     }
 
 // ---------------------------------------------------------------------------
 // CPEServiceHandling::EnableService
 // ---------------------------------------------------------------------------
 //
-void CPEServiceHandling::EnableServiceL( TInt aServiceId )
-	{
+void CPEServiceHandling::EnableServiceL( TInt /*aServiceId*/ )
+    {
     TEFLOGSTRING( KTAREQIN, "PE CPEServiceHandling::EnableServiceL" );
-	
-    if ( !iCchClient )
-        {
-        iCchClient = CCch::NewL();
-        }
-
-	CCchService* service = iCchClient->GetService( aServiceId );
-	
-	TInt error( KErrNotFound );
-	if( service )
-		{
-		iCurrentServiceId = aServiceId;
-		
-		TCchServiceStatus serviceStatus;
- 		error = service->GetStatus( ECCHVoIPSub, serviceStatus );
-		TCCHSubserviceState state = serviceStatus.State();
-	
-		if( error == KErrNone )
-		    {
-		    if ( serviceStatus.Error() == KErrNone )
-		        {
-		        error = EnableServiceIfNeeded( state, *service );
-		        }
-		    else
-		        {
-		        TEFLOGSTRING2( KTAERROR,
-		                "PE CPEServiceHandling::EnableServiceL, error: %d"
-		                , serviceStatus.Error() );
-		        SendErrorMessage( serviceStatus.Error());
-		        }
-    		}
-		}
-	
-	if ( error != KErrNone )
-	    {
-	    if ( error == KErrNotFound )
-	         {
-	         iModel.SendMessage( MEngineMonitor::EPEMessageNoService );
-	         }
-	     else
-	         {
-	         TEFLOGSTRING2( KTAERROR,
-	                  "PE CPEServiceHandling::EnableServiceL, Error: %d"
-	                  , error );
-	         SendErrorMessage( error );
-	       
-             iCurrentServiceId = KErrNotFound;
-             service->RemoveObserver( *this );	
-	         }
-	    }
-	
-	TEFLOGSTRING2( KTAINT, 
-            "PE CPEServiceHandling::EnableServiceL, error: %d", error );		
-	}
-
-// ---------------------------------------------------------------------------
-// CPEServiceHandling::EnableServiceIfNeeded
-// ---------------------------------------------------------------------------
-//
-TInt CPEServiceHandling::EnableServiceIfNeeded( 
-        const TCCHSubserviceState& aState, 
-        CCchService& aService )
-    {
-    TEFLOGSTRING( KTAINT, "PE CPEServiceHandling::EnableServiceIfNeeded" );
-    TInt error = KErrNone;
-    
-    TEFLOGSTRING2( KTAINT, 
-            "PE CPEServiceHandling::EnableServiceIfNeeded, aState: %d", aState );
-    switch ( aState )
-        {
-        case ECCHEnabled:
-            {
-            iModel.SendMessage( MEngineMonitor::EPEMessageServiceEnabled );
-            }
-            break;
-        case ECCHUninitialized:
-        case ECCHDisabled:
-        case ECCHConnecting:
-            {
-            // Temporary solution, it will be fixed as soon as possible. 
-            // Message have to send before enable is called. Reason is so that progress bar 
-            //(global note) doesn't hide Networks's "Connection Needed" global note.
-            iModel.SendMessage( MEngineMonitor::EPEMessageServiceEnabling );
-            aService.AddObserver( *this );
-            error = aService.Enable( ECCHUnknown );  
-            }
-            break;
-        case ECCHDisconnecting:
-            {
-            error = KErrNotFound;
-            }
-            break;
-        default:
-            break;
-        }
-    TEFLOGSTRING2( KTAINT, 
-            "PE CPEServiceHandling::EnableServiceIfNeeded, error: %d", error );
-    return error;
+    User::LeaveIfError( 0 );
+    iModel.SendMessage( MEngineMonitor::EPEMessageServiceEnabled );
     }
     
 // ---------------------------------------------------------------------------
-// CPEServiceHandling::ServiceStatusChanged
-// ---------------------------------------------------------------------------
-//
-void CPEServiceHandling::ServiceStatusChanged(
-    TInt aServiceId,
-	const TCCHSubserviceType aType,
-	const TCchServiceStatus& aServiceStatus )
-	{
-	TEFLOGSTRING( KTAINT, "PE CPEServiceHandling::ServiceStatusChanged <" );
-	
-	if( aServiceId == iCurrentServiceId && aType == ECCHVoIPSub )
-	    {
-    	TEFLOGSTRING3( KTAINT,
-    	        "PE CPEServiceHandling::ServiceStatusChanged, state: %d, error: %d"
-    	        , aServiceStatus.State()
-    	        , aServiceStatus.Error() );
-
-       	CCchService* service = iCchClient->GetService( aServiceId );
-       	if( service )
-       	    {
-    	    if( aServiceStatus.Error() != KErrNone )
-    	        {
-    	        TEFLOGSTRING( KTAERROR, 
-    	                "PE CPEServiceHandling::ServiceStatusChanged, error" );
-    	        SendErrorMessage( aServiceStatus.Error());
-    	        CancelServiceEnabling();
-    	        }
-    	    else 
-    	        {
-    	        if( aServiceStatus.State() == ECCHEnabled )
-    	            {
-                    TEFLOGSTRING( KTAINT, 
-                             "PE CPEServiceHandling::ServiceStatusChanged, enabled" );
-                    iModel.SendMessage( MEngineMonitor::EPEMessageServiceEnabled );
-    	            }
-
-
-    	        // Notify UI, that service is disabled.
-    	        else if( aServiceStatus.State() == ECCHDisabled ) 
-                     {
-                     TEFLOGSTRING( KTAERROR, 
-                              "PE CPEServiceHandling::ServiceStatusChanged, disabled" );
-                     iModel.SendMessage( MEngineMonitor::EPEMessageServiceDisabled );
-                     }
-    	        }
-    	    
-    	    // don't remove observer, if state are connecting or disconnecting
-    	    if ( aServiceStatus.State() != ECCHConnecting && 
-    	         aServiceStatus.State() != ECCHDisconnecting )
-    	        {
-    	        service->RemoveObserver( *this );
-    	        }
-       	    }//if( service )
-       	else
-       	    {
-            TEFLOGSTRING( KTAERROR, 
-                    "PE CPEServiceHandling::ServiceStatusChanged, no service" );
-       	    }
-	    }
-	TEFLOGSTRING( KTAINT, "PE CPEServiceHandling::ServiceStatusChanged >" );
-	}
-	
-// ---------------------------------------------------------------------------
 // CPEServiceHandling::CancelServiceEnabling
 // ---------------------------------------------------------------------------
 //
 void CPEServiceHandling::CancelServiceEnabling() const
     {
     TEFLOGSTRING( KTAREQIN, "PE CPEServiceHandling::CancelServiceEnabling" );
-    
-    if ( iCchClient )
-        {
-        CCchService* service = iCchClient->GetService( iCurrentServiceId );
+    }
         
-        if ( service )
-            {
-            TCchServiceStatus serviceStatus;
-            TInt error = service->GetStatus( ECCHVoIPSub, serviceStatus );
-            TCCHSubserviceState state = serviceStatus.State();
-            
-            // Disable only, if service is connecting state
-            if ( error == KErrNone && state == ECCHConnecting )
-                {
-                TEFLOGSTRING( KTAREQOUT,
-                  "PE CPEServiceHandling::CancelServiceEnabling, CCchService->Disable" );
-                service->Disable( ECCHUnknown );
-                }
-            }
-        }
-    }
-		
-// -----------------------------------------------------------------------------
-// CPEServiceHandling::SendErrorMessage
-// -----------------------------------------------------------------------------
-//
-void CPEServiceHandling::SendErrorMessage(
-        TInt aErrorCode )
-    {
-    TEFLOGSTRING2( KTAINT, 
-        "PE CPEServiceHandling::SendErrorMessage, aErrorCode: %d", 
-        aErrorCode );
-
-    iModel.DataStore()->SetErrorCode( aErrorCode );
-    iModel.SendMessage( MEngineMonitor::EPEMessageServiceHandlingError );
-    }
-
 // -----------------------------------------------------------------------------
 // CPEServiceHandling::DisableService
 // -----------------------------------------------------------------------------
@@ -299,15 +104,6 @@
 void CPEServiceHandling::DisableService() const
     {
     TEFLOGSTRING( KTAREQIN, "PE CPEServiceHandling::DisableService" );
-
-    CCchService* service = iCchClient->GetService( iCurrentServiceId );
-    
-    if ( service )
-        {
-        TEFLOGSTRING( KTAREQOUT,
-          "PE CPEServiceHandling::DisableService, CCchService->Disable" );
-        service->Disable( ECCHUnknown );
-        }
-    }
+    } 
 
 //  End of File