phonebookengines_old/contactsmodel/cntmodel/inc/CCntNotificationMonitor.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 13:29:23 +0300
changeset 40 b46a585f6909
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/**
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/



/**
 @file
 @internalComponent
 @released
*/


#ifndef CCNT_NOTIFICATIONMONITOR_H
#define CCNT_NOTIFICATIONMONITOR_H

#include <e32base.h>
#include <f32file.h>
#include <badesca.h>

#include <cntdbobs.h> // for tcontactdbobserverevent.


/**
The CCntNotificationMonitor class provides the base class for monitoring of
event notifications from the Server.
*/
NONSHARABLE_CLASS(CCntNotificationMonitor) : public CActive
{
protected:
	CCntNotificationMonitor(RCntModel& aSession);
	~CCntNotificationMonitor();	
	void DoCancel();

protected:
	RCntModel& iSession;
};


/**
The CCntDbNotifyMonitor class is an Active Object which makes requests for
Contacts database events from the Server.  Each Contacts database event
received from the Server is sent to all registered observers.  Each observer
implements the MContactDbObserver interface which consists of the
HandleDatabaseEventL() method.
*/
NONSHARABLE_CLASS(CCntDbNotifyMonitor) : private CCntNotificationMonitor
{
public:
	static  CCntDbNotifyMonitor* NewL(RCntModel& aSession);
	void 	AddObserverL(MContactDbObserver& aObserver);
	void 	RemoveObserver(const MContactDbObserver& aObserver);
	~CCntDbNotifyMonitor();
	TInt    NumberOfListeners() const;

private:
	CCntDbNotifyMonitor(RCntModel& aSession);
	void 	RunL();
	void 	Start();
	TInt	RunError(TInt aError);

private:	
	RPointerArray<MContactDbObserver> iObserverArray;
	TPckgBuf<TContactDbObserverEvent> iEventMsg;
	TInt iCurrentProcessedObserver;
};


#endif // CCNT_NOTIFICATIONMONITOR_H