convergedcallengine/cce/inc/ccceemergencycall.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 emergency call object
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCCEEMERGENCYCALL_H
       
    20 #define CCCEEMERGENCYCALL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <mccpcallobserver.h>
       
    24 #include <mccpemergencycall.h>
       
    25 
       
    26 #include "ccpdefs.h" // TCCPError defs
       
    27 #include "mccecall.h"
       
    28 #include "mccecallobserver.h"
       
    29 #include "cccepluginmanager.h"
       
    30 #include "cccecallobserverasynchroniser.h"
       
    31 #include "mccecallinfo.h"
       
    32 #include "ccecallenums.h"
       
    33 
       
    34 // CONSTANTS
       
    35 const TInt KMaxEmergencyNumberLenght = 16;
       
    36 
       
    37 class CCCEDurationTimer;
       
    38 
       
    39 /**
       
    40  *  Internal emergency call object
       
    41  *
       
    42  *  This object contains logic for emergency call
       
    43  *
       
    44  *  @lib cce.dll
       
    45  *  @since S60 v3.2
       
    46  */
       
    47 NONSHARABLE_CLASS(CCCEEmergencyCall) : public CActive,
       
    48                               public MCCECall,
       
    49                               public MCCPCallObserver,
       
    50                               public MCCECallInfo
       
    51     {
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      * @param aCallContainer Reference callcontainer
       
    57      * @param aPluginManager Reference to plugin managerl
       
    58      */
       
    59     static CCCEEmergencyCall* NewL(CCCECallContainer& aCallContainer, 
       
    60                                    CCCEPluginManager& aPluginManager );
       
    61    
       
    62     /**
       
    63      * Two-phased constructor.
       
    64      * @param aCallContainer Reference callcontainer
       
    65      * @param aPluginManager Reference to plugin managerl
       
    66      */
       
    67     static CCCEEmergencyCall* NewLC(CCCECallContainer& aCallContainer, 
       
    68                                     CCCEPluginManager& aPluginManager );
       
    69     
       
    70     /**
       
    71      * Destructor.
       
    72      */
       
    73     virtual ~CCCEEmergencyCall();
       
    74     
       
    75     /**
       
    76      * Returnd ETrue if emergency call is in progress
       
    77      */
       
    78     TBool IsInProgress();
       
    79  
       
    80 // from class CActive
       
    81 
       
    82     /** @see CActive::RunL */  
       
    83     void RunL();
       
    84 
       
    85     /** @see CActive::RunError */
       
    86     TInt RunError(TInt aError);
       
    87 
       
    88     /** @see CActive::DoCancel */
       
    89     void DoCancel();
       
    90  
       
    91 // from class MCCECall
       
    92 
       
    93     /** @see MCCECall::Dial */
       
    94     void SetObserver( const MCCECallObserver& aObserver );
       
    95    
       
    96     /** @see MCCECall::DialEmergencyCall */
       
    97     void DialEmergencyCall( const TDesC16& aNumber );
       
    98 
       
    99     /** @see MCCECall::HangUp */
       
   100     TInt HangUp();
       
   101 
       
   102     /** @see MCCECall::Answer */
       
   103     TInt Answer();
       
   104 
       
   105     /** @see MCCECall::IsEmergency and MCCECallInfo::IsEmergency */
       
   106     TBool IsEmergency() const;
       
   107    
       
   108     /** @see MCCECall::GetMobileCallInfo */
       
   109     void GetMobileCallInfo( TDes8& aCallInfo ) const;
       
   110     
       
   111     /** @see MCCECall::Parameters */
       
   112     const CCCECallParameters& Parameters() const;
       
   113     
       
   114     /** @see MCCECall::State */
       
   115     CCPCall::TCallState State() const;
       
   116 
       
   117 // from class MCCPCallObserver
       
   118 
       
   119     /** @see MCCPCallObserver::ErrorOccurred */
       
   120     void ErrorOccurred( TCCPError aError, MCCPCall* aCall ); 
       
   121     
       
   122     /** @see MCCPCallObserver::CallStateChanged */
       
   123     void CallStateChanged( TCCPCallState aState, MCCPCall* aCall ); 
       
   124     
       
   125     /** @see MCCPCallObserver::CallEventOccurred */
       
   126     void CallEventOccurred( TCCPCallEvent aEvent, MCCPCall* aCall ); 
       
   127     
       
   128     /** @see MCCPCallObserver::CallCapsChanged */
       
   129     void CallCapsChanged( TUint32 aCapsFlags, MCCPCall* aCall ); 
       
   130     
       
   131     /** @see MCCPCallObserver::CallStateChangedWithInband */
       
   132     void CallStateChangedWithInband( TCCPCallState aState, MCCPCall* aCall ); 
       
   133     
       
   134 // from class MCCECallInfo
       
   135     
       
   136     /** @see MCCECallInfo::ImplementationUid */
       
   137     const TUid ImplementationUid() const;
       
   138     
       
   139     /** @see MCCECallInfo::Direction */
       
   140     CCPCall::TCallDirection Direction() const;
       
   141     
       
   142     /** @see MCCECallInfo::CallType */
       
   143     CCPCall::TCallType CallType() const;
       
   144     
       
   145     /** @see MCCECallInfo::CallIndex, MCCECall::CallIndex */
       
   146     TInt CallIndex() const;
       
   147     
       
   148 private:
       
   149 
       
   150     enum TEmergencyCallRequest
       
   151         {
       
   152         ECCENone                  =   0x00000000, // 0 must be set to 0
       
   153         ECCEDial,                                 // 1
       
   154         ECCEReleaseActive                         // 2
       
   155         };
       
   156 
       
   157     enum TCCEEmergencyState
       
   158         {
       
   159         EPrimary = 1,
       
   160         EOther,
       
   161         ETerminated
       
   162         };
       
   163 
       
   164     
       
   165     class TStateTransition
       
   166         {
       
   167     public:
       
   168     	TStateTransition() 
       
   169     		{
       
   170     		iState = CCPCall::EStateIdle;
       
   171     		iInband = EFalse;
       
   172     		}
       
   173     		
       
   174     	CCPCall::TCallState iState;
       
   175         TBool iInband;
       
   176         };
       
   177     /**
       
   178      * Constructor.
       
   179      */  
       
   180     CCCEEmergencyCall(CCCECallContainer& aCallContainer, CCCEPluginManager& aPluginManager );
       
   181    
       
   182     /**
       
   183      * leaving parts of constructor.
       
   184      */
       
   185     void ConstructL();
       
   186     
       
   187     /**
       
   188      * Next available plugin.
       
   189      */
       
   190     void NextPluginL();
       
   191    
       
   192     /**
       
   193      * Removes used plugin if was other than primary.
       
   194      */
       
   195     void ReleasePlugin();
       
   196     
       
   197     /**
       
   198      * State event handler iplementation.
       
   199      */
       
   200     void NotifyCallStatusChange( 
       
   201         CCPCall::TCallState aCallStatus, 
       
   202         TBool aInband, 
       
   203         CCECallEnums::TNotifyType aNotify );
       
   204    
       
   205     /**
       
   206      * State event handler iplementation.
       
   207      */
       
   208     void HandleCallStateChanged( TCCPCallState aState, TBool aInband );
       
   209    
       
   210     
       
   211 
       
   212 private: // data
       
   213     
       
   214     /**
       
   215      * State 
       
   216      */
       
   217     TCCEEmergencyState iState;
       
   218     
       
   219     /**
       
   220      * Dialled number 
       
   221      */
       
   222     TBuf <KMaxEmergencyNumberLenght> iEmergencyNumber;
       
   223     
       
   224     /**
       
   225      * Is disconnect allowed 
       
   226      */
       
   227     TBool iAllowDisconnect;
       
   228     
       
   229     /**
       
   230      * Exit code to sent in mobilecallinfo 
       
   231      */
       
   232     TInt iExitCode;
       
   233    
       
   234     /**
       
   235      * Emergency call is in progress
       
   236      */  
       
   237     TBool iIsInProgress;
       
   238     
       
   239     /**
       
   240      * call parameters received from phone 
       
   241      */
       
   242     CCCECallParameters* iCallParameters;
       
   243     
       
   244     /**
       
   245      * Call observer
       
   246      * Not own 
       
   247      */
       
   248     CCCECallObserverAsynchroniser* iObserver;
       
   249     
       
   250     /**
       
   251      * Emergency call object from primary plugin
       
   252      * Not own 
       
   253      */
       
   254     MCCPEmergencyCall* iPrimaryEmergencyCall;
       
   255     
       
   256     /**
       
   257      * Available emergency call plugin TUids 
       
   258      */
       
   259     RArray<TUid> iAltEmergencyCallPlugins;
       
   260     
       
   261     /**
       
   262      * Currently active plugin 
       
   263      */
       
   264     TUid iEmergencyProvider;
       
   265     
       
   266     /**
       
   267      * Currently active emergency call object
       
   268      * Not own  
       
   269      */
       
   270     MCCPEmergencyCall* iEmergencyCallInUse;
       
   271     
       
   272     /**
       
   273      * State 
       
   274      */
       
   275     CCPCall::TCallState iCallState;
       
   276     
       
   277     /**
       
   278      * Reference to call container 
       
   279      */
       
   280     CCCECallContainer& iCallContainer; 
       
   281     
       
   282     /**
       
   283      *  Reference to plugin manager 
       
   284      */
       
   285     CCCEPluginManager& iPluginManager;
       
   286     
       
   287     /**
       
   288      *  Current call state 
       
   289      */
       
   290     TEmergencyCallRequest iActiveRequest;
       
   291     
       
   292     /**
       
   293      * Counts duration for this call
       
   294      * Own
       
   295      */
       
   296     CCCEDurationTimer* iCCEDurationTimer;
       
   297 
       
   298     /**
       
   299      *  Pointer to own iStatus
       
   300      *  NULL when Request is completed
       
   301      *  Should be set when iStatus is activated
       
   302      */
       
   303     TRequestStatus* iInitializing;
       
   304     
       
   305     /**
       
   306      * GSM spec call index.
       
   307      */
       
   308     TInt iCallIndex;
       
   309 
       
   310 private:
       
   311 
       
   312     // all rest are not used. just stubs.
       
   313 
       
   314     /** @see MCCECall::Tone
       
   315      * Not Supported in emergency call
       
   316      */
       
   317     TCCPTone Tone() const;
       
   318 
       
   319     /** @see MCCECall::IsSecureSpecified 
       
   320      * Not Supported in emergency call
       
   321      */
       
   322     TBool SecureSpecified() const;
       
   323 
       
   324     /** @see MCCECall::IsSecured 
       
   325      * Not Supported in emergency call
       
   326      */
       
   327     TBool IsSecured() const;
       
   328 
       
   329     /** @see MCCECall::SetParameters 
       
   330      * Not Supported in emergency call
       
   331      */
       
   332     void SetParameters( const CCCECallParameters& aNewParams );
       
   333 
       
   334     /** @see MCCECall::Hold 
       
   335      * Not Supported in emergency call
       
   336      */
       
   337     TInt Hold();
       
   338 
       
   339     /** @see MCCECall::Resume 
       
   340      * Not Supported in emergency call
       
   341      */
       
   342     TInt Resume();
       
   343 
       
   344     /** @see MCCECall::Swap 
       
   345      * Not Supported in emergency call
       
   346      */
       
   347     TInt Swap();
       
   348 
       
   349     /** @see MCCECall::Dial 
       
   350      * Not Supported in emergency call
       
   351      */
       
   352     TInt Dial( const TDesC8& aCallParams );
       
   353 
       
   354     /** @see MCCECSCall::NoFDNCheck 
       
   355      * Not Supported in emergency call
       
   356      */
       
   357     void NoFDNCheck();
       
   358 
       
   359     /** @see MCCECall::Release 
       
   360      * Not Supported in emergency call
       
   361      */
       
   362     TInt Release();
       
   363 
       
   364     /** @see MCCECall::HoldNoNotifyL 
       
   365      * Not Supported in emergency call
       
   366      */
       
   367     void HoldNoNotifyL();
       
   368 
       
   369     /** @see MCCECall::ResumeNoNotifyL 
       
   370      * Not Supported in emergency call
       
   371      */
       
   372     void ResumeNoNotifyL();
       
   373 
       
   374     /** @see MCCECall::ForwardToAddressL 
       
   375      * Not Supported in emergency call
       
   376      */
       
   377     void ForwardToAddressL( TInt aIndex );
       
   378 
       
   379     /** @see MCCECall::CallDuration 
       
   380      * Not Supported in emergency call
       
   381      */
       
   382     TTimeIntervalSeconds CallDuration() const;
       
   383 
       
   384     /** @see MCCECall::StartTime 
       
   385      * Not Supported in emergency call
       
   386      */
       
   387     TDateTime StartTime() const;
       
   388 
       
   389     /** @see MCCECall::RemoteParty 
       
   390      * Not Supported in emergency call
       
   391      */
       
   392     const TDesC& RemoteParty() const;
       
   393 
       
   394     /** @see MCCECall::RemotePartyName
       
   395      * Not Supported in emergency call
       
   396      */
       
   397     const TDesC& RemotePartyName() const;
       
   398 
       
   399     /** @see MCCECall::DialledParty 
       
   400      * Not Supported in emergency call
       
   401      */
       
   402     const TDesC& DialledParty() const;
       
   403 
       
   404     /** @see MCCECall::ServiceId 
       
   405      * Not Supported in emergency call
       
   406      */
       
   407     TUint32 ServiceId() const;
       
   408 
       
   409     /** @see MCCECall::Caps 
       
   410      * Not Supported in emergency call
       
   411      */
       
   412     MCCECallObserver::TCCECallControlCaps Caps() const;
       
   413 
       
   414     /** @see MCCECall::GetMobileDataCallCaps 
       
   415      * Not Supported in emergency call
       
   416      */
       
   417     TInt GetMobileDataCallCaps( TDes8& aCaps ) const;
       
   418 
       
   419     /** @see MCCECall::LogDialedNumber 
       
   420      * Not Supported in emergency call
       
   421      */
       
   422     TBool LogDialedNumber() const;
       
   423 
       
   424     /** @see MCCECall::AttendedTransfer 
       
   425      * Not Supported in emergency call
       
   426      */
       
   427     TInt AttendedTransfer( const TDesC& aTransferTarget );
       
   428 
       
   429     /** @see MCCECall::UnattendedTransfer 
       
   430      * Not Supported in emergency call
       
   431      */
       
   432     TInt UnattendedTransfer( const TDesC& aTarget );
       
   433 
       
   434     /** @see MCCECall::AcceptTransfer 
       
   435      * Not Supported in emergency call
       
   436      */
       
   437     TInt AcceptTransfer( TBool aAccept );
       
   438 
       
   439     /** @see MCCECall::TransferTarget 
       
   440      * Not Supported in emergency call
       
   441      */
       
   442     const TDesC& TransferTarget() const;
       
   443 
       
   444     /** @see MCCECall::GetForwardAddressChoicesL 
       
   445      * Not Supported in emergency call
       
   446      */
       
   447     const CDesC8Array& GetForwardAddressChoicesL();
       
   448 
       
   449     /** @see MCCECall::SwitchAlternatingCall 
       
   450      * Not Supported in emergency call
       
   451      */
       
   452     TInt SwitchAlternatingCall();
       
   453 
       
   454     /** @see MCCECall::Tone 
       
   455      * Not Supported in emergency call
       
   456      */
       
   457     TDateTime iStartTime;
       
   458 
       
   459     /** @see MCCECall::ReplaceActive
       
   460      * Not Supported in emergency call
       
   461      */
       
   462     virtual TInt ReplaceActive();
       
   463 
       
   464     };
       
   465 
       
   466 #endif // CCCEEMERGENCYCALL_H