idlehomescreen/sapiwrapper/cpswrapper/inc/cpswrapper.h
changeset 0 f72a12da539e
child 1 5315654608de
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2  * Copyright (c) 2008 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:  Encapsulates hsps liw service
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef CPSWRAPPER_H
       
    19 #define CPSWRAPPER_H
       
    20 
       
    21 // System includes
       
    22 #include <e32base.h>
       
    23 #include <LiwCommon.h>      // for MLiwNotifyCallback
       
    24 
       
    25 // Forward declarations
       
    26 class CLiwServiceHandler;
       
    27 class CLiwCriteriaItem;
       
    28 class MLiwInterface;
       
    29 
       
    30 namespace cpswrapper
       
    31     {
       
    32     /**
       
    33      * Content publishing service wrapper namespace
       
    34      */
       
    35 
       
    36     // Forward declarations
       
    37     class CPublisherMap;
       
    38     class CCpsObserver;
       
    39    
       
    40     /**
       
    41      *  Observer class for cpswrapper
       
    42      *
       
    43      *  @code
       
    44      *
       
    45      *  @endcode
       
    46      *
       
    47      *  @lib cpswrapper.lib
       
    48      *  @since S60 v5.0
       
    49      */
       
    50     class MCpsWrapperObserver
       
    51         {
       
    52     public:
       
    53         /**
       
    54          * Callback methot for unregistered widget notify.
       
    55          *
       
    56          * @param aPublisher a Publisher
       
    57          */
       
    58         virtual void NotifyWidgetUnregisteredL(const TDesC& aPublisher) = 0;
       
    59         
       
    60         /**
       
    61          * Callback methot for registered widget notify.
       
    62          */
       
    63         virtual void NotifyWidgetRegisteredL() = 0;
       
    64         };
       
    65 
       
    66     /**
       
    67      *  Wrapper for cps liw service
       
    68      *
       
    69      *
       
    70      *  @code
       
    71      *
       
    72      *  @endcode
       
    73      *
       
    74      *  @lib cpswrapper.lib
       
    75      *  @since S60 v5.0
       
    76      */
       
    77     NONSHARABLE_CLASS( CCpsWrapper ) : public CBase
       
    78         {
       
    79     public:
       
    80         /**
       
    81          * Two-phased constructor.
       
    82          * @param aObserver Observer
       
    83          */
       
    84         IMPORT_C static CCpsWrapper* NewL( MCpsWrapperObserver& aObserver );
       
    85 
       
    86         /**
       
    87          * Two-phased constructor.
       
    88          * @param aObserver Observer
       
    89          */
       
    90         IMPORT_C static CCpsWrapper* NewLC( MCpsWrapperObserver& aObserver );
       
    91 
       
    92         /**
       
    93          * Destructor.
       
    94          */
       
    95         IMPORT_C ~CCpsWrapper();
       
    96 
       
    97     protected:
       
    98         /**
       
    99          * Constructor
       
   100          * @param aObserver Observer
       
   101          */
       
   102         CCpsWrapper( MCpsWrapperObserver& aObserver );
       
   103 
       
   104         /** 
       
   105          * Second phase constructor 
       
   106          */
       
   107         void ConstructL();
       
   108 
       
   109     public:
       
   110         /**
       
   111          * Gets templated publishers
       
   112          *
       
   113          * @return map of publisher infos. Ownership is transfered.
       
   114          */
       
   115         IMPORT_C CPublisherMap* GetTemplatedPublishersL();
       
   116         
       
   117         /**
       
   118 		 * Handles changed publisher. Deleted or added. 
       
   119 		 * 
       
   120 		 * @param aPublisher publisher
       
   121 		 * @return 
       
   122 		 */
       
   123         void HandleChangedPublisherL(const TDesC& aPublisher, 
       
   124                 const TDesC& aOperation);
       
   125 
       
   126     private:
       
   127         // new functions
       
   128 
       
   129         /**
       
   130          * Register for notification from publisher registry
       
   131          */
       
   132         void StartListeningPublisherRegistryL();
       
   133         
       
   134         /**
       
   135 		 * Get maps of WRT widget publishers info. 
       
   136 		 * 
       
   137 		 * @param aPublisherMap a map of publishers info.
       
   138 		 */
       
   139         void GetWRTWidgetsL(CPublisherMap& aPublisherMap);
       
   140 
       
   141         /**
       
   142 		 * Register an observer for request notification  
       
   143 		 * 
       
   144 		 * @param aPublisher  publisher name
       
   145 		 * @param aContentType content type
       
   146 		 * @param aContentId content id
       
   147 		 * @param aOperation operation (add,delete,update,execute)
       
   148 		 * @param aRegistry registry type (publisher/cp_data)
       
   149 		 */
       
   150         void RequestForNotificationL(
       
   151         		const TDesC& aPublisher, 
       
   152         		const TDesC& aContentType,
       
   153         		const TDesC& aContentId,
       
   154         		const TDesC8& aOperation,
       
   155         		const TDesC& aRegistry);
       
   156         
       
   157     private: // Data
       
   158         /**
       
   159          * Wrapper observer.
       
   160          * Not owned
       
   161          */
       
   162         MCpsWrapperObserver& iObserver;
       
   163 
       
   164         /**
       
   165          * SAPI service handler.
       
   166          * Owned.
       
   167          */
       
   168         CLiwServiceHandler* iServiceHandler;
       
   169 
       
   170         /**
       
   171          * CPS SAPI service.
       
   172          * Owned.
       
   173          */
       
   174         CLiwCriteriaItem* iCpsService;
       
   175 
       
   176         /**
       
   177          * Provides hsps services.
       
   178          * Owned.
       
   179          */
       
   180         MLiwInterface* iCpsInterface;
       
   181         
       
   182         /**
       
   183 	     * Registered cps observers.
       
   184 	     * Owned.
       
   185 	     */
       
   186         RPointerArray<CCpsObserver> iObservers;
       
   187         };
       
   188     
       
   189     }
       
   190 
       
   191 #endif // CPSWRAPPER_H
       
   192 // End of file