telephonyserverplugins/common_tsy/commontsy/src/mmgsmwcdma/cmmconferencecallgsmwcdmaextwithdispatcher.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifdef USING_CTSY_DISPATCHER
       
    17 
       
    18 /**
       
    19  * This file contains additional function definitions for the CMmConferenceCallGsmWcdmaExt class
       
    20  * in CTSY for use when the CTSY is used with the CTSY Dispatcher. 
       
    21  */
       
    22 
       
    23 //  INCLUDE FILES
       
    24 #include "cmmconferencecallgsmwcdmaext.h"
       
    25 #include "cmmphonetsy.h"
       
    26 #include "cmmconferencecalltsy.h"
       
    27 #include "cmmvoicecalltsy.h"
       
    28 #include "cmmcalllist.h"
       
    29 #include "cmmcallgsmwcdmaext.h"
       
    30 #include <ctsy/pluginapi/cmmdatapackage.h>
       
    31 #include "cmmmessagemanagerbase.h"
       
    32 #include <etelmmerr.h> // etel error codes
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // CMmConferenceCallGsmWcdmaExt::AddCallL
       
    36 // Addition of a new call to an existing conference call. If
       
    37 // call object is not found by the name given as input parameter KErrArgument
       
    38 // will be returned.
       
    39 // (other items were commented in a header).
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 TInt CMmConferenceCallGsmWcdmaExt::AddCallL(
       
    43     const TName* aCallName,
       
    44     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
    45     CMmCallList* aCallList )
       
    46     {
       
    47     TInt ret = KErrArgument;
       
    48 
       
    49     // Get the call object that should be added to the conference call
       
    50     CMmCallTsy* mmCall = aCallList->GetMmCallByName( aCallName );
       
    51     if ( mmCall )
       
    52         {
       
    53         // Fetch the active call extension
       
    54         CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>( mmCall->ActiveCallExtension() );
       
    55         // Get the mobile call capabilities
       
    56         RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
    57 
       
    58         mmCallGsmWcdmaExt->GetMobileCallCapsV1(mobileCallCaps);
       
    59         	
       
    60         // Only calls whose call control capabilities include KCapsJoin can be added to a conference call.
       
    61         if( !( RMobileCall::KCapsJoin & mobileCallCaps.iCallControlCaps ))
       
    62         	{ // Do not add the call to the conference since the call doesn't have KCapsJoin capability.
       
    63         	if(KMaxCallsInConference <= iMmConferenceCallTsy->NumberOfCallsInConference())
       
    64         		return KErrMMEtelMaxReached;
       
    65         	return ret;
       
    66         	} 
       
    67         
       
    68         RMobileCall::TMobileCallStatus callStatus =
       
    69             mmCall->MobileCallStatus();
       
    70         //check that this call is not in hold or connected  state and
       
    71         //conference call is not idle (=no reason to try this)
       
    72         if ( ( ( callStatus == RMobileCall::EStatusHold ) ||
       
    73                 ( callStatus == RMobileCall::EStatusConnected ) )
       
    74             && ( RMobileConferenceCall::EConferenceIdle != aStatus ) )
       
    75             {
       
    76             // send request to DOS
       
    77             // only packed parameter for DOS call: Id of the call to be added
       
    78             CCallDataPackage callDataPackage;
       
    79             callDataPackage.SetCallIdAndMode( mmCall->CallId(),
       
    80                 RMobilePhone::EServiceUnspecified ); // service type not needed
       
    81 
       
    82             CMmCallTsy* mmExistingCall = NULL;
       
    83             TInt existingCallId;
       
    84             __DEBUG_ONLY(TBool callFound = EFalse;)
       
    85             TInt numOfObjects = aCallList->GetNumberOfObjects();            
       
    86             for ( TInt i = 0; i < numOfObjects; i++ )
       
    87             	{
       
    88             	mmExistingCall = aCallList->GetMmCallByIndex(i);
       
    89             	if ( mmExistingCall->IsPartOfConference() )
       
    90             		{
       
    91             		__DEBUG_ONLY(callFound = ETrue;)
       
    92             		existingCallId = mmExistingCall->CallId();
       
    93             		break;
       
    94             		}            		
       
    95             	}
       
    96             __ASSERT_DEBUG(callFound,User::Invariant());
       
    97             
       
    98             callDataPackage.PackData(&existingCallId);
       
    99             
       
   100             ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   101                     HandleRequestL( EMobileConferenceCallAddCall,
       
   102                     &callDataPackage );
       
   103             }
       
   104         }
       
   105 
       
   106     return ret;
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CMmConferenceCallGsmWcdmaExt::HangUpL
       
   111 // This method terminates the whole conference call. All calls
       
   112 // participating in the conference call will be disconnected.
       
   113 // (other items were commented in a header).
       
   114 // ---------------------------------------------------------------------------
       
   115 //
       
   116 TInt CMmConferenceCallGsmWcdmaExt::HangUpL(
       
   117     RMobileConferenceCall::TMobileConferenceStatus aStatus )
       
   118     {
       
   119     TInt ret( KErrAccessDenied );
       
   120 
       
   121     if ( aStatus != RMobileConferenceCall::EConferenceIdle )
       
   122         {     
       
   123         RArray<TInt> callIds;
       
   124         CleanupClosePushL( callIds );
       
   125                 
       
   126         CMmCallList* callList = iMmConferenceCallTsy->Phone()->CallList();
       
   127         CMmCallTsy* mmCall = NULL;
       
   128         TInt numOfObjects = callList->GetNumberOfObjects();
       
   129         
       
   130         for ( TInt i = 0; i < numOfObjects; i++ )
       
   131         	{
       
   132         	mmCall = callList->GetMmCallByIndex(i);
       
   133         	if ( mmCall->IsPartOfConference() )
       
   134         		{
       
   135         		callIds.AppendL( mmCall->CallId() );
       
   136         		}
       
   137         	}
       
   138         
       
   139         CMmDataPackage package;
       
   140         package.PackData(&callIds);
       
   141         
       
   142         ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   143             HandleRequestL( EMobileConferenceCallHangUp, &package );
       
   144                 
       
   145         CleanupStack::PopAndDestroy(&callIds);         
       
   146         }
       
   147 
       
   148     return ret;
       
   149     }
       
   150 
       
   151 #endif //USING_CTSY_DISPATCHER