emailcontacts/contactactionservice/callplugin/inc/cfsccallpluginimpl.h
changeset 0 8466d47a6819
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 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:  Definition of the class CFscCallPluginImpl.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_FSCCALLPLUGINIMPL_H
       
    20 #define C_FSCCALLPLUGINIMPL_H
       
    21 
       
    22 //<cmail>
       
    23 #include "cfsccontactactionplugin.h"
       
    24 //</cmail>
       
    25 #include "mfscreasoncallback.h"
       
    26 #include "mfsccontactset.h"
       
    27 #include "mfsccontactsetobserver.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CFscContactAction;
       
    31 class CAiwServiceHandler;
       
    32 class MFscContactAction;
       
    33 class MFscContactActionPluginObserver;
       
    34 class MAiwNotifyCallback;
       
    35 
       
    36 // CONSTANTS DECLARATIONS
       
    37 const TInt KMaxLengthOfNumber = 100;
       
    38 
       
    39 /**
       
    40  *  Call plugin implementation.
       
    41  *  Contains implementation of Call actions.
       
    42  *
       
    43  *  @lib fsccallplugin.lib
       
    44  *  @since S60 3.1
       
    45  */
       
    46 class CFscCallPluginImpl : public CFscContactActionPlugin,
       
    47                            public MFscReasonCallback,
       
    48                            public MFscContactSetObserver,
       
    49                            public MAiwNotifyCallback
       
    50     {
       
    51     
       
    52     /**  
       
    53      * States of operations
       
    54      */
       
    55     enum TActionPluginLastEvent 
       
    56         {
       
    57         EActionEventIdle,
       
    58         EActionEventCanExecuteLaunched,
       
    59         EActionEventCanExecuteFinished,
       
    60         EActionEventContactRetrieve,
       
    61         EActionEventGroupRetrieve,
       
    62         EActionEventExecuteLaunched,
       
    63         EActionEventCanceled
       
    64         };
       
    65     
       
    66 public:
       
    67 
       
    68     /**
       
    69      * Two-phased constructor.
       
    70      *
       
    71      * @param aParams contact action plugin parameters
       
    72      * @return New instance of CFscCallPluginImpl
       
    73      */
       
    74     static CFscCallPluginImpl* NewL( TAny* aParams );
       
    75    
       
    76     /**
       
    77      * Destructor.
       
    78      */
       
    79     virtual ~CFscCallPluginImpl();
       
    80     
       
    81 public: // From CFscContactActionPlugin
       
    82 
       
    83     /**
       
    84      * @see CFscContactActionPlugin::Uid
       
    85      */
       
    86     virtual TUid Uid() const;
       
    87 
       
    88     /**
       
    89      * @see CFscContactActionPlugin::ActionList
       
    90      */
       
    91     virtual const CArrayFix<TUid>* ActionList() const;
       
    92 
       
    93     /**
       
    94      * @see CFscContactActionPlugin::GetActionL
       
    95      */
       
    96     virtual const MFscContactAction& GetActionL( 
       
    97         TUid aActionUid ) const;
       
    98             
       
    99     /**
       
   100      * Method for quering action's priority and visibility in current context with given contacts
       
   101      *
       
   102      * @param aActionUid Action uid
       
   103      * @param aContactSet Target contact set
       
   104      * @param aGroupList List containing target groups and their contacts
       
   105      * @param aActionMenuVisibility Action's visibility in action menu. 
       
   106      *   Visibility information is updated by the method.
       
   107      * @param aOptionsMenuVisibility Action's visibility in options menu
       
   108      *   Visibility information is updated by the method.
       
   109      * @return Priority of the action
       
   110      */
       
   111     virtual void PriorityForContactSetL( 
       
   112         TUid aActionUid,
       
   113         MFscContactSet& aContactSet,
       
   114         TFscContactActionVisibility& aActionMenuVisibility,
       
   115         TFscContactActionVisibility& aOptionsMenuVisibility,
       
   116         MFscContactActionPluginObserver* aObserver );
       
   117         
       
   118     /**
       
   119      * Execute action. Asynchronous method.
       
   120      *
       
   121      * @param aActionUid Action uid of the action to be executed.
       
   122      * @param aContactSet Target contact set.
       
   123      * @param aObserver operation observer.
       
   124      */
       
   125     virtual void ExecuteL( 
       
   126         TUid aActionUid,
       
   127         MFscContactSet& aContactSet,
       
   128         MFscContactActionPluginObserver* aObserver );
       
   129     
       
   130 public: // From MFscReasonCallback
       
   131 
       
   132     /**
       
   133      * @see MFscReasonCallback::GetReasonL
       
   134      */
       
   135     virtual void GetReasonL(
       
   136         TUid aActionUid,
       
   137         TInt aReasonId,
       
   138         HBufC*& aReason ) const;
       
   139     
       
   140 public: //From base class MFscContactSetObserver
       
   141     
       
   142     /**
       
   143      * @see MFscContactSetObserver::NextContactComplete
       
   144      */
       
   145     virtual void NextContactComplete( MVPbkStoreContact* aContact );
       
   146     
       
   147     /**
       
   148      * @see MFscContactSetObserver::NextContactFailed
       
   149      */
       
   150     virtual void NextContactFailed( TInt aError );
       
   151     
       
   152     /**
       
   153      * @see MFscContactSetObserver::NextGroupComplete
       
   154      */
       
   155     virtual void NextGroupComplete( MVPbkStoreContact* aContact );
       
   156     
       
   157     /**
       
   158      * @see MFscContactSetObserver::NextGroupFailed
       
   159      */
       
   160     virtual void NextGroupFailed( TInt aError );
       
   161     
       
   162     /**
       
   163      * @see MFscContactSetObserver::GetGroupContactComplete
       
   164      */
       
   165     virtual void GetGroupContactComplete( MVPbkStoreContact* aContact );
       
   166     
       
   167     /**
       
   168      * @see MFscContactSetObserver::GetGroupContactFailed
       
   169      */
       
   170     virtual void GetGroupContactFailed( TInt aError );
       
   171     
       
   172     /**
       
   173      * @see CFscContactActionPlugin::CancelPriorityForContactSet
       
   174      */
       
   175     virtual void CancelPriorityForContactSet();
       
   176      
       
   177     /**
       
   178      * @see CFscContactActionPlugin::CancelExecute
       
   179      */
       
   180     virtual void CancelExecute();
       
   181     
       
   182 public: //from MAiwNotifyCallback
       
   183 	
       
   184 	/**
       
   185 	 * @see MAiwNotifyCallback :: HandleNotifyL
       
   186 	 */
       
   187 	
       
   188 	virtual TInt HandleNotifyL(
       
   189         TInt aCmdId,
       
   190         TInt aEventId,
       
   191         CAiwGenericParamList& aEventParamList,
       
   192         const CAiwGenericParamList& aInParamList);
       
   193 
       
   194 private: // methods
       
   195 
       
   196     /**
       
   197      * Makes call using Dial AIW API
       
   198      *
       
   199      * @param aNumber phone number to make a call
       
   200      * @param aCallType specifies voice, video or voip
       
   201      */      
       
   202     void MakeAiwCallL( const TDesC& aNumber, CAiwDialData::TCallType aCallType );  
       
   203     
       
   204     /**
       
   205      * Helper method to check if action can be executed with 
       
   206      * given contacts in current context
       
   207      *
       
   208      * @param aActionId Action Id
       
   209      * @param aContactSet contains contact list and group lists
       
   210      * @return KErrNone if action can be executed,
       
   211      *  otherwise system wide error code
       
   212      */
       
   213     void CanExecuteL(
       
   214         TUid aActionUid,
       
   215         MFscContactSet& aContactSet );
       
   216 
       
   217     /**
       
   218      * Updates action icons
       
   219      *
       
   220      * @param aActionId Action Id
       
   221      */
       
   222     void UpdateActionIconL( TUid aActionUid );
       
   223     
       
   224 private: // constructors
       
   225 
       
   226     /**
       
   227      * Constructor.
       
   228      *
       
   229      * @param aParams contact action plugin parameters
       
   230      */
       
   231     CFscCallPluginImpl(
       
   232         const TFscContactActionPluginParams& aParams );
       
   233 
       
   234     /**
       
   235      * Second phase constructor.
       
   236      */
       
   237     void ConstructL();
       
   238     
       
   239     /**
       
   240      * Restores members related to state machine
       
   241      */
       
   242     void ResetData();
       
   243     
       
   244     /**
       
   245      * Resumes plugin processing
       
   246      * Resumes ExecuteL or PriorityForContactSetL execution
       
   247      * 
       
   248      * @param aActionUid action UID
       
   249      * @param aContactSet set of contacts
       
   250      * @param aIsExecute is ExecuteL or PriorityForContactSetL launched
       
   251      */
       
   252     void ResumeAsync(
       
   253             TUid aActionUid,
       
   254             MFscContactSet& aContactSet,
       
   255             TBool aIsExecute );
       
   256         
       
   257 private: // data
       
   258 
       
   259     /**
       
   260      * Action plugin parameters
       
   261      */
       
   262     TFscContactActionPluginParams iParams;
       
   263     
       
   264     /**
       
   265      * Resource handle
       
   266      */
       
   267     TInt iResourceHandle;
       
   268 
       
   269     /**
       
   270      * Own: Contact action for Gsm call
       
   271      */      
       
   272     CFscContactAction* iContactCallGsmAction;
       
   273 
       
   274     /**
       
   275      * Own: Contact action for video call
       
   276      */    
       
   277     CFscContactAction* iContactCallVideoAction;
       
   278   
       
   279     /**
       
   280      * Own: Contact action for conf number call
       
   281      */    
       
   282     CFscContactAction* iContactCallConfNumAction;
       
   283 
       
   284     /**
       
   285      * Own: Contact action for voip call
       
   286      */    
       
   287     CFscContactAction* iContactCallVoipAction;
       
   288 
       
   289     /**
       
   290      * Own: Contact action array
       
   291      */    
       
   292     CArrayFixFlat<TUid>* iActionList;
       
   293 
       
   294     /**
       
   295      * Own: AIW service handler
       
   296      */
       
   297     CAiwServiceHandler* iAiwServiceHandler;
       
   298     
       
   299     //-----------------------------------
       
   300   
       
   301     /**
       
   302      * Action Uid
       
   303      */
       
   304     TUid iActionUid;
       
   305     
       
   306     /**
       
   307      * Contact set
       
   308      */
       
   309     MFscContactSet* iContactSet;
       
   310     
       
   311     /**
       
   312      * Action menu visbility
       
   313      */
       
   314     TFscContactActionVisibility* iActionMenuVisibility;
       
   315     
       
   316     /**
       
   317      * Options menu visbility
       
   318      */
       
   319     TFscContactActionVisibility* iOptionsMenuVisibility;
       
   320     
       
   321     /**
       
   322      * Plug-in observer
       
   323      */
       
   324     MFscContactActionPluginObserver* iPluginObserver;
       
   325     
       
   326     /**
       
   327      * Current state of state machine 
       
   328      */
       
   329     TActionPluginLastEvent iLastEvent;
       
   330     
       
   331     /**
       
   332      * Action priority
       
   333      */
       
   334     TInt iActionPriority;
       
   335     
       
   336     /**
       
   337      * Can display action
       
   338      */
       
   339     TInt iCanDisplay;
       
   340 
       
   341     /**
       
   342      * Retrieved store contact
       
   343      */
       
   344     MVPbkStoreContact* iRetrievedStoreContact;
       
   345     
       
   346     /**
       
   347      * Is ExecuteL or PriorityForContactSetL launched
       
   348      */
       
   349     TBool iIsExecute;
       
   350     
       
   351     /**
       
   352      * Variable used to check if preferred call is a voice or internet call
       
   353      * (only when VOIP is set as 'default' in Contacts application and
       
   354      * user selects 'Voice call' from Options or Action Menu)
       
   355      */
       
   356     TBool iPreferredCallValueChanged;
       
   357     
       
   358     };
       
   359 
       
   360 #endif // C_FSCCALLPLUGINIMPL_H