telephonyserverplugins/common_tsy/commontsy/src/mmgsmwcdma/cmmconferencecallgsmwcdmaext.cpp
changeset 0 3553901f7fa8
child 14 7ef16719d8cb
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 
       
    17 
       
    18 //  INCLUDE FILES
       
    19 #include "cmmconferencecallgsmwcdmaext.h"
       
    20 #include "cmmphonetsy.h"
       
    21 #include "cmmconferencecalltsy.h"
       
    22 #include "cmmvoicecalltsy.h"
       
    23 #include "cmmcalllist.h"
       
    24 #include "cmmcallgsmwcdmaext.h"
       
    25 #include <ctsy/pluginapi/cmmdatapackage.h>
       
    26 #include "cmmmessagemanagerbase.h"
       
    27 #include <etelmmerr.h> // etel error codes
       
    28 
       
    29 // ======== MEMBER FUNCTIONS ========
       
    30 
       
    31 CMmConferenceCallGsmWcdmaExt::CMmConferenceCallGsmWcdmaExt()
       
    32     {
       
    33     }
       
    34 
       
    35 CMmConferenceCallGsmWcdmaExt::~CMmConferenceCallGsmWcdmaExt()
       
    36     {
       
    37     iMmConferenceCallTsy = NULL;
       
    38     }
       
    39 
       
    40 CMmConferenceCallGsmWcdmaExt* CMmConferenceCallGsmWcdmaExt::NewL(
       
    41     CMmConferenceCallTsy* aMmConferenceCallTsy )
       
    42     {
       
    43     CMmConferenceCallGsmWcdmaExt* const conferenceCallGsmWcdmaExt = 
       
    44         new ( ELeave ) CMmConferenceCallGsmWcdmaExt();
       
    45     
       
    46     CleanupStack::PushL( conferenceCallGsmWcdmaExt );
       
    47     conferenceCallGsmWcdmaExt->iMmConferenceCallTsy = aMmConferenceCallTsy;
       
    48     conferenceCallGsmWcdmaExt->ConstructL();
       
    49     CleanupStack::Pop();
       
    50 
       
    51     return conferenceCallGsmWcdmaExt;
       
    52     }
       
    53 
       
    54 void CMmConferenceCallGsmWcdmaExt::ConstructL()
       
    55     {
       
    56     ResetAttributes();
       
    57     }
       
    58 
       
    59 // ======== LOCAL FUNCTIONS ========
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // CMmConferenceCallGsmWcdmaExt::CreateConferenceL
       
    63 // This method allows clients to create the initial conference call.
       
    64 // (other items were commented in a header).
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 TInt CMmConferenceCallGsmWcdmaExt::CreateConferenceL(
       
    68     RMobileConferenceCall::TMobileConferenceStatus aStatus )
       
    69     {
       
    70     TInt ret = KErrNotReady;
       
    71 
       
    72     //This method allows clients to create the inital 3-way conference call. 
       
    73     //The phone must be in a state where there are two single voice calls, 
       
    74     //one on hold and the other connected or alerting the remote, called party. 
       
    75     //The TSY will reflect the conference creation capability by setting 
       
    76     //the KCapsJoin flags of the individual calls and the KCapsCreate flag 
       
    77     //of the conference call sub-session.
       
    78     //
       
    79     //In GSM mode, this method will complete when the TSY has received 
       
    80     //confirmation from the network that the conference call service has been 
       
    81     //successfully invoked.
       
    82 
       
    83     //This check is required because Add call uses same DOS operation to 
       
    84     //as this one. Therefore we don't want to continue if status is not
       
    85     //Idle.     
       
    86     if ( RMobileConferenceCall::EConferenceIdle == aStatus )
       
    87         {
       
    88         //We have to get 2 active status indications before the conference 
       
    89         //has really gone to active state.
       
    90         iCreateConferenceCounter = 2;
       
    91 
       
    92 #ifndef USING_CTSY_DISPATCHER
       
    93         //send request to DOS
       
    94 		// no packaged parameters for DOS call
       
    95 		ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
    96             HandleRequestL( EMobileConferenceCallCreateConference );
       
    97 #else
       
    98 		// Pass down the call IDs of the active and held calls to be
       
    99 		// joined in the conference.
       
   100 		TInt heldCallId = iMmConferenceCallTsy->HeldCall()->CallId();
       
   101 		TInt connectedCallId = iMmConferenceCallTsy->ConnectedCall()->CallId();
       
   102 		CCallDataPackage package;
       
   103 		package.SetCallIdAndMode(heldCallId, iMmConferenceCallTsy->HeldCall()->CallMode());
       
   104 		package.PackData(&connectedCallId);
       
   105 		ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   106 			HandleRequestL( EMobileConferenceCallCreateConference, &package);
       
   107 #endif   // USING_CTSY_DISPATCHER
       
   108         }
       
   109 
       
   110     //return request result
       
   111     return ret;
       
   112 
       
   113     }
       
   114 
       
   115 #ifndef USING_CTSY_DISPATCHER
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // CMmConferenceCallGsmWcdmaExt::AddCallL
       
   119 // Addition of a new call to an existing conference call. If 
       
   120 // call object is not found by the name given as input parameter KErrArgument
       
   121 // will be returned.
       
   122 // (other items were commented in a header).
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 TInt CMmConferenceCallGsmWcdmaExt::AddCallL(
       
   126     const TName* aCallName,
       
   127     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   128     CMmCallList* aCallList )
       
   129     {
       
   130     TInt ret = KErrArgument;
       
   131 
       
   132     // Get the call object that should be added to the conference call
       
   133     CMmCallTsy* mmCall = aCallList->GetMmCallByName( aCallName );
       
   134     if ( mmCall ) 
       
   135         {
       
   136         // Fetch the active call extension
       
   137         CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>( mmCall->ActiveCallExtension() );
       
   138         // Get the mobile call capabilities
       
   139         RMobileCall::TMobileCallCapsV1 mobileCallCaps;
       
   140         mmCallGsmWcdmaExt->GetMobileCallCapsV1(mobileCallCaps);
       
   141         // Only calls whose call control capabilities include KCapsJoin can be added to a conference call.
       
   142         if( !( RMobileCall::KCapsJoin & mobileCallCaps.iCallControlCaps ))
       
   143         	{ // Do not add the call to the conference since the call doesn't have KCapsJoin capability.
       
   144         	if(KMaxCallsInConference <= iMmConferenceCallTsy->NumberOfCallsInConference())
       
   145         		return KErrMMEtelMaxReached;
       
   146         	return ret;
       
   147         	} 
       
   148 
       
   149         RMobileCall::TMobileCallStatus callStatus = 
       
   150             mmCall->MobileCallStatus();
       
   151         //check that this call is not in hold or connected  state and 
       
   152         //conference call is not idle (=no reason to try this)
       
   153         if ( ( ( callStatus == RMobileCall::EStatusHold ) ||
       
   154                 ( callStatus == RMobileCall::EStatusConnected ) )
       
   155             && ( RMobileConferenceCall::EConferenceIdle != aStatus ) )
       
   156             {
       
   157             // send request to DOS
       
   158             // only packed parameter for DOS call: Id of the call to be added
       
   159             CCallDataPackage callDataPackage;
       
   160             callDataPackage.SetCallIdAndMode( mmCall->CallId(), 
       
   161                 RMobilePhone::EServiceUnspecified ); // service type not needed
       
   162             ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   163                     HandleRequestL( EMobileConferenceCallAddCall,
       
   164                     &callDataPackage );
       
   165             }
       
   166         }
       
   167 
       
   168     return ret;
       
   169     }
       
   170 #endif //USING_CTSY_DISPATCHER
       
   171 
       
   172 // ---------------------------------------------------------------------------
       
   173 // CMmConferenceCallGsmWcdmaExt::SwapL
       
   174 // This method can be used to swap the ongoing conference call
       
   175 // between active and held status. 
       
   176 // (other items were commented in a header).
       
   177 // ---------------------------------------------------------------------------
       
   178 //
       
   179 TInt CMmConferenceCallGsmWcdmaExt::SwapL(
       
   180 	RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   181     CMmCallList* aCallList )
       
   182     {
       
   183 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::SwapL");
       
   184 	TInt ret = KErrArgument;
       
   185 
       
   186 	// conference must be active or held
       
   187     if ( aStatus == RMobileConferenceCall::EConferenceIdle )
       
   188         {
       
   189         ret = KErrNotReady;
       
   190         }
       
   191     else
       
   192         {
       
   193         // Init counter
       
   194         iNumberOfCallsToBeSwapped = 0;
       
   195         CMmCallTsy* mmCall = NULL;
       
   196         CMmCallList* callList = iMmConferenceCallTsy->Phone()->CallList();
       
   197 
       
   198         // Check from call list the number of calls to be swapped
       
   199         for ( TInt i = 0; i < callList->GetNumberOfObjects(); i++ )
       
   200             {
       
   201             mmCall = callList->GetMmCallByIndex( i );
       
   202 
       
   203             if ( mmCall->IsPartOfConference() 
       
   204                 && ( mmCall->MobileCallStatus() == RMobileCall::EStatusHold 
       
   205                 || mmCall->MobileCallStatus() == RMobileCall::EStatusConnected ) )
       
   206                 {
       
   207                 // Call found, increase the counter.
       
   208                 iNumberOfCallsToBeSwapped++;
       
   209                 }
       
   210             }
       
   211 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::SwapL - Number of calls in conference: %d", iNumberOfCallsToBeSwapped);
       
   212 
       
   213         // Find active and held call objects:
       
   214         CMmCallTsy* mmActiveCall = 
       
   215             aCallList->GetMmCallByStatus( RMobileCall::EStatusConnected );
       
   216         CMmCallTsy* mmHeldCall = 
       
   217             aCallList->GetMmCallByStatus( RMobileCall::EStatusHold ); 
       
   218 
       
   219         if ( RMobileConferenceCall::EConferenceActive == aStatus )
       
   220             {
       
   221             // conference is active
       
   222             // if held call is found, swap operation is required
       
   223             if ( mmHeldCall )
       
   224                 {
       
   225 #ifndef USING_CTSY_DISPATCHER
       
   226                 // need to swap
       
   227                 // no packed parameters for DOS call
       
   228                 ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   229                     HandleRequestL( EMobileConferenceCallSwap );
       
   230 #else
       
   231                 if (mmActiveCall && mmCall)
       
   232                 	{
       
   233 	                CCallDataPackage callDataPackage;
       
   234 	                callDataPackage.SetCallIdAndMode( mmCall->CallId(),
       
   235 	                		RMobilePhone::EServiceUnspecified ); // service type not needed
       
   236 	                TInt heldCallId = mmHeldCall->CallId();
       
   237 	                TInt connectedCallId = mmActiveCall->CallId();
       
   238 	                callDataPackage.PackData(&heldCallId, &connectedCallId);
       
   239 	                ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   240 	                		HandleRequestL(EMobileConferenceCallSwap, &callDataPackage);
       
   241                 	}
       
   242                 else
       
   243                 	{
       
   244                 	ret = KErrNotReady; // Shouldn't happen
       
   245                 	}
       
   246 #endif // USING_CTSY_DISPATCHER
       
   247                 }
       
   248             // if held call is not found, there should be an active call
       
   249 	        // and hold operation is required
       
   250             else if ( mmActiveCall )
       
   251                 {
       
   252                 // need to hold the active (conference) call
       
   253 
       
   254                 // create package; set call id and call mode
       
   255                 CCallDataPackage package;
       
   256                 package.SetCallIdAndMode( mmActiveCall->CallId(),
       
   257                     mmActiveCall->CallMode() );
       
   258 
       
   259                 // send to DOS
       
   260                 ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   261                     HandleRequestL( EMobileCallHold, &package );
       
   262                 }
       
   263             // we have neither an active nor a held call
       
   264             else
       
   265                 {
       
   266                 ret = KErrNotReady; // should never happen
       
   267                 }
       
   268             }
       
   269         else if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
   270             {
       
   271             // conference is held
       
   272             //if active call is found, swap operation is required
       
   273             if ( mmActiveCall )
       
   274                 {
       
   275 #ifndef USING_CTSY_DISPATCHER
       
   276                 // need to swap
       
   277                 // no packed parameters for DOS call
       
   278                 ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   279                     HandleRequestL( EMobileConferenceCallSwap );
       
   280 #else
       
   281                 if (mmHeldCall && mmCall)
       
   282                 	{
       
   283 	                CCallDataPackage callDataPackage;
       
   284 	                callDataPackage.SetCallIdAndMode( mmCall->CallId(),
       
   285 	                		RMobilePhone::EServiceUnspecified ); // service type not needed
       
   286 	                TInt heldCallId = mmHeldCall->CallId();
       
   287 	                TInt connectedCallId = mmActiveCall->CallId();
       
   288 	                callDataPackage.PackData(&heldCallId, &connectedCallId);
       
   289 	                ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   290 	                		HandleRequestL(EMobileConferenceCallSwap, &callDataPackage);
       
   291                 	}
       
   292                 else
       
   293                 	{
       
   294                 	ret = KErrNotReady; // Shouldn't happen
       
   295                 	}
       
   296 #endif // USING_CTSY_DISPATCHER
       
   297                 }
       
   298             // if active call is not found, there should be a held call
       
   299             // and resume operation is required
       
   300             else if ( mmHeldCall )
       
   301                 {
       
   302                 // need to retrieve (unhold) the held call
       
   303 
       
   304                 // create package; set call id and call mode
       
   305                 CCallDataPackage package;
       
   306                 package.SetCallIdAndMode( mmHeldCall->CallId(),
       
   307                     mmHeldCall->CallMode() );
       
   308 
       
   309                 // send to DOS
       
   310                 ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   311                     HandleRequestL( EMobileCallResume, &package );
       
   312                 }
       
   313             // we have neither an active nor a held call
       
   314             else
       
   315                 {
       
   316                 ret = KErrNotReady; // should never happen
       
   317                 }
       
   318             }
       
   319         }
       
   320 
       
   321     return ret;
       
   322     }
       
   323 
       
   324 // ---------------------------------------------------------------------------
       
   325 // CMmConferenceCallGsmWcdmaExt::CallStatusChanged
       
   326 // After the status of a single call has changed, this method decides if
       
   327 // the status of the conference call should be changed as well.
       
   328 // (other items were commented in a header).
       
   329 // ---------------------------------------------------------------------------
       
   330 //
       
   331 TBool CMmConferenceCallGsmWcdmaExt::CallStatusChanged(
       
   332     RMobileCall::TMobileCallStatus aNewStatus,
       
   333     TInt aCallId )
       
   334     {
       
   335 TFLOGSTRING3("TSY: CMmConferenceCallGsmWcdmaExt::CallStatusChanged, aNewStatus:%d, aCallId:%d", aNewStatus, aCallId );
       
   336 
       
   337     TBool statusChanged( EFalse );
       
   338 
       
   339     //get current conference call status
       
   340     RMobileConferenceCall::TMobileConferenceStatus status 
       
   341             = iMmConferenceCallTsy->Status();
       
   342 
       
   343 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::CallStatusChanged, Current conf call iMmConferenceCallTsy->Status:%d ", status);
       
   344 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::CallStatusChanged, Current conference extension iNewStatus:%d ", iNewStatus);
       
   345     //get call list
       
   346     CMmCallList* callList = iMmConferenceCallTsy->Phone()->CallList();
       
   347 
       
   348     switch( aNewStatus )
       
   349         {
       
   350         //call has gone to idle state
       
   351         case RMobileCall::EStatusIdle:
       
   352             //If conference call is in active or held state 
       
   353             if ( ( RMobileConferenceCall::EConferenceActive == status ||
       
   354                    RMobileConferenceCall::EConferenceHold == status ) )           
       
   355                 {
       
   356                 //handle call releasing
       
   357                 statusChanged = HandleCallRelease(
       
   358                     status, *callList, aNewStatus, aCallId );
       
   359                 }
       
   360             break;
       
   361         //call has gone to held state
       
   362         case RMobileCall::EStatusHold:
       
   363             //if conference call is in active state
       
   364             if ( RMobileConferenceCall::EConferenceActive == status )
       
   365                 {
       
   366                 //check if swap request is pending
       
   367                 if ( iMmConferenceCallTsy->ServiceRequested(
       
   368                         CMmConferenceCallTsy::EMultimodeConferenceCallSwap )
       
   369                      || iCurrentGhostOperation ==
       
   370                         RMobileConferenceCall::EConferenceSwapped )
       
   371                     {
       
   372                     //handle swapping
       
   373                     statusChanged = HandleSwap( status, *callList );
       
   374                     }
       
   375                 //is GoOneToOne going on
       
   376                 else if ( iGoOneToOneHandlingStarted )
       
   377                     {
       
   378                     statusChanged = HandleGoOneToOne( *callList, aCallId );
       
   379                     }
       
   380                 //check that add call request is not pending
       
   381                 else if ( !iMmConferenceCallTsy->ServiceRequested( 
       
   382                     CMmConferenceCallTsy::EMultimodeConferenceCallAddCall ) )
       
   383                     {
       
   384                     //Client has requested hold for a single call. If the call is part
       
   385                     //of the conference, all calls participating in the conference
       
   386                     //call will be held.
       
   387                     CMmCallTsy* call = callList->GetMmCallById(aCallId);
       
   388                     if(call != NULL && call->IsPartOfConference())
       
   389                     	{
       
   390                     	statusChanged = HandleSingleCallControl(status, aNewStatus);
       
   391                     	}
       
   392                     }
       
   393                 }
       
   394             break;
       
   395         //call has gone to active state
       
   396         case RMobileCall::EStatusConnected:
       
   397             //check if CreateConference request is pending
       
   398             if ( ( iMmConferenceCallTsy->ServiceRequested(
       
   399                     CMmConferenceCallTsy::EMultimodeConferenceCallCreateConference )
       
   400                  || iCurrentGhostOperation == RMobileConferenceCall::EConferenceBuilt ) 
       
   401                  && RMobileConferenceCall::EConferenceIdle == status )
       
   402                 {
       
   403                 //handle create conference
       
   404                 statusChanged = HandleCreateConference(
       
   405                     *callList, aCallId );
       
   406                 }
       
   407             //check if AddCall request is pending
       
   408             else if ( ( iMmConferenceCallTsy->ServiceRequested(
       
   409                     CMmConferenceCallTsy::EMultimodeConferenceCallAddCall ) ||
       
   410                 iCurrentGhostOperation ==  RMobileConferenceCall::EConferenceBuilt ||
       
   411                 iCurrentGhostOperation ==  RMobileConferenceCall::EConferenceCallAdded ) &&
       
   412                 ( RMobileConferenceCall::EConferenceActive == status ||
       
   413                 RMobileConferenceCall::EConferenceHold == status ) )
       
   414                 {
       
   415                 //handle add call...
       
   416                 statusChanged = HandleAddCall( status, *callList,
       
   417                     aNewStatus );
       
   418                 }
       
   419             //check if swap request is pending
       
   420             else if ( iMmConferenceCallTsy->ServiceRequested(
       
   421                     CMmConferenceCallTsy::EMultimodeConferenceCallSwap ) ||
       
   422                 iCurrentGhostOperation ==  RMobileConferenceCall::EConferenceSwapped )
       
   423                 {
       
   424                 //is conference status hold
       
   425                 if ( RMobileConferenceCall::EConferenceHold == status )
       
   426                     {
       
   427                     //handle swap...
       
   428                     statusChanged = HandleSwap( status, *callList );
       
   429                     }
       
   430                 }
       
   431             // call status might have changed because client has requested it
       
   432             // directly from a call object which is part of the conference
       
   433             // (not from the conference call object).
       
   434             else if ( RMobileConferenceCall::EConferenceHold == status )
       
   435                 {
       
   436                 CMmCallTsy* mmCall = callList->GetMmCallById( aCallId );
       
   437                 if ( mmCall )
       
   438                     {
       
   439                     if ( mmCall->IsPartOfConference() )
       
   440                         {
       
   441                         // if this call is part of the conference, conference
       
   442                         // status is Hold and new call status is Connected, we
       
   443                         // have to get the whole conference into active state
       
   444                         statusChanged = HandleSingleCallControl(
       
   445                             status, aNewStatus );
       
   446                         }
       
   447                     }
       
   448                 }
       
   449             break;
       
   450         case RMobileCall::EStatusUnknown:
       
   451         case RMobileCall::EStatusDialling:
       
   452         case RMobileCall::EStatusRinging:
       
   453         case RMobileCall::EStatusAnswering:
       
   454         case RMobileCall::EStatusConnecting:
       
   455         case RMobileCall::EStatusDisconnecting:
       
   456         case RMobileCall::EStatusDisconnectingWithInband:
       
   457         case RMobileCall::EStatusReconnectPending:
       
   458         case RMobileCall::EStatusWaitingAlternatingCallSwitch:
       
   459         case RMobileCall::EStatusTransferring:
       
   460         case RMobileCall::EStatusTransferAlerting:
       
   461         default:
       
   462             break;
       
   463         }
       
   464 
       
   465     if ( statusChanged )
       
   466         {
       
   467         // -1 indicates that there is no unhandled ghost operation anymore
       
   468         iCurrentGhostOperation = -1;
       
   469 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CallStatusChanged, statusChanged!! ");   
       
   470         }
       
   471 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::CallStatusChanged END, current conference extension iNewStatus:%d ", iNewStatus);
       
   472 
       
   473     return statusChanged;
       
   474     }
       
   475 
       
   476 // ---------------------------------------------------------------------------
       
   477 // CMmConferenceCallGsmWcdmaExt::SetGoOneToOneHandlingStarted
       
   478 // Informs the Gsm extension if Go-One-To-One handling
       
   479 // has started for any call.
       
   480 // (other items were commented in a header).
       
   481 // ---------------------------------------------------------------------------
       
   482 //
       
   483 void CMmConferenceCallGsmWcdmaExt::SetGoOneToOneHandlingStarted(
       
   484     TBool aVal,
       
   485     TInt aCallId )
       
   486     {
       
   487     iGoOneToOneHandlingStarted = aVal;
       
   488     iGoOneToOneCallId = aCallId;
       
   489     }
       
   490 
       
   491 // ---------------------------------------------------------------------------
       
   492 // CMmConferenceCallGsmWcdmaExt::CheckConferenceCapability
       
   493 // Check if conference call creation is possible.
       
   494 // (other items were commented in a header).
       
   495 // ---------------------------------------------------------------------------
       
   496 //
       
   497 void CMmConferenceCallGsmWcdmaExt::CheckConferenceCapability(
       
   498     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   499     CMmCallList* aCallList )
       
   500     {
       
   501 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::CheckConferenceCapability. aStatus:%d ", aStatus);     
       
   502     //Check if conference creation is possible. CC has to be in Idle state
       
   503     if ( RMobileConferenceCall::EConferenceIdle == aStatus  )
       
   504         {
       
   505         TUint8 connectedCount( 0 ); //how many calls are in active state
       
   506         TUint8 heldCount( 0 ); //how many calls are in hold state
       
   507         //number of calls in CallList
       
   508         TInt numberOfCallObjects = aCallList->GetNumberOfObjects();
       
   509 
       
   510         //check how many calls are in connected and held state
       
   511         for ( TInt i = 0; i < numberOfCallObjects; i++ )
       
   512             {
       
   513             CMmCallTsy* aMmCall = aCallList->GetMmCallByIndex( i );
       
   514             if ( aMmCall->MobileCallStatus() == 
       
   515                     RMobileCall::EStatusConnected )
       
   516                 {
       
   517                 //increment connected count
       
   518                 connectedCount++;
       
   519                 }
       
   520             else if ( aMmCall->MobileCallStatus() ==
       
   521                         RMobileCall::EStatusHold )
       
   522                 {
       
   523                 //increment held count
       
   524                 heldCount++;
       
   525                 }
       
   526             }
       
   527 
       
   528         //If caps were KCapsCreate and conference call creation is not anymore
       
   529         //possible, clear caps.
       
   530         TBool tryToClearConference( EFalse );
       
   531 
       
   532         if ( iMmConferenceCallTsy->Caps() == 
       
   533                 RMobileConferenceCall::KCapsCreate )
       
   534             {
       
   535             tryToClearConference = ETrue;
       
   536             }
       
   537 
       
   538         //Check that exactly one call is on hold and one is active
       
   539         if ( ( 1 == connectedCount && 1 == heldCount ) && 
       
   540             !tryToClearConference )
       
   541             {
       
   542             //Conference call creation is possible -> inform Common part.
       
   543             iMmConferenceCallTsy->
       
   544                 CompleteNotifyCapsChange( RMobileConferenceCall::KCapsCreate );
       
   545             }
       
   546         else if ( ( ( 1 == connectedCount && 0 == heldCount ) ||
       
   547             ( 0 == connectedCount && 1 == heldCount ) ) && 
       
   548             tryToClearConference ) 
       
   549             {
       
   550             //Conference call creation is not possible -> inform Common part.
       
   551             iMmConferenceCallTsy->CompleteNotifyCapsChange( KErrNone );
       
   552             }
       
   553         }
       
   554     }
       
   555 
       
   556 #ifndef USING_CTSY_DISPATCHER
       
   557 
       
   558 // ---------------------------------------------------------------------------
       
   559 // CMmConferenceCallGsmWcdmaExt::HangUpL
       
   560 // This method terminates the whole conference call. All calls 
       
   561 // participating in the conference call will be disconnected.
       
   562 // (other items were commented in a header).
       
   563 // ---------------------------------------------------------------------------
       
   564 //
       
   565 TInt CMmConferenceCallGsmWcdmaExt::HangUpL(
       
   566     RMobileConferenceCall::TMobileConferenceStatus aStatus )
       
   567     {
       
   568     TInt ret( KErrAccessDenied );
       
   569 
       
   570     if ( aStatus != RMobileConferenceCall::EConferenceIdle )
       
   571         {
       
   572         //Close all calls that are part of the conference call.
       
   573         //Held call is not released if there is one...
       
   574         // no packed parameters for DOS call
       
   575         ret = iMmConferenceCallTsy->Phone()->MessageManager()->
       
   576             HandleRequestL( EMobileConferenceCallHangUp );
       
   577         }
       
   578 
       
   579     return ret;
       
   580     }
       
   581 
       
   582 #endif //USING_CTSY_DISPATCHER
       
   583 
       
   584 // ---------------------------------------------------------------------------
       
   585 // CMmConferenceCallGsmWcdmaExt::GetMobileCallInfo
       
   586 // This method returns a current snapshot of the call information 
       
   587 // associated with the call specified by the aIndex parameter. This works in 
       
   588 // the following way: depending on the conference call status active/held the
       
   589 // call object with the same status is searched from the call list. The index 
       
   590 // defines which object's information is searched, for example if index is 2,
       
   591 // second call object's information with the same status will be returned.
       
   592 // (other items were commented in a header).
       
   593 // ---------------------------------------------------------------------------
       
   594 //
       
   595 TInt CMmConferenceCallGsmWcdmaExt::GetMobileCallInfo(
       
   596     TInt* aIndex,
       
   597     TDes8* aCallInfo,
       
   598     CMmCallList* aCallList,
       
   599     RMobileConferenceCall::TMobileConferenceStatus aConferenceStatus )
       
   600     {
       
   601     TInt ret( KErrNotFound );
       
   602     RMobileCall::TMobileCallStatus searchedStatus( RMobileCall::EStatusIdle );
       
   603     
       
   604     //check if we are trying to find active or held calls
       
   605     if ( aConferenceStatus == RMobileConferenceCall::EConferenceActive )
       
   606         {
       
   607         //active
       
   608         searchedStatus = RMobileCall::EStatusConnected;
       
   609         }
       
   610     else if ( aConferenceStatus == RMobileConferenceCall::EConferenceHold )
       
   611         {
       
   612         //held
       
   613         searchedStatus = RMobileCall::EStatusHold;
       
   614         }
       
   615 
       
   616     if ( searchedStatus != RMobileCall::EStatusIdle )
       
   617         {
       
   618         TInt counter( 0 );
       
   619         CMmCallTsy* mobileCall = NULL;
       
   620 
       
   621         //search through all objects in call list
       
   622         for ( TInt i = 0; i < aCallList->GetNumberOfObjects(); i++)
       
   623             {
       
   624             //get mobile call
       
   625             mobileCall = static_cast<CMmCallTsy*>(
       
   626                 aCallList->GetObjectByIndex( i ) );
       
   627             //if call's status matches with searched status
       
   628             if ( mobileCall->MobileCallStatus() == searchedStatus && 
       
   629                     mobileCall->IsPartOfConference() )
       
   630                 {
       
   631                 //if index matches
       
   632                 if ( counter == *aIndex )
       
   633                     {
       
   634                     //get mobile call info
       
   635                     mobileCall->FillMobileCallInfo( aCallInfo );
       
   636                     ret = KErrNone;
       
   637                     break;
       
   638                     }
       
   639                 else
       
   640                     {
       
   641                     //else loop to next item in CallList with same status.
       
   642                     counter++;
       
   643                     }
       
   644                 }
       
   645             }
       
   646         }
       
   647     
       
   648     return ret;
       
   649     }
       
   650 
       
   651 // ---------------------------------------------------------------------------
       
   652 // CMmConferenceCallGsmWcdmaExt::IsGoOneToOneSupported
       
   653 // GoOneToOne is only valid if the MS is in GSM mode, the 
       
   654 // selected call is a voice call and it is a member of an ongoing conference 
       
   655 // call and there are no calls in Hold state.
       
   656 // (other items were commented in a header).
       
   657 // ---------------------------------------------------------------------------
       
   658 //
       
   659 TInt CMmConferenceCallGsmWcdmaExt::IsGoOneToOneSupported(
       
   660     TInt  aCallId,
       
   661     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   662     CMmCallList* aCallList )
       
   663     {
       
   664     TInt ret( KErrNotSupported );
       
   665 
       
   666     //The action is only valid if the MS is in GSM mode, the selected call 
       
   667     //is a voice call and it is a member of an ongoing conference call.
       
   668     if ( aStatus == RMobileConferenceCall::EConferenceActive )
       
   669         {
       
   670         CMmCallTsy* mobileCall = aCallList->GetMmCallById( aCallId );
       
   671         
       
   672         if (mobileCall != NULL)
       
   673             {
       
   674             if ( ( RMobilePhone::EVoiceService == mobileCall->CallMode() ) // is a voice call
       
   675                 && ( RMobileCall::EStatusConnected ==  mobileCall->MobileCallStatus()) // is an active call
       
   676                 && mobileCall->IsPartOfConference() ) // is a member of an ongoing conference call
       
   677                 {
       
   678                 ret = KErrNone;
       
   679 	
       
   680                 //Check that there are no held calls
       
   681                 mobileCall = aCallList->GetMmCallByStatus( 
       
   682                                 RMobileCall::EStatusHold );
       
   683 	
       
   684                 if ( mobileCall )
       
   685                     {
       
   686                     //held call found -> GoOneToOne not possible
       
   687                     ret = KErrNotSupported;
       
   688                     }
       
   689                 }
       
   690             }
       
   691         }
       
   692 
       
   693     return ret;
       
   694     }
       
   695 
       
   696 // ---------------------------------------------------------------------------
       
   697 // CMmConferenceCallGsmWcdmaExt::HandleSwap
       
   698 // This method checks when Swap is ready and can be completed.
       
   699 // (other items were commented in a header).
       
   700 // ---------------------------------------------------------------------------
       
   701 //
       
   702 TBool CMmConferenceCallGsmWcdmaExt::HandleSwap(
       
   703     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   704     CMmCallList& aCallList )
       
   705     {
       
   706 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::HandleSwap. aStatus:%d ", aStatus);     
       
   707     TBool statusChanged( EFalse );
       
   708 
       
   709     //increment counter telling how many calls will still change state
       
   710     iNumberOfCallsToBeSwapped--;
       
   711 
       
   712     //if all have changed state
       
   713     if ( 0 == iNumberOfCallsToBeSwapped )
       
   714         {
       
   715         //if status was active
       
   716         if ( RMobileConferenceCall::EConferenceActive == aStatus )
       
   717             {
       
   718             //new status is hold
       
   719             iNewStatus = RMobileConferenceCall::EConferenceHold;
       
   720             statusChanged = ETrue;            
       
   721             }
       
   722         //else if status was hold
       
   723         else if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
   724             {
       
   725             //new status id active
       
   726             iNewStatus = RMobileConferenceCall::EConferenceActive;
       
   727             statusChanged = ETrue;
       
   728             }
       
   729         //update caps
       
   730         UpdateCapsAfterSwap( aStatus, aCallList );
       
   731         }
       
   732 
       
   733     return statusChanged;
       
   734     }
       
   735 
       
   736 // ---------------------------------------------------------------------------
       
   737 // CMmConferenceCallGsmWcdmaExt::HandleAddCall
       
   738 // This method checks when AddCall is ready and can be completed.
       
   739 // It also updates the capability flags of the calls.
       
   740 // (other items were commented in a header).
       
   741 // ---------------------------------------------------------------------------
       
   742 //
       
   743 TBool CMmConferenceCallGsmWcdmaExt::HandleAddCall(
       
   744     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   745     CMmCallList& aCallList,
       
   746     RMobileCall::TMobileCallStatus aNewStatus )
       
   747     {
       
   748 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::HandleAddCall. aStatus:%d ", aStatus); 
       
   749 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::HandleAddCall. aNewStatus:%d ", aNewStatus); 
       
   750     TBool statusChanged( EFalse );
       
   751 
       
   752     //Handle adding a call to conference call
       
   753     if ( RMobileCall::EStatusConnected == aNewStatus ||
       
   754          RMobileCall::EStatusIdle == aNewStatus )
       
   755         {
       
   756         TUint8 heldCount( 0 );
       
   757 
       
   758         //calculate how many calls are in hold state.
       
   759         for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
   760             {
       
   761             if ( aCallList.GetMmCallByIndex(i)->MobileCallStatus() 
       
   762                     == RMobileCall::EStatusHold )
       
   763                 {
       
   764                 //if a held call is found get out. There will be more active
       
   765                 //status indications coming...
       
   766                 heldCount++;
       
   767                 break;
       
   768                 }
       
   769             }
       
   770         //All calls have gone to active state
       
   771         if ( heldCount == 0 )
       
   772             {
       
   773             //This means that the conference call has gone from hold state
       
   774             //to active state in the add call process. AddCall can now be
       
   775             //completed.
       
   776             if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
   777                 {
       
   778                 iNewStatus = RMobileConferenceCall::EConferenceActive;
       
   779                 statusChanged = ETrue;
       
   780                 }
       
   781             //Conference call status has not changed but we still have to 
       
   782             //complete the AddCall operation. 
       
   783             else 
       
   784                 { 
       
   785                 iMmConferenceCallTsy->CompleteAddCall( KErrNone ); 
       
   786                 } 
       
   787 
       
   788             if ( RMobileConferenceCall::EConferenceBuilt == iCurrentGhostOperation ||
       
   789                  RMobileConferenceCall::EConferenceCallAdded == iCurrentGhostOperation )
       
   790                 {
       
   791                 TInt callIndex( 0 );
       
   792                 CMmCallTsy* mmCall = aCallList.GetMmCallByIndex( callIndex );
       
   793 
       
   794                 while ( mmCall ) 
       
   795                     { 
       
   796                     if ( !mmCall->IsPartOfConference() &&
       
   797                          ( mmCall->MobileCallStatus() == RMobileCall::EStatusConnected ||
       
   798                          mmCall->MobileCallStatus() == RMobileCall::EStatusHold) )
       
   799                         {
       
   800                         iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
   801                             mmCall->CallName(), 
       
   802                             RMobileConferenceCall::EConferenceCallAdded );
       
   803                         break;
       
   804                         }
       
   805                     callIndex++;
       
   806                     mmCall = aCallList.GetMmCallByIndex( callIndex );
       
   807                     }
       
   808                 }
       
   809 
       
   810             //Call method that updates the caps of the joined calls
       
   811             UpdateCapsAfterJoin( aCallList );
       
   812             } 
       
   813         }
       
   814 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::HandleAddCall. statusChanged:%d ", statusChanged); 
       
   815     
       
   816     return statusChanged;
       
   817     }
       
   818 
       
   819 
       
   820 // ---------------------------------------------------------------------------
       
   821 // CMmConferenceCallGsmWcdmaExt::HandleCreateConference
       
   822 // This method checks when CreateConference is ready and can be completed.
       
   823 // This method checks that 2 active status indications are received
       
   824 // as a response to the CreateConference request and when this is true, 
       
   825 // CreateConference request can be completed.
       
   826 // (other items were commented in a header).
       
   827 // ---------------------------------------------------------------------------
       
   828 //
       
   829 TBool CMmConferenceCallGsmWcdmaExt::HandleCreateConference(
       
   830     CMmCallList& aCallList,
       
   831     TInt aCallId )
       
   832     {
       
   833     TBool statusChanged ( EFalse );
       
   834     CMmCallTsy* mmCall = NULL;
       
   835 
       
   836     //get mmcall
       
   837     mmCall = aCallList.GetMmCallById( aCallId );
       
   838 
       
   839     if ( mmCall )
       
   840         {
       
   841         //send call added event...
       
   842         iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
   843             mmCall->CallName(), RMobileConferenceCall::EConferenceCallAdded );
       
   844 
       
   845         //decrement counter..
       
   846         iCreateConferenceCounter--;
       
   847 
       
   848         //if 2 status indications are received
       
   849         if ( 0 == iCreateConferenceCounter )
       
   850             {
       
   851             //CreateConferece can be completed.
       
   852             iNewStatus = RMobileConferenceCall::EConferenceActive;
       
   853             statusChanged = ETrue;
       
   854 
       
   855             //Call method that updates the caps of the joined calls
       
   856             UpdateCapsAfterJoin( aCallList );
       
   857             } 
       
   858         }
       
   859 
       
   860     return statusChanged;
       
   861     }
       
   862 
       
   863 // ---------------------------------------------------------------------------
       
   864 // CMmConferenceCallGsmWcdmaExt::HandleCallRelease
       
   865 // This method is called when status indications are received
       
   866 // after HangUp is requested from Conference call object. First this method
       
   867 // finds out which call object has gone to idle state. Then if there are
       
   868 // less than 2 calls left in the remaining conference call, the rest of
       
   869 // the conference call will be put to idle state as well (1 call can't be
       
   870 // conference call from TSY's point of view).
       
   871 // (other items were commented in a header).
       
   872 // ---------------------------------------------------------------------------
       
   873 //
       
   874 TBool CMmConferenceCallGsmWcdmaExt::HandleCallRelease(
       
   875 		RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
   876 		CMmCallList& aCallList,
       
   877 		RMobileCall::TMobileCallStatus aNewStatus,
       
   878 		TInt aCallId )
       
   879 	{
       
   880 	TBool statusChanged( EFalse );
       
   881 	TBool callFound( EFalse );
       
   882 	CMmCallTsy* mmCall = NULL;
       
   883 
       
   884 	TFLOGSTRING3("TSY: CMmConferenceCallGsmWcdmaExt::HandleCallRelease aNewStatus %d, aCallId %d",aNewStatus , aCallId );
       
   885 	TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::HandleCallRelease Calls in CC %d",iMmConferenceCallTsy->NumberOfCallsInConference());
       
   886 
       
   887 	//first find the call object which has gone to idle state
       
   888 	for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
   889 		{
       
   890 		mmCall = aCallList.GetMmCallByIndex( i );
       
   891 
       
   892 		if(mmCall)
       
   893 			{
       
   894 			TFLOGSTRING2("TSY: Previous Call ID: %d", mmCall->PreviousCallId() );
       
   895 			if ( mmCall->PreviousCallId() == aCallId )
       
   896 				{
       
   897 				if ( 2 == iMmConferenceCallTsy->NumberOfCallsInConference() && mmCall->IsPartOfConference() &&
       
   898 						iMmConferenceCallTsy->ServiceRequested( 
       
   899 								CMmConferenceCallTsy::EMultimodeConferenceCallAddCall ) )
       
   900 					{
       
   901 					TFLOGSTRING("TSY: STOP handling this case");
       
   902 					return EFalse;
       
   903 					}
       
   904 				mmCall->ResetPreviousCallId();
       
   905 				callFound = ETrue;
       
   906 				break;
       
   907 				}
       
   908 			}
       
   909 		}
       
   910 
       
   911 	//if call object has been found
       
   912 	if ( callFound )
       
   913 		{
       
   914 		//add Join caps to the call that is not part of conference
       
   915 		if ( KMaxCallsInConference == 
       
   916 		iMmConferenceCallTsy->NumberOfCallsInConference() )
       
   917 			{
       
   918 			CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = NULL;
       
   919 			RMobileCall::TMobileCallStatus status( RMobileCall::EStatusIdle );
       
   920 
       
   921 			if ( RMobileConferenceCall::EConferenceActive == aStatus )
       
   922 				{
       
   923 				//get the held call
       
   924 				status = RMobileCall::EStatusHold;
       
   925 				}
       
   926 			else if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
   927 				{
       
   928 				//get the connected call
       
   929 				status = RMobileCall::EStatusConnected;
       
   930 				}
       
   931 
       
   932 			if ( status != RMobileCall::EStatusIdle )
       
   933 				{
       
   934 				CMmCallTsy* nonIdleCall =
       
   935 				aCallList.GetMmCallByStatus( status );
       
   936 
       
   937 				if ( nonIdleCall )
       
   938 					{
       
   939 					// Fetch the active call extension
       
   940 					mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>(
       
   941 							nonIdleCall->ActiveCallExtension() );
       
   942 					//add Join caps
       
   943 					mmCallGsmWcdmaExt->AddGSMCallCaps( 
       
   944 							RMobileCall::KCapsJoin );
       
   945 					//complete caps change notification
       
   946 					nonIdleCall->CompleteNotifyMobileCallCapsChange( 
       
   947 							KErrNone );
       
   948 					}
       
   949 				}
       
   950 			}
       
   951 
       
   952 		if ( mmCall && mmCall->IsPartOfConference() )
       
   953 			{    
       
   954 			// if the released call was in the conference, send 
       
   955 			// removed from conference indication
       
   956 			iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
   957 					mmCall->CallName(),
       
   958 					RMobileConferenceCall::EConferenceCallRemoved );
       
   959 			}
       
   960 
       
   961 		//If there is only 1 call left in the CC, remove it. 1 call can't be
       
   962 		//a conference call from MM API's point of view.
       
   963 		if ( ( 1 == iMmConferenceCallTsy->NumberOfCallsInConference() ) &&
       
   964 				!iMmConferenceCallTsy->ServiceRequested( 
       
   965 						CMmConferenceCallTsy::EMultimodeConferenceCallHangUp ) )
       
   966 			{
       
   967 			RMobileCall::TMobileCallStatus callStatus( 
       
   968 					RMobileCall::EStatusIdle );
       
   969 
       
   970 			//send removed from conference also to the last call in the 
       
   971 			// conference. Single call cannot be a conference call.
       
   972 			if ( RMobileConferenceCall::EConferenceActive == aStatus )
       
   973 				{
       
   974 				//we are trying to find connected call
       
   975 				callStatus = RMobileCall::EStatusConnected;
       
   976 
       
   977 				//Special case when last member is on hold and CC Status is active at this 
       
   978 				//point(2 members in CC and one is dropped and MO call is made at the same time)
       
   979 				for ( TInt d = 0; d < aCallList.GetNumberOfObjects(); d++ )
       
   980 					{
       
   981 					CMmCallTsy* remainingCall = aCallList.GetMmCallByIndex(d);
       
   982 
       
   983 					if( remainingCall->MobileCallStatus() == RMobileCall::EStatusHold )
       
   984 						{
       
   985 						callStatus = RMobileCall::EStatusHold;
       
   986 						TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::HandleCallRelease Call with Hold status found" );
       
   987 						break;
       
   988 						}	
       
   989 					}
       
   990 
       
   991 				}
       
   992 			else if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
   993 				{
       
   994 				//we are trying to find a held call
       
   995 				callStatus = RMobileCall::EStatusHold;
       
   996 				}
       
   997 			//now search that call
       
   998 			for ( TInt c = 0; c < aCallList.GetNumberOfObjects(); c++ )
       
   999 				{
       
  1000 				CMmCallTsy* remainingCall = aCallList.GetMmCallByIndex(c);
       
  1001 				if ( remainingCall->MobileCallStatus() == callStatus )
       
  1002 					{
       
  1003 					iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
  1004 							remainingCall->CallName(), 
       
  1005 							RMobileConferenceCall::EConferenceCallRemoved );
       
  1006 					break;
       
  1007 					}                
       
  1008 				}
       
  1009 
       
  1010 			UpdateCapsAfterCallRelease( aCallList );
       
  1011 			}
       
  1012 
       
  1013 		//If there are no calls anymore in the CC, notify it...
       
  1014 		if ( 0 == iMmConferenceCallTsy->NumberOfCallsInConference() )
       
  1015 			{
       
  1016 			iNewStatus = RMobileConferenceCall::EConferenceIdle;
       
  1017 			statusChanged = ETrue;
       
  1018 			TName dummyName; //No calls left. Send EConferenceTerminate event. Use an empty placeholder name
       
  1019 			iMmConferenceCallTsy->CompleteNotifyConferenceEvent(dummyName,RMobileConferenceCall::EConferenceTerminated);
       
  1020 			}
       
  1021 		//if add call was going on and there was a call release
       
  1022 		else if ( iMmConferenceCallTsy->ServiceRequested( 
       
  1023 				CMmConferenceCallTsy::EMultimodeConferenceCallAddCall ) )
       
  1024 			{
       
  1025 			//conference call has not gone to idle state
       
  1026 			HandleAddCall( aStatus, aCallList, aNewStatus );
       
  1027 			}
       
  1028 		//if swap was going on and there was a call release
       
  1029 		else if ( iMmConferenceCallTsy->ServiceRequested( 
       
  1030 				CMmConferenceCallTsy::EMultimodeConferenceCallSwap ) )
       
  1031 			{
       
  1032 			//conference call has not gone to idle state
       
  1033 			HandleSwap( aStatus, aCallList );
       
  1034 			}
       
  1035 		}
       
  1036 
       
  1037 	return statusChanged;
       
  1038 	}
       
  1039 
       
  1040 // ---------------------------------------------------------------------------
       
  1041 // CMmConferenceCallGsmWcdmaExt::HandleSingleCallControl
       
  1042 // This method is called when status indication is received
       
  1043 // and Swap, AddCall, CreateConference or HangUp is not requested from
       
  1044 // Conference call object. This means that client has requested hold or
       
  1045 // resume directly from single call object. If Hold has been requested 
       
  1046 // from single call participating conference call -> all calls in conference
       
  1047 // call will go to Hold state. Same applies also to the Resume command.
       
  1048 // (other items were commented in a header).
       
  1049 // ---------------------------------------------------------------------------
       
  1050 //
       
  1051 TBool CMmConferenceCallGsmWcdmaExt::HandleSingleCallControl(
       
  1052     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
  1053     RMobileCall::TMobileCallStatus aNewStatus )
       
  1054     {
       
  1055     TBool statusChanged( EFalse );
       
  1056 
       
  1057     if ( !iCallControlStarted )
       
  1058         {   
       
  1059         //save count, how many indications should be received
       
  1060         iCallsToBeControlled = iMmConferenceCallTsy->
       
  1061             NumberOfCallsInConference();
       
  1062         //Don't come here before all calls have changed their status
       
  1063         iCallControlStarted = ETrue;
       
  1064         }
       
  1065 
       
  1066     //if CC is in Hold status and we get Active status indication
       
  1067     if ( RMobileCall::EStatusConnected == aNewStatus &&
       
  1068         RMobileConferenceCall::EConferenceHold == aStatus )
       
  1069         {
       
  1070         //one call in Conference call has changed its status
       
  1071         iCallsToBeControlled--;
       
  1072         }
       
  1073     //if CC is in Active status and we get Hold status indication
       
  1074     else if ( RMobileCall::EStatusHold == aNewStatus &&
       
  1075         RMobileConferenceCall::EConferenceActive == aStatus )
       
  1076         {
       
  1077         //one call in Conference call has changed its status
       
  1078         iCallsToBeControlled--;
       
  1079         }
       
  1080 
       
  1081     //Have all calls in Conference call changed their status?
       
  1082     if ( 0 == iCallsToBeControlled )
       
  1083         {
       
  1084         //if CC was originally in Hold status we have changed to active state
       
  1085         if ( RMobileConferenceCall::EConferenceHold == aStatus )
       
  1086             {
       
  1087             iNewStatus = RMobileConferenceCall::EConferenceActive;
       
  1088             }
       
  1089         //if CC was originally in Active status we have changed to hold state
       
  1090         else if ( RMobileConferenceCall::EConferenceActive == aStatus )
       
  1091             {
       
  1092             iNewStatus = RMobileConferenceCall::EConferenceHold;
       
  1093             }
       
  1094         //reset flag
       
  1095         iCallControlStarted = EFalse;
       
  1096    
       
  1097         statusChanged = ETrue;
       
  1098         }   
       
  1099 
       
  1100     return statusChanged;
       
  1101     }
       
  1102     
       
  1103 // ---------------------------------------------------------------------------
       
  1104 // CMmConferenceCallGsmWcdmaExt::HandleGoOneToOne
       
  1105 // This method checks when GoOneToOne is ready and can be completed.
       
  1106 // (other items were commented in a header).
       
  1107 // ---------------------------------------------------------------------------
       
  1108 //
       
  1109 TBool CMmConferenceCallGsmWcdmaExt::HandleGoOneToOne(
       
  1110     CMmCallList& aCallList,
       
  1111     TInt aCallId )
       
  1112     {
       
  1113     TBool statusChanged( EFalse );
       
  1114     CMmCallTsy* mmCall = NULL;
       
  1115 
       
  1116     // check if the call placed on hold is the one to go one to one with
       
  1117     // if so, cancel one to one
       
  1118     if (aCallId == iGoOneToOneCallId)
       
  1119         {
       
  1120         mmCall = aCallList.GetMmCallById( iGoOneToOneCallId );
       
  1121         if ( mmCall )
       
  1122             {
       
  1123             // failure of the Go-One-To-One operation
       
  1124             reinterpret_cast<CMmVoiceCallTsy*>( mmCall )->CompleteGoOneToOne(
       
  1125                 KErrNotReady );
       
  1126             }
       
  1127         
       
  1128         iGoOneToOneHandlingStarted = EFalse;
       
  1129         iGoOneToOneCallId = -1;
       
  1130         iCallControlStarted = EFalse;
       
  1131         return statusChanged;
       
  1132         }
       
  1133 
       
  1134     if ( !iCallControlStarted )
       
  1135         {   
       
  1136         //save count, how many indications should be received. All but one 
       
  1137         //call (the one that was splitted) should go to hold state.
       
  1138         iCallsToBeControlled = 
       
  1139             iMmConferenceCallTsy->NumberOfCallsInConference() - 1;
       
  1140 
       
  1141         //Conference call will go to Idle state
       
  1142         if ( 1 == iCallsToBeControlled )
       
  1143             {
       
  1144             for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
  1145                 {
       
  1146                 mmCall = aCallList.GetMmCallByIndex( i );
       
  1147 
       
  1148                 if ( RMobileCall::EStatusConnected == mmCall->MobileCallStatus() 
       
  1149                     || RMobileCall::EStatusHold == mmCall->MobileCallStatus() )
       
  1150                     {
       
  1151                     // The call removed notification event for the call which has
       
  1152                     // been split gets completed later when the split event is
       
  1153                     // completed. This if stops extra call removed event from being completed.
       
  1154                     if (mmCall->CallId() != iGoOneToOneCallId)
       
  1155                     	{
       
  1156 #ifdef USING_CTSY_DISPATCHER
       
  1157 						iMmConferenceCallTsy->CompleteNotifyConferenceEvent(
       
  1158 							mmCall->CallName(),
       
  1159 							RMobileConferenceCall::EConferenceCallRemoved );
       
  1160 #else // USING_CTSY_DISPATCHER
       
  1161                     iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
  1162                         mmCall->CallName(), 
       
  1163                         RMobileConferenceCall::EConferenceCallRemoved );
       
  1164 #endif // USING_CTSY_DISPATCHER
       
  1165                     	}
       
  1166    
       
  1167                     CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = 
       
  1168                         static_cast<CMmCallGsmWcdmaExt*>( 
       
  1169                             mmCall->ActiveCallExtension() );
       
  1170 
       
  1171                     TUint32 caps = RCall::KCapsHangUp;
       
  1172                     caps |= RMobileCall::KCapsJoin |
       
  1173                         RMobileCall::KCapsSwap |
       
  1174                         RMobileCall::KCapsTransfer;
       
  1175 
       
  1176                     mmCallGsmWcdmaExt->AddGSMCallCaps( caps );
       
  1177                     mmCallGsmWcdmaExt->RemoveGSMCallCaps( 
       
  1178                         RMobileCall::KCapsOneToOne );
       
  1179 
       
  1180                     mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );  
       
  1181                     }
       
  1182                 }
       
  1183 
       
  1184             //new status is idle (there is no conference anymore)
       
  1185             iNewStatus = RMobileConferenceCall::EConferenceIdle;
       
  1186             statusChanged = ETrue;
       
  1187             }
       
  1188 
       
  1189         // Call control is going on, i.e. we are waiting for other calls'
       
  1190         // status indications
       
  1191         iCallControlStarted = ETrue;
       
  1192         }      
       
  1193 
       
  1194     //decrement counter telling how many calls will still change state
       
  1195     iCallsToBeControlled--;
       
  1196 
       
  1197     //All conference related call object have changed their state. Remove 
       
  1198     //go-one-to-one call object from conference call.
       
  1199     if ( iCallsToBeControlled == 0 && iCallControlStarted )
       
  1200         {
       
  1201         if ( !statusChanged )
       
  1202             {
       
  1203             // If conference is created with two other parties, conference
       
  1204             // is destructed (status is set to EConferenceIdle, see above)
       
  1205             iNewStatus = RMobileConferenceCall::EConferenceHold;
       
  1206             statusChanged = ETrue;
       
  1207             }
       
  1208         iCallControlStarted = EFalse;
       
  1209         iGoOneToOneHandlingStarted = EFalse;
       
  1210 
       
  1211         mmCall = aCallList.GetMmCallById( iGoOneToOneCallId );
       
  1212         
       
  1213         iGoOneToOneCallId = -1;
       
  1214 
       
  1215         if ( mmCall )
       
  1216             {
       
  1217             iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
  1218                     mmCall->CallName(), 
       
  1219                     RMobileConferenceCall::EConferenceCallRemoved );  
       
  1220                     
       
  1221             iMmConferenceCallTsy->CompleteNotifyConferenceEvent( 
       
  1222                     mmCall->CallName(), 
       
  1223                     RMobileConferenceCall::EConferenceSplit );  
       
  1224 
       
  1225             CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = 
       
  1226                 static_cast<CMmCallGsmWcdmaExt*>( 
       
  1227                     mmCall->ActiveCallExtension() );
       
  1228                     
       
  1229             mmCallGsmWcdmaExt->AddGSMCallCaps( RMobileCall::KCapsJoin );
       
  1230             mmCallGsmWcdmaExt->AddGSMCallCaps( RMobileCall::KCapsHangUp );
       
  1231             mmCallGsmWcdmaExt->RemoveGSMCallCaps( RMobileCall::KCapsOneToOne );  
       
  1232             
       
  1233             mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );        
       
  1234 
       
  1235             // successful complete of the Go-One-To-One operation
       
  1236             reinterpret_cast<CMmVoiceCallTsy*>( mmCall )->CompleteGoOneToOne(
       
  1237                 KErrNone );
       
  1238             }
       
  1239         }
       
  1240     //Update caps only if call is still part of conference call
       
  1241     else if ( iCallControlStarted && iGoOneToOneCallId != aCallId )
       
  1242         {        
       
  1243         mmCall = aCallList.GetMmCallById( aCallId );
       
  1244 
       
  1245         if ( NULL != mmCall )
       
  1246             {
       
  1247             CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = 
       
  1248                 static_cast<CMmCallGsmWcdmaExt*>(
       
  1249                     mmCall->ActiveCallExtension() );
       
  1250 
       
  1251             mmCallGsmWcdmaExt->AddGSMCallCaps( RMobileCall::KCapsHangUp );
       
  1252             mmCallGsmWcdmaExt->RemoveGSMCallCaps( 
       
  1253                 RMobileCall::KCapsOneToOne );
       
  1254 
       
  1255             mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1256             }
       
  1257         }
       
  1258 
       
  1259     return statusChanged;
       
  1260     }
       
  1261 
       
  1262 // ---------------------------------------------------------------------------
       
  1263 // CMmConferenceCallGsmWcdmaExt::GetNewStatus
       
  1264 // Called by common Conference call object to get the current
       
  1265 // conference call status. It will be copied to aNewStatus.
       
  1266 // (other items were commented in a header).
       
  1267 // ---------------------------------------------------------------------------
       
  1268 //
       
  1269 TInt CMmConferenceCallGsmWcdmaExt::GetNewStatus(
       
  1270     RMobileConferenceCall::TMobileConferenceStatus* aNewStatus )
       
  1271     {
       
  1272 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::GetNewStatus. iNewStatus:%d ", iNewStatus );     
       
  1273     //copy new status
       
  1274     *aNewStatus = iNewStatus;
       
  1275     //delete new status from GSM extension
       
  1276     iNewStatus = RMobileConferenceCall::EConferenceIdle;
       
  1277 
       
  1278     return KErrNone;
       
  1279     }
       
  1280 
       
  1281 // ---------------------------------------------------------------------------
       
  1282 // CMmConferenceCallGsmWcdmaExt::ResetAttributes
       
  1283 // Resets internal attributes.
       
  1284 // ---------------------------------------------------------------------------
       
  1285 //
       
  1286 void CMmConferenceCallGsmWcdmaExt::ResetAttributes()
       
  1287     {
       
  1288 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::ResetAttributes. " );     
       
  1289     //Flag telling if this is not the first hold/active status indication
       
  1290     //caused by client asking hold/resume for a single call.
       
  1291     iCallControlStarted = EFalse;
       
  1292     //Counter telling how many calls should still change their state before
       
  1293     //Conference call changes its' state.
       
  1294     iCallsToBeControlled = 0;
       
  1295     //Counter telling when Create conference is ready to be completed 
       
  1296     iCreateConferenceCounter = 0;
       
  1297     //New conference call status
       
  1298     iNewStatus = RMobileConferenceCall::EConferenceIdle;
       
  1299     //Count, how many calls are to be swapped
       
  1300     iNumberOfCallsToBeSwapped = 0;
       
  1301     //Flag telling if GoOneToOne handling is going on.
       
  1302     iGoOneToOneHandlingStarted = EFalse;
       
  1303     //Call id for which GoOneToOne handling is going on.
       
  1304     iGoOneToOneCallId = -1;
       
  1305     //Operation initiated bypassing the ETel (ghost operetion).
       
  1306     iCurrentGhostOperation = -1;
       
  1307     }
       
  1308 
       
  1309 // ---------------------------------------------------------------------------
       
  1310 // CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterJoin
       
  1311 // Updates call capabilities of all calls after a Join operation
       
  1312 // has been executed (CreateConference or AddCall).
       
  1313 // (other items were commented in a header).
       
  1314 // ---------------------------------------------------------------------------
       
  1315 //
       
  1316 void CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterJoin(
       
  1317     CMmCallList& aCallList ) const
       
  1318     {
       
  1319     //update flags of all joined calls
       
  1320     for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
  1321         {
       
  1322         //Get call object
       
  1323         CMmCallTsy* mmCall = aCallList.GetMmCallByIndex(i);
       
  1324 
       
  1325         if ( mmCall )
       
  1326             {
       
  1327             if ( mmCall->MobileCallStatus() == RMobileCall::EStatusConnected )
       
  1328                 {
       
  1329                 // Fetch the active call extension
       
  1330                 CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = 
       
  1331                     static_cast<CMmCallGsmWcdmaExt*>(
       
  1332                         mmCall->ActiveCallExtension() );
       
  1333 
       
  1334                 //set caps to be removed;
       
  1335                 TUint32 caps =  
       
  1336                     RMobileCall::KCapsJoin 
       
  1337                     | RMobileCall::KCapsSwap;
       
  1338                 //remove Join and Swap caps
       
  1339                 mmCallGsmWcdmaExt->RemoveGSMCallCaps( caps );
       
  1340                 //Add GoOneToOne caps
       
  1341                 mmCallGsmWcdmaExt->AddGSMCallCaps( 
       
  1342                     RMobileCall::KCapsOneToOne );
       
  1343                 //complete caps change notification
       
  1344                 mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1345                 }
       
  1346             }
       
  1347         }
       
  1348     }
       
  1349 
       
  1350 // ---------------------------------------------------------------------------
       
  1351 // CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterCallRelease
       
  1352 // Updates call capabilities of all calls after a call participating in
       
  1353 // the conference call has gone to idle state.
       
  1354 // (other items were commented in a header).
       
  1355 // ---------------------------------------------------------------------------
       
  1356 //
       
  1357 void CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterCallRelease(
       
  1358     CMmCallList& aCallList ) const
       
  1359     {
       
  1360     TUint32 caps( 0 );
       
  1361 
       
  1362     //try to find connected call
       
  1363     CMmCallTsy* connectedCall = aCallList.GetMmCallByStatus( 
       
  1364         RMobileCall::EStatusConnected );
       
  1365     //try to find a held call
       
  1366     CMmCallTsy* heldCall = aCallList.GetMmCallByStatus( 
       
  1367         RMobileCall::EStatusHold );
       
  1368 
       
  1369     CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = NULL;
       
  1370 
       
  1371     if ( connectedCall )
       
  1372         {
       
  1373         // Fetch the active call extension
       
  1374         mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>(
       
  1375             connectedCall->ActiveCallExtension() );
       
  1376 
       
  1377         //add HangUp caps
       
  1378         mmCallGsmWcdmaExt->AddGSMCallCaps( 
       
  1379             RMobileCall::KCapsHangUp );
       
  1380 
       
  1381         //update caps of connected call
       
  1382         if ( heldCall )
       
  1383             {
       
  1384             //set caps to be added;
       
  1385             caps = RMobileCall::KCapsJoin 
       
  1386                 | RMobileCall::KCapsTransfer
       
  1387                 | RMobileCall::KCapsSwap;
       
  1388             //add Join, Transfer and Swap caps
       
  1389             mmCallGsmWcdmaExt->AddGSMCallCaps( caps );
       
  1390             }
       
  1391         else
       
  1392             {
       
  1393             //set caps to be removed;
       
  1394             caps = RMobileCall::KCapsJoin 
       
  1395                 | RMobileCall::KCapsTransfer
       
  1396                 | RMobileCall::KCapsSwap;
       
  1397             //remove Join, Transfer and Swap caps
       
  1398             mmCallGsmWcdmaExt->RemoveGSMCallCaps( caps );
       
  1399             }
       
  1400 
       
  1401         //complete caps change notification
       
  1402         connectedCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1403         }
       
  1404 
       
  1405     if ( heldCall )
       
  1406         {
       
  1407         // Fetch the active call extension
       
  1408         mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>(
       
  1409             heldCall->ActiveCallExtension() );
       
  1410 
       
  1411         //add HangUp caps
       
  1412         mmCallGsmWcdmaExt->AddGSMCallCaps( 
       
  1413             RMobileCall::KCapsHangUp );
       
  1414 
       
  1415         //update caps of connected call
       
  1416         if ( connectedCall )
       
  1417             {
       
  1418             //set caps to be added;
       
  1419             caps = RMobileCall::KCapsJoin 
       
  1420                 | RMobileCall::KCapsTransfer
       
  1421                 | RMobileCall::KCapsSwap;
       
  1422             //add Join, Transfer and Swap caps
       
  1423             mmCallGsmWcdmaExt->AddGSMCallCaps( caps );
       
  1424             }
       
  1425         else
       
  1426             {
       
  1427             //set caps to be removed;
       
  1428             caps = RMobileCall::KCapsJoin 
       
  1429                 | RMobileCall::KCapsTransfer
       
  1430                 | RMobileCall::KCapsSwap;
       
  1431             //remove Join, Transfer and Swap caps
       
  1432             mmCallGsmWcdmaExt->RemoveGSMCallCaps( caps );
       
  1433             }
       
  1434 
       
  1435         //complete caps change notification
       
  1436         heldCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1437         }
       
  1438     }
       
  1439 
       
  1440 // ---------------------------------------------------------------------------
       
  1441 // CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterSwap
       
  1442 // Updates call capabilities of all calls after a Swap operation has
       
  1443 // been executed.
       
  1444 // (other items were commented in a header).
       
  1445 // ---------------------------------------------------------------------------
       
  1446 //
       
  1447 void CMmConferenceCallGsmWcdmaExt::UpdateCapsAfterSwap(
       
  1448     RMobileConferenceCall::TMobileConferenceStatus aStatus,
       
  1449     CMmCallList& aCallList ) const
       
  1450     {
       
  1451     CMmCallTsy* mmCall = NULL;
       
  1452     CMmCallGsmWcdmaExt* mmCallGsmWcdmaExt = NULL;
       
  1453 
       
  1454     //if status was active
       
  1455     if ( aStatus == RMobileConferenceCall::EConferenceActive )
       
  1456         {
       
  1457         //update caps of all calls participating conference
       
  1458         //loop through all call objects searching the held calls
       
  1459         for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
  1460             {
       
  1461             mmCall = aCallList.GetMmCallByIndex( i );
       
  1462 
       
  1463             if ( mmCall->MobileCallStatus() == RMobileCall::EStatusHold )
       
  1464                 {
       
  1465                 // Fetch the active call extension
       
  1466                 mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>(
       
  1467                     mmCall->ActiveCallExtension() );
       
  1468 
       
  1469                 //remove GoOneToOne caps
       
  1470                 mmCallGsmWcdmaExt->RemoveGSMCallCaps( 
       
  1471                     RMobileCall::KCapsOneToOne );
       
  1472                 //complete caps change notification
       
  1473                 mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1474                 }
       
  1475             }
       
  1476         }
       
  1477     //else if status was hold
       
  1478     else if ( aStatus == RMobileConferenceCall::EConferenceHold )
       
  1479         {
       
  1480         TInt numberOfNonIdleCalls( 0 );
       
  1481 
       
  1482         //find out the number of non idle calls
       
  1483         for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
  1484             {
       
  1485             mmCall = aCallList.GetMmCallByIndex( i );
       
  1486             if ( mmCall->MobileCallStatus() != RMobileCall::EStatusIdle )
       
  1487                 {
       
  1488                 numberOfNonIdleCalls++;
       
  1489                 }
       
  1490             }
       
  1491 
       
  1492         //check that all non idle calls belong to conference call
       
  1493         //-> GoOneToOne can be activated.
       
  1494         if ( numberOfNonIdleCalls <=
       
  1495             iMmConferenceCallTsy->NumberOfCallsInConference() )
       
  1496             {
       
  1497             //update caps of all calls participating conference
       
  1498             //loop through all call objects searching the held calls
       
  1499             for ( TInt i = 0; i < aCallList.GetNumberOfObjects(); i++ )
       
  1500                 {
       
  1501                 mmCall = aCallList.GetMmCallByIndex( i );
       
  1502 
       
  1503                 if ( mmCall->MobileCallStatus() 
       
  1504                     == RMobileCall::EStatusConnected )
       
  1505                     {
       
  1506                     // Fetch the active call extension
       
  1507                     mmCallGsmWcdmaExt = static_cast<CMmCallGsmWcdmaExt*>(
       
  1508                         mmCall->ActiveCallExtension() );
       
  1509 
       
  1510                     //add GoOneToOne caps
       
  1511                     mmCallGsmWcdmaExt->AddGSMCallCaps( 
       
  1512                         RMobileCall::KCapsOneToOne );
       
  1513                     //complete caps change notification
       
  1514                     mmCall->CompleteNotifyMobileCallCapsChange( KErrNone );
       
  1515                     }
       
  1516                 }
       
  1517             }
       
  1518         }
       
  1519     }
       
  1520 
       
  1521 // ---------------------------------------------------------------------------
       
  1522 // CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent
       
  1523 // Informs the Gsm extension if there is conference call
       
  1524 // operation performed that has been initiated bypassing the ETel.
       
  1525 // (other items were commented in a header).
       
  1526 // ---------------------------------------------------------------------------
       
  1527 //
       
  1528 void CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent(
       
  1529     CMmDataPackage* aDataPackage )
       
  1530     {
       
  1531     TInt callId( -1 );
       
  1532     RMobilePhone::TMobileService callMode(
       
  1533         RMobilePhone::EServiceUnspecified );
       
  1534     TInt confEvent = -1;
       
  1535 
       
  1536     CCallDataPackage* callDataPackage = 
       
  1537         reinterpret_cast<CCallDataPackage*>(aDataPackage);
       
  1538 
       
  1539     callDataPackage->GetCallIdAndMode( callId, callMode );
       
  1540     callDataPackage->UnPackData( confEvent );
       
  1541 
       
  1542     //get current conference call status
       
  1543     RMobileConferenceCall::TMobileConferenceStatus status 
       
  1544             = iMmConferenceCallTsy->Status();
       
  1545 TFLOGSTRING2("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent. iMmConferenceCallTsy->Status():%d ", status );
       
  1546 
       
  1547     switch( confEvent )
       
  1548         {
       
  1549         case RMobileConferenceCall::EConferenceBuilt:
       
  1550             //if createConference has not been requested using ETel API
       
  1551             //and conference status is idle
       
  1552             if ( RMobileConferenceCall::EConferenceIdle == status && 
       
  1553                 !iMmConferenceCallTsy->ServiceRequested( CMmConferenceCallTsy::
       
  1554                     EMultimodeConferenceCallCreateConference ) )
       
  1555                 {
       
  1556 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - Build");
       
  1557                 //We have to get 2 active status indications before the 
       
  1558                 //conference has really gone to active state.
       
  1559                 iCreateConferenceCounter = 2;
       
  1560                 iCurrentGhostOperation = confEvent;
       
  1561                 }
       
  1562             //if addCall has not been requested using ETel API
       
  1563             //and conference status is Hold or Active
       
  1564             else if ( RMobileConferenceCall::EConferenceIdle != status &&
       
  1565                 !iMmConferenceCallTsy->ServiceRequested( CMmConferenceCallTsy::
       
  1566                     EMultimodeConferenceCallAddCall ) )
       
  1567                 {
       
  1568 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - Build/Add");
       
  1569                 iCurrentGhostOperation = confEvent;
       
  1570                 }
       
  1571             break;
       
  1572         case RMobileConferenceCall::EConferenceCallAdded:
       
  1573             //if addCall has not been requested using ETel API
       
  1574             //and conference status is Hold or Active
       
  1575             if ( RMobileConferenceCall::EConferenceIdle != status &&
       
  1576                 !iMmConferenceCallTsy->ServiceRequested( CMmConferenceCallTsy::
       
  1577                     EMultimodeConferenceCallAddCall ) )
       
  1578                 {
       
  1579 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - Add");
       
  1580                 iCurrentGhostOperation = confEvent;
       
  1581                 }
       
  1582             break;
       
  1583         case RMobileConferenceCall::EConferenceSwapped:
       
  1584             //if swap has not been requested using ETel API
       
  1585             if ( RMobileConferenceCall::EConferenceIdle != status &&
       
  1586                 !iMmConferenceCallTsy->ServiceRequested( 
       
  1587                 CMmConferenceCallTsy::EMultimodeConferenceCallSwap ) )
       
  1588                 {
       
  1589 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - Swap");
       
  1590                 iNumberOfCallsToBeSwapped 
       
  1591                     = iMmConferenceCallTsy->NumberOfCallsInConference();
       
  1592 
       
  1593                 iCurrentGhostOperation = confEvent;
       
  1594                 }
       
  1595             break;
       
  1596         //GoOneToOne has been requested
       
  1597         case RMobileConferenceCall::EConferenceSplit:
       
  1598             if ( !iGoOneToOneHandlingStarted )
       
  1599                 {
       
  1600 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - Split");
       
  1601                 iGoOneToOneHandlingStarted = ETrue;
       
  1602                 iCurrentGhostOperation = confEvent;
       
  1603                 iGoOneToOneCallId = callId;
       
  1604                 }
       
  1605             break;
       
  1606         default:
       
  1607 TFLOGSTRING("TSY: CMmConferenceCallGsmWcdmaExt::CompleteNotifyConferenceEvent - No Actions");
       
  1608             break;
       
  1609         }
       
  1610     }
       
  1611 
       
  1612 
       
  1613 //  End of File