idlehomescreen/sapiwrapper/cpswrapper/inc/cpsobserver.h
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2005-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:  Defines an observer to CPS
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CPSOBSERVER_H
       
    19 #define CPSOBSERVER_H
       
    20 
       
    21  // Forward declarations
       
    22 class CLiwServiceHandler;
       
    23 class CLiwCriteriaItem;
       
    24 class MLiwInterface;
       
    25 
       
    26 namespace cpswrapper
       
    27     {
       
    28     /**
       
    29       * Content publishing service wrapper namespace
       
    30       */
       
    31     
       
    32     // Forward declarations
       
    33     class CCpsWrapper;
       
    34     
       
    35     /**
       
    36 	 *  Observer class for cps registry 
       
    37 	 *
       
    38 	 *  @code
       
    39 	 *
       
    40 	 *  @endcode
       
    41 	 *
       
    42 	 *  @lib cpswrapper.lib
       
    43 	 *  @since S60 v5.0
       
    44 	 */
       
    45     NONSHARABLE_CLASS( CCpsObserver ) : public CBase, public MLiwNotifyCallback
       
    46 		{
       
    47 		public: // Constructors and destructor
       
    48 			/**
       
    49 			 * Two-phased constructor.
       
    50 			 */
       
    51 			static CCpsObserver* NewLC( CCpsWrapper* aCpsWrapper);
       
    52 			
       
    53 			/**
       
    54 			 * Destructor.
       
    55 			 */
       
    56 			~CCpsObserver();
       
    57 	
       
    58 		public:  //from MLiwNotifyCallback
       
    59 			
       
    60 			/**
       
    61 			* Handles notifications caused by an asynchronous Execute*CmdL call
       
    62 			* or an event.
       
    63 			*
       
    64 			* @param aCmdId The service command associated to the event.
       
    65 			* @param aEventId Occured event, see LiwCommon.hrh.
       
    66 			* @param aEventParamList Event parameters, if any, as defined per
       
    67 			*        each event.
       
    68 			* @param aInParamList Input parameters, if any, given in the
       
    69 			*        related HandleCommmandL.
       
    70 			* @return Error code for the callback.
       
    71 			*/
       
    72 			TInt HandleNotifyL(
       
    73 				TInt aCmdId,
       
    74 				TInt aEventId,
       
    75 				CLiwGenericParamList& aEventParamList,
       
    76 				const CLiwGenericParamList& aInParamList);
       
    77 		
       
    78 		public:
       
    79 			
       
    80 			/**
       
    81 			* Registers to CPS for add, delete , update and execute notifications
       
    82 			* 
       
    83 			* @param aFilter - filter for input parameter list
       
    84 			* @param aRegistry - registry to register observer
       
    85 			*/
       
    86 			void RegisterL( CLiwDefaultMap* aFilter,  const TDesC& aRegistry  );
       
    87 			
       
    88 			/**
       
    89 			* Cancel all the registered notifications.
       
    90 			*/
       
    91 			void ReleaseL();
       
    92 	
       
    93 		private:
       
    94 			
       
    95 			/**
       
    96 			* Perform the second phase construction 
       
    97 			*/      
       
    98 			void ConstructL( );
       
    99 			
       
   100 			/**
       
   101 			* Constructor.
       
   102 			* 
       
   103 			* @param aCpsWrapper cps wrapper 
       
   104 			*/
       
   105 			CCpsObserver( CCpsWrapper* aCpsWrapper );
       
   106 			
       
   107 			/**
       
   108 			* Initialise Liw connection to Content publishing service.
       
   109 			*/
       
   110 			void InitLiwL();
       
   111 			
       
   112 			/**
       
   113 			* Closes Liw connection to Content publishing service.
       
   114 			*/
       
   115 			void ReleaseLiw();
       
   116 			
       
   117 		private: // data
       
   118 				
       
   119 			// Reference of MLiwInterface
       
   120 			// Owned
       
   121 			MLiwInterface* iInterface;
       
   122 			
       
   123 			// Reference of CLiwServiceHandler
       
   124 			// Owned
       
   125 			CLiwServiceHandler* iLiwHandler;	            
       
   126 					
       
   127 			// Reference of the CCpsWrapper
       
   128 			// Not owned
       
   129 			CCpsWrapper* iCpsWrapper;
       
   130 			
       
   131 			// Call back error code
       
   132 			TInt iError;
       
   133 		};
       
   134     }
       
   135 #endif /* CPSOBSERVER_H_ */