callcontinuity/vcc/src/tvccstatereleasing.cpp
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2007-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:   Implementation for the VCC Releasing state
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "tvccstatereleasing.h"
       
    21 #include "cvccperformer.h"
       
    22 #include "rubydebug.h"
       
    23 
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // c'tor
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 
       
    30 TVccStateReleasing::TVccStateReleasing()
       
    31 	{
       
    32 	RUBY_DEBUG_BLOCK( "TVccStateReleasing::TVccStateReleasing" );	
       
    33 	} 
       
    34 
       
    35 // -----------------------------------------------------------------------------
       
    36 // Name
       
    37 // -----------------------------------------------------------------------------
       
    38 //	
       
    39 TUint TVccStateReleasing::Name() const
       
    40 	{
       
    41 	RUBY_DEBUG_BLOCK( "TVccStateReleasing::Name" );
       
    42 	return KVccStateReleasing;
       
    43 	}
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // LinkState
       
    47 // -----------------------------------------------------------------------------
       
    48 //	
       
    49 void TVccStateReleasing::LinkState(TVccState& aInit)
       
    50 	{
       
    51 	RUBY_DEBUG_BLOCK( "TVccStateReleasing::LinkState" );
       
    52 	iInit = &aInit;
       
    53 	}
       
    54 	
       
    55 // -----------------------------------------------------------------------------
       
    56 // CallStateChanged
       
    57 // -----------------------------------------------------------------------------
       
    58 //	
       
    59 void TVccStateReleasing::CallStateChanged( CVccPerformer& aContext, 
       
    60                                 const MCCPCallObserver::TCCPCallState aState,
       
    61                                 MCCPCall* aCall )
       
    62 	{
       
    63 	RUBY_DEBUG_BLOCK( "TVccStateReleasing::CallStateChanged" );
       
    64 	__ASSERT_DEBUG( aContext.CallObserver()!=NULL, User::Invariant() );
       
    65 	__ASSERT_DEBUG(aContext.PrimaryCall()!=NULL, User::Invariant());
       
    66 	__ASSERT_DEBUG(aCall != NULL, User::Invariant());
       
    67 	if (aState == MCCPCallObserver::ECCPStateIdle )
       
    68 		{
       
    69 		//delete the actuall call object and move to the Init state
       
    70 		if( aCall == aContext.PrimaryCall() )
       
    71 		    {
       
    72 		    ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, KVccHoNok );
       
    73 		    aContext.CallObserver()->CallStateChanged( aState, aCall );
       
    74 		    }
       
    75 		else
       
    76 		    {
       
    77 		    ReleaseCall( aContext, *aContext.SecondaryCall(), *iInit, KVccHoOk );
       
    78 		                
       
    79 		    }
       
    80 		    
       
    81 		}
       
    82 	//for some reason the old leg hasnt been released, so new leg's events must
       
    83 	//be passed forward. 
       
    84 	else if( aCall == aContext.PrimaryCall() ) 
       
    85 	    {
       
    86 	    aContext.CallObserver()->CallStateChanged( aState, aCall );
       
    87 	    }
       
    88 		
       
    89 	}
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // From MCCPCallObserver, new leg events need to go through even when 
       
    93 // old leg has not yet been disconnected
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void TVccStateReleasing::CallEventOccurred( CVccPerformer& aContext, 
       
    97                                   const MCCPCallObserver::TCCPCallEvent aEvent,
       
    98                                   MCCPCall* aCall)
       
    99     {
       
   100     if( aCall == aContext.PrimaryCall() ) 
       
   101         {
       
   102         aContext.CallObserver()->CallEventOccurred( aEvent, 
       
   103                                                     aContext.PrimaryCall());
       
   104         }
       
   105     }