devicediagnosticsfw/diagframework/inc/diagplugin.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:  Abstract class that represents a diagnostics plug-in
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef DIAGPLUGIN_H
       
    20 #define DIAGPLUGIN_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <badesca.h>            // CPtrCArray . Needed since this is typedef.
       
    24 
       
    25 //Forward declarations
       
    26 class CGulIcon;
       
    27 class MDiagEngineCommon;
       
    28 
       
    29 // Constants for plugin interfaces 
       
    30 const TUid KDiagPluginInterfaceUid = { 0x2000AFEB };
       
    31 
       
    32 // UID of top most root suite uid.  All plug-ins are descendant of this suite.
       
    33 const TUid KDiagRootSuiteUid = { 0x00000000 };
       
    34 
       
    35 /**
       
    36 * Abstract class that repsesents a diagnostics plug-in.
       
    37 *
       
    38 * @since S60 v5.0
       
    39 **/
       
    40 class MDiagPlugin
       
    41     {
       
    42 public: //data structures
       
    43 
       
    44     /**
       
    45     * Indicates is the plug-in a suite or a test plug-in
       
    46     **/
       
    47     enum TPluginType
       
    48         {
       
    49         ETypeTestPlugin,
       
    50         ETypeSuitePlugin
       
    51         };
       
    52 
       
    53     /**
       
    54     * Layout type of name being requested.
       
    55     */
       
    56     enum TNameLayoutType
       
    57         {
       
    58         ENameLayoutListSingle,              // list_single_graphic_heading_pane_t1_cp2
       
    59         ENameLayoutPopupNoteWaitWindow,     // popup_note_wait_window
       
    60         ENameLayoutListLargeGraphic,        // list_single_large_graphic_pane_t1
       
    61         ENameLayoutHeadingPane,             // heading_pane_t1
       
    62         ENameLayoutPopupInfoPane,           // popup_info_list_pane_t1
       
    63         ENameLayoutTitlePane,               // title_pane_t2/opt12
       
    64         ENameLayoutListSingleGraphic,       // list_single_graphic_pane_t1
       
    65         ENameLayoutListDoubleGraphic        // list_double_graphic_pane_t1
       
    66         };
       
    67 
       
    68 public: // public methods
       
    69 
       
    70     /**
       
    71     * Virtual destructor. This ensures that when the interface is deleted,
       
    72     * compiler will look up virtual table to find correct destructor.
       
    73     */
       
    74     virtual ~MDiagPlugin() {}
       
    75 
       
    76     /**
       
    77     * Method for getting the name of the plugin. Name returned should be based
       
    78     * on the layout requested, and it should fit within the layout.
       
    79     *
       
    80     * @param aLayoutType - Layout where text will be displayed in. @see TNameLayoutType
       
    81     * @return Localized name of the plug-in. Ownership is transferred to caller.
       
    82     */
       
    83     virtual HBufC* GetPluginNameL( TNameLayoutType aLayoutType ) const = 0;
       
    84 
       
    85     /**
       
    86     * Get the name of the service that the plug-in provides.
       
    87     * Service name is defined in the ECOM resource file, thus, it is not localized.
       
    88     *
       
    89     * @return The name of the service.
       
    90     **/
       
    91     virtual const TDesC& ServiceLogicalName() const = 0;
       
    92 
       
    93     /**
       
    94     * Get logical dependencies. One plug-in can have multiple dependencies to other plug-ins.
       
    95     *
       
    96     * @param aArray An array of logical names.
       
    97     * @see ServiceLogicalName.
       
    98     **/
       
    99     virtual void GetLogicalDependenciesL( CPtrCArray& aArray ) const = 0;
       
   100 
       
   101     /**
       
   102     * Return the type of the plug-in. 
       
   103     *
       
   104     * @return The type.
       
   105     * @see TPluginType.
       
   106     **/
       
   107     virtual TPluginType Type() const = 0;
       
   108 
       
   109     /**
       
   110     * Create an icon that represents the plug-in.
       
   111     *
       
   112     * @return An icon. 
       
   113     **/
       
   114     virtual CGulIcon* CreateIconL() const = 0;
       
   115 
       
   116     /** Method for checking, if plugin should be visible.
       
   117     * (for example shown in listbox).
       
   118     * Overwrite this function to show or hide your plugin dynamically.
       
   119     *
       
   120     * @return ETrue if plugin should be visible, EFalse otherwise.
       
   121     */
       
   122     virtual TBool IsVisible() const = 0;
       
   123 
       
   124     /** Method for checking, if plugin is supported.
       
   125     * Overwrite this function to enable or disable your plugin dynamically.
       
   126     * If EFalse, plug-in will not be loaded by plugin pool.
       
   127     *
       
   128     * @return ETrue if plugin is supported, EFalse otherwise.
       
   129     */
       
   130     virtual TBool IsSupported() const = 0;
       
   131 
       
   132     /**
       
   133     * Get localised description of the test. Description should be used to explain 
       
   134     * the test for the user. It can contain comments that this service needs for 
       
   135     * example access point and it creates costs or that the duration might be long.
       
   136     *
       
   137     * @return Allocated buffer containing localized description of the plugin.
       
   138     **/
       
   139     virtual HBufC* GetDescriptionL() const = 0;
       
   140 
       
   141     /**
       
   142     * Get UID of this plug-in.
       
   143     *
       
   144     * @return the UID.
       
   145     **/
       
   146     virtual TUid Uid() const = 0;
       
   147 
       
   148     /**
       
   149     * Get the order number that this plug-in should appear in its parent list.
       
   150     *
       
   151     * @return TUint order number.
       
   152     **/
       
   153     virtual TUint Order() const = 0;
       
   154 
       
   155     /**
       
   156     * Get UID of the parent.
       
   157     *
       
   158     * @return The parent UID.
       
   159     **/
       
   160     virtual TUid ParentUid() const = 0;
       
   161 
       
   162     /**
       
   163     * Set ECom Destructor ID Key.
       
   164     *
       
   165     * @param aDtorIdKey Uid returned by REComSession::CreateImplementationL()
       
   166     **/
       
   167     virtual void SetDtorIdKey( TUid aDtorIdKey ) = 0;
       
   168 
       
   169 
       
   170     /**
       
   171     * Initialization Step. This method is called before any plugin are executed.
       
   172     * This can be used to clean up any left over data from previous execution 
       
   173     * sessions. All plug-ins in execution plan will have a chance to clean 
       
   174     * up before any plug-ins are run.  This is a synchrouns method.
       
   175     *
       
   176     * @param aEngine - Reference to engine.
       
   177     * @param aSkipDependencyCheck - If ETrue, plug-in will be executed
       
   178     *   even if dependencies are not executed.
       
   179     * @param aCustomParams Custom parameters for plug-ins. 
       
   180     *   It can used to pass arbitrary data from application to the plug-ins.
       
   181     *   Owership is not transferred and plug-in must not delete
       
   182     *   this parameter. Ownership is not transferred since
       
   183     *   client does not always know the type of pointer.
       
   184     **/
       
   185     virtual void TestSessionBeginL( MDiagEngineCommon& aEngine,
       
   186                                     TBool aSkipDependencyCheck,
       
   187                                     TAny* aCustomParams ) = 0;
       
   188 
       
   189 
       
   190     /**
       
   191     * Cleanup Step. This method is called after all plug-ins in the 
       
   192     * execution plan is completed to clean up any left over data from 
       
   193     * current sesison. This can be used to clean up any data that
       
   194     * provides dependent service created for its dependencies.
       
   195     * This is a synchrouns method.
       
   196     *
       
   197     * @param aEngine - Reference to engine.
       
   198     * @param aSkipDependencyCheck - If ETrue, plug-in as executed
       
   199     *   even if dependencies are not executed.
       
   200     * @param aCustomParams Custom parameters for plug-ins. 
       
   201     *   It can used to pass arbitrary data from application to the plug-ins.
       
   202     *   Owership is not transferred and plug-in must not delete
       
   203     *   this parameter. Ownership is not transferred since
       
   204     *   client does not always know the type of pointer.
       
   205     **/
       
   206     virtual void TestSessionEndL( MDiagEngineCommon& aEngine,
       
   207                                   TBool aSkipDependencyCheck,
       
   208                                   TAny* aCustomParams ) = 0;
       
   209 
       
   210 
       
   211     /**
       
   212     * Reserved for future use/plugin's custom functionality.
       
   213     *
       
   214     * @param aUid Unique identifier of the operation.
       
   215     * @param aParam Custom parameter. 
       
   216     * @return TAny pointer. Custom data.
       
   217     *   It can used to pass arbitrary data from application to the plug-ins.
       
   218     *   Owership is not transferred and plug-in must not delete
       
   219     *   this parameter. Ownership is not transferred since
       
   220     *   client does not always know the type of pointer.
       
   221     **/
       
   222     virtual TAny* CustomOperationL( TUid aUid, TAny* aParam ) = 0;
       
   223         
       
   224     /**
       
   225     * Reserved for future use/plugin's custom functionality. 
       
   226     *
       
   227     * @param aParam Custom parameter.
       
   228     * @return TAny pointer. Custom data. 
       
   229     *   It can used to pass arbitrary data from application to the plug-ins.
       
   230     *   Owership is not transferred and plug-in must not delete
       
   231     *   this parameter. Ownership is not transferred since
       
   232     *   client does not always know the type of pointer.
       
   233     **/
       
   234     virtual TAny* GetCustomL( TUid aUid, TAny* aParam ) = 0;
       
   235     };
       
   236 
       
   237 #endif // DIAGPLUGIN_H
       
   238 
       
   239 // End of File
       
   240