voipplugins/sipconnectionprovider/src/scpconnectingservice.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "scpconnectingservice.h"
       
    20 #include "scpservicehandlerbase.h"
       
    21 #include "scpsubservice.h"
       
    22 #include "scplogger.h"
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // TScpConnectingService::TScpConnectingService
       
    26 // -----------------------------------------------------------------------------
       
    27 //
       
    28 TScpConnectingService::TScpConnectingService()
       
    29     {
       
    30     SCPLOGSTRING( "TScpConnectingService::TScpConnectingService" );
       
    31     }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // TScpConnectingService::State
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 TCCHSubserviceState TScpConnectingService::State() const
       
    38     {
       
    39     SCPLOGSTRING( "TScpConnectingService::State" );
       
    40 
       
    41     return ECCHConnecting;
       
    42     }
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // TScpConnectingService::EnableL
       
    46 // -----------------------------------------------------------------------------
       
    47 //
       
    48 void TScpConnectingService::EnableL( CScpSubService& aSubService ) const
       
    49     {
       
    50     SCPLOGSTRING( "TScpConnectingService::EnableL" );
       
    51 
       
    52     // Launch refresh only if the sub service is in error condition
       
    53     // no need to launch refresh if connected iap is not supported -> 
       
    54     // just wait until valid iap is available
       
    55     if( aSubService.LastReportedError() != KErrNone && 
       
    56         aSubService.LastReportedError() != KErrNotSupported )
       
    57         {
       
    58         aSubService.SetEnableRequestedState( CScpSubService::EScpRefreshed );
       
    59         User::LeaveIfError( aSubService.Disable() );
       
    60         }
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // TScpConnectingService::Disable
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 TInt TScpConnectingService::Disable( CScpSubService& aSubService ) const
       
    68     {
       
    69     SCPLOGSTRING( "TScpConnectingService::Disable" );
       
    70 
       
    71     if( aSubService.EnableRequestedState() != CScpSubService::EScpRefreshed )
       
    72         { 
       
    73         aSubService.SetEnableRequestedState( CScpSubService::EScpDisabled );
       
    74         }
       
    75         
       
    76     CScpServiceHandlerBase& handler = aSubService.ServiceHandler();
       
    77     TInt result = handler.DisableSubService();
       
    78 
       
    79     ChangeState( aSubService, ECCHDisconnecting, KErrNone );
       
    80 
       
    81     return result;
       
    82     }
       
    83 
       
    84 // -----------------------------------------------------------------------------
       
    85 // TScpConnectingService::NetworkNotFound
       
    86 // -----------------------------------------------------------------------------
       
    87 //
       
    88 void TScpConnectingService::NetworkNotFound( CScpSubService& aSubService ) const
       
    89     {
       
    90     SCPLOGSTRING( "TScpConnectingService::NetworkNotFound" );
       
    91     
       
    92     ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // TScpConnectingService::NetworkLost
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 void TScpConnectingService::NetworkLost( CScpSubService& aSubService ) const
       
   100     {
       
   101     SCPLOGSTRING( "TScpConnectingService::NetworkLost" );
       
   102     
       
   103     ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
       
   104     }
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // TScpConnectingService::ServiceConnectionFailed
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void TScpConnectingService::ServiceConnectionFailed( CScpSubService& aSubService ) const
       
   111     {
       
   112     SCPLOGSTRING( "TScpConnectingService::ServiceConnectionFailed" );
       
   113 
       
   114     ChangeState( aSubService, ECCHConnecting, KCCHErrorLoginFailed );
       
   115     }
       
   116 
       
   117 // -----------------------------------------------------------------------------
       
   118 // TScpConnectingService::ServiceInvalidSettings
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 void TScpConnectingService::ServiceInvalidSettings( CScpSubService& aSubService ) const
       
   122     {
       
   123     SCPLOGSTRING( "TScpConnectingService::ServiceInvalidSettings" );
       
   124 
       
   125     ChangeState( aSubService, ECCHConnecting, KCCHErrorInvalidSettings );
       
   126     }
       
   127 
       
   128 // -----------------------------------------------------------------------------
       
   129 // TScpConnectingService::ServiceConnected
       
   130 // -----------------------------------------------------------------------------
       
   131 //
       
   132 void TScpConnectingService::ServiceConnected( CScpSubService& aSubService ) const
       
   133     {
       
   134     SCPLOGSTRING( "TScpConnectingService::ServiceConnected" );
       
   135 
       
   136     ChangeState( aSubService, ECCHEnabled, KErrNone );
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------------------------
       
   140 // TScpConnectingService::ServiceDisconnected
       
   141 // -----------------------------------------------------------------------------
       
   142 //
       
   143 void TScpConnectingService::ServiceDisconnected( CScpSubService& aSubService ) const
       
   144     {
       
   145     SCPLOGSTRING( "TScpConnectingService::ServiceDisconnected" );
       
   146 
       
   147     ChangeState( aSubService, ECCHConnecting, KCCHErrorServiceNotResponding );
       
   148     }
       
   149 
       
   150 // -----------------------------------------------------------------------------
       
   151 // TScpConnectingService::BandwidthLimited
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 void TScpConnectingService::BandwidthLimited( CScpSubService& aSubService ) const
       
   155     {
       
   156     SCPLOGSTRING( "TScpConnectingService::BandwidthLimited" );
       
   157     
       
   158     ChangeState( aSubService, ECCHEnabled, KCCHErrorBandwidthInsufficient ); 
       
   159     }
       
   160 
       
   161 // -----------------------------------------------------------------------------
       
   162 // TScpConnectingService::AuthenticationFailed
       
   163 // -----------------------------------------------------------------------------
       
   164 //
       
   165 void TScpConnectingService::AuthenticationFailed( CScpSubService& aSubService ) const
       
   166     {
       
   167     SCPLOGSTRING( "TScpConnectingService::AuthenticationFailed" );
       
   168     
       
   169     ChangeState( aSubService, ECCHConnecting, KCCHErrorAuthenticationFailed ); 
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // TScpConnectingService::ServiceConnectionCanceled
       
   174 // -----------------------------------------------------------------------------
       
   175 //
       
   176 void TScpConnectingService::ServiceConnectionCanceled( CScpSubService& aSubService ) const
       
   177     {
       
   178     SCPLOGSTRING( "TScpConnectingService::ServiceConnectionCanceled" );
       
   179     
       
   180     ChangeState( aSubService, ECCHDisabled, KErrCancel ); 
       
   181     }
       
   182 
       
   183 // -----------------------------------------------------------------------------
       
   184 // TScpConnectingService::BearerNotSupported
       
   185 // -----------------------------------------------------------------------------
       
   186 //
       
   187 void TScpConnectingService::BearerNotSupported( CScpSubService& aSubService ) const
       
   188     {
       
   189     SCPLOGSTRING( "TScpConnectingService::BearerNotSupported" );
       
   190     
       
   191     ChangeState( aSubService, ECCHConnecting, KErrNotSupported ); 
       
   192     }
       
   193 
       
   194 //  End of File