summaryrefslogtreecommitdiffstats
path: root/plugins/contacts/symbian/contactsmodel/cntmodel/inc/ccntnotificationmonitor.h
blob: bff83ca0b8a6aa97550dba722a8e9a46821bd5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* 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.

class CCntPackager;

/**
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);
	void    AddObserverV2L(MContactDbObserverV2& aObserver);
	void    RemoveObserverV2(const MContactDbObserverV2& aObserver);
	~CCntDbNotifyMonitor();
	TInt    NumberOfListeners() const;

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

private:	
	RPointerArray<MContactDbObserver> iObserverArray;
	RPointerArray<MContactDbObserverV2> iObserverV2Array;
	TPckgBuf<TContactDbObserverEventV2> iEventMsg;
	TInt iCurrentProcessedObserver;
	CCntPackager* iPackager;
	TDes8* iPackagerBuffer;
	TBool iIsConnected;
};


#endif // CCNT_NOTIFICATIONMONITOR_H