phoneclientserver/callui/inc/cauiengine/cauiengine.h
changeset 51 12bc758d6a02
parent 48 78df25012fda
child 53 25b8d29b7c59
equal deleted inserted replaced
48:78df25012fda 51:12bc758d6a02
     1 /*
       
     2 * Copyright (c) 2004-2005 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:  Provides engine implementation for CallUI.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAUIENGINE_H
       
    20 #define CAUIENGINE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include    <e32std.h>
       
    24 #include    <coneresloader.h> // RconeResourceLoader. 
       
    25 #include    <mphcltextphoneobserver.h> // MPhCltExtPhoneObserver. 
       
    26 #include    "cauieng.h" 
       
    27 #include    "cauidialresultobserver.h" 
       
    28 #include    "cauiqueryobserver.h" 
       
    29 #include    <phclttypes.h> 
       
    30 #include    <mphcltemergencycallobserver.h> 
       
    31 #include    <cphcntcontactdataselection.h>  // MPhCntSelectionObserver
       
    32 #include    <cphcltemergencycall.h> // CPhCltEmergencyCall 
       
    33 #include    <mcauireconnectqueryobserver.h>
       
    34 #include    <cconvergedserviceselector.h>
       
    35 #include    <mphcntstoreloaderobserver.h>
       
    36 #include    <aiwdialdata.h>
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 class CPhCltExtPhoneBase;
       
    40 class CAknGlobalListQuery;
       
    41 class CAknGlobalConfirmationQuery;
       
    42 class CAknGlobalNote;
       
    43 class CCaUiReConQueryInformation;
       
    44 class CAiwInternalDialData;
       
    45 class CPhCltExtPhoneDialData;
       
    46 class CPhCntSingleItemFetch;
       
    47 class CPhCntFactory;
       
    48 class CCaUiVoIPExtension;
       
    49 class MPhCntStoreLoader;
       
    50 class MVPbkContactStore;
       
    51 
       
    52 class CCaUiDialogs;
       
    53 
       
    54 // CONSTANTS
       
    55 
       
    56 // Owned and used resource file.
       
    57 _LIT( KCallUIResFile,         "z:\\resource\\CallUI.rsc" );
       
    58 
       
    59 
       
    60     /**   
       
    61     * Indicates state of long press key
       
    62     * Default value: 0
       
    63     * Default value for iMode variant: 1    
       
    64     */
       
    65 enum TCaUiLongPressKey
       
    66     {
       
    67     ECaUiLongPressKeyNotSet      = 0, // Long press key is not set
       
    68     ECaUiLongPressKeyNotInUse    = 1, // Long press key is not in use
       
    69     ECaUiLongPressKeyInUse       = 2, // Long press key is in use
       
    70     };
       
    71    
       
    72 // CLASS DECLARATION
       
    73 
       
    74 /**
       
    75 *  CaUIEngine implementation.
       
    76 *  
       
    77 *  @lib CaUiEngine.lib
       
    78 *  @since 2.6
       
    79 */
       
    80 NONSHARABLE_CLASS( CCaUiEngine )
       
    81 :   public CCaUiEngApi,
       
    82     public MPhCltExtPhoneObserver,
       
    83     public MCaUiReconnectQueryObserver,
       
    84     public MPhCntSelectionObserver,
       
    85     public MPhCltEmergencyCallObserver,
       
    86     public MPhCntStoreLoaderObserver
       
    87     {
       
    88     public:  // Constructors and destructor
       
    89 
       
    90         /**
       
    91         * Two-phased constructor.
       
    92         * @return an instance of CallUI.
       
    93         */
       
    94         static CCaUiEngine* NewL();
       
    95         
       
    96         /**
       
    97         * Destructor.
       
    98         */
       
    99         virtual ~CCaUiEngine();
       
   100 
       
   101 
       
   102     public:  // New functions
       
   103 
       
   104         /**
       
   105         * Make the dial operation.
       
   106         * 
       
   107         * @see CCaUiEngApi::DialL().
       
   108         */
       
   109         void DialL(
       
   110             MCaUiDialResultObserver& aObserver,
       
   111             const TDesC8& aDialData,
       
   112             const TCaUiCallType aCallType );
       
   113 
       
   114         /**
       
   115         * Launch the qtn.tel.no.video.network information note.
       
   116         * 
       
   117         * @see CCaUiEngApi::LaunchNoNetSupNoteL().
       
   118         */
       
   119         void LaunchNoNetSupNoteL();
       
   120 
       
   121 
       
   122         /**
       
   123         * Launch reconnect confirmation query.
       
   124         * 
       
   125         * @see CCaUiEngApi::LaunchReconConfQueryL().
       
   126         */
       
   127         void LaunchReconConfQueryL( 
       
   128             MCaUiReconnectQueryObserver& aObserver,
       
   129             CPhCntMatcher* aPhCntMatcher,
       
   130             const TPtrC aPhoneNumber,
       
   131             const TBool aIncludeVideoCallOption );
       
   132 
       
   133         /**
       
   134         * Cancel reconnect query.
       
   135         * 
       
   136         * @see CCaUiEngApi::CancelReconConfQuery().
       
   137         */
       
   138         void CancelReconConfQuery();
       
   139 
       
   140 
       
   141         /**
       
   142         * Launch note and reconnect confirmation query.
       
   143         * 
       
   144         * @see CCaUiEngApi::LaunchNoteAndReconConfQueryL().
       
   145         */
       
   146         void LaunchNoteAndReconConfQueryL( 
       
   147             MCaUiReconnectQueryObserver& aObserver,
       
   148             CPhCntMatcher* aPhCntMatcher,
       
   149             const TPtrC aPhoneNumber,
       
   150             const TBool aIncludeVideoCallOption,
       
   151             const TPtrC aNoteText );
       
   152 
       
   153         /**
       
   154         * Cancel note and reconnect query.
       
   155         * 
       
   156         * @see CCaUiEngApi::CancelNoteAndReconConfQuery().
       
   157         */
       
   158         void CancelNoteAndReconConfQuery();
       
   159 
       
   160         /**
       
   161         * Launch address selection.
       
   162         * @since 3.0
       
   163         * 
       
   164         * @see CCaUiEngApi::LaunchAddressSelectL(). 
       
   165         */
       
   166         TBool LaunchAddressSelectL(
       
   167             TDes& aTelNum, 
       
   168             const TInt aContactId,
       
   169             const TBool aVoIPAddressSelect );
       
   170 
       
   171         /**
       
   172         * Cancel address select launched with LaunchAddressSelectL.
       
   173         * @since 3.0
       
   174         * 
       
   175         * @see CCaUiEngApi::CancelAddressSelect().
       
   176         */
       
   177         void CancelAddressSelect();
       
   178 
       
   179     public: // from MPhCntStoreLoaderObserver
       
   180         
       
   181         /**
       
   182          * From MPhCntStoreLoaderObserver;
       
   183          * @since S60 v9.1
       
   184          * @see MPhCntStoreLoaderObserver.
       
   185          */
       
   186         void ContactStoreLoadingCompleted( 
       
   187             MVPbkContactStore* aStore, TInt aErrorCode );
       
   188     
       
   189     private: // Functions from base classes
       
   190 
       
   191         /**
       
   192         * Handle dial request completion.
       
   193         * 
       
   194         * @see MPhCltExtPhoneObserver::HandleDialL().
       
   195         */
       
   196         void HandleDialL( const TInt aStatus );
       
   197 
       
   198         /**
       
   199         * Called when CCaUiReconnectQuery has got a key press.
       
   200         * 
       
   201         * @see MCaUiReconnectQueryObserver::OptionSelectedL().
       
   202         */
       
   203         void OptionSelected( MCaUiReconnectQueryObserver::TCaUiReconType aReconType );
       
   204 
       
   205     
       
   206     private:
       
   207 
       
   208         /**
       
   209         * C++ default constructor.
       
   210         */
       
   211         CCaUiEngine();
       
   212 
       
   213         /**
       
   214         * By default Symbian 2nd phase constructor is private.
       
   215         */
       
   216         void ConstructL();
       
   217 
       
   218         /**
       
   219         * Convert the AIW dialdata to PhoneClient format.
       
   220         * 
       
   221         * @param aAiwDialData AIW DialData format.
       
   222         */
       
   223        void ConvertDialDataL(
       
   224             const CAiwInternalDialData& aAiwDialData );
       
   225    
       
   226 
       
   227         /**
       
   228         * Clear the Dial related contents if they exist.
       
   229         */
       
   230         void ClearDialContents();
       
   231 
       
   232 
       
   233 
       
   234     public:
       
   235 
       
   236         /**
       
   237         * Check is there VoIP profiles in phone.
       
   238         * 
       
   239         * @since 3.0
       
   240         * @return ETrue if found, EFalse otherwise.
       
   241         */
       
   242         TBool IsVoIPProfiles();
       
   243         
       
   244         /**
       
   245         * @see CCaUiEngApi::GetVoIPServiceIdsL
       
   246         */
       
   247         void GetVoIPServiceIdsL( RIdArray& aVoipServiceIds ) const;
       
   248         
       
   249         /**
       
   250         * @see CCaUiEngApi::GetVoipServiceNameL
       
   251         */
       
   252         void GetVoipServiceNameL( TServiceId aServiceId, TDes& aServiceName ) const;
       
   253 
       
   254     private:
       
   255 
       
   256         /**
       
   257         * Launch address selection. If contact contains default number or 
       
   258         * only one number, number will be returned directly. 
       
   259         * Otherwise address selection list displayed.
       
   260         * @since 3.0
       
   261         * 
       
   262         * @param aTelNum Contains selected number after execution.
       
   263         * @param aContactId The contact id from PhoneBook.
       
   264         * @param aCallType If calltype is ECaUiCallTypeInternet VoIP address
       
   265         *     select is used. 
       
   266         * @param aRemoveInvalidChars Removes invalid chars from selected number
       
   267         *                            if set ETrue.
       
   268         * @param aFocusedField Focused field from PhoneBook
       
   269         * @return TBool, ETrue if number selected, EFalse otherwice 
       
   270         *     (E.g. list canceled)
       
   271         */
       
   272         void LaunchAddressSelectL( 
       
   273             const TDesC8& aContactLink,
       
   274             const TCaUiCallType aCallType
       
   275             );
       
   276 
       
   277 
       
   278         /**
       
   279         * Looks for tel URI parameters from a specified phone number.
       
   280         * @param aNumber The phone number that might contain URI parameters
       
   281         * @return HBufC containing URI parameters, if parameters couldn't 
       
   282         * be found the HBufC with zero length is returned
       
   283         * NOTE: The parameters will be ripped off from the given phone 
       
   284         * number (aNumber) if found.
       
   285          */
       
   286         HBufC* FindAndRipURIParametersL( TDes& aNumber ) const;
       
   287         
       
   288         /**
       
   289          * Looks call-type parameter from, URI params and converts the
       
   290          * possible found hint as a return value.
       
   291          * @param aUriParams The descriptor containing URI part of the tel URI.
       
   292          * Parameters can be extracted from URI by using 
       
   293          * FindAndRipURIParametersL method.
       
   294          * @return The hinted call type defined in URI parameters. 
       
   295          * If call-type parameter couldn't be found the EPhCltVoice is returned.
       
   296          */        
       
   297         TPhCltCallType CallTypeFromUriParams( const TDesC& aUriParams ) const;
       
   298         
       
   299         /**
       
   300          * Utility method to search value of named parameter from tel URI.
       
   301          * @param aName The name of parameter what is searched
       
   302          * @param aUri The URI from from which parameter is searched
       
   303          * @return The descriptor containing the valud of named parameter.
       
   304          * If named parameter couldn't be found, KNullDesC is returned
       
   305          */        
       
   306         TPtrC ParamValue( const TDesC& aName, const TDesC& aUri ) const;
       
   307         
       
   308         /**
       
   309          * Utility method to loop through all parameters in Tel URI.
       
   310          * @param aUri Tel URI from which the parameters are searched.
       
   311          * @param aStartIndex Offset from which searching is started.
       
   312          * NOTE: method modifies aStartIndex parameter, always when 
       
   313          * it returns. So 
       
   314          * @return The descriptor containing the next parameter name=value pair.
       
   315          */        
       
   316         TPtrC FindNextParamValuePair( const TDesC& aUri, 
       
   317                                       TInt& aStartIndex ) const;
       
   318      
       
   319         /**
       
   320         * Handle first long press of send key
       
   321         * @since 3.2
       
   322         * Leaves if cenrep data can't be read.
       
   323         * @return User decision about the VT setting
       
   324         */
       
   325         TBool HandleFirstLongPressOfSendKeyL();
       
   326         
       
   327         /**
       
   328         * General handling of long press of send key
       
   329         * @since 3.2
       
   330         * Leaves if cenrep data can't be read.        
       
   331         */
       
   332         void HandleLongPressOfSendKeyL();
       
   333         
       
   334         /**
       
   335         *  from MPhCntSelectionObserver class 
       
   336         * @since 3.2
       
   337         * Leaves if aContactData data can't be read.        
       
   338         */
       
   339         void SelectionDone( CPhCntSelectedData* aContactData, TInt aErrorCode );
       
   340         
       
   341         /**
       
   342         * Makes phoneclient dial request 
       
   343         * @since 3.2
       
   344         * @param fieldLink   link to phonenumber in contacts. If NULL call is 
       
   345         * not created from Phonebook.        
       
   346         */
       
   347         void PhoneClientDialL( const TDesC8* fieldLink );
       
   348         
       
   349         /**
       
   350         * Sets call type to phoneclient dial data struct.
       
   351         * @since 3.2
       
   352         * @param aCallType Call type to set in dialdata struct.        
       
   353         */
       
   354         void SetDialDataCallType( const TCaUiCallType aCallType ); 
       
   355         
       
   356         /**
       
   357         * Checks if number is emergency number using
       
   358         * Emergency call API
       
   359         * @since 3.2
       
   360         * returns ETrue if number is emergency number. Default EFalse.        
       
   361         */
       
   362         TBool IsEmergencyNumber();
       
   363         
       
   364         /**
       
   365         * Handling of emergency dial result. 
       
   366         * @since 3.2
       
   367         * @see MPhCltEmergencyCallObserver::HandleEmergencyDialL().        
       
   368         */
       
   369         void HandleEmergencyDialL( const TInt aStatus ); 
       
   370 
       
   371         /**
       
   372         * Checks if Video Call can be made
       
   373         * @since 3.2
       
   374         * Leaves if cenrep data can't be read.
       
   375         * returns ETrue if call can be made.
       
   376         */
       
   377         TBool IsVideoCallAllowedL();
       
   378         
       
   379         /**
       
   380         * Gets Central repository value
       
   381         * @since 3.2
       
   382         * @param aUid Central repository uid.
       
   383         * @param aId, Central repository key Id.
       
   384         * @param aValue  Cen Rep key value. 
       
   385         * Leaves if cenrep data can't be read.
       
   386         */
       
   387         void GetCenRepValueL( const TUid& aUid, 
       
   388                              const TUint aId,
       
   389                              TInt& aValue ) const;
       
   390         
       
   391         /**
       
   392         * Converts given TCaUiCallType to CPhCntContactDataSelection::TCallType 
       
   393         * @since 3.2
       
   394         * @param aCallType CallType to convert
       
   395         * @param aResultCallType converted type
       
   396         * 
       
   397         */
       
   398         void ConvertCaUiCallType( const TCaUiCallType aCallType,
       
   399                     CPhCntContactDataSelection::TCallType& aResultCallType  );
       
   400         
       
   401          /**
       
   402         * Converts CPhCltExtPhoneDialData callType 
       
   403         * to CPhCntContactDataSelection::TCallType 
       
   404         * @since 3.2
       
   405         * @param aResultCallType converted type
       
   406         * 
       
   407         */            
       
   408         void ConvertDialDataCallType( 
       
   409                     CPhCntContactDataSelection::TCallType& aResultCallType );
       
   410 
       
   411       /**
       
   412        * Converts TPhCltCallType callType to TCaUiCallType. 
       
   413        * @since S60 v9.1
       
   414        * @param aCallType           Source type
       
   415        * @param aResultCallType     Converted type
       
   416        */
       
   417         void ConvertPhCltCallType( const TPhCltCallType aCallType,
       
   418             TCaUiCallType& aResultCallType ) const;
       
   419         
       
   420         /**
       
   421         * Returns Service Selectors calltype by dial data calltype.
       
   422         * @since 5.0
       
   423         * @param Selector calltype.
       
   424         */            
       
   425         CConvergedServiceSelector::TSsCallType ServiceSelectorCallType() const;
       
   426        
       
   427         /**
       
   428         * Converts CCConvergedServiceSelector results 
       
   429         * to CPhCltExtPhoneDialData (calltype and service id) 
       
   430         * @since 5.0
       
   431         * @param aResults Service selectors results.
       
   432         */            
       
   433         void SetSelectorResults( 
       
   434                   CConvergedServiceSelector::TSsResult& aResults );
       
   435 
       
   436         /**
       
   437         * Starts to load specified contact store if not yet loaded. 
       
   438         * If loading is needed, MPhCntStoreLoaderObserver::ContactStoreLoaded
       
   439         * is called when store is ready for use.
       
   440         *  
       
   441         * @since    S60 v9.1
       
   442         * @param    aContactLink   Contact link specifying store to load.
       
   443         * @return   ETrue if store is already loaded.
       
   444         */
       
   445         TBool LaunchContactStoreLoadingL( const TDesC8& aContactLink );
       
   446 
       
   447         /**
       
   448         * Resolves with a help of call type values whether call is initiated
       
   449         * with a send command or through the explicit menu option. 
       
   450         * 
       
   451         * @since    S60 v9.1
       
   452         * @param    aCallType       Call UI call type.
       
   453         * @param    aAiwCallType    AIW call type.
       
   454         * @return   ETrue if send key pressed, EFalse otherwise.
       
   455         */
       
   456         TBool IsSendKeyPressed( TCaUiCallType aCallType,
       
   457             CAiwDialData::TCallType aAiwCallType ) const;
       
   458         
       
   459     private:    // Data
       
   460 
       
   461         // Owned resource loader.
       
   462         RConeResourceLoader             iResourceLoader;
       
   463 
       
   464         // Buffer for returned localized texts.
       
   465         HBufC*                          iBuf;
       
   466 
       
   467         // PhoneClient for call creation.
       
   468         CPhCltExtPhoneBase*             iPhCltDialer;
       
   469 
       
   470         // Handler class for PhoneClient Dial data.
       
   471         CPhCltExtPhoneDialData*         iDialData;
       
   472         // Emergency call API
       
   473         CPhCltEmergencyCall*            iEmergencyCall;
       
   474         
       
   475         // The observer to handle CallUI dial results.
       
   476         MCaUiDialResultObserver*        iObserver;
       
   477         
       
   478         // VoIP extension.        
       
   479         CCaUiVoIPExtension*             iVoIPProfileHandler;
       
   480 
       
   481         // Long press of Send key setting state, NOT SET/ON/OFF
       
   482         TInt iLongPressSet;
       
   483         
       
   484         // The qtn.tel.xxx note shown to the user.
       
   485         CAknGlobalConfirmationQuery*    iVTSettingQuery;
       
   486 
       
   487         // Long key press note buffer        
       
   488         HBufC* iVTString;
       
   489         // Contact factory for PhoneCntFinder connection
       
   490         CPhCntFactory* iFactory;
       
   491         
       
   492         // Contact selector for fetching contact information from phonebook
       
   493         CPhCntContactDataSelection* iContactSelector;
       
   494         
       
   495         // Service selector for calling service (service id and type)
       
   496         CConvergedServiceSelector*      iServiceSelector;
       
   497 
       
   498         /**
       
   499          * Contact store loader.
       
   500          * Own.
       
   501          */
       
   502         MPhCntStoreLoader* iContactStoreLoader;
       
   503 
       
   504         // Dialogs class. Own
       
   505         CCaUiDialogs* iDialogs;
       
   506 
       
   507     };
       
   508 
       
   509 #endif  // CAUIENGINE_H
       
   510 
       
   511 // End of file