CMonitorPlugin Class Reference

class CMonitorPlugin : public CBase

Monitor Plug-in ECom interface definition. Monitor plug-in implementation needs to inherit this class and implement the pure virtual methods which exist in this interface. All monitor plug-ins are provided a reference to the Harvester server ( MMonitorPluginObserver ) which hanles the new harvesting requests, open session to MdE for DB maintenance operations, pointer to ContextEngine and a pointer Harvester plug-in factory.

Example:

// interface for notifying Monitor plug-in about new files class MMonitorNotifier { public: /** * Called when we notice a new file/item * * // Monitor plug-in implementation class CMyMonitorPlugin: public CMonitorPlugin , public MMonitorNotifier { public: TBool StartMonitoring( MMonitorPluginObserver & aObserver, CMdESession* aMdEClient, CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ); TBool StopMonitoring() ; TBool ResumeMonitoring( MMonitorPluginObserver & aObserver, CMdESession* aMdEClient, CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ); TBool PauseMonitoring() ; void NewFile( CHarvesterData* aHarvesterData );

private: MMonitorPluginObserver* iObserver; CMyActiveObjectNotifier* iNotifier; }

TBool CMyMonitorPlugin::StartMonitoring( MMonitorPluginObserver & aObserver, CMdESession* aMdEClient, CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) { iObserver =

// Active object which observes the system and notices new files/items in the system iNotifier = CMyActiveObjectNotifier::NewL(*this); } TBool CMyMonitorPlugin::StopMonitoring() { iNotifier->StopNotifying(); }

TBool CMyMonitorPlugin::ResumeMonitoring( MMonitorPluginObserver & aObserver, CMdESession* aMdEClient, CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) { // Do what needs to be done when operation is resumed - for example handle // events received through callback CMyMonitorPlugin::NewFile during pause. }

TBool CMyMonitorPlugin::PauseMonitoring() { // Do what needs to be done during pause - for example buffer all events coming // through callback CMyMonitorPlugin::NewFile }

void CMyMonitorPlugin::NewFile( CHarvesterData* aHarvesterData ) { // Our CMyActiveObjectNotifier notifies us about new file and we notify the Harvester server about it. // Before this CMyActiveObjectNotifier has filled the need data to aHarvesterData like: aHarvesterData->SetEventType( EHarvesterAdd ); aHarvesterData->SetOrigin( aOrigin ); iObserver->MonitorEvent( aHarvesterData ); }

Inherits from

Constructor & Destructor Documentation

~CMonitorPlugin()

IMPORT_C ~CMonitorPlugin ( ) [virtual]

Destructor

Member Functions Documentation

ListImplementationsL(RImplInfoPtrArray &)

IMPORT_C void ListImplementationsL ( RImplInfoPtrArray & aImplInfoArray ) [static]

A static method which list all available implementations which satisfy this given interface.

Parameters

RImplInfoPtrArray & aImplInfoArray On return this contains information about all available implementations.

NewL(const TUid &)

IMPORT_C CMonitorPlugin * NewL ( const TUid & aUid ) [static]

Creates and constructs a new instance of CMonitorPlugin .

Parameters

const TUid & aUid An UID of desired implementation.

PauseMonitoring()

TBool PauseMonitoring ( ) [pure virtual]

A pure virtual method which pauses the plug-in.

ResumeMonitoring(MMonitorPluginObserver &, CMdESession *, CContextEngine *, CHarvesterPluginFactory *)

TBool ResumeMonitoring ( MMonitorPluginObserver & aObserver,
CMdESession * aMdEClient,
CContextEngine * aCtxEngine,
CHarvesterPluginFactory * aHarvesterPluginFactory
) [pure virtual]

A pure virtual method which resumes the paused plug-in.

Parameters

MMonitorPluginObserver & aObserver All events are notified via the aObserver.
CMdESession * aMdEClient A pointer to MdE client.
CContextEngine * aCtxEngine A pointer to context engine.
CHarvesterPluginFactory * aHarvesterPluginFactory A pointer to harvester plugin factory.

StartMonitoring(MMonitorPluginObserver &, CMdESession *, CContextEngine *, CHarvesterPluginFactory *)

TBool StartMonitoring ( MMonitorPluginObserver & aObserver,
CMdESession * aMdEClient,
CContextEngine * aCtxEngine,
CHarvesterPluginFactory * aHarvesterPluginFactory
) [pure virtual]

A pure virtual method which starts the monitoring.

Parameters

MMonitorPluginObserver & aObserver All events are notified via the aObserver.
CMdESession * aMdEClient A pointer to MdE client.
CContextEngine * aCtxEngine A pointer to context engine.
CHarvesterPluginFactory * aHarvesterPluginFactory A pointer to harvester plugin factory.

StopMonitoring()

TBool StopMonitoring ( ) [pure virtual]

A pure virtual method which stops the monitoring.

Member Data Documentation

TUid iDtor_ID_Key

TUid iDtor_ID_Key [private]

Identification on cleanup.