webengine/wrtharvester/inc/wrtharvester.h
changeset 10 a359256acfc6
parent 0 dd21522fd290
child 11 c8a366e56285
equal deleted inserted replaced
5:10e98eab6f85 10:a359256acfc6
    20 #define C_WRTCONTENTHARVESTER_H 
    20 #define C_WRTCONTENTHARVESTER_H 
    21 
    21 
    22 // INCLUDES
    22 // INCLUDES
    23 #include <apgcli.h> // RApaLsSession 
    23 #include <apgcli.h> // RApaLsSession 
    24 #include <contentharvesterplugin.h>
    24 #include <contentharvesterplugin.h>
    25 #include "widgetappdefs.rh"
    25 #include <widgetappdefs.rh>
    26 #include "wrtharvesterregistryaccess.h"
    26 #include "wrtharvesterregistryaccess.h"
    27 
    27 
    28 
    28 
    29 // FORWARD DECLARATIONS
    29 // FORWARD DECLARATIONS
    30 class CWrtHarvesterPSNotifier;
    30 class CWrtHarvesterPSNotifier;
    31 class CWrtHarvesterPublisherObserver;
    31 class CWrtHarvesterPublisherObserver;
    32 class MLiwInterface;
    32 class MLiwInterface;
    33 class CLiwGenericParamList;
    33 class CLiwGenericParamList;
       
    34 class CWrtInfo;
    34 
    35 
    35 // CONSTANTS
    36 // CONSTANTS
       
    37 
       
    38 enum TWidgetState
       
    39     {
       
    40     EActivatedState = 0,
       
    41     EResumeState
       
    42     };
       
    43 
       
    44 class TWrtState
       
    45     {
       
    46     public:
       
    47         /**
       
    48         * Constructor
       
    49         */
       
    50         inline TWrtState(TUid aUid, TWidgetState aState)
       
    51             {
       
    52             iUid = aUid;
       
    53             iState = aState;
       
    54             }
       
    55 
       
    56     public:
       
    57         TUid            iUid;
       
    58         TWidgetState    iState;
       
    59     };
    36 
    60 
    37 // CLASS DECLARATION
    61 // CLASS DECLARATION
    38 /**
    62 /**
    39  * 
       
    40  *
       
    41  *  @lib ??????.dll
       
    42  *  @since S60 S60 v3.1
       
    43  */
    63  */
    44 
       
    45 class CWrtHarvester: public CContentHarvesterPlugin
    64 class CWrtHarvester: public CContentHarvesterPlugin
    46 	{
    65 	{
       
    66 	struct SWidgetOperation
       
    67 	    {
       
    68 	    TWidgetOperations iOperation;
       
    69 	    TUid iUid;
       
    70 	    };
       
    71 	
    47 	public: // Constructors and destructor
    72 	public: // Constructors and destructor
    48 		/**
    73 		/**
    49 		 * Two-phased constructor.
    74 		 * Two-phased constructor.
    50 		 */
    75 		 */
    51 		static CWrtHarvester* NewL( MLiwInterface* aCPSInterface );
    76 		static CWrtHarvester* NewL( MLiwInterface* aCPSInterface );
    63 		void UpdateL();
    88 		void UpdateL();
    64 		
    89 		
    65 		/**
    90 		/**
    66     	* 
    91     	* 
    67     	*/
    92     	*/
    68 		void TryLaunchNextWidgetL();
    93 		void TryLaunchNextOperationL();
    69 
    94 
    70         /**
    95         /**
    71 		* @param aContentId
    96 		* @param aContentId
    72 		* @param aTrigger
    97 		* @param aTrigger
    73 		*/
    98 		*/
    74 		void HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger );
    99 		void HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger );
       
   100        
       
   101         /**
       
   102 		*Clears the Event Queue 
       
   103 		*/
       
   104 		
       
   105 		void ClearAllOperations();
       
   106 		
       
   107 		/**
       
   108 		* Queues widget operation
       
   109 		* @param aOperation Operation to be queued
       
   110     	* @param aUid Uid of the widget
       
   111     	*/
       
   112 		void QueueOperationL(  TWidgetOperations aOperation, TUid aUid );	
       
   113 		
       
   114 		void DialogShown(){ iDialogShown = EFalse; }	
    75 		
   115 		
    76 	private:
   116 	private:
    77         
   117         
    78     	/**
   118     	/**
    79     	* Perform the second phase construction 
   119     	* Perform the second phase construction 
    90     	* 
   130     	* 
    91     	*/
   131     	*/
    92 		void UpdatePublishersL();
   132 		void UpdatePublishersL();
    93 		
   133 		
    94 		/**
   134 		/**
       
   135         * 
       
   136         */
       
   137 		void RemoveObsoletePublishersL();
       
   138 		
       
   139 		/**
       
   140         * 
       
   141         */
       
   142 		void RegisteredPublishersL( RPointerArray<HBufC>& publishers );
       
   143 		
       
   144 		/**
    95 		* 
   145 		* 
    96     	* @param aPublisherId
   146     	* @param aWrtInfo
    97     	* @param aContentId
       
    98     	* @param aContentType
       
    99     	* @param aResultType
       
   100     	* @return TInt
   147     	* @return TInt
   101     	*/
   148     	*/
   102 		TInt RegisterPublisherL( const TDesC& aPublisherId, const TDesC& aContentId,
   149 		TInt RegisterPublisherL( CWrtInfo& aWrtInfo );
   103 		        const TDesC& aContentType, const TDesC8& aResultType );
   150 		
   104 		
   151 		/**
   105 		/**
   152     	* 
   106     	* 
   153     	* @param aBundleId
   107     	* @param aPublisherId
   154     	*/
   108     	* @param aContentId
   155 		void RemovePublisherAndObserverL( const TDesC& aBundleId );
   109     	* @param aContentType
   156 		
   110     	*/
   157 		/**
   111 		void RemovePublisherL( const TDesC& aPublisherId, const TDesC& aContentId,
   158 		* 
   112 		        const TDesC& aContentType );
   159 		* @param aBundleId
   113 		
   160 		*/
   114 		/**
   161 		void RemoveObserver(const TDesC& aBundleId);
   115 		* Starts WRT widget
   162 		
   116     	* @param aUid Uid of the widget
   163 		/**
   117     	*/
   164     	* 
   118 		void StartWidgetL( TUid aUid );
   165     	* @param aWrtInfo
   119 		
   166     	*/
   120 		/**
   167 		void RequestForNotificationL( CWrtInfo& aWrtInfo );
   121     	* 
   168 		
   122     	* @param aPublisherId
   169 		/**
   123     	* @param aContentId
   170         * 
   124     	* @param aContentType
   171         */
   125     	*/
   172 		TUid WidgetUid( TPtrC aBundleId );
   126 		void RequestForNotificationL( const TDesC& aPublisherId, const TDesC& aContentId,
       
   127 		        const TDesC& aContentType );
       
   128 		
   173 		
   129 		/**
   174 		/**
   130     	* 
   175     	* 
   131     	* @param aInParamList
   176     	* @param aInParamList
   132     	* @return TInt
   177     	* @return TInt
   135 		
   180 		
   136 		
   181 		
   137 		/**
   182 		/**
   138 		 * 
   183 		 * 
   139 		 */
   184 		 */
   140 		void LaunchWidgetL( TWidgetOperations aOperation, TUid aUid );
   185 		void LaunchWidgetOperationL( SWidgetOperation aOperation );
   141 
   186 		
       
   187 		/**
       
   188 		 * Check If widget Ui Process Exists
       
   189 		 */		
       
   190 		TBool CheckTaskExistsL();
       
   191 				
       
   192 		/**
       
   193 		 * Queues widget resume operation
       
   194 		 * @param aUid Uid of the widget
       
   195 		 * @return void
       
   196 		 */
       
   197 		void QueueResumeL( TUid& aUid );
       
   198 		
       
   199 		/**
       
   200 		 * Processes online/offline event
       
   201 		 * @param aUid Uid of the widget
       
   202 		 * @param aOperation Online/Offline operation to be queued
       
   203 		 * @return void
       
   204 		 */
       
   205 		 void ProcessNetworkModeL( TUid& aUid, TWidgetOperations aOperation );
       
   206 		       
       
   207 		/**
       
   208 		 * Finds widget in the widget state array which has
       
   209 		 * the same uid and state as specified in the params
       
   210 		 * @param aUid Uid of the widget to be found
       
   211 		 * @param aState Widget state
       
   212 		 * @returns the array index of the widget found
       
   213 		 */
       
   214 		TInt FindWidget( TUid& aUid, TWidgetState aState );
       
   215 		
       
   216 		/**
       
   217 		 * Finds widget in the widget state array which has
       
   218 		 * the same uid as specified in the params
       
   219 		 * @param aUid Uid of the widget to be found
       
   220 		 * @returns the array index of the widget found
       
   221 		 */
       
   222 		TInt FindWidget( TUid& aUid );
       
   223 		
       
   224 		/**
       
   225 		 * Checks if the widget has network access
       
   226 		 * @param aUid Uid of the widget to be checked
       
   227 		 * @returns ETrue if widget has network access,
       
   228 		 * else returns EFalse
       
   229 		 */
       
   230 		TBool CheckNetworkAccessL( TUid& aUid );
       
   231 		
       
   232 		/**
       
   233 		 * Prompt for Allow Platform Access
       
   234 		 * @param aUid Uid of the widget
       
   235 		 * @return void
       
   236 		 */
       
   237 		void AllowPlatformAccessL( TUid& aUid );
   142 
   238 
   143 	private: // data
   239 	private: // data
   144        	
   240        	
   145        	/**
   241        	/**
   146         * Instance of CPS interface used for update with CPS.
   242         * Instance of CPS interface used for update with CPS.
   163          * Publish & Subscribe listener
   259          * Publish & Subscribe listener
   164          * own
   260          * own
   165          */
   261          */
   166         CWrtHarvesterPSNotifier* iWidgetMMCListener;
   262         CWrtHarvesterPSNotifier* iWidgetMMCListener;
   167         
   263         
   168 		/**
   264         /**
   169     	* 
   265          * Publish & Subscribe listener
   170     	*/
   266          * own
   171         RWrtArray< CWrtHarvesterPublisherObserver > iObservers;
   267          */        
       
   268         CWrtHarvesterPSNotifier* iWidgetUsbListener;
       
   269         
       
   270 		/**
       
   271     	* 
       
   272     	*/
       
   273         RWrtArray<CWrtHarvesterPublisherObserver> iObservers;
       
   274         
       
   275         /**
       
   276         * 
       
   277         */
       
   278         RWrtArray<CWrtInfo> iWidgetInfo;
       
   279         
       
   280         /**
       
   281         * 
       
   282         */
       
   283         RWrtArray<TWrtState> iWidgetStateArray;
   172 
   284 
   173 		/**
   285 		/**
   174     	* 
   286     	* 
   175     	*/
   287     	*/
   176         WrtHarvesterRegistryAccess iRegistryAccess;
   288         WrtHarvesterRegistryAccess iRegistryAccess;
   177         
   289         
   178 		/**
   290 		/**
   179     	* 
   291     	* 
   180     	*/
   292     	*/
   181         RArray<TUid> iWidgetUids;
   293         RArray<SWidgetOperation> iWidgetOperations;
   182         
   294         
   183         /**
   295         /**
   184          * 
   296          * 
   185          */
   297          */
   186         RApaLsSession iApaSession;
   298         RApaLsSession iApaSession;
       
   299         
       
   300         /**
       
   301          * Resource offset
       
   302          */
       
   303         TInt iResourceFileOffset;
       
   304 		
       
   305         /**
       
   306          * 
       
   307          */        
       
   308         TInt          iHSCount;		
       
   309         /**
       
   310          *
       
   311          *
       
   312          */
       
   313          TBool        iDialogShown;
   187     };
   314     };
   188 
   315 
   189 #endif // C_WRTCONTENTHARVESTER_H 
   316 #endif // C_WRTCONTENTHARVESTER_H