remotemgmt_plat/diagnostics_plugin_pool_api/inc/diagpluginpool.h
branchRCL_3
changeset 25 b183ec05bd8c
parent 24 13d7c31c74e0
child 26 19bba8228ff0
equal deleted inserted replaced
24:13d7c31c74e0 25:b183ec05bd8c
     1 /*
       
     2 * Copyright (c) 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:  Manages Diagnostics Plug-in
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGPLUGINPOOL_H
       
    20 #define DIAGPLUGINPOOL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>            // CBase
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MDiagPlugin;
       
    27 class MDiagPluginPoolObserver;
       
    28 class CDiagPluginPoolImpl;        
       
    29 
       
    30 
       
    31 /**
       
    32 *  Diagnostics Framework Plugin Pool Class
       
    33 *
       
    34 *  This class is used to load Diagnostics ECom plug-ins. It works with both
       
    35 *  Suite Plug-in and Test Plug-in. Once loaded, it will manage the life
       
    36 *  cycle of the plug-ins.
       
    37 *
       
    38 *  All loaded plug-ins will be destroyed when pool is deleted.
       
    39 *
       
    40 *  @since S60 v5.0
       
    41 */
       
    42 NONSHARABLE_CLASS( CDiagPluginPool ) : public CBase
       
    43     {
       
    44 public:
       
    45 
       
    46     /**
       
    47     * Two-phased constructors
       
    48     *
       
    49     * @param aObserver     Plug-in Pool observer.
       
    50     * @return New instance of CDiagPluginPool
       
    51     */
       
    52     IMPORT_C static CDiagPluginPool* NewL( MDiagPluginPoolObserver& aObserver );
       
    53     IMPORT_C static CDiagPluginPool* NewLC( MDiagPluginPoolObserver& aObserver );
       
    54 
       
    55     /**
       
    56     * Destructor
       
    57     *
       
    58     */
       
    59     IMPORT_C virtual ~CDiagPluginPool();
       
    60 
       
    61 public:     // new API
       
    62 
       
    63     /**
       
    64     * Loads all plug-ins. Progress is notified via MDiagPluginPoolObserver.
       
    65     * 
       
    66     * @param aUid - Interface Uid to load.
       
    67     */
       
    68     IMPORT_C void LoadAsyncL( TUid aUid );
       
    69     
       
    70     /**
       
    71     * Create an instance of a plug-in. It can be a test plug-in or suite plug-in.
       
    72     * If this is a suite, it will not have its children associated with it since
       
    73     * will require children to be loaded as well.
       
    74     *
       
    75     * Plug-ins created using this method is not part of plug-in pool. Therefore
       
    76     * client must manage the life cycle of the plug-in.
       
    77     * 
       
    78     * @param aUid - Implementation Uid of plug-in. 
       
    79     * @return Newly instantiated plug-in. Ownership is transferred to caller.
       
    80     */
       
    81     IMPORT_C static MDiagPlugin* CreatePluginL( TUid aUid );
       
    82 
       
    83     /**
       
    84     * Cancel Plug-in Loading
       
    85     * This method cancels plug-in loading. If it was not currently loading
       
    86     * plug-ins, it will leave with KErrNotReady
       
    87     */
       
    88     IMPORT_C void CancelLoadPluginsL();
       
    89 
       
    90     /**
       
    91     * Find Plug-in that matches given Uid.
       
    92     *
       
    93     * @param aUid      Uid of plug-in to search.
       
    94     * @param aPlugin   Reference to Plugin found. Engine owns this plug-in.
       
    95     *                  Client must not deallocate plug-in.
       
    96     * @return TInt     KErrNone        - Success.
       
    97     *                  KErrNotFound    - Not found.
       
    98     *                  KErrNotReady    - Plug-ins are not yet loaded.
       
    99     */
       
   100     IMPORT_C TInt FindPlugin( TUid aUid, MDiagPlugin*& aPlugin ) const;
       
   101 
       
   102     /**
       
   103     * Find Plug-in that matches given Uid. This function will leave on error.
       
   104     *  Leave codes:    KErrNone        - Success.
       
   105     *                  KErrNotFound    - Not found.
       
   106     *                  KErrNotReady    - Plug-ins are not yet loaded.
       
   107     *
       
   108     * @param aUid      Uid of plug-in to search.
       
   109     * @return Refernce to the plug-in found.
       
   110     */
       
   111     IMPORT_C MDiagPlugin& FindPluginL( TUid aUid ) const;
       
   112 
       
   113     /**
       
   114     * Find Plug-in that matches given service name.
       
   115     *
       
   116     * @param aServiceName  Service name of the plug-in. Name must match exactly.
       
   117     * @param aPlugin       Reference to Plugin found. Engine owns this plug-in.
       
   118     *                      Client must not deallocate plug-in.
       
   119     * @return TInt         KErrNone        - Success.
       
   120     *                      KErrNotFound    - Not found.
       
   121     *                      KErrNotReady    - Plug-ins are not yet loaded.
       
   122     */
       
   123     IMPORT_C TInt FindPlugin( const TDesC& aServiceName,
       
   124                               MDiagPlugin*& aPlugin ) const;
       
   125 
       
   126     /**
       
   127     * Find Plug-in that matches given service name. Will leave on error.
       
   128     *  Leave codes:    KErrNone        - Success.
       
   129     *                  KErrNotFound    - Not found.
       
   130     *                  KErrNotReady    - Plug-ins are not yet loaded.
       
   131     *
       
   132     * @param aServiceName  Service name of the plug-in. Name must match exactly.
       
   133     * @return Reference to Plugin found.
       
   134     */
       
   135     IMPORT_C MDiagPlugin& FindPluginL( const TDesC& aServiceName ) const;
       
   136 
       
   137 private:  // private constructors
       
   138     
       
   139     /**
       
   140     * C++ Constructor
       
   141     *    
       
   142     */    
       
   143     CDiagPluginPool();
       
   144     
       
   145     /**
       
   146     * 2nd phase constructor
       
   147     *    
       
   148     */        
       
   149     void ConstructL( MDiagPluginPoolObserver& aObserver );
       
   150 
       
   151 private:    //  MEMBER DATA
       
   152     
       
   153     /**
       
   154     * iPluginPoolImpl - Acutal implementation of CDiagPluginPool
       
   155     * Owns
       
   156     */
       
   157     CDiagPluginPoolImpl* iPluginPoolImpl;
       
   158     };
       
   159 
       
   160 
       
   161 #endif // DIAGPLUGINPOOL_H
       
   162 
       
   163 // End of File
       
   164