mediator/inc/Server/MediatorServerPluginHandler.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 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:  Resolves and loads ECom plugins into new threads.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef MEDIATORSERVERPLUGINHANDLER_H
       
    19 #define MEDIATORSERVERPLUGINHANDLER_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <ecom/ecom.h>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 
       
    27 /**
       
    28 *  Plugin handler class for Mediator Server.
       
    29 *
       
    30 *  @lib MediatorServer
       
    31 *  @since S60 3.1
       
    32 */
       
    33 class CMediatorServerPluginHandler : public CBase
       
    34     {
       
    35     public:  // Constructors and destructor
       
    36         
       
    37         /**
       
    38         * Two-phased constructor.
       
    39         */
       
    40         static CMediatorServerPluginHandler* NewL();
       
    41         
       
    42         /**
       
    43         * Destructor.
       
    44         */
       
    45         virtual ~CMediatorServerPluginHandler();
       
    46 
       
    47     public: // New functions
       
    48         
       
    49         /**
       
    50         * Thread's entry point
       
    51         * @since S60 3.1
       
    52         * @param aParameter Pointer of parameter passed to thread
       
    53         * @return Error code of thread creating
       
    54         *         KErrNone if succesfully
       
    55         */
       
    56         static TInt ThreadEntryPoint( TAny* aParameter );
       
    57 
       
    58         /**
       
    59         * Starts the thread creating
       
    60         * @since S60 3.1
       
    61         * @param aMediatorPluginUid Implementation uid for Mediator plugin
       
    62         * @param aThreadName Thread name
       
    63         * @return None.
       
    64         */
       
    65         void StartThreadL( TUid aMediatorPluginUid );
       
    66         
       
    67         /**
       
    68         * Loads plugins
       
    69         * @since S60 3.1
       
    70         * @param aPtr pointer to CIdle callback instance
       
    71         * @return TInt indicating the status of the callback.
       
    72         */
       
    73         static TInt LoadPlugins( TAny* aPtr );
       
    74         
       
    75         /**
       
    76         * Loads ECom plugins
       
    77         * @since S60 3.1
       
    78         * @param None.
       
    79         * @return None.
       
    80         */
       
    81         void LoadPluginsL( );
       
    82         
       
    83         /**
       
    84         * Returns count of plugins in this handler
       
    85         * @since S60 3.1
       
    86         * @param None.
       
    87         * @return TInt plugin count.
       
    88         */
       
    89         TInt PluginCount() { return iPluginImplInfoArray.Count(); }
       
    90 
       
    91     private:  // New functions
       
    92         
       
    93         /**
       
    94         * Finds ECom interface implementations
       
    95         * @since S60 3.1
       
    96         * @param None.
       
    97         * @return None.
       
    98         */
       
    99         void FindImplementationsL();
       
   100         
       
   101         /**
       
   102         * Starts a new thread for given plugin
       
   103         * @since S60 3.1
       
   104         * @param aMediatorPluginUid UID for the plugin to be loaded
       
   105         * @return None.
       
   106         */
       
   107         static void DoStartThreadL( TUid aMediatorPluginUid );
       
   108         
       
   109     private:
       
   110 
       
   111         /**
       
   112         * C++ default constructor.
       
   113         */
       
   114         CMediatorServerPluginHandler();
       
   115 
       
   116         /**
       
   117         * By default Symbian 2nd phase constructor is private.
       
   118         */
       
   119         void ConstructL();
       
   120 
       
   121     private:    // Data
       
   122         
       
   123         /**
       
   124         *  A class for passing parameter data for new plugin thread
       
   125         *
       
   126         *  @lib MediatorServer
       
   127         *  @since S60 3.1
       
   128         */
       
   129         class TMediatorThreadParam
       
   130             {
       
   131             public:
       
   132                 // plugin uid
       
   133                 TUid iMediatorPluginUid;
       
   134             };
       
   135         
       
   136         /**
       
   137         * Implementation info of Mediator plugin instances.
       
   138         */
       
   139         RImplInfoPtrArray iPluginImplInfoArray;
       
   140          
       
   141         /**
       
   142         * To detect idle time 
       
   143         * Own.
       
   144         */
       
   145         CIdle* iIdle;
       
   146         
       
   147     };
       
   148 
       
   149 #endif      // MEDIATORSERVERPLUGINHANDLER_H   
       
   150             
       
   151 // End of File