voipplugins/sipconnectionprovider/src/scpdisabled.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     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 "scpdisabled.h"
       
    20 #include "scpsubservice.h"
       
    21 #include "scpservicehandlerbase.h"
       
    22 #include "scplogger.h"
       
    23 #include "scputility.h"
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // TScpDisabled::CTScpDisabled
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 TScpDisabled::TScpDisabled()
       
    30     {
       
    31     SCPLOGSTRING( "TScpDisabled::TScpDisabled" );
       
    32     }
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // TScpDisabled::State
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 TCCHSubserviceState TScpDisabled::State() const
       
    39     {
       
    40     SCPLOGSTRING( "TScpDisabled::State" );
       
    41 
       
    42     return ECCHDisabled;
       
    43     }
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // TScpDisabled::EnableL
       
    47 // -----------------------------------------------------------------------------
       
    48 //
       
    49 void TScpDisabled::EnableL( CScpSubService& aSubService ) const
       
    50     {
       
    51     SCPLOGSTRING( "TScpDisabled::EnableL" );
       
    52 
       
    53     aSubService.SetSubServiceDisconnected( EFalse );
       
    54     aSubService.SetEnableRequestedState( CScpSubService::EScpEnabled );
       
    55 
       
    56     CScpServiceHandlerBase& handler = aSubService.ServiceHandler();
       
    57     TRAPD( error, handler.EnableSubServiceL() );
       
    58 
       
    59     if ( KErrNoMemory == error )
       
    60         {
       
    61         User::Leave( error );
       
    62         }
       
    63     
       
    64     if( error != KErrNone )
       
    65         {
       
    66         TInt cchError = TScpUtility::ConvertToCchError( error );
       
    67         if( cchError != KErrUnknown ) 
       
    68             {
       
    69             ChangeState( aSubService, ECCHConnecting, cchError );
       
    70             }
       
    71         else
       
    72             {
       
    73             // If another sub service is already in use, no need to
       
    74             // leave
       
    75             if( error != KErrInUse )
       
    76                 {
       
    77                 User::LeaveIfError( error );
       
    78                 }
       
    79             }
       
    80         }
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // TScpDisabled::NetworkFound
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void TScpDisabled::NetworkFound( CScpSubService& aSubService ) const
       
    88     {
       
    89     SCPLOGSTRING( "TScpDisabled::NetworkFound" );
       
    90 
       
    91     ChangeState( aSubService, ECCHConnecting, KErrNone );
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // TScpDisabled::NetworkNotFound
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void TScpDisabled::NetworkNotFound( CScpSubService& aSubService ) const
       
    99     {
       
   100     SCPLOGSTRING( "TScpDisabled::NetworkNotFound" );
       
   101 
       
   102     // This is because some other app has enabled sip profile
       
   103     // and we move from disabled to connecting. But should the update
       
   104     // be done at all? See ServiceManager::UpdateService
       
   105 
       
   106     ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
       
   107     }
       
   108 
       
   109 // -----------------------------------------------------------------------------
       
   110 // TScpDisabled::NetworkLost
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void TScpDisabled::NetworkLost( CScpSubService& aSubService ) const
       
   114     {
       
   115     SCPLOGSTRING( "TScpDisabled::NetworkLost" );
       
   116 
       
   117     ChangeState( aSubService, ECCHConnecting, KCCHErrorNetworkLost );
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // TScpDisabled::ServiceConnected
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void TScpDisabled::ServiceConnected( CScpSubService& aSubService ) const
       
   125     {
       
   126     SCPLOGSTRING( "TScpDisabled::ServiceConnected" );
       
   127 
       
   128     ChangeState( aSubService, ECCHEnabled, KErrNone );
       
   129     }
       
   130 
       
   131 //  End of File