ncdengine/engine/inc/catalogsengineimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 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:   Declaration of CCatalogsEngineImpl
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CATALOGS_ENGINE_IMPL_H
       
    20 #define C_CATALOGS_ENGINE_IMPL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 #include "catalogsengine.h"
       
    25 #include "catalogsclientserverclientsession.h"
       
    26 #include "catalogsbaseimpl.h"
       
    27 
       
    28 // Forward declaration                        
       
    29 class CNcdProviderProxy;
       
    30 class MCatalogsEngineObserver;
       
    31 class CCatalogsProviderCreator;
       
    32 class CCatalogsShutdownObserver;
       
    33 class CCatalogsUpdateObserver;
       
    34 class CCatalogsConnectionObserver;
       
    35 
       
    36 /**
       
    37  *  An interface providing the main handle to Catalogs engine
       
    38  *
       
    39  *  This class offers functionality for provider creation
       
    40  *
       
    41  *  @lib ncdproxy_20019119.dll
       
    42  *  @since S60 v3.2
       
    43  */
       
    44 
       
    45 // Cannot use CCatalogsBase<> base class because class declaration must match CCatalogsEngine
       
    46 // ECom interface.
       
    47 class CCatalogsEngineImpl : public CCatalogsEngine
       
    48     {
       
    49 
       
    50 public:
       
    51 
       
    52     /**
       
    53      * Instantiates the catalogs engine.
       
    54      *
       
    55      * @param aObserver Observer for engine callbacks.
       
    56      * @return CCatalogsEngineImpl* The instantiated object.
       
    57      */
       
    58     static CCatalogsEngineImpl* NewL( TAny* aInitParams );
       
    59 
       
    60 
       
    61     /**
       
    62      * Destructor
       
    63      */
       
    64     virtual ~CCatalogsEngineImpl();
       
    65 
       
    66   
       
    67     /**
       
    68      * Connect to the Catalogs engine
       
    69      * 
       
    70      * @since S60 v3.2
       
    71      * @return System wide error code.
       
    72      */
       
    73     TInt Connect( TUid aClientUid );
       
    74 
       
    75     /**
       
    76      * Close connection to the Catalogs engine
       
    77      *
       
    78      * @since S60 v3.2
       
    79      */
       
    80     void Close();
       
    81 
       
    82     /**
       
    83      * Requests a provider from the Catalogs engine. Spesific provider types are
       
    84      * identified by UIDs.
       
    85      *
       
    86      * @since S60 v3.2
       
    87      * @param aUid Type of the provider that should be created.
       
    88      *             (integer containing a hexadecimal number)
       
    89      * @param aStatus 
       
    90      * @param aProviderOptions Provider spesific options
       
    91      * @return Pointer to the created provider. The pointer should be cast by
       
    92      *         the user of the interface to match the requested provider type.
       
    93      * @exception System wide error code.
       
    94      * 
       
    95      */    
       
    96     void CreateProviderL( 
       
    97         TInt aUid, 
       
    98         MCatalogsBase*& aProvider, 
       
    99         TRequestStatus& aStatus, 
       
   100         TUint32 aProviderOptions );
       
   101 
       
   102     /**
       
   103      * Cancels provider creation.
       
   104      *
       
   105      * @note Completes the ongoing provider creation immediately
       
   106      *       with KErrCancel.
       
   107      *
       
   108      * @since S60 v3.2
       
   109      */
       
   110     void CancelProviderCreation();
       
   111 
       
   112     /**
       
   113      * Starts engine maintenance. All clients with open sessions to the engine will
       
   114      * receive a callback requesting closing of engine sessions. Also, further
       
   115      * connections are refused until EndMaintenanceL() is called.
       
   116      *
       
   117      * A state change callback is received to engine observer when the server is ready for
       
   118      * maintenance (no open connections).
       
   119      *
       
   120      * @note After calling StartMaintenanceL(), the client may itself receive a
       
   121      *  CatalogsEngineShutdown() callback to its observer, in case it has open sessions
       
   122      *  to the engine.
       
   123      *
       
   124      * @exception KErrAccessDenied Client is not authorized to start maintenance
       
   125      *  on engine.
       
   126      * @exception Leave System wide error code.
       
   127      */
       
   128 //    virtual void StartMaintenanceL();
       
   129 
       
   130 
       
   131     /**
       
   132      * Ends engine maintenance. Connections to engine are allowed.
       
   133      *
       
   134      * @exception KErrAccessDenied Client is not authorized to end maintenance
       
   135      *  on engine.
       
   136      * @exception KErrNotFound Client has not started maintenance.
       
   137      * @exception Leave System wide error code.
       
   138      */
       
   139 //    virtual void EndMaintenanceL();
       
   140 
       
   141 /*
       
   142 public: // from CActive
       
   143 
       
   144     void RunL();
       
   145     void DoCancel();
       
   146 */
       
   147 
       
   148 public: // from MCatalogsBase
       
   149 
       
   150     TInt AddRef() const;
       
   151     TInt Release() const;
       
   152     
       
   153 protected: // from MCatalogsBase
       
   154     const TAny* QueryInterfaceL( TInt aInterfaceType ) const;
       
   155 
       
   156 private:
       
   157                                           
       
   158     /**
       
   159      * Constructor, private
       
   160      * @param aObserver Observer for engine callbacks.
       
   161      */
       
   162     CCatalogsEngineImpl( MCatalogsEngineObserver& aObserver );
       
   163 
       
   164     /**
       
   165      * 2nd phase constructor, private
       
   166      */
       
   167     void ConstructL();
       
   168 
       
   169 
       
   170 private: // data
       
   171 
       
   172     mutable TInt iRefCount;
       
   173 
       
   174     /**
       
   175      * Uid of the client.
       
   176      */
       
   177     TUid iClientUid;
       
   178 
       
   179     /**
       
   180      * Handle to the Catalogs engine.
       
   181      */
       
   182     RCatalogsClientServerClientSession iCatalogsEngine;
       
   183 
       
   184     /**
       
   185      * Engine observer. 
       
   186      * Not own.
       
   187      */
       
   188     MCatalogsEngineObserver* iObserver;
       
   189 
       
   190     /**
       
   191      * Provider creator active object. Pwned.
       
   192      */
       
   193     CCatalogsProviderCreator* iProviderCreator;
       
   194     
       
   195     /**
       
   196      * Catalogs engine mutex.
       
   197      */
       
   198     RMutex iCatalogsMutex;
       
   199 
       
   200     /** Catalogs maintenance lock observer. */
       
   201     CCatalogsShutdownObserver* iShutdownObserver;
       
   202     
       
   203     /** Catalogs OTA update observer */
       
   204     CCatalogsUpdateObserver* iUpdateObserver;
       
   205 
       
   206     CCatalogsConnectionObserver* iConnectionObserver;
       
   207     };
       
   208 
       
   209 #endif // C_CATALOGS_ENGINE_IMPL_H