idlefw/plugins/sapidataplugin/inc/sapidata.h
changeset 0 79c6a41cd166
child 1 844b978f8d5e
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     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:  Plug-in main class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SAPIDATA_H
       
    20 #define SAPIDATA_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 #include <LiwCommon.h> 
       
    24 #include <AknsItemID.h>
       
    25 #include <aieventhandlerextension.h>
       
    26 #include "sapidatapluginconst.h"
       
    27 #include "aicontentpublisher.h"
       
    28 
       
    29 class MLiwInterface;
       
    30 class CLiwServiceHandler;
       
    31 class CSapiDataObserver;
       
    32 class CSapiDataPlugin;
       
    33 
       
    34 
       
    35 class CContentItem :  public CBase
       
    36 	{
       
    37 	public :
       
    38 
       
    39 	/**
       
    40 	* Part of the two phased constuction
       
    41 	*
       
    42 	* @param none
       
    43 	* @return none
       
    44 	*/
       
    45 	static CContentItem* NewL();
       
    46 
       
    47 	
       
    48 	/*
       
    49 	* Destructor  
       
    50 	*/
       
    51 	~CContentItem();
       
    52 
       
    53 	private :
       
    54 		
       
    55 	/* 
       
    56 	* Constructor  
       
    57 	*/
       
    58 		CContentItem();   
       
    59 	
       
    60 	/**
       
    61 	* Part of the two phased construction
       
    62 	*
       
    63 	* @param none
       
    64 	* @return void
       
    65 	*/
       
    66 	void ConstructL();
       
    67 
       
    68 	public :
       
    69 
       
    70     TInt iId;
       
    71 	/* item id */
       
    72 	HBufC* iName;
       
    73 	/* type (image/text) */
       
    74     HBufC* iType;
       
    75     
       
    76 	HBufC* iContentType;
       
    77 	};
       
    78 
       
    79 /**
       
    80  *  @ingroup group_sapidataplugin
       
    81  *
       
    82  *  Sapi data
       
    83  *
       
    84  *  @since S60 v3.2
       
    85  */
       
    86 class CSapiData : public CBase
       
    87    {
       
    88    public:
       
    89  
       
    90     /**
       
    91     * Part of the two phased construction
       
    92     *
       
    93     * @param aPlugin refrence of the plugin
       
    94     * @return none
       
    95     */
       
    96     static CSapiData* NewL(CSapiDataPlugin* aPlugin);
       
    97     
       
    98     /**
       
    99     * Destructor
       
   100     *
       
   101     * @param none
       
   102     * @return none
       
   103     */
       
   104     ~CSapiData();
       
   105     
       
   106    private :
       
   107 
       
   108 
       
   109     /**
       
   110     * Constructor
       
   111     *
       
   112     * @param none
       
   113     * @return none
       
   114     */
       
   115     CSapiData();
       
   116    
       
   117     
       
   118     /**
       
   119     * Part of the two phased construction
       
   120     *
       
   121     * @param aPlugin reference of the plugin
       
   122     * @return void
       
   123     */
       
   124     void ConstructL(CSapiDataPlugin* aPlugin);
       
   125    
       
   126     /**
       
   127     * Change the publisher status
       
   128     *
       
   129     * @param aStatus new status of the publisher
       
   130     * @return void
       
   131     */
       
   132     void ChangePublisherStatusL(const TDesC& aStatus);
       
   133     
       
   134     /**
       
   135     * Gets the menu item from the publisher
       
   136     *
       
   137     * @param none
       
   138     * @return void
       
   139     */
       
   140     void GetMenuItemsL();
       
   141     
       
   142    public :
       
   143     
       
   144     /**
       
   145     * Configures the subscriber and data to subscribe.
       
   146     *  
       
   147     * @param aConfigurations  Information about the subscriber 
       
   148     *  and the data to subscribe.
       
   149     * @return void
       
   150     */
       
   151     void ConfigureL(RAiSettingsItemArray& aConfigurations);
       
   152     
       
   153     void SetContentIdL(const TDesC8& aId);
       
   154     
       
   155     /**
       
   156 	* Execute the command to get the data from CPS
       
   157 	*
       
   158 	* @param aRegistry type of registry (publisher/cp_data) 
       
   159 	* @param aInFilter input filter for the command
       
   160 	* @param outParamList output data map 
       
   161 	* @return void 
       
   162 	*/
       
   163     void ExecuteCommandL(const TDesC& aRegistry ,
       
   164     		CLiwDefaultMap* aInFilter, CLiwGenericParamList* outParamList  );
       
   165    
       
   166     /**
       
   167 	* Checks Can Update for this publisher 
       
   168 	* 
       
   169 	* @param aPublisher  publisher.
       
   170     * @param aContentType  content type.
       
   171     * @param aContentId content Id.
       
   172     * @return bool
       
   173 	*/
       
   174     TBool CanUpdate( TDesC& aPublisher, TDesC& aContentType, TDesC& aContentId );
       
   175     
       
   176     /**
       
   177    	* Removes all the data from the widget which matches to 
       
   178    	* this publisher, contentype, contentid values
       
   179    	*
       
   180     * @param aObserver to publish data
       
   181     * @param aContentType content type 
       
   182     * @return void
       
   183    	*/
       
   184     void RemoveL( MAiContentObserver* aObserver,  TDesC& aContentType );
       
   185    
       
   186     /**
       
   187 	* Checks is this menu item is supported by the publisher
       
   188 	* 
       
   189 	* @param aMenuItem  menu item name.
       
   190 	* @return  boolean (ETrue/EFalse) 
       
   191 	*/
       
   192     TBool HasMenuItem(const TDesC& aMenuItem );
       
   193     
       
   194     /**
       
   195     * Publish the data to widget.
       
   196     *   
       
   197     * @param aObserver to publish data
       
   198     * @param aContentType content type
       
   199     * @return void
       
   200     */
       
   201     void PublishL( MAiContentObserver* aObserver, const TDesC& aContentType );
       
   202     
       
   203     /**
       
   204     * Publish the updated data to widget.
       
   205     *   
       
   206     * @param aObserver to publish data
       
   207     * @param aDataMap data map with updated data
       
   208     * @return void
       
   209     */
       
   210     void PublishDataL(MAiContentObserver* aObserver, CLiwDefaultMap* aDataMap );
       
   211     
       
   212     /**
       
   213     * Tigger for execution of a action for a specific content id.
       
   214     * 
       
   215     * @param aObjectId object Id.
       
   216     * @param aTrigger name of the trigger.
       
   217     * @return void
       
   218     */
       
   219     void ExecuteActionL(const TDesC& aObjectId, const TDesC& aTrigger);
       
   220      
       
   221     /**
       
   222     * Register to publisher registry for all (update) action
       
   223     * 
       
   224     * @param none
       
   225     * @return void
       
   226     */
       
   227     void RegisterPublisherObserverL();
       
   228     
       
   229     /**
       
   230     * Register to content registry for all (add/delete/update) action
       
   231     * 
       
   232     * @param none
       
   233     * @return void
       
   234     */
       
   235     void RegisterContentObserverL();
       
   236      
       
   237     /**
       
   238     * Called by the observer to refresh the changed content
       
   239     *   
       
   240     * @param aPublisher  publisher.
       
   241     * @param aContentType  content type.
       
   242     * @param aContentId content Id.
       
   243     * @param aOperation operation (add/delete/update/execute).
       
   244     * @return void
       
   245     */
       
   246     void RefreshL( TDesC& aPublisher, TDesC& aContentType, 
       
   247             TDesC& aContentId, TDesC& aOperation );
       
   248      
       
   249     /**
       
   250     * Createts the filter map and push it in the stack
       
   251     * 
       
   252     * @return filter map
       
   253     */
       
   254     CLiwDefaultMap* CreateFilterLC();
       
   255     
       
   256     /**
       
   257     * Createts the filter map and push it in the stack
       
   258     * 
       
   259     * @param aConType content type
       
   260     * @return filter map
       
   261     */
       
   262     CLiwDefaultMap* CreateFilterLC(const TDesC& aConType);
       
   263     
       
   264     /**
       
   265     * Createts the filter map and push it in the stack
       
   266     * 
       
   267     * @param aConType content type
       
   268     * @param aContentId cotent Id
       
   269     * @return filter map
       
   270     */
       
   271     CLiwDefaultMap* CreateFilterLC(const TDesC& aContentType,
       
   272     		const TDesC& aContentId);
       
   273     		
       
   274     /**
       
   275     * Is the pugin is active to publish the data.
       
   276     * 
       
   277     * @param None
       
   278     * @return boolean (ETrue/EFalse).
       
   279     */
       
   280     TBool IsPluginActive();
       
   281      
       
   282     /**
       
   283     * Resume the publisher
       
   284     * 
       
   285     * @param None
       
   286     * @return void
       
   287     */
       
   288     void ResumeL();
       
   289     
       
   290     /**
       
   291 	* Suspend the publisher
       
   292 	* 
       
   293 	* @param None
       
   294 	* @return void
       
   295 	*/
       
   296     void SuspendL();
       
   297     
       
   298     /**
       
   299 	* Activate the publisher
       
   300 	* 
       
   301 	* @param None
       
   302 	* @return void
       
   303 	*/
       
   304     void ActivateL();
       
   305     
       
   306     /**
       
   307 	* Deactivate the publisher
       
   308 	* 
       
   309 	* @param None
       
   310 	* @return void
       
   311 	*/
       
   312     void DeActivateL();
       
   313     
       
   314     /**
       
   315 	* OnLineL 
       
   316 	* 
       
   317 	* @param None
       
   318 	* @return void
       
   319 	*/
       
   320     void OnLineL();
       
   321     
       
   322     /**
       
   323 	* OffLineL 
       
   324 	* 
       
   325 	* @param None
       
   326 	* @return void
       
   327 	*/
       
   328     void OffLineL();
       
   329     
       
   330     /**
       
   331 	* InActiveL 
       
   332 	* 
       
   333 	* @param None
       
   334 	* @return void
       
   335 	*/
       
   336 	void InActiveL();
       
   337 	
       
   338     /**
       
   339 	* Update the publisher status 
       
   340 	* 
       
   341 	* @param aPublisher publisher name
       
   342 	* @return void
       
   343 	*/
       
   344     void UpdatePublisherStatusL(TDesC& aPublisher);
       
   345     
       
   346     /**
       
   347     * Resolves skin item id and Mif id from pattern 
       
   348     * skin( <majorId> <minorId> (<colourGroupId>) 
       
   349     * mif(<MifFileName.mif> <bitmapId> <maskId>)
       
   350     * 
       
   351     * @param aPath  skin pattern / mif pattern value
       
   352     * @param aItemId skin item id  
       
   353     * @param aMifId  mif id 
       
   354     * @param aMaskId  mask id 
       
   355     * @param aFilename mif file name
       
   356     * @return boolean (ETrue/EFalse)  
       
   357     */
       
   358     TBool ResolveSkinIdAndMifId( const TDesC& aPath, TAknsItemID& aItemId,
       
   359     		TInt& aMifId, TInt& aMaskId, TDes& aFilename );
       
   360 
       
   361     /**
       
   362 	* Sets the on resume update needed status  
       
   363 	* 
       
   364 	* @param aStatus update needed status (ETrue/EFalse)
       
   365 	* @return void  
       
   366 	*/
       
   367     void SetUpdateNeeded(TBool aStatus);
       
   368     
       
   369     private :   
       
   370     
       
   371     // Subscriber interface
       
   372     // own
       
   373     MLiwInterface* iInterface;
       
   374       
       
   375     // Data Observer to CPS content registry
       
   376     // Own // iConObserver;
       
   377     CSapiDataObserver* iContentObserver;
       
   378     
       
   379     // Data Observer to CPS publisher registry
       
   380     // Own // iConObserver;
       
   381     CSapiDataObserver* iPubObserver;
       
   382    
       
   383     // Service handler 
       
   384     // Own
       
   385     CLiwServiceHandler* iServiceHandler;
       
   386     
       
   387     // Array of configurations
       
   388     // Own
       
   389     RPointerArray<CContentItem> iItemList;
       
   390 
       
   391     // Number of configurations 
       
   392     TInt iItemCount;
       
   393     
       
   394     // Command name in configuration Array
       
   395     HBufC8* iCommandName;
       
   396 	/* publisher id */
       
   397 	HBufC* iPublisher;
       
   398 	/* content type */
       
   399 	HBufC* iContentType;
       
   400 	/* content id */
       
   401 	HBufC* iContentId;
       
   402 
       
   403     // Reference of the sapi data plugin
       
   404     // Not owned
       
   405     CSapiDataPlugin* iPlugin;
       
   406     
       
   407     // Menu item names
       
   408     // Own
       
   409     RPointerArray<HBufC> iMenuItems; 
       
   410     
       
   411     // Trigger names for the menu items
       
   412     // Own
       
   413     RPointerArray<HBufC8> iMenuTriggers;
       
   414     
       
   415     // Store the status of update needed on resume
       
   416     TBool iUpdateNeeded;
       
   417     };
       
   418 
       
   419 #endif /*SAPIDATA_H*/