convergedcallengine/cce/inc/cccepluginmanager.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Handles threads / plugins 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CCCEPLUGINMANAGER_H
       
    20 #define CCCEPLUGINMANAGER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32property.h> // P&S support
       
    24 
       
    25 #include "mccpplugindeathobserver.h" // MCCPPluginDeathObserver
       
    26 #include "mccespsobserver.h" // MCCESPSObserver
       
    27 
       
    28 class CConvergedCallProvider;
       
    29 class MCCPObserver;
       
    30 class CCCEPlugin;
       
    31 class CCCECallContainer;
       
    32 class MCCEObserver;
       
    33 class MCCPCallObserver;
       
    34 class MCCPEmergencyCall;
       
    35 class MCCPDTMFProvider;
       
    36 class MCCPDTMFObserver;
       
    37 class CCCETransferController;
       
    38 class CCCESPSettingsHandler;
       
    39 
       
    40 /**
       
    41  *  CCE Plugin manager
       
    42  *
       
    43  *  Creates/Deletes and update current plugins.
       
    44  *
       
    45  *  @lib cce.dll
       
    46  *  @since S60 v3.2
       
    47  */
       
    48 NONSHARABLE_CLASS(CCCEPluginManager): public CActive,
       
    49     public MCCPPluginDeathObserver,
       
    50     public MCCESPSObserver
       
    51     {
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Two-phased constructor.
       
    56      * @param aCallContainer Reference to call container
       
    57      * @param aTransferController Reference to transfer controller
       
    58      */
       
    59 	static CCCEPluginManager* NewL( 
       
    60 	    CCCECallContainer& aCallContainer,
       
    61 	    CCCETransferController& aTransferController );
       
    62 
       
    63     /**
       
    64      * Destructor.
       
    65      */
       
    66     virtual ~CCCEPluginManager();
       
    67 
       
    68 public:
       
    69 
       
    70     /**
       
    71      * Sets observer
       
    72      *
       
    73      * @since S60 v3.2
       
    74      * @param aProviders 
       
    75      */
       
    76     void SetObserver( const MCCEObserver& aObserver );
       
    77 
       
    78     /**
       
    79      * TODO
       
    80      *
       
    81      * @since S60 v3.2
       
    82      * @param aProviders 
       
    83      */
       
    84     void SetEmergencyCallObserver(MCCPCallObserver& aEmergencyCallObserver);
       
    85 
       
    86     /**
       
    87      * Returns pointer to primary emergencycall
       
    88      *
       
    89      * @since S60 v3.2
       
    90      * @return Pointer to emergency call.
       
    91      */
       
    92     MCCPEmergencyCall* PrimaryEmergencyCall();
       
    93     
       
    94     /**
       
    95      * Returns Uid of primary emergencycall
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @return Implementation Uid.
       
    99      */
       
   100     TUid PrimaryEmergencyCallUid() const;
       
   101     
       
   102     /**
       
   103      * Returns plugins with emergency call attribute.
       
   104      *
       
   105      * @since S60 v3.2
       
   106      * @return Array of emergency call capable plugins.
       
   107      */
       
   108     RArray<TUid>& AlternativeEmergencyPlugins();
       
   109 
       
   110     /**
       
   111      * Returns plugin with desired service id
       
   112      *
       
   113      * @since S60 v3.2
       
   114      * @param aServiceId Used for searching
       
   115      * @return Pointer to plugin. NULL if not found.
       
   116      */
       
   117     CConvergedCallProvider* GetPluginL( TUint32 aServiceId );
       
   118 
       
   119    /**
       
   120     * Returns plugin with desired implementation id
       
   121     *
       
   122     * @since S60 v3.2
       
   123     * @param aType Used for searching
       
   124     * @return Pointer to plugin. NULL if not found.
       
   125     */
       
   126     CConvergedCallProvider* GetPluginL( const TUid& aType );
       
   127  
       
   128    /**
       
   129     * Remove unneeded plugin with desired implementation id
       
   130     *
       
   131     * @since S60 v3.2
       
   132     * @param aType Used for searching
       
   133     */
       
   134     void RemovePlugin( const TUid& aType );
       
   135    
       
   136    /**
       
   137     * Returns ETrue if plugin can be relesed if idle
       
   138     *
       
   139     * @since S60 v3.2
       
   140     * @return TBool EFalse If plugin is permanently in memory
       
   141     */
       
   142     TBool ReleaseWhenIdle( const TUid aType );
       
   143     
       
   144    /**
       
   145     * Returns dtmf interface for desired provider
       
   146     *
       
   147     * @since S60 v3.2
       
   148     * @param aObserver Used for setting interface observer
       
   149     * @param aImplementationUid Used for searching
       
   150     * @return Reference to dtmf provider or leave.
       
   151     */
       
   152     MCCPDTMFProvider& DtmfProviderL(
       
   153         const MCCPDTMFObserver& aObserver,
       
   154         TUid aImplementationUid ) const;
       
   155 
       
   156 private:
       
   157 
       
   158 // from base class MCCESPSObserver
       
   159     /** @see MCCESPSObserver */
       
   160     void ServiceEnabledL( TUid aImplementationUid );
       
   161 
       
   162     /** @see MCCESPSObserver */
       
   163     void ServiceDisabledL( TUid aImplementationUid );
       
   164 
       
   165 // from base class MCCPPluginDeathObserver
       
   166 
       
   167     /** @see MCCPPluginDeathObserver::CCPPluginDiedEvent */
       
   168 	void CCPPluginDiedEvent(TUid aPluginId, TInt aDeathType, TInt aReason);
       
   169 	
       
   170 	/** @see MCCPPluginDeathObserver::CCPPluginInitialisationFailed */
       
   171     void CCPPluginInitialisationFailed(TUid aPluginUid, TInt aError);
       
   172     
       
   173 // from base class CActive
       
   174 
       
   175     /**
       
   176      * This will be runned when incoming call monitor activates
       
   177      *
       
   178      * @since S60 v3.2
       
   179      */
       
   180 	void RunL();
       
   181 
       
   182     /**
       
   183      * Cancels incoming call monitor
       
   184      *
       
   185      * @since S60 v3.2
       
   186      */
       
   187 	void DoCancel(); 
       
   188 
       
   189 private:
       
   190 
       
   191     /**
       
   192      * This is called after phone application is constructed 
       
   193      * or else causes phone not to boot.
       
   194      *
       
   195      * @since S60 v3.2
       
   196      * @param aPluginManager 
       
   197      * @return KErrNone if successful
       
   198      *         ( KErrNone always or else there is loop possiple ).
       
   199      */
       
   200     static TInt DoAfterBoot( TAny* aPluginManager );
       
   201  
       
   202     /**
       
   203      * This is called when plugins are cheduled to be removed
       
   204      *
       
   205      * @since S60 v3.2
       
   206      * @param aPluginManager 
       
   207      * @return KErrNone if successful
       
   208      *         ( KErrNone always or else there is posiibility to loop
       
   209      */
       
   210     static TInt RemovePlugins( TAny* aPluginManager );
       
   211     
       
   212 
       
   213     /**
       
   214      * Logic for loading plugins at boot.
       
   215      *
       
   216      * @since S60 v3.2
       
   217      */
       
   218     void LoadBootPluginsL();
       
   219    
       
   220     /**
       
   221      * Logic for loading single plugin at boot
       
   222      * 
       
   223      * @since S60 v3.2
       
   224      * @param aServiceId Service id for loadable plugin
       
   225      */
       
   226     void LoadBootPluginL( TInt aServiceId );
       
   227     
       
   228     /**
       
   229      * Append to emergency call array if not already there.
       
   230      *
       
   231      * @since S60 v3.2
       
   232      */
       
   233     void AddToAlternativeEmergencyArray(TUid aUid);
       
   234 
       
   235 private:
       
   236 
       
   237     /** Constructor */
       
   238 	CCCEPluginManager( 
       
   239 	    CCCECallContainer& aCallContainer,
       
   240 	    CCCETransferController& aTransferController );
       
   241 
       
   242     /** Leaving stuff in constructor */
       
   243 	void ConstructL();
       
   244 
       
   245 private:
       
   246     
       
   247     /**
       
   248      * Reference to call container
       
   249      */
       
   250     CCCECallContainer& iCallContainer;
       
   251     
       
   252     /**
       
   253      * Reference to transfer controller
       
   254      */
       
   255     CCCETransferController& iTransferController;
       
   256 
       
   257     /**
       
   258      * This calls DoAfterBoot method
       
   259      * Own
       
   260      */
       
   261     CIdle* iIdle;
       
   262 
       
   263     /**
       
   264      * Array of plugins
       
   265      * Own
       
   266      */
       
   267     RPointerArray<CCCEPlugin> iPluginArray;
       
   268     
       
   269     /**
       
   270      * Array of plugins
       
   271      * Own
       
   272      */
       
   273     RPointerArray<CCCEPlugin> iPluginsToClose;
       
   274 
       
   275     /**
       
   276      * Observer
       
   277      * Own
       
   278      */
       
   279     const MCCEObserver* iObserver;
       
   280    
       
   281     /**
       
   282      * TODO
       
   283      * Own?
       
   284      */
       
   285     MCCPCallObserver* iEmergencyCallObserver;
       
   286     
       
   287     /**
       
   288      * TODO
       
   289      * Own?
       
   290      */
       
   291     CCCEPlugin* iPrimaryEmergencyCallPlugin;
       
   292     
       
   293     /**
       
   294      * Used in incoming call monitor
       
   295      */
       
   296     RProperty iProperty;
       
   297     
       
   298     /**
       
   299      * Array of plugins with emergency call attribute
       
   300      */
       
   301     RArray<TUid> iAlternativeEmergencyPlugins;
       
   302     
       
   303     /**
       
   304      * SPSettings listener
       
   305      * Own
       
   306      */
       
   307     CCCESPSettingsHandler* iSPSettings;
       
   308     };
       
   309 
       
   310 #endif // CCCEPLUGINMANAGER_H