diff -r 1a2a00e78665 -r d0529222e3f0 idlefw/plugins/sapidataplugin/inc/sapidataplugin.h --- a/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h Tue Feb 02 00:23:10 2010 +0200 +++ b/idlefw/plugins/sapidataplugin/inc/sapidataplugin.h Fri Feb 19 23:07:29 2010 +0200 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Plug-in main class +* Description: SAPI data plug-in main class * */ @@ -19,16 +19,16 @@ #ifndef SAPIDATAPLUGIN_H #define SAPIDATAPLUGIN_H -#include -#include +// System includes + +// User includes +#include #include -#include +// Forward declarations class MAiContentObserver; class MAiContentItemIterator; -class MAiPSPropertyObserver; class CSapiData; -class CDesC16Array; class CGulIcon; /** @@ -38,13 +38,11 @@ * * @since S60 v3.2 */ -class CSapiDataPlugin : public CAiContentPublisher, - public MAiPropertyExtension, - public MAiEventHandlerExtension - - { +NONSHARABLE_CLASS( CSapiDataPlugin ) : public CHsContentPublisher + { +public: + // data types -public : /** * Plugin's network state. */ @@ -62,11 +60,12 @@ { ENone, EResume, - ESuspend, - EInActive, + ESuspend }; + public: - + // constructor and destructor + /** * Part of the two phased constuction * @@ -84,6 +83,7 @@ ~CSapiDataPlugin(); private: + // constructors /** * Constructor @@ -100,148 +100,67 @@ * @return void */ void ConstructL(); - - /** - * Resume the plug-in. - * - * @param aReason reason for state change, see TAiTransitionChange. - * @return void - */ - void DoResumeL(TAiTransitionReason aReason); -public: // from base class CAiContentPublisher +public: + // from CHsContentPublisher /** - * From CAiContentPublisher - * The method is called by the framework to request the plug-in free all - * memory and CPU resources and close all its open files, e.g. the plug-in - * should unload its engines due backup operation. The method transits the - * plug-in to "Idle" state. - * - * @param aReason reason for state change, see TAiTransitionChange. - * @return void - */ - void Stop( TAiTransitionReason aReason ); + * @see CHsContentPublisher + */ + void Start( TStartReason aReason ); /** - * From CAiContentPublisher - * The method is called by the framework to instruct plug-in that it is - * allowed to consume CPU resources, e.g plug-in is able to run timers, - * perform asynchronous operations, etc. The method transits the plug-in - * to "Alive" state. - * - * @param aReason reason for state change, see TAiTransitionChange. - * @return void - */ - void Resume( TAiTransitionReason aReason ); - + * @see CHsContentPublisher + */ + void Stop( TStopReason aReason ); + /** - * From CAiContentPublisher - * The method is called by the framework to instruct plug-in that it is - * not allowed to consume CPU resources, e.g plug-in MUST stop each - * timers, cancel outstanding asynchronous operations, etc. The method - * transits the plug-in to "Suspendend" state. - * - * @param aReason reason for state change, see TAiTransitionChange. - * @return void - */ - void Suspend( TAiTransitionReason aReason ); - - /** - * From CAiContentPublisher - * Adds the content observer / subscriber to plug-in. The plug-in MUST - * maintain a registry of subscribers and send notification to all them - * whenever the plug-in changes state or new content available. - * - * @param aObserver content observer to register. - * @return void - */ - void SubscribeL( MAiContentObserver& aObserver ); + * @see CHsContentPublisher + */ + void Resume( TResumeReason aReason ); /** - * From CAiContentPublisher - * Configures the plug-in. - * Plug-ins take ownership of the settings array, so it must either - * store it in a member or free it. Framework has put the array in cleanup - * stack so the plugin shouldn't do that. - * If this leaves, the plug-in will be destroyed by AI FW. - * Plug-in must support LaunchByValue-event even if normal shortcuts don't - * work. The only allowed serious enough leave is KErrNotFound from CenRep. - * - * @param aSettings setting items defined in the UI definition. - * @return void - */ - void ConfigureL( RAiSettingsItemArray& aSettings ); + * @see CHsContentPublisher + */ + void Suspend( TSuspendReason aReason ); + + /** + * @see CHsContentPublisher + */ + void SetOnline(); + + /** + * @see CHsContentPublisher + */ + void SetOffline(); /** - * From CAiContentPublisher - * Returns interface extension. In Series 60 3.1 only event & property - * extensions are supported. See MAiEventExtension & MAiPropertyExtension - * interfaces. - * - * @param aUid - UID of the extension interface to access. - * @return the extension interface. Actual type depends on the passed aUid - * argument. - */ - TAny* Extension( TUid aUid ); - -// from base class MAiPropertyExtension - - /** - * From MAiPropertyExtension. - * Read property of publisher plug-in. - * - * @param aProperty - identification of property. - * @return pointer to property value. - */ - TAny* GetPropertyL( TInt aProperty ); + * @see CHsContentPublisher + */ + void SubscribeL( MAiContentObserver& aObserver ); /** - * From MAiPropertyExtension. - * Write property value. - * - * @param aProperty - identification of property. - * @param aValue - contains pointer to property value. - */ - void SetPropertyL( TInt aProperty, TAny* aValue ); - - // from base class MAiEventHandlerExtension - - /** - * From MAiEventHandlerExtension - * Invoked by the framework when plug-in must handle an event. - * @param aEvent - unique identifier of event from plug-in content model. - * @param aParam - parameters associated with event. Each UI Definition - * declares events in the format: (), - * where is mapped by the framework to unique - * identifier supplied in aEvent, are provided to - * plug-in as-is in the descriptor. - * @since S60 3.2 + * @see CHsContentPublisher */ - void HandleEvent(TInt aEvent, const TDesC& aParam); - - /** - * From MAiEventHandlerExtension - * Invoked by the framework when plug-in must handle an event. - * - * @param aEventName - name of the event from plug-in content model. - * @param aParam - parameters associated with event. Each UI Definition - * declares events in the format: (), - * where mapping to unique identifier supplied by event - * is failed by the frame work then the and - * are provided to plug-in as-is in the descriptor. + void ConfigureL( RAiSettingsItemArray& aSettings ); + + /** + * @see CHsContentPublisher */ - void HandleEvent(const TDesC& aEventName, const TDesC& aParam); + TAny* GetProperty( TProperty aProperty ); /** - * Invoked by the framework for querying if plugin has menu item - * - * @param aMenuItem menu item name. - * @return ETrue if plugin has specific menu item, EFalse otherwise - */ - TBool HasMenuItem(const TDesC16& aMenuItem); + * @see CHsContentPublisher + */ + void HandleEvent( const TDesC& aEventName, const TDesC& aParam ); + + /** + * @see CHsContentPublisher + */ + TBool HasMenuItem( const TDesC16& aMenuItem ); -public : // new functions +public: + // new functions /** * Publishes widget's texts and images @@ -282,7 +201,7 @@ * @param void * @return boolean (ETrue/EFalse) */ - TBool IsActive(); + TBool IsActive() const; /** * Publish a specific text of the widget @@ -332,69 +251,38 @@ * CSapiData getter * @return Pointer to CSapiData */ - inline CSapiData* Data() const - { - return iData; - } + CSapiData* Data() const; /* * Plugin's network status getter - * @return Pointer to Harvester status observer */ - inline TPluginNetworkStatus NetworkStatus() const - { - return iNetworkStatus; - } - -private: // data - - // Iterator for plugin content - // Own - MAiContentItemIterator* iContent; - - // Array of content observers - // Own - RPointerArray iObservers; - - // Information about the content publisher (this plug-in) - TAiPublisherInfo iInfo; - - // Number of data in the content model. - TInt iDataCount; - - // Dynamic content model - // Own - TAiContentItem* iContentModel; + TPluginNetworkStatus NetworkStatus() const; - // Reference array for Published text - // Own - RPointerArray iDataArray; - - // Service API Data Subscriber. - // Own - CSapiData* iData; - - // References array for published images - // Own - RArray iIconArray; - - // File Server - // Reference - RFs iRfs; - - // Plugin's network status - TPluginNetworkStatus iNetworkStatus; - - // Is Homescreen foreground. - TBool iHSForeGround; - - // Is KeyLockON. - TBool iKeyLockOn; +private: + // data - // Plugin state + /** Iterator for plugin content, owned */ + MAiContentItemIterator* iContent; + /** Array of content observers, owned */ + RPointerArray iObservers; + /** Number of data in the content model */ + TInt iDataCount; + /** Dynamic content model, owned */ + TAiContentItem* iContentModel; + /** Reference array for Published text, owned */ + RPointerArray< HBufC > iDataArray; + /** Service API Data Subscriber, owned */ + CSapiData* iData; + /** References array for published images, owned */ + RArray< CGulIcon* > iIconArray; + /** Handle to file server session, owned */ + RFs iRfs; + /** Plugin's network status */ + TPluginNetworkStatus iNetworkStatus; + /** Plugin state */ TPluginStates iPluginState; }; #endif // SAPIDATAPLUGIN_H - +// End of file