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