convergedcallengine/csplugin/src/cspclientvoicecall.cpp
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:15:03 +0100
branchRCL_3
changeset 20 987c9837762f
parent 0 ff3b6d0fd310
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Implements class CSPClientVoiceCall which provides call functionality
*
*/


#include <etelmm.h>
#include <etel.h>
#include <mccpcallobserver.h>
#include <cccecallparameters.h>

#include "cspclientvoicecall.h"
#include "csplogger.h"
#include "csppanic.pan"
#include "cspconsts.h"
#include "mcspcommoninfo.h"


// ---------------------------------------------------------------------------
// CSPClientVoiceCall::NewL Two phased construction.
// ---------------------------------------------------------------------------
//
CSPClientVoiceCall* CSPClientVoiceCall::NewL( const TDesC& aName, 
                          RMobileLine& aLine,  
                          const CCCECallParameters& aParams,
                          MCSPCommonInfo& aCommonInfo )
    {
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::NewL <");
    
    CSPClientVoiceCall* self = new ( ELeave ) CSPClientVoiceCall( aLine,
                                            aName,
                                            aCommonInfo );
    CleanupStack::PushL( self );
    self->ConstructL( aParams );
    CleanupStack::Pop( self );
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::NewL >");
    return self;
    }
    
// ---------------------------------------------------------------------------
// CSPClientVoiceCall::~CSPClientVoiceCall
// ---------------------------------------------------------------------------
//
CSPClientVoiceCall::~CSPClientVoiceCall()
    {
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::~CSPClientVoiceCall");
    }
  
// ---------------------------------------------------------------------------
// CSPClientVoiceCall::CSPClientVoiceCall
// ---------------------------------------------------------------------------
//
CSPClientVoiceCall::CSPClientVoiceCall( RMobileLine& aLine,
                  const TDesC& aName,
                  MCSPCommonInfo& aCommonInfo ):
                  CSPVoiceCall( aLine,
                     ETrue, aName, 
                     aCommonInfo, EFalse )
    {
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::CSPClientVoiceCall");
    
    // Set client call flag(s)
    iClientCallIndicated = EFalse; 
    }

// ---------------------------------------------------------------------------
// CSPClientVoiceCall::ConstructL
// Constructing CSPClientVoiceCall for MT call.
// ---------------------------------------------------------------------------
//    
void CSPClientVoiceCall::ConstructL( const CCCECallParameters& aParams )
    {
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::ConstructL <");
    CSPVoiceCall::ConstructL( aParams ); 
    CSPLOGSTRING(CSPOBJECT, "CSPClientVoiceCall::ConstructL >");
    }

// ---------------------------------------------------------------------------
// CSPClientVoiceCall::NotifyCallStateChanged
// Notifies observers about state changes
// ---------------------------------------------------------------------------
//
void CSPClientVoiceCall::NotifyCallStateChanged(
            MCCPCallObserver::TCCPCallState aState ) 
    {
    CSPLOGSTRING2(CSPINT, 
            "CSPClientVoiceCall::NotifyCallStateChanged state: %d", 
            aState);
    
    // Client call is indicated during dialling state 
    if ( aState == MCCPCallObserver::ECCPStateDialling )
        {
        IndicateClientCall(); 
        }
    
    CSPVoiceCall::NotifyCallStateChanged( aState );  
    }
    
// ---------------------------------------------------------------------------
// CSPClientVoiceCall::NotifyCallStateChangedWithInband
// Notifies observers about state changes
// ---------------------------------------------------------------------------
//
void CSPClientVoiceCall::NotifyCallStateChangedWithInband(
            MCCPCallObserver::TCCPCallState aState ) 
    {
    CSPLOGSTRING2(CSPINT, 
            "CSPClientVoiceCall::NotifyCallStateChangedWithInband state: %d", 
            aState);

    // Client call is indicated during dialling state
    if ( aState == MCCPCallObserver::ECCPStateDialling )
        {
        IndicateClientCall(); 
        }

    CSPVoiceCall::NotifyCallStateChangedWithInband( aState );  
    }

// ---------------------------------------------------------------------------
// CSPClientVoiceCall::IndicateClientCall
// Indicate dialling if needed 
// ---------------------------------------------------------------------------
//  
void CSPClientVoiceCall::IndicateClientCall()
    {
    // Can be done only once for each call and possible duplicate 
    // notifies are blocked 
    if ( !iClientCallIndicated )
        {
        iClientCallIndicated = ETrue;

        CSPLOGSTRING(CSPINT, 
            "CSPClientVoiceCall::IndicateClientCall indicate client call")
        
        iCommonInfo.IndicateClientCall( this );
        
        CSPLOGSTRING(CSPINT, 
            "CSPClientVoiceCall::IndicateClientCall IndicateClientCall completed")                
        }
    else 
        {
        CSPLOGSTRING(CSPERROR, 
            "CSPClientVoiceCall::IndicateClientCall already indicated")
        }        
    }

// ---------------------------------------------------------------------------
// CSPClientVoiceCall::OpenCallHandleL
// ---------------------------------------------------------------------------
//    
void CSPClientVoiceCall::OpenCallHandleL()
    {
    CSPLOGSTRING(CSPINT, "CSPClientVoiceCall::OpenCallHandleL <");

    // Client call, open existing call handle 
    OpenExistingCallL( iName ); 
    
    CSPLOGSTRING(CSPINT, "CSPClientVoiceCall::OpenCallHandleL >");
    }

// ---------------------------------------------------------------------------
// CSPClientVoiceCall::UpdateCallInfoImpl
// Update call info including remote party name and number data  
// ---------------------------------------------------------------------------
//    
void CSPClientVoiceCall::UpdateCallInfoImpl( RMobileCall::TMobileCallInfoV7 aCallInfo )
    {
    CSPLOGSTRING(CSPINT, "CSPClientVoiceCall::UpdateCallInfoImpl <");    

    // Call was added by ETel monitor, update info accordingly 
    UpdateCallNameNumberInfo( aCallInfo, ETrue );     
    UpdateCallOrigin( aCallInfo );
    
    CSPLOGSTRING(CSPINT, "CSPClientVoiceCall::UpdateCallInfoImpl >");
    }

// End of File