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