idlefw/tsrc/framework/ut_aifw/stub/inc/aipluginfactory_stub.h
branchRCL_3
changeset 27 2c7f27287390
equal deleted inserted replaced
25:9e077f9a342c 27:2c7f27287390
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  Content publisher factory stub
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef _AIPLUGINCFACTORY_STUB_H
       
    21 #define _AIPLUGINCFACTORY_STUB_H
       
    22 
       
    23 // System includes
       
    24 #include <e32base.h>
       
    25 #include <ecom/implementationinformation.h>
       
    26 
       
    27 // User includes
       
    28 
       
    29 // Forward declarations
       
    30 class CAiUiControllerManager;
       
    31 class CAiStateManager;
       
    32 class CAiCpsCommandBuffer;
       
    33 class TAiFwPublisherInfo;
       
    34 class CHsContentPublisher;
       
    35 class THsPublisherInfo;
       
    36 
       
    37 // Class declaration
       
    38 /**
       
    39  * @ingroup group_aifw
       
    40  * 
       
    41  *  Plugin factory class for Active idle framework.
       
    42  *
       
    43  *  @lib aifw
       
    44  *  @since S60 5.2
       
    45  */
       
    46 NONSHARABLE_CLASS( CAiPluginFactory ) : public CTimer
       
    47 	{
       
    48 public:
       
    49     // Constructors and destructor
       
    50     
       
    51     /**
       
    52      * Two-phased constructor.
       
    53      */	
       
    54     static CAiPluginFactory* NewL( CAiUiControllerManager& aManager );
       
    55 
       
    56     /**
       
    57      * 2nd phase constructor
       
    58      */
       
    59     void ConstructL();
       
    60     
       
    61     /**
       
    62      * Destructor
       
    63      */    
       
    64     ~CAiPluginFactory();
       
    65 
       
    66 public:
       
    67     // new functions
       
    68 
       
    69     /**
       
    70      * Lists KInterfaceUidHsContentPlugin ECom implementations 
       
    71      * 
       
    72      * @since S60 5.2
       
    73      */
       
    74     void ListImplementationsL();
       
    75     
       
    76     /**
       
    77      * Schedules plugin loading
       
    78      *
       
    79      * @since S60 5.2
       
    80      * @param aInfo Plugin to load           
       
    81      */    
       
    82     void LoadPlugin( const TAiFwPublisherInfo& aInfo );
       
    83 
       
    84     /**
       
    85      * Schedules plugin destroyal
       
    86      *
       
    87      * @since S60 5.2
       
    88      * @param aInfo Plugin to destroy
       
    89      */        
       
    90     void DestroyPlugin( const TAiFwPublisherInfo& aInfo );
       
    91     
       
    92     /**
       
    93      * Destroy plugin
       
    94      *
       
    95      * @since S60 5.2
       
    96      * @param aUid Implementation UID of a plugin to destroy.
       
    97      */
       
    98     void DestroyPlugin( 
       
    99         const TUid& aUid );      
       
   100     
       
   101     /**
       
   102      * Destroys all plugins during system shutdown
       
   103      * 
       
   104      * @since S60 5.2
       
   105      */
       
   106     void DestroyAllPlugins();
       
   107     
       
   108     /**
       
   109      * Flushes cps command buffer
       
   110      * 
       
   111      * @since S60 5.2
       
   112      */    
       
   113     void FlushCommandBuffer();
       
   114     
       
   115     /**
       
   116      * Finds plugin by publisher info.
       
   117      *
       
   118      * @since S60 5.2
       
   119      * @param aInfo publisher info.
       
   120      * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership.
       
   121      */        
       
   122     CHsContentPublisher* PluginByInfo( 
       
   123         const THsPublisherInfo& aPublisherInfo ) const;
       
   124 
       
   125     /**
       
   126      * Finds plugin by uid.
       
   127      *
       
   128      * @since S60 5.2
       
   129      * @param aInfo publisher uid.
       
   130      * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership.
       
   131      */            
       
   132     CHsContentPublisher* PluginByUid( const TUid& aUid ) const;
       
   133     
       
   134     /**
       
   135      * Finds plugin by name.
       
   136      *
       
   137      * @since S60 5.2
       
   138      * @param aInfo publisher info.
       
   139      * @return Pointer to plugin, NULL if not found. Factory keeps plugin's ownership.
       
   140      */                
       
   141     CHsContentPublisher* PluginByName( const TDesC& aName ) const;
       
   142       
       
   143     /**
       
   144      * Sets state manager
       
   145      * 
       
   146      * @since S60 5.2
       
   147      * @param aStateManager State Manager
       
   148      */
       
   149     void SetStateManager( CAiStateManager* aStateManager );
       
   150     
       
   151     /**
       
   152      * Gets all plugins from factory
       
   153      * 
       
   154      * @since S60 5.2
       
   155      * @return Array of plugins
       
   156      */
       
   157     RPointerArray< CHsContentPublisher >& Publishers() const;
       
   158         
       
   159 private:
       
   160     // from CTimer
       
   161     
       
   162     /**
       
   163      * @see CTimer
       
   164      */
       
   165     void RunL();
       
   166     
       
   167     /**
       
   168      * @see CTimer
       
   169      */
       
   170     void DoCancel();
       
   171     
       
   172 private:	
       
   173     // private constructors
       
   174     
       
   175     /**
       
   176      * C++ default constructor
       
   177      */	
       
   178     CAiPluginFactory( CAiUiControllerManager& aManager );
       
   179 		
       
   180 private:    								
       
   181     // new functions
       
   182 	      
       
   183     TInt DoCreatePlugin( 
       
   184         const TAiFwPublisherInfo& aPublisherInfo );                     
       
   185                                                 
       
   186     void DoDestroyPlugin( 
       
   187         const TAiFwPublisherInfo& aPublisherInfo );         
       
   188     
       
   189     void DoCreatePluginL( 
       
   190         const TAiFwPublisherInfo& aPublisherInfo );
       
   191                  
       
   192     void SubscribePluginL( 
       
   193         CHsContentPublisher& aContentPublisher,		    
       
   194         const THsPublisherInfo& aPublisherInfo );
       
   195                                          
       
   196     void ConfigurePluginL(         
       
   197         CHsContentPublisher& aContentPublisher,
       
   198         const THsPublisherInfo& aPublisherInfo );		                           
       
   199            
       
   200     void HandleQueueChanged();
       
   201         
       
   202     static TInt ProcessQueue( TAny* aAny );
       
   203     
       
   204 private:     
       
   205     // data	
       
   206 
       
   207     /** UI Controller Manager, Not owned */
       
   208     CAiUiControllerManager& iUiControllerManager;
       
   209     /** State Manager, Not owned */
       
   210     CAiStateManager* iStateManager;
       
   211     /** Cps command buffer, Owned */
       
   212     CAiCpsCommandBuffer* iCommandBuffer;
       
   213     /** Queue starter, Owned */
       
   214     CPeriodic* iStarter;
       
   215     /** Array of loaded data plugins, Owned */
       
   216     mutable RPointerArray< CHsContentPublisher > iPublishers;
       
   217     /** Ecom implementation info, Owned */
       
   218     RImplInfoPtrArray iEComPlugins;		          
       
   219     /** Load queue, Owned */
       
   220     RArray< TAiFwPublisherInfo > iLoadQueue;
       
   221     /** Destroy queue, Owned */
       
   222     RArray< TAiFwPublisherInfo > iDestroyQueue;
       
   223     /** Flag to determine wheter flush is allowed */
       
   224     TBool iAllowFlush;
       
   225     
       
   226 private: 
       
   227     // friend classes
       
   228     
       
   229 #ifdef _AIFW_UNIT_TEST
       
   230     friend class UT_AiPluginFactory;
       
   231 #endif
       
   232     };
       
   233 
       
   234 #endif // _AIPLUGINCFACTORY_H
       
   235 
       
   236 // End of File.