idlehomescreen/sapiwrapper/cpswrapper/inc/cpswrapper.h
branchRCL_3
changeset 83 5456b4e8b3a8
equal deleted inserted replaced
82:5f0182e07bfb 83:5456b4e8b3a8
       
     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          * Callback method for updated widget notify.
       
    67          */
       
    68         virtual void NotifyWidgetUpdatedL() = 0;
       
    69         };
       
    70 
       
    71     /**
       
    72      *  Wrapper for cps liw service
       
    73      *
       
    74      *
       
    75      *  @code
       
    76      *
       
    77      *  @endcode
       
    78      *
       
    79      *  @lib cpswrapper.lib
       
    80      *  @since S60 v5.0
       
    81      */
       
    82     NONSHARABLE_CLASS( CCpsWrapper ) : public CBase
       
    83         {
       
    84     public:
       
    85         /**
       
    86          * Two-phased constructor.
       
    87          * @param aObserver Observer
       
    88          */
       
    89         IMPORT_C static CCpsWrapper* NewL( MCpsWrapperObserver& aObserver );
       
    90 
       
    91         /**
       
    92          * Two-phased constructor.
       
    93          * @param aObserver Observer
       
    94          */
       
    95         IMPORT_C static CCpsWrapper* NewLC( MCpsWrapperObserver& aObserver );
       
    96 
       
    97         /**
       
    98          * Destructor.
       
    99          */
       
   100         IMPORT_C ~CCpsWrapper();
       
   101 
       
   102     protected:
       
   103         /**
       
   104          * Constructor
       
   105          * @param aObserver Observer
       
   106          */
       
   107         CCpsWrapper( MCpsWrapperObserver& aObserver );
       
   108 
       
   109         /** 
       
   110          * Second phase constructor 
       
   111          */
       
   112         void ConstructL();
       
   113 
       
   114     public:
       
   115         /**
       
   116          * Gets templated publishers
       
   117          *
       
   118          * @return map of publisher infos. Ownership is transfered.
       
   119          */
       
   120         IMPORT_C CPublisherMap* GetTemplatedPublishersL();
       
   121         
       
   122         /**
       
   123 		 * Handles changed publisher. Deleted or added. 
       
   124 		 * 
       
   125 		 * @param aPublisher publisher
       
   126 		 * @return 
       
   127 		 */
       
   128         void HandleChangedPublisherL(const TDesC& aPublisher, 
       
   129                 const TDesC& aOperation);
       
   130 
       
   131     private:
       
   132         // new functions
       
   133 
       
   134         /**
       
   135          * Register for notification from publisher registry
       
   136          */
       
   137         void StartListeningPublisherRegistryL();
       
   138         
       
   139         /**
       
   140 		 * Get maps of WRT widget publishers info. 
       
   141 		 * 
       
   142 		 * @param aPublisherMap a map of publishers info.
       
   143 		 */
       
   144         void GetWRTWidgetsL(CPublisherMap& aPublisherMap);
       
   145 
       
   146         /**
       
   147 		 * Register an observer for request notification  
       
   148 		 * 
       
   149 		 * @param aPublisher  publisher name
       
   150 		 * @param aContentType content type
       
   151 		 * @param aContentId content id
       
   152 		 * @param aOperation operation (add,delete,update,execute)
       
   153 		 * @param aRegistry registry type (publisher/cp_data)
       
   154 		 */
       
   155         void RequestForNotificationL(
       
   156         		const TDesC& aPublisher, 
       
   157         		const TDesC& aContentType,
       
   158         		const TDesC& aContentId,
       
   159         		const TDesC8& aOperation,
       
   160         		const TDesC& aRegistry);
       
   161         
       
   162     private: // Data
       
   163         /**
       
   164          * Wrapper observer.
       
   165          * Not owned
       
   166          */
       
   167         MCpsWrapperObserver& iObserver;
       
   168 
       
   169         /**
       
   170          * SAPI service handler.
       
   171          * Owned.
       
   172          */
       
   173         CLiwServiceHandler* iServiceHandler;
       
   174 
       
   175         /**
       
   176          * CPS SAPI service.
       
   177          * Owned.
       
   178          */
       
   179         CLiwCriteriaItem* iCpsService;
       
   180 
       
   181         /**
       
   182          * Provides hsps services.
       
   183          * Owned.
       
   184          */
       
   185         MLiwInterface* iCpsInterface;
       
   186         
       
   187         /**
       
   188 	     * Registered cps observers.
       
   189 	     * Owned.
       
   190 	     */
       
   191         RPointerArray<CCpsObserver> iObservers;
       
   192         };
       
   193     
       
   194     }
       
   195 
       
   196 #endif // CPSWRAPPER_H
       
   197 // End of file