phoneengine/phonemodel/inc/cpemessagehandler.h
changeset 0 5f000ab63145
child 1 838b0a10d15b
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Message handler
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CPEMESSAGEHANDLER_H
       
    21 #define CPEMESSAGEHANDLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <pevirtualengine.h>
       
    25 #include "DosSvrServices.h"
       
    26 #include <CPhCltCommandHandler.h>
       
    27 #include <cphcltdialdata.h>
       
    28 
       
    29 #include "mpecallhandling.h"
       
    30 
       
    31 // CONSTANTS
       
    32 const TInt KModeNormal = 0;  // Normal System mode  
       
    33 const TInt KModeFligth = 1;  // Flight mode 
       
    34 const TInt KModePDA    = 2;  // PDA mode 
       
    35 
       
    36 // Valid characters in an dialing string
       
    37 _LIT( KPEClientValidChars, "+0123456789*#pwPW" );
       
    38 _LIT( KPEValidDTMFChars, "0123456789*#pwPW" );
       
    39 _LIT( KPEValidDTMFStringStopChars, "+pPwW" );
       
    40 
       
    41 // DTMF Speed dial substitution
       
    42 _LIT( KPEValidSpeedDialChars, "23456789" );
       
    43 const TInt KPEDtmfSpeedDialSubstitutionsMax = 2; // prevent infinite loop.
       
    44 const TInt KPESpeedDialIndexMin = 2;
       
    45 const TInt KPESpeedDialIndexMax = 9;
       
    46 
       
    47 // DTMF parsing status for Speed dial location
       
    48 enum TPESpeedDialSubstituionStatus
       
    49     {
       
    50     EPEDtmfSpeedDialOk,
       
    51     EPEDtmfSpeedDialPromptUser,
       
    52     EPEDtmfSpeedDialNotAssigned,
       
    53     EPEDtmfSpeedDialInvalidSpeedDial
       
    54     };
       
    55 
       
    56 // Invalid characters in an dialing string, these chars can be removed from dial string
       
    57 _LIT( KPECharsThatCanBeDelete, "\"/ ().-" );
       
    58 
       
    59 // MACROS
       
    60 // None.
       
    61 
       
    62 // DATA TYPES
       
    63 
       
    64 // Phone number prefix text, for prefix change
       
    65 typedef TBuf<10> TPEPrefixText;
       
    66 
       
    67 // FUNCTION PROTOTYPES
       
    68 // None.
       
    69 
       
    70 // FORWARD DECLARATIONS
       
    71 class MPEPhoneModelInternal;
       
    72 class MPECallHandling;
       
    73 class MEngineMonitor;
       
    74 class CPEGsmAudioData;
       
    75 class CPESimStateMonitor;
       
    76 class CPEMMParserBase;
       
    77 class CPETimer;
       
    78 class MPEAudioData;
       
    79 class MPELogHandling;
       
    80 class MPEContactHandling;
       
    81 class CPEMMHandlerContainer;
       
    82 class RTASecuritySession;
       
    83 class CPEClientInformation;
       
    84 class CPEClientServices;
       
    85 class CPEClientCallRequestMonitor;
       
    86 class CPEExternalDataHandler;
       
    87 class MPEDataStore;
       
    88 class CPhoneGsmOptionContainerBase;
       
    89 class CPEParserPhoneNumberHandler;
       
    90 class CPEParserSSHandler;
       
    91 class CPhoneGsmParserBase;
       
    92 class CPhoneGsmHandlerContainer;
       
    93 class CPhoneGsmParserResult;
       
    94 class CPEParserEmergencyNumberHandler;
       
    95 class CPEParserVoipNumberHandler;
       
    96 class CPEManualCallControlHandler;
       
    97 class MPEServiceHandling;
       
    98 
       
    99 // CLASS DECLARATION
       
   100 
       
   101 /**
       
   102 *  Handles phone related messages from the MPEPhoneModelInternal object.
       
   103 *
       
   104 *  @lib phoneenginebase.dll
       
   105 *  @since S60_5.0
       
   106 */
       
   107 NONSHARABLE_CLASS( CPEMessageHandler ) : public CBase
       
   108     {
       
   109     public:  // Destructor
       
   110 
       
   111         /**
       
   112         * Two-phased constructor.
       
   113         */
       
   114         static CPEMessageHandler* NewL( 
       
   115                 MPEPhoneModelInternal& aModel,
       
   116                 MPECallHandling& aCallHandling,
       
   117                 MEngineMonitor& aEngineMonitor,
       
   118                 CPEGsmAudioData& aAudioData,
       
   119                 MPELogHandling& aLogHandling,
       
   120                 MPEContactHandling& aContactHandling,
       
   121                 CPESimStateMonitor& aSimStateMonitor,
       
   122                 CPEExternalDataHandler& aGsmExternalDataHandler,
       
   123                                            MPEServiceHandling& aServiceHandling,
       
   124                 RFs& aFsSession );
       
   125         /**
       
   126         * Destructor.
       
   127         */
       
   128         ~CPEMessageHandler();
       
   129 
       
   130     public: // New functions
       
   131 
       
   132         /**
       
   133         * Handles answer call message from the phone application.
       
   134         * @param aAutomaticAnswer, ETrue if triggered by automatic answer
       
   135         * @return possible error code from the CallHandling subsystem.
       
   136         */
       
   137         TInt HandleAnswerCall( const TBool aAutomaticAnswer );
       
   138 
       
   139         /**
       
   140         * Handles accessory mode changed message from AudioHandling subsystem.
       
   141         * @param aVideoCall, ETrue if call type video call
       
   142         * @return possible error code from the AudioHandling subsystem
       
   143         */
       
   144         TInt HandleAudioRouting( TBool aVideoCall, TInt aCallId );
       
   145 
       
   146         /**
       
   147         * Handles route preference changed message from AudioHandling subsystem.
       
   148         * @return possible error code from the AudioHandling subsystem
       
   149         */
       
   150         TInt HandleRoutePreferenceChanged();
       
   151         
       
   152         /**
       
   153         * Handles continue dtmf sending ('w' character in the dtmf string have defected stop in the dtmf sending)
       
   154         * @param aContinue, informs continue or not.
       
   155         */
       
   156         void HandleContinueDtmfSending( const TBool aContinue );
       
   157 
       
   158         /**
       
   159         * Handles release all message from phone application 
       
   160         * @return possible error code from the CallHandling subsystem.
       
   161         */
       
   162         TInt HandleReleaseAll( );
       
   163 
       
   164         /**
       
   165         * Handles release message from phone application 
       
   166         * @param aAutoResumeOption if options for autoresume.
       
   167         * @return Return possible error code.
       
   168         */
       
   169         TInt HandleReleaseCall( TPEHangUpOptions aAutoResumeOption = ETPEHangUpDefault );
       
   170 
       
   171         /**
       
   172         * Handles send dtmf message from phone application 
       
   173         * @return possible error code from the CallHandling subsystem.
       
   174         */
       
   175         TInt HandleSendDtmf();
       
   176 
       
   177         /**
       
   178         * Handles audio mute message from the phone application. 
       
   179         */
       
   180         void HandleSetAudioMute();
       
   181         
       
   182         /**
       
   183         * Handles audio output message from the phone application. 
       
   184         * @return possible error code from the AudioHandling subsystem.
       
   185         */
       
   186         TInt HandleSetAudioOutput();
       
   187 
       
   188         /**
       
   189         * Handles change volume message from the phone application.
       
   190         */
       
   191         void HandleSetAudioVolume();
       
   192 
       
   193         /**
       
   194         * Starts tone playing. 
       
   195         */
       
   196         void HandlePlayDTMFL();
       
   197 
       
   198         /**
       
   199         * Stops tone playing. 
       
   200         * @return error code.
       
   201         */
       
   202         TInt HandleEndDTMF();
       
   203 
       
   204         /**
       
   205         * Terminates all connected calls, waiting call, data connections.
       
   206         * @return errorCode.
       
   207         */        
       
   208         TInt HandleTerminateAllConnections(); 
       
   209 
       
   210         /**
       
   211         * Sets phone client information
       
   212         * @param aCallId, the dentification number of the call.
       
   213         * @param aMainPartOfPhoneNumber The phone number, 
       
   214         *        where extra chaters "/ ().-" and possible prefix are removed. 
       
   215         */        
       
   216         void SetClientInformation( const TInt aCallId, 
       
   217             const TDesC& aMainPartOfPhoneNumber );
       
   218             
       
   219          /**
       
   220         * Sets phone client information
       
   221         * @param aClientDialData Client dial data 
       
   222         */  
       
   223         void SetClientData( 
       
   224             const CPhCltDialData& aClientDialData ); 
       
   225         
       
   226         /**
       
   227         * Checks if the current char is removable
       
   228         * @param TChar, current character from inspected string.
       
   229         * @return TBool.
       
   230         */
       
   231         TBool IsItCharThatCanDelete( const TChar& aChar ) const;
       
   232 
       
   233         /**
       
   234         * Checks if the current char is valid
       
   235         * @param TChar, current character from inspected string.
       
   236         * @return TBool.
       
   237         */
       
   238         TBool IsValidChar( const TChar& aChar, const TDesC& aValidChars ) const;
       
   239 
       
   240         /**
       
   241         * Removes invalid char if it is removable
       
   242         * @param TDesc, current string from wich we are interested in.
       
   243         * @return TBool.
       
   244         */
       
   245         TBool RemoveInvalidChars( TDes& aString, 
       
   246                                            const TDesC& aValidChars, 
       
   247                                            const TBool aCheckForDelete ) const;
       
   248 
       
   249         /**
       
   250         * Handles lifetimer data from customa api -> engineinfo.
       
   251         * @return TInt possible error code..
       
   252         */
       
   253         TInt HandleGetLifeTimerData() const;
       
   254 
       
   255         /**
       
   256         * Handles EPEMessageDTMFSent message from call handling subsystem
       
   257         * @param ECCPErrorNone or KPEDontSendMessage
       
   258         */
       
   259         TInt HandleDtmfSent();
       
   260         
       
   261         /**
       
   262         * Stops DTMF sending and resets DTMF processing state
       
   263         */
       
   264         void StopDtmfSending();
       
   265         
       
   266         /**
       
   267         * Handles reject call message 
       
   268         * @return possible error code from the CallHandling subsystem.
       
   269         */
       
   270         TInt HandleRejectCall();
       
   271         
       
   272         /**
       
   273         * Called asyncronously from callback. Calls HandleSendDtmf()
       
   274         * function.
       
   275         * @param aAny Pointer to 'this' object.
       
   276         * @return error code.
       
   277         */
       
   278         static TInt CallBackHandleSendDtmf( TAny* aAny );
       
   279 
       
   280         /**
       
   281         * Handles plus (+) sign in a DTMF string.
       
   282         * @param aDtmfString Current DTMF string to process.
       
   283         */
       
   284         void HandlePlusSignInDtmf( const TPEDtmfString& aDtmfString );
       
   285         
       
   286         /**
       
   287         * Called asyncronously from callback.
       
   288         * @param aAny Pointer to 'this' object.
       
   289         * @return error code.
       
   290         */
       
   291         static TInt CallbackSendMessageStoppedDTMF( TAny* aAny );
       
   292         
       
   293         /**
       
   294         * Handles build conference message from phone application
       
   295         * @return Return possible error code from the CallHandling subsystem.
       
   296         */
       
   297         TInt HandleBuildConferenceCall();
       
   298 
       
   299         /**
       
   300         * Handles Going private in Conference Call
       
   301         * @return possible error code from the CallHandling subsystem.
       
   302         */
       
   303         TInt HandleGoOneToOne();        
       
   304 
       
   305         /**
       
   306         * Gets basic service group value. 
       
   307         * @return basic service group.
       
   308         */
       
   309         inline RMobilePhone::TMobileService BasicServiceGroup();
       
   310         
       
   311         /**
       
   312         * Handles add conference member message from phone application
       
   313         * @return possible error code.
       
   314         */
       
   315         TInt HandleAddConferenceMember();
       
   316 
       
   317         /**
       
   318         * Handles dropped conference member message
       
   319         */
       
   320         void HandleDroppedConferenceMember();
       
   321         
       
   322         /**
       
   323         * Handles EPEMessageALSLineChanged message.
       
   324         */
       
   325         void HandleALSLineChanged();
       
   326 
       
   327         /**
       
   328         * Handles error message from the CallHandling subsystem.
       
   329         * @param aCallId is the identification number of the call.
       
   330         * @param aBusyCall informs that error cause was busy remote party.
       
   331         */
       
   332         void HandleCallHandlingError( const TInt aCallId, const TBool aBusyCall );
       
   333         
       
   334         /**
       
   335         * Handles cancel SS string command.
       
   336         * @return Possible error code from the Settings utility subsystem.
       
   337         *         Security module don't have return value from cancel command.
       
   338         */
       
   339         TInt HandleCancelSSstringCommand();
       
   340 
       
   341         /**
       
   342         * Handles conference idle state
       
   343         * @param aCallId is the identification number of the call.
       
   344         * @return Return possible error code.
       
   345         */
       
   346         TInt HandleConferenceIdleState( const TInt aCallId );
       
   347 
       
   348         /**
       
   349         * Handles connected message from the CallHandling subsystem.
       
   350         * @param aCallId, identification number of the call.
       
   351         * @return possible error code from the CallHandling subsystem.
       
   352         */
       
   353         TInt HandleConnectedState( const TInt aCallId );
       
   354 
       
   355         /**
       
   356         * Handles video call logging in Connected state
       
   357         * @param aCallId is the identification number of the call.
       
   358         * @return Return possible error code.
       
   359         */
       
   360         TInt HandleVideoCallConnected( const TInt aCallId );
       
   361 
       
   362         /**
       
   363         * Handles video call logging in Idle state
       
   364         * @param aCallId is the identification number of the call.
       
   365         * @return Return possible error code.
       
   366         */
       
   367         TInt HandleVideoCallIdle( const TInt aCallId );
       
   368 
       
   369         /**
       
   370         * Handles EPEMessageSetALSLine message.
       
   371         */
       
   372         void HandleSetALSLineL();
       
   373 
       
   374         /**
       
   375         * Handles dial message from phone application or phone client.
       
   376         * @param aClientCall, Informs is the current call client originated or not.
       
   377         * @return Return possible error code.
       
   378         */
       
   379         TInt HandleDialCall( const TBool aClientCall );        
       
   380 
       
   381         /**
       
   382         * Handles dial emergency message from phone application or phone client.
       
   383         * Phase one of emergency call initialization
       
   384         * @param aClientCall, Informs is the current call client originated or not.
       
   385         * @return Return possible error code.
       
   386         */
       
   387         TInt HandleDialEmergencyCall( const TBool aClientCall );        
       
   388 
       
   389         /**
       
   390         * Handles Sat dial request completed message from the phone application 
       
   391         */
       
   392         void HandleSatCallRequestCompleted( );
       
   393 
       
   394         /**
       
   395         * Phase two of emergency call initialization
       
   396         */
       
   397         void ContinueDialEmergency();
       
   398 
       
   399         /**
       
   400         * Handles dialing state transition for voice and video calls
       
   401         * @param aCallId is the identification number of the call.
       
   402         */
       
   403         void HandleDialingStateL( const TInt aCallId );
       
   404 
       
   405         /**
       
   406         * Handles incoming voice and video call
       
   407         * @param aCallId is the identification number of the call.
       
   408         */
       
   409         void HandleIncomingCallL( const TInt aCallId );
       
   410 
       
   411         /**
       
   412         * Handles disconnecting without inband tones.
       
   413         * @param aCallId is the identification number of the call.
       
   414         * @return possible error code.
       
   415         */
       
   416         TInt HandleDisconnecting( const TInt aCallId ); 
       
   417 
       
   418         /**
       
   419         * Handles disconnecting with inband tones.
       
   420         * @param aCallId is the identification number of the call.
       
   421         * @return possible error code.
       
   422         */
       
   423         TInt HandleDisconnectingWithInband( const TInt aCallId );
       
   424 
       
   425         /**
       
   426         * Handles drop conference member message from phone application
       
   427         * @return possible error code from the CallHandling subsystem.
       
   428         */
       
   429         TInt HandleDropConferenceMember();
       
   430 
       
   431         /**
       
   432         * Handles hold message from the phone application 
       
   433         * @return possible error code from the CallHandling subsystem.
       
   434         */
       
   435         TInt HandleHoldCall( );
       
   436 
       
   437         /**
       
   438         * Handles video call switch to video or voice from phoneui 
       
   439         */
       
   440         TInt HandleSwitchToVideoOrVoice( const TInt aCallId ); 
       
   441         
       
   442         /**
       
   443         * Continue switch to video call or voice call.
       
   444         * Calls dial method to create new video call or voice call 
       
   445         * to same phonenumber.
       
   446         * @param aCallId is the identification number of the call.
       
   447         * @return possible error code from the CallHandling subsystem.
       
   448         */
       
   449         TInt ContinueSwitchToCall( const TInt aCallId );  
       
   450 
       
   451         /**
       
   452         * Handles idle state message from the CallHandling subsystem.
       
   453         * @param aCallId is the identification number of the call.
       
   454         * @return Return possible error code from the CallHandling subsystem.
       
   455         */
       
   456         TInt HandleVoiceCallIdleState( const TInt aCallId );
       
   457 
       
   458         /**
       
   459         * Handles play DMTF message from phone application 
       
   460         */
       
   461         void ProcessPlayDTMFL( );
       
   462 
       
   463         /**
       
   464         * Handles end DTMF playing message from phone application 
       
   465         * @return possible error code from the CallHandling subsystem.
       
   466         */
       
   467         TInt ProcessEndDTMF( );
       
   468 
       
   469         /**
       
   470         * Handles resume message from phone application 
       
   471         * @return possible error code from the CallHandling subsystem.
       
   472         */
       
   473         TInt HandleResumeCall( );
       
   474 
       
   475         /**
       
   476         * Handles send USSD request from CPEGsmParserMiscHandler
       
   477         * @param aString, USSD string to be sent
       
   478         * @return Symbian OS error code
       
   479         */
       
   480         TInt HandleSendUssd( const TDesC& aString );
       
   481 
       
   482         /**
       
   483         * Handles EPEMessageSimStateChanged from Dos Server.
       
   484         * @return None.
       
   485         */
       
   486         void HandleSimStateChanged( );
       
   487 
       
   488         /**
       
   489         * Handles startup message from the phone application.
       
   490         * @return None.
       
   491         */
       
   492         void HandleStartUp();
       
   493 
       
   494         /**
       
   495         * Handles Phone Number Edited message from phone application 
       
   496         */
       
   497         void HandlePhoneNumberEditedL();
       
   498 
       
   499         /**
       
   500         * Handles service enabled message from service handling subsystem
       
   501         * @since Series60_5.0
       
   502         * @return possible error code from the ServiceHandling subsystem
       
   503         */
       
   504         TInt HandleServiceEnabled();
       
   505         
       
   506         /**
       
   507          * Handles remote party information changed         
       
   508          * @since Series60_5.2         
       
   509          */
       
   510         void HandleRemotePartyInfoChanged( );
       
   511 
       
   512         /**
       
   513         * Handles swap message from the phone application 
       
   514         * @return possible error code from the CallHandling subsystem.
       
   515         */
       
   516         inline TInt HandleSwapCalls();
       
   517 
       
   518         /**
       
   519         * Handles transfer message from phone application.
       
   520         * @return possible error code from the CallHandling subsystem.
       
   521         */
       
   522         inline TInt HandleTransferCalls();
       
   523     
       
   524         /**
       
   525         * Sets basic service group for future using,
       
   526         * @param aServiceGroup, includes basic service group.
       
   527         * @return None.
       
   528         */
       
   529         inline void SetBasicServiceGroup( const RMobilePhone::TMobileService& aServiceGroup );
       
   530         
       
   531         /**
       
   532         * Sets gsm parser error code for future using.
       
   533         * @param aGsmParserErrorCode, includes possible error code from parser process.
       
   534         * @return None.
       
   535         */
       
   536         inline void SetGsmParserErrorCode( TInt aGsmParserErrorCode);
       
   537 
       
   538         /**
       
   539         * Check is given number emergency number
       
   540         * @return Epoc errorcodes.
       
   541         */
       
   542         TInt HandleEmergencyCheck( );
       
   543 
       
   544         /**
       
   545         * Stops playing a inband tone. 
       
   546         */
       
   547         void HandleStopInbandTonePlay();
       
   548 
       
   549         /**
       
   550         * Handles automatic answer off from customa api -> engineinfo.
       
   551         * @return TInt possible error code..
       
   552         */
       
   553         void HandleAutomaticAnswerOff( ) const;
       
   554 
       
   555         /**
       
   556         * Handles AT dialing started
       
   557         * @param aSucceed true if succeeded
       
   558         */
       
   559         void HandleATDialingStarted( const TBool aSucceed ) const;
       
   560         
       
   561         /**
       
   562         * Replace active call
       
   563         * @return Possible error code
       
   564         */
       
   565         TInt HandleReplaceActive();
       
   566         
       
   567         /**
       
   568         * Check if phone is locked, if locked leave with ECCPErrorAuthenticationFailed error.
       
   569         */
       
   570         void CheckIfPhoneIsLockedL();
       
   571         
       
   572         /**
       
   573          * Handles unattended transfer request response.
       
   574          * @param    aAcceptRequest     ETrue to accept, EFalse to reject request.
       
   575          */
       
   576         TInt HandleUnattendedTransferRequestResponse( TBool aAcceptRequest );
       
   577 
       
   578         /**
       
   579         * Handle unattended transfer
       
   580         * @return KErrNone if succesfull
       
   581         */
       
   582         TInt HandleUnattendedTransfer();
       
   583 
       
   584         /**
       
   585         * Handle call forward
       
   586         * @return KErrNone if succesfull
       
   587         */ 
       
   588         TInt ForwardCallToAddress();
       
   589  
       
   590         /**
       
   591         * Handle disable service
       
   592         */     
       
   593         void HandleDisableService();
       
   594    
       
   595     private: // New functions
       
   596         
       
   597         /**
       
   598         * C++ default constructor.
       
   599         */
       
   600         CPEMessageHandler( MPEPhoneModelInternal& aModel, 
       
   601                            MPECallHandling& aCallHandling, 
       
   602                            MEngineMonitor& aEngineMonitor, 
       
   603                            CPEGsmAudioData& aAudioData, 
       
   604                            MPELogHandling& aLogHandling, 
       
   605                            MPEContactHandling& aContactHandling,
       
   606                            CPESimStateMonitor& aSimStateMonitor,
       
   607                            CPEExternalDataHandler& aExternalDataHandler,
       
   608                               MPEServiceHandling& aServiceHandling,
       
   609                            RFs& aFsSession );
       
   610         void ConstructL();
       
   611         
       
   612         /**
       
   613         * Checks the status of phone number prefix change setting
       
   614         * and calls CPEMessageHandler::ChangePrefix for execution
       
   615         * If error occurs the phone number is left untouched
       
   616         * @param aPhoneNumber, phone number to be checked
       
   617         */
       
   618         void CheckPrefix();
       
   619 
       
   620         /**
       
   621         * Replaces phone number prefix with the one provided
       
   622         * @param aPrefixText, prefix to be used in replacement
       
   623         * @return possible Symbian OS error code
       
   624         */
       
   625         TInt ChangePrefix( const TPEPrefixText& aPrefixText );
       
   626         
       
   627         /**
       
   628         * Remove '+' begin of the string
       
   629         */
       
   630         void RemovePlusPrefix( TPEPhoneNumber& aPhoneNumber );
       
   631 
       
   632         /**
       
   633         * Checks if automatic answer is on for audio accessory
       
   634         * @param TInt aCallId, call identification.
       
   635         * @return TBool.
       
   636         */
       
   637         TBool AutomaticAnswer( const TInt aCallId ) const;
       
   638 
       
   639         /**
       
   640         * Returns a boolean to indicate whether emergency call is allowed or not.  
       
   641         * @return Return a True or False. 
       
   642         */
       
   643         TBool IsEmergencyAllowed() const;
       
   644 
       
   645         /**
       
   646         * Handle Client Call Data.
       
   647         * @return Return possible error.
       
   648         */
       
   649         void HandleClientCallData();
       
   650 
       
   651         /**
       
   652         * HandleEngineInfo. Set information to EngineInfo.
       
   653         * @param TInt aCallId, call identification.
       
   654         * @return Return possible error.
       
   655         */
       
   656         TInt HandleEngineInfo( const TInt aCallId ); 
       
   657         
       
   658         /**
       
   659         * Update Client information
       
   660         * @param TInt aCallId, call identification.
       
   661         */        
       
   662         TInt UpdateClientInfo( const TInt aCallId );
       
   663         
       
   664         /**
       
   665         * Check is phoneNumber emergency number and 
       
   666         * should phonenumber hide for User
       
   667         * @param TInt aCallId, call identification.
       
   668         */
       
   669         void CheckAndHideIdentity( const TInt aCallId );
       
   670 
       
   671         /**
       
   672         * Finds callInfo form TSY.
       
   673         * @param TInt aCallId, call identification.
       
   674         * @return Return possible error.
       
   675         */
       
   676         TInt FindCallInfo( const TInt aCallId );
       
   677 
       
   678         /**
       
   679         * Set phonenumber for call logging
       
   680         * @param TInt aCallId, call identification.
       
   681         * @return None.
       
   682         */
       
   683         void SetPhoneNumberForCallLogging( const TInt aCallId );
       
   684 
       
   685         /**
       
   686         * Store call information for logging
       
   687         * @param TInt aCallId, call identification.
       
   688         * @param TPEState aCallState, call's state.
       
   689         * @return None.
       
   690         */
       
   691         void SetLoggingInfo( const TInt aCallId, TPEState aCallState );
       
   692 
       
   693         /**
       
   694         * Set name to the EngineInfo.
       
   695         * @param TInt aCallId, call identification
       
   696         * @return None.
       
   697         */
       
   698         void SetName( const TInt aCallId );
       
   699 
       
   700         /**
       
   701         * Set rest of info to the EngineInfo.
       
   702         * @param TPEPhoneNumberIdType aPhoneNumberId, phonenumber type
       
   703         * @param TInt aCallId, call identification
       
   704         * @return None.
       
   705         */
       
   706         void HideIdentification(
       
   707             TPEPhoneNumberIdType aPhoneNumberId,
       
   708             const TInt aCallId );
       
   709 
       
   710         /**
       
   711         * Checks is the current call the missed call.
       
   712         * @param TInt aCallId, call identification.
       
   713         * @param TPEState aCallState, call's state.
       
   714         * @return None.
       
   715         */
       
   716         void IsMissedCall( const TInt aCallId, TPEState aCallState );
       
   717 
       
   718         /**
       
   719         * Notifies DevSound that there is no active call
       
   720         * and audio should be routed accordingly.
       
   721         */
       
   722         void ClearCallAudio();
       
   723              
       
   724         /**
       
   725         * Remove pre and post fix from phone number.
       
   726         * @param TDes aString, phonenumber. 
       
   727         * @return None
       
   728         */
       
   729         void RemovePreAndPostFix( TDes& aString );
       
   730         
       
   731         /**
       
   732         * Remove pre fix from phone number.
       
   733         * @param TLex aLex, orginal phonenumber.
       
   734         * @return None
       
   735         */
       
   736         void RemovePrefix( TLex& aLex );
       
   737         
       
   738         /**
       
   739         * Handle number part.
       
   740         * @param TLex aLex, orginal phonenumber.
       
   741         * @param TDes aNumberPart, TDes for edited phone numeber.
       
   742         * @return None
       
   743         */
       
   744         void HandleNumberPart( TLex& aLex, TDes& aNumberPart );
       
   745         
       
   746         /**
       
   747         * EqualsLeft combare if aString contains aPrefix.
       
   748         * @param TDesC aString, orginal phonenumber.
       
   749         * @param TDes aPrefix, 
       
   750         * @return TBool ETrue if match.
       
   751         */
       
   752         TBool EqualsLeft( const TDesC& aString, const TDesC& aPrefix );
       
   753 
       
   754         /**
       
   755         * Handles dial message from phone application or phone client.
       
   756         * @param aClientCall, Informs is the current call client originated or not.
       
   757         * @return Return possible error code.
       
   758         */
       
   759         TInt HandleDialCallL( const TBool aClientCall );      
       
   760 
       
   761         /**
       
   762         * Checks if there are any connected video calls
       
   763         * @return   EFalse: no active video call,
       
   764         *           ETrue: active video call
       
   765         */
       
   766         TBool IsActiveVideo();
       
   767         
       
   768         /**
       
   769         * Checks that string contains only valid dtmf characters 
       
   770         * @param aString string to be checked
       
   771         * @return ETrue if valid dtmf string 
       
   772         */
       
   773         TBool IsValidDtmfString( TDes& aString );
       
   774         
       
   775         /**
       
   776          * Updates remote party info to Mediator.
       
   777          */
       
   778         void UpdateRemotePartyInfo();
       
   779 
       
   780     private:  // Data
       
   781         
       
   782         // MPEPhoneModelInternal owns this object.
       
   783         MPEPhoneModelInternal& iModel;
       
   784         // It is container for parser options
       
   785         CPhoneGsmOptionContainerBase* iOptions;
       
   786         // Handles phone number from the parser.
       
   787         // Not owned
       
   788         CPEParserPhoneNumberHandler* iPhoneNumberHandler;
       
   789         // Handles supplementary service requests from the parser.
       
   790         CPEParserSSHandler* iSSHandler;
       
   791         // MPECallHandling handles call related commands to CallHandling subsystem.
       
   792         MPECallHandling& iCallHandling;
       
   793         // MEngineMonitor handles interface structures to phone application
       
   794         MEngineMonitor& iEngineMonitor;
       
   795         // CPEGsmAudioData handles audio commands
       
   796         CPEGsmAudioData& iGsmAudioData;
       
   797         // CPELogsData object which handles logs related commands
       
   798         MPELogHandling& iLogHandling;
       
   799         // Handle to contact handling
       
   800         MPEContactHandling& iContactHandling;
       
   801         // Handle to external data handler
       
   802         CPEExternalDataHandler& iExternalDataHandler; 
       
   803         // Mobile call info.
       
   804         RMobileCall::TMobileCallInfoV3* iCallInfo;
       
   805         // Sim state monitor
       
   806         CPESimStateMonitor& iSimStateMonitor;
       
   807         // Handle to a file server session
       
   808         RFs& iFsSession; 
       
   809         // Handles call request from the client/server interface.
       
   810         CPEClientServices* iClientServices;
       
   811         // Automatic answer timer.
       
   812         CPETimer* iAutomaticAnswerTimer;
       
   813         // Number parser object
       
   814         CPhoneGsmParserBase* iParser;
       
   815         // Container for parser handlers.
       
   816         CPhoneGsmHandlerContainer* iParserHandlerContainer;
       
   817         // Includes identification number of the waiting call.
       
   818         TInt iWaitingCallId;
       
   819         // Call start time
       
   820         TTime iTime;
       
   821         //Current emergency call state.
       
   822         TBool iEmergencyCallActive;
       
   823         //
       
   824         TBool iBtaaDisconnected;
       
   825         //Client Information, member variable because emergency call from phone client
       
   826         //is not allowed to allocate memory. 
       
   827         CPEClientInformation* iClientInformation;
       
   828 		// Dial Data
       
   829 		CPhCltDialData* iClientDialData;
       
   830         // Instances will contain the results of the parsing
       
   831         CPhoneGsmParserResult* iResult;
       
   832         // Handles emergency number from the parser.
       
   833         // Not owned
       
   834         CPEParserEmergencyNumberHandler* iEmergencyNumberHandler;
       
   835         // Handles voip number from the parser.
       
   836         // Not owned
       
   837         CPEParserVoipNumberHandler* iVoipNumberHandler;
       
   838         // Handles manual call control.
       
   839         // Owned
       
   840         CPEManualCallControlHandler* iManualCallControlHandler;
       
   841         MPEServiceHandling& iServiceHandling;
       
   842         // reference to data store
       
   843         MPEDataStore& iDataStore;
       
   844         // Asyncromous callback
       
   845         CAsyncCallBack* iAsyncCallBack;
       
   846         // Includes basic service value.
       
   847         RMobilePhone::TMobileService iBasicServiceGroup;
       
   848         // Includes possible Gsm Parser error code.
       
   849         TInt iGsmParserErrorCode;
       
   850         // Cheks if audio is registred and system is ready for startup
       
   851         TBool iPEReadyForStartUpMessageSent;
       
   852     };
       
   853 
       
   854 #include "cpemessagehandler.inl"
       
   855 
       
   856 #endif      // CPEMESSAGEHANDLER_H   
       
   857             
       
   858 // End of File