convergedcallengine/cce/inc/cccecall.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Implementation for call object
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCCECALL_H
       
    20 #define CCCECALL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <cccpcallparameters.h>
       
    24 
       
    25 #include "ccpdefs.h" // TCCPError defs
       
    26 
       
    27 #include "mccpcallobserver.h"     // MCCPCallObserver
       
    28 #include "mccptransferobserver.h" // MCCPTransferObserver
       
    29 #include "mccpforwardobserver.h"  // MCCPForwardObserver
       
    30 #include "mccecall.h"             // MCCECall
       
    31 #include "mccecallobserver.h"     // For enumeration use
       
    32 #include "mccecallinfo.h"
       
    33 #include "ccecallenums.h"
       
    34 
       
    35 class CCCEDurationTimer;
       
    36 class CCCECallContainer;
       
    37 class MCCPCall;
       
    38 class MCCPTransferProvider;
       
    39 class CCCETransferController;
       
    40 class MCCPForwardProvider;
       
    41 class CCCECallObserverAsynchroniser;
       
    42 
       
    43 /**
       
    44  *  Internal call object
       
    45  *
       
    46  *  This object contains logic for this specific call
       
    47  *
       
    48  *  @lib cce.dll
       
    49  *  @since S60 v3.2
       
    50  */
       
    51 NONSHARABLE_CLASS(CCCECall) : public CBase,
       
    52                               public MCCPCallObserver,
       
    53                               public MCCPTransferObserver,
       
    54                               public MCCPForwardObserver,
       
    55                               public MCCECall,
       
    56                               public MCCECallInfo
       
    57     {
       
    58     
       
    59 public:
       
    60 
       
    61     /** Enumeration for requests */ 
       
    62     enum TCallRequest
       
    63        {
       
    64        ECCENone                  =   0x00000000, // 0 must be set to 0
       
    65        ECCEDial,                                 // 1
       
    66        ECCEReleaseActive,                        // 2
       
    67        ECCEReleaseHeld,                          // 3
       
    68        ECCEReleaseOutgoing,                      // 4
       
    69        ECCERejectIncoming,                       // 5
       
    70        ECCETerminateDisconnected,                // 6
       
    71        ECCEHold,                                 // 7
       
    72        ECCEResume,                               // 8
       
    73        ECCESwap,                                 // 9
       
    74        ECCETransfer,                             //10
       
    75        ECCEConferenceJoin,                       //11
       
    76        ECCEMakeEmergencyCall,                    //12
       
    77        ECCEAnswer,                               //13
       
    78        ECCEConferencePrivate,                    //14
       
    79        ECCEConferenceDropParticipant,            //15
       
    80        ECCEConferenceTerminate,                  //16
       
    81        ECCESwitchCallMode,                       //17
       
    82        ECCEReplaceActive,                        //18
       
    83        ECCETerminateAll,                         //19
       
    84        ECCETerminateAllAndWaiting,               //20
       
    85        ECCETerminateAllActiveCalls,              //21
       
    86        ECCETerminateAllHeldCalls,                //22
       
    87        ECCEClearBlackListing,                    //23
       
    88        ECCETerminateAndDial,                     //24    
       
    89        ECCEActivateCcbs,                         //25
       
    90        ECCERejectCcbs,                           //26
       
    91        ECCEUnattendedTransfer,                   //27  
       
    92        ECCEPark                                  //28
       
    93        };
       
    94 
       
    95 private:
       
    96 
       
    97  
       
    98     class TStateTransition
       
    99         {
       
   100     public:
       
   101     	TStateTransition() 
       
   102     		{
       
   103     		iState = CCPCall::EStateIdle;
       
   104     		iInband = EFalse;
       
   105     		}
       
   106 
       
   107     	CCPCall::TCallState iState;
       
   108         TBool iInband;
       
   109         };
       
   110 public:
       
   111 
       
   112     /**
       
   113      * Two-phased constructor.
       
   114      * @param aCallContainer Reference callcontainer
       
   115      * @param aCallId Defines id for this call
       
   116      */
       
   117     static CCCECall* NewLC( CCCECallContainer& aCallContainer, TInt aCallId );
       
   118     
       
   119     /**
       
   120      * Destructor.
       
   121      */
       
   122     virtual ~CCCECall();
       
   123 
       
   124 public:
       
   125 
       
   126     /**
       
   127      * Sets new converged call into to use.
       
   128      *
       
   129      * @since S60 v3.2
       
   130      * @param aCall Pointer to used ccp call
       
   131      * @param aImplementationUid Implementation uid of plugin that call is from
       
   132      * @param aTransferred Flag indicating if this was transferred call. In that
       
   133      * case some of the initilizations made in this method should not be done
       
   134      * @return None
       
   135      */
       
   136     void SetConvergedCallL( 
       
   137         MCCPCall* aCall,
       
   138         TUid aImplementationUid,
       
   139         TBool aTransferred = EFalse );
       
   140 
       
   141     /**
       
   142      * Informs to observers that calls request has been completed.
       
   143      *
       
   144      * @since S60 v3.2
       
   145      * @param aRequest Request to be completed
       
   146      * @param aError Error code for request( KErrNone if succesful )
       
   147      */
       
   148     void NotifyRequestComplete( TInt aRequest, TCCPError aError );
       
   149 
       
   150     /**
       
   151      * Complete currently ongoing request
       
   152      *
       
   153      * @since S60 v3.2
       
   154      * @param aError Error code ( KErrNone if succesful )
       
   155      */
       
   156     void RequestComplete( TCCPError aError );
       
   157 
       
   158     /**
       
   159      * Do request that is pending. This is needed in multicall dial and answer.
       
   160      *
       
   161      * @since S60 v3.2
       
   162      * @return KErrNone if request was started succesfully. 
       
   163      */
       
   164     TInt DoPendingRequest();
       
   165 
       
   166     /**
       
   167      * Call object in use.
       
   168      *
       
   169      * @since S60 v3.2
       
   170      * @return ETrue if in use. 
       
   171      */
       
   172     TBool IsInUse() const;
       
   173 
       
   174     /**
       
   175      * Service id of this call.
       
   176      *
       
   177      * @since S60 v3.2
       
   178      * @return Service id of this call, 0 if not in use. 
       
   179      */
       
   180      TUint32 ServiceId() const;
       
   181 
       
   182     /**
       
   183      * Reference to owned converged call provider call.
       
   184      *
       
   185      * @since S60 v3.2
       
   186      * @return Reference to MCCPCall. 
       
   187      */    
       
   188     MCCPCall& GetCCPCall() const;
       
   189 
       
   190     /**
       
   191      * Returns currently ongoing request.
       
   192      *
       
   193      * @since S60 v3.2
       
   194      * @return Currently ongoing request 
       
   195      */
       
   196     TCallRequest Request() const;
       
   197         
       
   198      /**
       
   199      * Id of this call
       
   200      *
       
   201      * @since S60 v3.2
       
   202      * @return Id of this call. 
       
   203      */
       
   204     TInt CallId() const;
       
   205 
       
   206     /**
       
   207      * Adds new observer for MCCECall object.
       
   208      * 
       
   209      * @since S60 v3.2
       
   210      * @param aCallObserver Observer
       
   211      */
       
   212     void SetObserver( const MCCECallObserver& aObserver );
       
   213     
       
   214     /**
       
   215      * Put call on hold but dont complete request.
       
   216      * This is used in multicall situations.
       
   217      *
       
   218      * @since S60 v3.2
       
   219      * @return KErrNone if request was started succesfully. 
       
   220      */
       
   221     TInt HoldNoNotify();
       
   222 
       
   223     /**
       
   224      * Resume call but dont complete request.
       
   225      * This is used in multicall situations.
       
   226      *
       
   227      * @since S60 v3.2
       
   228      * @return KErrNone if request was started succesfully. 
       
   229      */
       
   230     TInt ResumeNoNotify();
       
   231     
       
   232     /**
       
   233      * Called by the TransferController object in case when remote end has been
       
   234      * inititated transfer
       
   235      * @since S60 v3.2
       
   236      * @param aAttended Type of the transfer ETrue if type is attended 
       
   237      * otherwise EFalse
       
   238      * @param aTransferController Reference to TransferController
       
   239      * @return None
       
   240      */
       
   241     void HandleTransfer( const TBool aAttented,
       
   242                          CCCETransferController& aTransferController );
       
   243     
       
   244      /**
       
   245      * Sets TransferController handle
       
   246      * @since S60 v3.2
       
   247      * @param aTransferController Pointer to TransferController object
       
   248      * @return None
       
   249      */
       
   250     void SetTransferController( CCCETransferController* aTransferController );
       
   251     
       
   252     /**
       
   253      * Sets new call index if call index not valid.
       
   254      * 
       
   255      * @since S60 5.0
       
   256      */
       
   257     void SetNewCallIndex();
       
   258 
       
   259 // from base class MCCECall
       
   260 
       
   261     /** @see MCCECall::Release */
       
   262     TInt Release();
       
   263 
       
   264     /** @see MCCECall::ReplaceActive */
       
   265 	TInt ReplaceActive();
       
   266 
       
   267     /** @see MCCECall::Hold */
       
   268     TInt Hold();
       
   269 
       
   270     /** @see MCCECall::Resume */
       
   271     TInt Resume();
       
   272     
       
   273     /** @see MCCECall::HangUp */
       
   274     TInt HangUp();
       
   275 
       
   276     /** @see MCCECall::State */
       
   277     CCPCall::TCallState State() const;
       
   278     
       
   279     /** @see MCCECall::Tone */
       
   280      TCCPTone Tone() const;
       
   281 
       
   282     /** @see MCCECall::CallDuration */
       
   283     TTimeIntervalSeconds CallDuration() const;
       
   284 
       
   285     /** @see MCCECall::Parameters */
       
   286     const CCCPCallParameters& Parameters() const;
       
   287 
       
   288 // from base class MCCPCallObserver
       
   289 
       
   290     /** @see MCCPCallObserver::ErrorOccurred */
       
   291     void ErrorOccurred( TCCPError aError, MCCPCall* aCall );
       
   292     
       
   293     /** @see MCCPCallObserver::CallStateChanged */
       
   294     void CallStateChanged( TCCPCallState aState, MCCPCall* aCall );
       
   295 
       
   296 // from class MCCECallInfo
       
   297     
       
   298     /** @see MCCECallInfo::ImplementationUid */
       
   299     const TUid ImplementationUid() const;
       
   300     
       
   301     /** @see MCCECallInfo::Direction */
       
   302     CCPCall::TCallDirection Direction() const;
       
   303     
       
   304     /** @see MCCECallInfo::CallType */
       
   305     CCPCall::TCallType CallType() const;
       
   306     
       
   307     /** @see MCCECallInfo::CallIndex and MCCECall::CallIndex */
       
   308     TInt CallIndex() const;
       
   309     
       
   310 private: 
       
   311 
       
   312 // from base class MCCECall
       
   313 
       
   314     /** @see MCCECall::SetParameters */
       
   315     void SetParameters( const CCCECallParameters& aNewParams );
       
   316     
       
   317     /** @see MCCECall::Swap */
       
   318     TInt Swap();
       
   319 
       
   320     /** @see MCCECall::Answer */
       
   321     TInt Answer();
       
   322 
       
   323     /** @see MCCECall::Dial */
       
   324     TInt Dial( const TDesC8& aCallParams );
       
   325 
       
   326     /** @see MCCECall::DialEmergencyCall */
       
   327     void DialEmergencyCall( const TDesC16& aNumber );
       
   328 
       
   329     /** @see MCCECall::ForwardToAddressL */
       
   330     void ForwardToAddressL( TInt aIndex );
       
   331 
       
   332     /** @see MCCECall::GetMobileCallInfo */
       
   333     void GetMobileCallInfo( TDes8& aCallInfo ) const;
       
   334 
       
   335     /** @see MCCECall::StartTime */
       
   336     TDateTime StartTime() const;
       
   337 
       
   338     /** @see MCCECall::Caps */
       
   339     MCCECallObserver::TCCECallControlCaps Caps() const;
       
   340 
       
   341     /** @see MCCECall::IsSecureSpecified */
       
   342     TBool SecureSpecified() const;
       
   343 
       
   344     /** @see MCCECall::IsSecured */
       
   345     TBool IsSecured() const;
       
   346     
       
   347     /** @see MCCECall::IsEmergency and MCCECallInfo::IsEmergency */
       
   348     TBool IsEmergency() const;
       
   349 
       
   350     /** @see MCCECall::RemoteParty */
       
   351     const TDesC& RemoteParty() const;
       
   352 
       
   353     /** @see MCCECall::RemotePartyName */
       
   354     const TDesC& RemotePartyName() const;
       
   355 
       
   356     /** @see MCCECall::DialledParty */
       
   357     const TDesC& DialledParty() const;
       
   358     
       
   359     /** @see MCCECall::AttendedTransfer */
       
   360     TInt AttendedTransfer( const TDesC& aTransferTarget );
       
   361 
       
   362     /** @see MCCECall::UnattendedTransfer */
       
   363     TInt UnattendedTransfer( const TDesC& aTarget );
       
   364 
       
   365     /** @see MCCECall::AcceptTransfer */
       
   366     TInt AcceptTransfer( const TBool aAccept );
       
   367 
       
   368     /** @see MCCECall::TransferTarget */
       
   369     const TDesC& TransferTarget() const;
       
   370 
       
   371     /** @see MCCECall::GetForwardAddressChoicesL */
       
   372     const CDesC8Array& GetForwardAddressChoicesL();
       
   373 
       
   374 // from base class MCCECSCall
       
   375 
       
   376     /** @see MCCECSCall::SwitchAlternatingCall */
       
   377     TInt SwitchAlternatingCall();
       
   378     
       
   379     /** @see MCCECSCall::GetMobileDataCallCaps */
       
   380     TInt GetMobileDataCallCaps( TDes8& aCaps ) const;
       
   381     
       
   382     /** @see MCCECSCall::NoFDNCheck */
       
   383     void NoFDNCheck();
       
   384     
       
   385     /** @see MCCECSCall::LogDialedNumber */
       
   386     TBool LogDialedNumber() const;
       
   387     
       
   388 // from base class MCCPCallObserver
       
   389     
       
   390     /** @see MCCPCallObserver::CallEventOccurred */
       
   391     void CallEventOccurred( TCCPCallEvent aEvent, MCCPCall* aCall );
       
   392     
       
   393     /** @see MCCPCallObserver::CallCapsChanged */
       
   394     void CallCapsChanged( TUint32 aCapsFlags, MCCPCall* aCall );
       
   395     
       
   396     /** @see MCCPCallObserver::CallStateChangedWithInband */
       
   397     void CallStateChangedWithInband( TCCPCallState aState, MCCPCall* aCall );
       
   398     
       
   399 // from base class MCCPTransferObserver
       
   400 
       
   401     /** @see MCCPTransferObserver::TransferEventOccurred */
       
   402     void TransferEventOccurred( TCCPTransferEvent aEvent );
       
   403 
       
   404 // from base class MCCPForwardObserver
       
   405 
       
   406      /** @see MCCPForwardObserver::ForwardEventOccurred */
       
   407     void ForwardEventOccurred( 
       
   408         const MCCPForwardObserver::TCCPForwardEvent aEvent );
       
   409 
       
   410 private:
       
   411 
       
   412     /**
       
   413      * Reset call members
       
   414      *
       
   415      * @since S60 v3.2
       
   416      */
       
   417     void Reset();
       
   418 
       
   419     /**
       
   420      * Handle call state change
       
   421      *
       
   422      * @since S60 v3.2
       
   423      * @param aCallState New call state ( TCCPCallState )
       
   424      * @param aInband ETrue if tones for this status is generated inband
       
   425      */
       
   426     void CallStateChanged( TCCPCallState aState, TBool aInband );
       
   427 
       
   428     /**
       
   429      * Notify call state changes to observers
       
   430      *
       
   431      * @since S60 v3.2
       
   432      * @param aCallStatus New call state
       
   433      * @param aInband ETrue if tones for this status is generated inband
       
   434      */
       
   435     void NotifyCallStatusChange( 
       
   436         CCPCall::TCallState aCallStatus, 
       
   437         TBool aInband, 
       
   438         CCECallEnums::TNotifyType aNotify);
       
   439 
       
   440     /**
       
   441      * Tells if cs plugin is used in current call
       
   442      *
       
   443      * @since S60 v3.2
       
   444      * @return ETrue if cs plugin used
       
   445      */
       
   446     TBool IsCsPlugin() const;
       
   447     
       
   448 private:
       
   449 
       
   450     /** Constructor */
       
   451     CCCECall( CCCECallContainer& aCallContainer, TInt aCallId );
       
   452 
       
   453     /** Leaving stuff in constructor */
       
   454     void ConstructL();
       
   455 
       
   456 private: // data
       
   457 
       
   458     /**
       
   459      * Id for this call
       
   460      */
       
   461     const TInt iCallId;
       
   462 
       
   463     /**
       
   464      * Callcontainer that owns this call
       
   465      */
       
   466     CCCECallContainer& iCallContainer;
       
   467         
       
   468     /**
       
   469      * Currently ongoing request
       
   470      */
       
   471     TCallRequest iActiveRequest;
       
   472     
       
   473     /**
       
   474      * KErrNone if everythink OK
       
   475      */
       
   476     TCCPError iExitCode;
       
   477     
       
   478     /**
       
   479      * Call direction
       
   480      */
       
   481     CCPCall::TCallDirection iCallDirection;
       
   482 
       
   483     /**
       
   484      * If request is made internally, its completion is not
       
   485      * notified to observer. This variable contains request
       
   486      * id of internal request
       
   487      */
       
   488     TInt iDoNotReportRequest;
       
   489     
       
   490     /**
       
   491      * Call status for internal use
       
   492      */
       
   493     CCPCall::TCallState iCallState;
       
   494     
       
   495     /**
       
   496      * Plugin implementation Uid
       
   497      */
       
   498     TUid iImplementationUid;
       
   499     
       
   500     /**
       
   501      * Callparameters
       
   502      */
       
   503     CCCPCallParameters* iCallParameters;
       
   504     
       
   505     /**
       
   506      * CS call only
       
   507      * Not own
       
   508      */
       
   509     const TDesC8* iCallParams;
       
   510     
       
   511     /**
       
   512      * Pointer to observer
       
   513      * Own
       
   514      */
       
   515     CCCECallObserverAsynchroniser* iObserver;
       
   516     
       
   517     /**
       
   518      * Pointer to converged call provider call
       
   519      * Own
       
   520      */
       
   521     MCCPCall* iCall;
       
   522     
       
   523     /**
       
   524      * Counts duration for this call
       
   525      * Own
       
   526      */
       
   527     CCCEDurationTimer* iCCEDurationTimer;
       
   528     
       
   529     /**
       
   530      * ForwardProvider interface handle
       
   531      * Own
       
   532      */
       
   533     MCCPForwardProvider* iForwardProvider;
       
   534     
       
   535     /**
       
   536      * TransferProvider interface handle. 
       
   537      * Not own
       
   538      */  
       
   539     MCCPTransferProvider* iTransferProvider;
       
   540      
       
   541     /**
       
   542      * TransferController handle. 
       
   543      * Not own
       
   544      */ 
       
   545     CCCETransferController* iTransferController;
       
   546     
       
   547     /**
       
   548      * GSM spec Call index.
       
   549      */
       
   550     TInt iCallIndex;
       
   551     
       
   552    
       
   553     };
       
   554 
       
   555 #endif // CCCECALL_H