phonebookengines_old/contactsmodel/cntmodel/inc/CCntNotificationMonitor.h
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 /**
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 /**
       
    21  @file
       
    22  @internalComponent
       
    23  @released
       
    24 */
       
    25 
       
    26 
       
    27 #ifndef CCNT_NOTIFICATIONMONITOR_H
       
    28 #define CCNT_NOTIFICATIONMONITOR_H
       
    29 
       
    30 #include <e32base.h>
       
    31 #include <f32file.h>
       
    32 #include <badesca.h>
       
    33 
       
    34 #include <cntdbobs.h> // for tcontactdbobserverevent.
       
    35 
       
    36 
       
    37 /**
       
    38 The CCntNotificationMonitor class provides the base class for monitoring of
       
    39 event notifications from the Server.
       
    40 */
       
    41 NONSHARABLE_CLASS(CCntNotificationMonitor) : public CActive
       
    42 {
       
    43 protected:
       
    44 	CCntNotificationMonitor(RCntModel& aSession);
       
    45 	~CCntNotificationMonitor();	
       
    46 	void DoCancel();
       
    47 
       
    48 protected:
       
    49 	RCntModel& iSession;
       
    50 };
       
    51 
       
    52 
       
    53 /**
       
    54 The CCntDbNotifyMonitor class is an Active Object which makes requests for
       
    55 Contacts database events from the Server.  Each Contacts database event
       
    56 received from the Server is sent to all registered observers.  Each observer
       
    57 implements the MContactDbObserver interface which consists of the
       
    58 HandleDatabaseEventL() method.
       
    59 */
       
    60 NONSHARABLE_CLASS(CCntDbNotifyMonitor) : private CCntNotificationMonitor
       
    61 {
       
    62 public:
       
    63 	static  CCntDbNotifyMonitor* NewL(RCntModel& aSession);
       
    64 	void 	AddObserverL(MContactDbObserver& aObserver);
       
    65 	void 	RemoveObserver(const MContactDbObserver& aObserver);
       
    66 	~CCntDbNotifyMonitor();
       
    67 	TInt    NumberOfListeners() const;
       
    68 
       
    69 private:
       
    70 	CCntDbNotifyMonitor(RCntModel& aSession);
       
    71 	void 	RunL();
       
    72 	void 	Start();
       
    73 	TInt	RunError(TInt aError);
       
    74 
       
    75 private:	
       
    76 	RPointerArray<MContactDbObserver> iObserverArray;
       
    77 	TPckgBuf<TContactDbObserverEvent> iEventMsg;
       
    78 	TInt iCurrentProcessedObserver;
       
    79 };
       
    80 
       
    81 
       
    82 #endif // CCNT_NOTIFICATIONMONITOR_H