convergedcallengine/cce/inc/cccecallcontainer.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 container
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCCECALLCONTAINER_H
       
    20 #define CCCECALLCONTAINER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "ccpdefs.h"
       
    25 
       
    26 #include "mccecallobserver.h"           // TCCECallState
       
    27 #include "mcceconferencecallobserver.h" // TCCEConferenceCallState
       
    28 #include "ccce.h"                       // CCCECallParameters
       
    29 #include "mccecallarray.h"
       
    30 #include "ccecallenums.h"
       
    31 
       
    32 class CCCE;
       
    33 class CCCEDtmf;
       
    34 class CCCECall;
       
    35 class CCCEDurationTimer;
       
    36 class CCCEConferenceCall;
       
    37 class CCCEPluginManager;
       
    38 class MCCEConferenceCallObserver;
       
    39 class MCCEDtmfObserver;
       
    40 class MCCPCall;
       
    41 class CConvergedCallProvider;
       
    42 class CCCEExtension;
       
    43 class MCCESsObserver;
       
    44 class MCCECallInfo;
       
    45 class CCCECallInfoMediator;
       
    46 
       
    47 // UID of CSPlugin
       
    48 const TUid KCSProviderUid = { 0x102828E5 }; 
       
    49 const TUid KVCCProviderUid = { 0x2000CFAA }; 
       
    50 
       
    51 /**
       
    52  *  Container
       
    53  *
       
    54  *  This object contains normal calls, emergency call and conference call.
       
    55  *  Also Dtmf and extension interfaces are located here.
       
    56  *  
       
    57  *  Multicall situations are also handled here.
       
    58  *  
       
    59  *  @lib cce.dll
       
    60  *  @since S60 v3.2
       
    61  */
       
    62 NONSHARABLE_CLASS(CCCECallContainer) : public CBase, public MCCECallArray
       
    63     {
       
    64 public:
       
    65 
       
    66     /**
       
    67      * Two-phased constructor.
       
    68      * @param aObserver Reference to observer
       
    69      */
       
    70     static CCCECallContainer* NewL( MCCEObserver& aObserver );
       
    71 
       
    72     /**
       
    73      * Destructor.
       
    74      */
       
    75     virtual ~CCCECallContainer();
       
    76 
       
    77 public: 
       
    78 
       
    79     /** @see CCCE::SetObserver */
       
    80     void SetObserver( MCCEObserver& aObserver, MCCESsObserver& aSsObserver );
       
    81 
       
    82     /** @see CCCE::OpenNewCallL */
       
    83     MCCECall& OpenNewCallL( const TDesC& aAddress,
       
    84          const CCCECallParameters& aCallParameters,
       
    85          const MCCECallObserver& aCallObserver );
       
    86 
       
    87     /** @see CCCE::ConferenceCallL */
       
    88     CCCEConferenceCall& ConferenceCallL(
       
    89         const MCCEConferenceCallObserver& aObserver );
       
    90 
       
    91     /** @see CCCE::EmergencyCall */
       
    92     MCCECall& EmergencyCall( const MCCECallObserver& aCallObserver );
       
    93 
       
    94     /** @see CCCE::GetAirTimeDuration */
       
    95     void GetAirTimeDuration( TTimeIntervalSeconds& aCSDuration, 
       
    96         TTimeIntervalSeconds& aPSDuration);
       
    97 
       
    98     /** @see CCCE::DtmfInterfaceL */
       
    99     CCCEDtmf& DtmfInterfaceL(
       
   100         const MCCEDtmfObserver& aObserver );
       
   101 
       
   102     /** @see CCCE::ExtensionInterfaceL */
       
   103     MCCEExtensionInterface& ExtensionInterfaceL(
       
   104         const MCCEExtensionObserver& aObserver );
       
   105 
       
   106 
       
   107     /**
       
   108      * Get call which isnt in use.
       
   109      *
       
   110      * @since S60 v3.2
       
   111      * @return Found call, NULL if none is found.
       
   112      */
       
   113     CCCECall* GetNextFreeCall() const;
       
   114 
       
   115     /**
       
   116      * Get call with specific id.
       
   117      *
       
   118      * @since S60 v3.2
       
   119      * @param aCallId Specifies which call is returned
       
   120      * @return Found call, NULL if none is found.
       
   121      */
       
   122     CCCECall* GetCall( TInt aCallId ) const;
       
   123 
       
   124     /**
       
   125      * This is called from cccecall.cpp when it is taken in use.
       
   126      *
       
   127      * @since S60 v3.2
       
   128      * @param aCallId CallId to be reserved
       
   129      */
       
   130     void ReserveCallInfoCallId( TInt aCallId );
       
   131 
       
   132     /**
       
   133      * This is called from cccecall.cpp when it is removed from use.
       
   134      *
       
   135      * @since S60 v3.2
       
   136      * @param aCallId CallId to be released
       
   137      */
       
   138     void ReleaseCallInfoCallId( TInt aCallId );
       
   139 
       
   140     /**
       
   141      * This is called when call status is changed.
       
   142      *
       
   143      * @since S60 v3.2
       
   144      * @param aStatus New call state
       
   145      * @param aCall Pointer to call which is changed
       
   146      * @aNotify Type of notify
       
   147      */
       
   148     void HandleCallStatusChange( 
       
   149         CCPCall::TCallState aStatus, 
       
   150         CCCECall* aCall,
       
   151         CCECallEnums::TNotifyType aNotify );
       
   152       
       
   153     /**
       
   154      * This is called when conference status is changed.
       
   155      *
       
   156      * @since S60 v3.2
       
   157      * @param aStatus New conference state 
       
   158      */
       
   159     void HandleConferenceStatusChange( 
       
   160         MCCEConferenceCallObserver::TCCEConferenceCallState aStatus );   
       
   161     
       
   162     /**
       
   163      * Indication from emergency call about status change.
       
   164      * 
       
   165      * @since S60 v5.0
       
   166      * @param aNotify Type of notify.
       
   167      */
       
   168     void HandleEmergencyCallStatusChange( CCECallEnums::TNotifyType aNotify );
       
   169 
       
   170     /**
       
   171      * Releases call
       
   172      *
       
   173      * @since S60 v3.2
       
   174      * @param aCalltoRemove Call to be removed
       
   175      * @param aUid Uid for this call
       
   176      * @return KErrNone if succesful
       
   177      */
       
   178     TInt ReleaseCall( MCCPCall& aCalltoRelease, const TUid aUid );
       
   179 
       
   180     /**
       
   181      * Releases call
       
   182      *
       
   183      * @since S60 v3.2
       
   184      * @param aCalltoRemove Call to be removed
       
   185      * @return KErrNone if succesful
       
   186      */
       
   187     TInt ReleaseCall( MCCPCall& aCalltoRelease );
       
   188 
       
   189     /**
       
   190      * Returns reference to conferencecall
       
   191      *
       
   192      * @since S60 v3.2
       
   193      * @return Conference call
       
   194      */
       
   195     CCCEConferenceCall& ConferenceCall() const;
       
   196 
       
   197     /**
       
   198      * Get call with specific state, Skip given call
       
   199      *
       
   200      * @since S60 v3.2
       
   201      * @param aCallStatus Specified callstatus.
       
   202      * @param aSkippedCall Skip this call
       
   203      * @return Found call, NULL if none is found.
       
   204      */
       
   205     CCCECall* GetCall( 
       
   206         CCPCall::TCallState aCallStatus, 
       
   207         CCCECall* aSkippedCall ) const;
       
   208 
       
   209     /**
       
   210      * Get call which owns specific MCCPCall.
       
   211      * If specified call is NULL return next free call
       
   212      *
       
   213      * @since S60 v3.2
       
   214      * @param aMCCPCall Call to be found.
       
   215      * @return Found call.
       
   216      */
       
   217     CCCECall* GetCall( const MCCPCall* aMCCPCall) const;
       
   218 
       
   219     /**
       
   220      * Get call array of specific type
       
   221      *
       
   222      * @since S60 v3.2
       
   223      * @param aImplementationUid Specifies calltype to be found
       
   224      * @param aCallArray Calls are inserted in this array
       
   225      * @return Count of found calls, KErrNotFound if none found
       
   226      */
       
   227     TInt GetCall( TUid aImplementationUid, 
       
   228         RPointerArray<CCCECall>& aCallArray ) const;
       
   229 
       
   230     /**
       
   231      * Checks if there is any connected, connecting or dialling calls
       
   232      *
       
   233      * @since S60 v3.2
       
   234      * @param aCallArray Calls are inserted in this array
       
   235      * @return Count of found calls, KErrNotFound if none found
       
   236      */
       
   237     TInt GetActiveOrConnectingCalls( RPointerArray<MCCECallInfo>& aCallArray ) const;
       
   238     
       
   239     /**
       
   240      * Counts calls of specified type
       
   241      *
       
   242      * @since S60 v3.2
       
   243      */
       
   244     TInt CountCalls( TUid aImplementationUid ) const;
       
   245     
       
   246     /**
       
   247      * Counts calls of specified type
       
   248      * Check implementation UID and call type
       
   249      * so that call provided by CS plugin
       
   250      */
       
   251     TInt CountCsCalls( TUid aImplementationUid ) const;
       
   252     
       
   253     /**
       
   254      * Create room to incoming emergency
       
   255      *
       
   256      * @since S60 v3.2
       
   257      */
       
   258     void TerminateAllButRingingAndQueuedCalls();
       
   259     
       
   260      /**
       
   261      * Create room to emergency
       
   262      *
       
   263      * @since S60 v3.2
       
   264      */
       
   265     void TerminateAllCalls();
       
   266     
       
   267     /**
       
   268     * Create room to emergency
       
   269     *
       
   270     * @since S60 v3.2
       
   271     */
       
   272    void TerminateAllVoIPCalls();
       
   273    
       
   274     /**
       
   275      * Call propagated error
       
   276      *
       
   277      * @since S60 v3.2
       
   278      * @param aCall CCCECall failed
       
   279      * @param aError error occured
       
   280      */
       
   281     void ErrorOccurred( CCCECall* aCall, TCCPError aError );
       
   282 
       
   283     /**
       
   284      * Get CCE observer
       
   285      * @since S60 v3.2
       
   286      * @param none
       
   287      * @return CCE observer reference.
       
   288      */
       
   289     MCCEObserver* CCEObserver();
       
   290 
       
   291     /**
       
   292      * Get ss observer
       
   293      * @since S60 v3.2
       
   294      * @param none
       
   295      * @return CCE observer reference.
       
   296      */
       
   297     MCCESsObserver* SsObserver();
       
   298     
       
   299     /**
       
   300      * Get life time info from CS plugin.
       
   301      * @since S60 v3.2
       
   302      * @param aLifeTimeInfo Life time info.
       
   303      * @return Get succeeded ot not.
       
   304      */
       
   305 	TBool GetLifeTime( TDes8& aLifeTimeInfo );
       
   306 
       
   307     /**
       
   308      * Get CS specific misc info from CS plugin.
       
   309      * @since S60 v3.2
       
   310      * @param aCSInfo CS info.
       
   311      * @return Get succeeded ot not.
       
   312      */
       
   313 	TBool GetCSInfo( CSInfo& aCSInfo );
       
   314 	
       
   315 	/**
       
   316      * Stop airtime duration timer
       
   317      *
       
   318      * @since S60 v3.2
       
   319      * @param aCall CCCECall is used for checking call type
       
   320      */
       
   321     void AirTimeDurationStop( CCCECall* aCall ) const;
       
   322 	
       
   323 	/**
       
   324      * Switch Air Duration timer, is needed for handover
       
   325      * 
       
   326      * Stop current timer and starts another one. New timer is initialized 
       
   327      * with the same value that old timer had when it was stopped
       
   328      *
       
   329      * @since S60 v3.2
       
   330      * @param aCall aNewCallType new call type, indicated direction of 
       
   331      * timer switching
       
   332      */
       
   333     void AirTimeDurationSwap(const CCPCall::TCallType aNewCallType);
       
   334 	
       
   335     /**
       
   336      * Start airtime duration timer
       
   337      *
       
   338      * @since S60 v3.2
       
   339      * @param aCall CCCECall is used for checking call type
       
   340      */
       
   341     void AirTimeDurationStart( CCCECall* aCall ) const;
       
   342     
       
   343     /**
       
   344      * From base class MCCECallArray
       
   345      * @see MCCECallArray
       
   346      */
       
   347     MCCECallInfo* EmergencyCallInfo() const;
       
   348     
       
   349     /**
       
   350      * From base class MCCECallArray
       
   351      * @see MCCECallArray
       
   352      */
       
   353     MCCECallInfo* CallInfo( TInt aIndex ) const;
       
   354        
       
   355     /**
       
   356      * From base class MCCECallArray
       
   357      * @see MCCECallArray
       
   358      */
       
   359     TInt MaxNumberOfCalls() const;
       
   360 
       
   361 private:
       
   362 
       
   363     /**
       
   364      * Gets call with active request, skip call which is given as param
       
   365      *
       
   366      * @since S60 v3.2
       
   367      * @param aCall Call to be skipped
       
   368      * @return Found call, NULL if notfound
       
   369      */
       
   370     CCCECall* GetCallWithActiveRequest( CCCECall* aCall ) const;
       
   371 
       
   372     /**
       
   373      * Creates call array
       
   374      *
       
   375      * @since S60 v3.2
       
   376      */
       
   377     void CreateCallDataArraysL();
       
   378 
       
   379    
       
   380     
       
   381     /**
       
   382      * Add a call to release list
       
   383      *
       
   384      * @since S60 v3.2
       
   385      * @param aCall CCCECall is used for checking call type
       
   386      */
       
   387      void ScheduleReleaseCall( MCCPCall& aCalltoRelease, const TUid aUid );
       
   388  
       
   389    /**
       
   390      * This is called when call(s) is(are) scheduled to be released
       
   391      *
       
   392      * @since S60 v3.2
       
   393      * @param aPluginManager 
       
   394      * @return KErrNone if successful
       
   395      *         ( KErrNone always or else there is posiibility to loop
       
   396      */
       
   397     static TInt ReleaseCalls( TAny* aCallContainer );
       
   398    
       
   399     /**
       
   400      * Clear the array of calls to be released
       
   401      *
       
   402      * @since S60 v3.2
       
   403      */
       
   404     void DoReleaseCalls();
       
   405     
       
   406     /**
       
   407      * Gets call which isnt part of conference
       
   408      *
       
   409      * @since S60 v3.2
       
   410      */
       
   411     CCCECall* GetNonConferenceCall() const;
       
   412     
       
   413     /**
       
   414      * Tells if cs plugin is used in current call
       
   415      *
       
   416      * @since S60 v3.2
       
   417      * @param aCall Call to be checked
       
   418      * @return ETrue if cs plugin used
       
   419      */
       
   420     TBool IsCsPlugin( CCCECall* aCall, TBool aConference ) const;
       
   421     
       
   422 private:
       
   423 
       
   424     /** Constructor */
       
   425     CCCECallContainer( MCCEObserver& aObserver );
       
   426 
       
   427     /** Leaving stuff in constructor */
       
   428     void ConstructL();
       
   429     
       
   430 private: // data
       
   431     
       
   432     /**
       
   433      * Class to hold removed cal information 
       
   434      * used in delayed release
       
   435      */
       
   436     class TCallReleaseEntry
       
   437         {
       
   438         public:
       
   439             /**
       
   440              * Pointer to call object
       
   441              * Not own
       
   442              */
       
   443             MCCPCall* iCallToRelease;
       
   444             /**
       
   445              * Uid of plugin where call is located 
       
   446              */
       
   447             TUid iUid; 
       
   448          };
       
   449      
       
   450      RArray<TCallReleaseEntry> iCallstoRelease;
       
   451     /**
       
   452      * Dealyed releaser
       
   453      * Own
       
   454      */
       
   455     CIdle* iIdle;    
       
   456    
       
   457     /**
       
   458      * Observer
       
   459      * Not own
       
   460      */
       
   461     MCCEObserver* iMCCEObserver;
       
   462    
       
   463     /**
       
   464      * Observer
       
   465      * Not own
       
   466      */
       
   467     MCCESsObserver* iMCCESsObserver;
       
   468     
       
   469     /**
       
   470      * Conference call object
       
   471      * Own
       
   472      */
       
   473     CCCEConferenceCall* iConferenceCall;
       
   474     
       
   475     /**
       
   476      * Pluginmanager, manages plugin loading
       
   477      * Own
       
   478      */
       
   479     CCCEPluginManager* iPluginManager;
       
   480 
       
   481     /**
       
   482      * Emergency call object
       
   483      * Own
       
   484      */
       
   485     CCCEEmergencyCall*  iEmergencyCall;
       
   486    
       
   487     /**
       
   488      * Transfer controller
       
   489      * Own
       
   490      */
       
   491     CCCETransferController* iTransferController;
       
   492    
       
   493     /**
       
   494      * Dtmf logic container
       
   495      * Own
       
   496      */
       
   497     CCCEDtmf* iDtmf;
       
   498     
       
   499     /**
       
   500      * Extension interface logic
       
   501      * Own
       
   502      */
       
   503     CCCEExtension* iExtension;
       
   504     
       
   505     /**
       
   506      * Array of call objects
       
   507      * Own
       
   508      */
       
   509     CArrayPtrFlat<CCCECall>* iCallArray;
       
   510        
       
   511     /**
       
   512      * CS call duration
       
   513      * Own
       
   514      */
       
   515     CCCEDurationTimer* iCSDuration;
       
   516       
       
   517     /**
       
   518      * PS call duration
       
   519      * Own
       
   520      */
       
   521     CCCEDurationTimer* iPSDuration;
       
   522     
       
   523     /**
       
   524      * Table is filled so that call info callid 0 is used by
       
   525      * callid in table index 0 etc.
       
   526      */
       
   527     TFixedArray<TInt, KCCECallObjects> iCallInfoCallId;
       
   528     
       
   529     /** 
       
   530      * Call info mediator.
       
   531      * Own.
       
   532      */
       
   533     CCCECallInfoMediator* iCallStateMediator;
       
   534     
       
   535     };
       
   536     
       
   537     
       
   538 #endif