appsupport_plat/context_source_plugin_api/inc/CFContextSourcePlugIn.h
changeset 0 2e3d3ce01487
child 21 c4cbaa4fb734
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2006-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:  CCFContextSourcePlugIn class declaration
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CFCONTEXTSOURCEPLUGIN_H
       
    21 #define C_CFCONTEXTSOURCEPLUGIN_H
       
    22 
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <CFContextSourcePlugInConst.hrh>
       
    26 
       
    27 class MCFContextInterface;
       
    28 class MCFContextSourceSetting;
       
    29 class TCFContextObject;
       
    30 class TContextSourceInitParams;
       
    31 class CCFContextSubscription;
       
    32 class CCFContextSourceSettingArray;
       
    33 
       
    34 /**
       
    35 * Context source plug-in construction parameters.
       
    36 */
       
    37 class TContextSourceInitParams
       
    38     {
       
    39     public:
       
    40     
       
    41         // Default constructor
       
    42         inline TContextSourceInitParams( MCFContextInterface& aCF ):
       
    43             iCF( aCF )
       
    44             {
       
    45             }
       
    46     
       
    47     public:
       
    48     
       
    49         // Context manager
       
    50         MCFContextInterface& iCF;
       
    51     };
       
    52     
       
    53 /**
       
    54 * Context Source plug-in interface UID.
       
    55 * Every Context Source plug-in must implement this interface.
       
    56 */
       
    57 const TUid KContextSourcePlugInInterface = {KContextSourcePluginInterfaceUid};
       
    58     
       
    59 /**
       
    60  *  Context source plug-in API.
       
    61  *
       
    62  *  All context source plug-ins must define this interface
       
    63  *  to be able to publish contexts and subscribe contexts.
       
    64  *  It must be noticed that time consuming actions must not
       
    65  *  be done in construction phase. Only context definitions
       
    66  *  are allowed. All other initialization is done when InitializeL
       
    67  *  is called by Context Framework.
       
    68  *  Context source plug-in will be initialized in following order:
       
    69  *  - HandleSettingL
       
    70  *  - DefineContextsL
       
    71  *  - InitializeL
       
    72  *
       
    73  *  @lib CFContextSourceManager.lib
       
    74  *  @since S60 5.0
       
    75  */
       
    76 class CCFContextSourcePlugIn : public CBase
       
    77     {
       
    78     public:
       
    79 
       
    80         /**
       
    81         * Two phased constructors
       
    82         * 
       
    83         * @since S60 5.0
       
    84         * @param aImplementationUid Implementation to create.
       
    85         * @param aParams Construction parameters.
       
    86         * @return CCFContextSourcePlugIn*
       
    87         */
       
    88         IMPORT_C static CCFContextSourcePlugIn* NewL(
       
    89             const TUid& aImplementationUid,
       
    90             TContextSourceInitParams* aParams );
       
    91         IMPORT_C static CCFContextSourcePlugIn* NewLC(
       
    92             const TUid& aImplementationUid,
       
    93             TContextSourceInitParams* aParams );
       
    94 
       
    95         // Destructor
       
    96         IMPORT_C virtual ~CCFContextSourcePlugIn();
       
    97         
       
    98     public: // New methods
       
    99     
       
   100         /**
       
   101         * Returns an extension interface.
       
   102         * The extension interface is mapped with the extension UID.
       
   103         *
       
   104         * The default implemementation returns NULL.
       
   105         *
       
   106         * @since S60 5.0
       
   107         * @param aExtensionUid: The identifier of the extension.
       
   108         * @return Pointer to the extension.
       
   109         */
       
   110         IMPORT_C virtual TAny* Extension( const TUid& aExtensionUid ) const;
       
   111 
       
   112     public: // Implementation specific
       
   113     
       
   114         /**
       
   115         * All contexts by this source must be defined in this stage.
       
   116         * Contexts can be defined though MCF interface.
       
   117         * Definition must include:
       
   118         * - Context source
       
   119         * - Context type
       
   120         * - Security policy
       
   121         * Called after settings are handled.
       
   122         *
       
   123         * @since S60 5.0
       
   124         * @param None
       
   125         * @return None
       
   126         */
       
   127         virtual void DefineContextsL() = 0;
       
   128     
       
   129         /**
       
   130         * Handles settings.
       
   131         * All the setting blocks defined with the plug-in name
       
   132         * in the XML settings file will be given in an array.
       
   133         * Ownership of aSettingList is transferred to the plug-in.
       
   134         *
       
   135         * @since S60 5.0
       
   136         * @param aSettingList List of setting blocks defined
       
   137         *  in the settings file.
       
   138         * @return None
       
   139         */
       
   140         virtual void HandleSettingL(
       
   141             CCFContextSourceSettingArray* aSettingList ) = 0;
       
   142             
       
   143         /**
       
   144         * Plug-in is allowed to initialize.
       
   145         * E.g. start listening some events or triggers.
       
   146         *
       
   147         * @since S60 5.0
       
   148         * @param None
       
   149         * @return None
       
   150         */
       
   151         virtual void InitializeL() = 0;
       
   152             
       
   153     protected:
       
   154 
       
   155         IMPORT_C CCFContextSourcePlugIn( TContextSourceInitParams* aParams );
       
   156         
       
   157     protected:
       
   158     
       
   159         /** Own: Descructor key for Ecom */
       
   160         TUid iDtorKey;
       
   161 
       
   162         /** Ref: CF interface */
       
   163         MCFContextInterface& iCF;
       
   164 
       
   165         /** Reserved */
       
   166         TAny* iReserved1;
       
   167         TAny* iReserved2;
       
   168         TAny* iReserved3;
       
   169     };
       
   170     
       
   171 #endif