sipvoipprovider/svptransfer/src/svptransferidlestate.cpp
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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:  Transfer state representing the idle state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "svptransferidlestate.h"
       
    20 #include "svptransferstatecontext.h"
       
    21 #include "svptransferobserver.h"                // MSVPTransferObserver
       
    22 #include "svplogger.h"
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // CSVPTransferIdleState::CSVPTransferIdleState
       
    26 // ---------------------------------------------------------------------------
       
    27 //
       
    28 CSVPTransferIdleState::CSVPTransferIdleState()
       
    29     {
       
    30     }
       
    31 
       
    32 // ---------------------------------------------------------------------------
       
    33 // CSVPTransferIdleState::NewLC
       
    34 // ---------------------------------------------------------------------------
       
    35 //
       
    36 CSVPTransferIdleState* CSVPTransferIdleState::NewLC()
       
    37     {
       
    38     CSVPTransferIdleState* self = new( ELeave ) CSVPTransferIdleState;
       
    39     CleanupStack::PushL( self );
       
    40     return self;
       
    41     }
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CSVPTransferIdleState::~CSVPTransferIdleState
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 CSVPTransferIdleState::~CSVPTransferIdleState()
       
    48     {
       
    49     }    
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 // CSVPTransferIdleState::DoApplyL
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 void CSVPTransferIdleState::DoApplyL( CSVPTransferStateContext& aContext )
       
    56     {
       
    57     SVPDEBUG1( "CSVPTransferIdleState::DoApplyL In" )
       
    58 
       
    59     if ( KSVPTransferIdleStateIndex  == aContext.CurrentState() )         
       
    60         {          
       
    61         if ( !aContext.IsIncoming() )
       
    62             {                
       
    63             // Execute the refer, creates mce out event. 
       
    64             TRAPD( err, aContext.ExecuteReferL() );
       
    65                                                                   
       
    66             if ( KErrNone != err )
       
    67                 {
       
    68                 SVPDEBUG2( "CSVPTransferIdleState::DoApplyL: error: %i", err )
       
    69                 // Notify the observer about the error.
       
    70                 aContext.TransferObserver().TransferFailed( err );
       
    71                 // Set and apply to the terminating state
       
    72                 aContext.SetCurrentStateL( KSVPTransferTerminatingStateIndex );
       
    73                 aContext.ApplyCurrentStateL();
       
    74                 User::Leave( err );
       
    75                 }
       
    76             }
       
    77         
       
    78         // Set and apply the next state - transfer pending
       
    79         aContext.SetCurrentStateL( KSVPTransferPendingStateIndex );
       
    80         aContext.ApplyCurrentStateL();
       
    81         }
       
    82     else
       
    83         {
       
    84         // Notify the observer about the error.
       
    85         aContext.TransferObserver().TransferFailed( KSVPErrTransferStateError );
       
    86         }
       
    87     
       
    88     SVPDEBUG1( "CSVPTransferIdleState::DoApplyL Out" )
       
    89     }
       
    90 
       
    91 // ---------------------------------------------------------------------------
       
    92 // CSVPTransferIdleState::DoEnter
       
    93 // ---------------------------------------------------------------------------
       
    94 //
       
    95 void CSVPTransferIdleState::DoEnter( CSVPTransferStateContext& /*aContext*/ )
       
    96     {
       
    97     }
       
    98