diff -r fd64c38c277d -r b46a585f6909 phonebookengines_old/contactsmodel/cntmodel/inc/CCntNotificationMonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookengines_old/contactsmodel/cntmodel/inc/CCntNotificationMonitor.h Fri Jun 11 13:29:23 2010 +0300 @@ -0,0 +1,82 @@ +/** +* 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 +#include +#include + +#include // 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 iObserverArray; + TPckgBuf iEventMsg; + TInt iCurrentProcessedObserver; +}; + + +#endif // CCNT_NOTIFICATIONMONITOR_H