phonebookengines/contactsmodel/cntmodel/inc/CCntNotificationMonitor.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 02 Feb 2010 10:12:17 +0200
changeset 0 e686773b3f54
child 24 0ba2181d7c28
permissions -rw-r--r--
Revision: 201003 Kit: 201005

/**
* 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