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 ); }
Public Member Functions | |
---|---|
~CMonitorPlugin() | |
IMPORT_C void | ListImplementationsL(RImplInfoPtrArray &) |
IMPORT_C CMonitorPlugin * | NewL(const TUid &) |
TBool | PauseMonitoring() |
TBool | ResumeMonitoring(MMonitorPluginObserver &, CMdESession *, CContextEngine *, CHarvesterPluginFactory *) |
TBool | StartMonitoring(MMonitorPluginObserver &, CMdESession *, CContextEngine *, CHarvesterPluginFactory *) |
TBool | StopMonitoring() |
Private Attributes | |
---|---|
TUid | iDtor_ID_Key |
IMPORT_C void | ListImplementationsL | ( | RImplInfoPtrArray & | aImplInfoArray | ) | [static] |
A static method which list all available implementations which satisfy this given interface.
RImplInfoPtrArray & aImplInfoArray | On return this contains information about all available implementations. |
IMPORT_C CMonitorPlugin * | NewL | ( | const TUid & | aUid | ) | [static] |
Creates and constructs a new instance of CMonitorPlugin.
const TUid & aUid | An UID of desired implementation. |
TBool | PauseMonitoring | ( | ) | [pure virtual] |
A pure virtual method which pauses the plug-in.
TBool | ResumeMonitoring | ( | MMonitorPluginObserver & | aObserver, |
CMdESession * | aMdEClient, | |||
CContextEngine * | aCtxEngine, | |||
CHarvesterPluginFactory * | aHarvesterPluginFactory | |||
) | [pure virtual] |
A pure virtual method which resumes the paused plug-in.
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. |
TBool | StartMonitoring | ( | MMonitorPluginObserver & | aObserver, |
CMdESession * | aMdEClient, | |||
CContextEngine * | aCtxEngine, | |||
CHarvesterPluginFactory * | aHarvesterPluginFactory | |||
) | [pure virtual] |
A pure virtual method which starts the monitoring.
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. |
TBool | StopMonitoring | ( | ) | [pure virtual] |
A pure virtual method which stops the monitoring.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.