|
1 /* |
|
2 * Copyright (c) 2006-2006 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: Active notifier class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPCLIENTACTIVENOTIFIER_H |
|
20 #define CPCLIENTACTIVENOTIFIER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32hashtab.h> |
|
24 #include "cpclientsession.h" |
|
25 |
|
26 class MLiwNotifyCallback; |
|
27 /** |
|
28 * Content publisher active notifier class |
|
29 * |
|
30 * |
|
31 * @lib cpclient.dll |
|
32 * @since S60 v 5.0 |
|
33 */ |
|
34 class CCPActiveNotifier : public CActive |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Two-phased constructor. |
|
40 * |
|
41 */ |
|
42 static CCPActiveNotifier* NewL( RCPServerClient& aServerClient ); |
|
43 |
|
44 /** |
|
45 * Desctructor. |
|
46 */ |
|
47 ~CCPActiveNotifier(); |
|
48 |
|
49 /** |
|
50 * Register observer |
|
51 * |
|
52 * @param aObserver Pointer for callback |
|
53 * @param aMap Map containing parameters |
|
54 * @param aTransactionId Integer transaction id |
|
55 */ |
|
56 void RegisterL( MLiwNotifyCallback* aObserver, TInt32 aTransactionId, |
|
57 CCPLiwMap* aMap ); |
|
58 |
|
59 /** |
|
60 * Unregister observer |
|
61 * |
|
62 * @since S60 v 5.0 |
|
63 */ |
|
64 void UnregisterL(); |
|
65 |
|
66 /** |
|
67 * Unregister observer |
|
68 * |
|
69 * @since S60 v 5.0 |
|
70 * @param aTransactionId Integer transaction id |
|
71 * @return returns ETrue if last observer was unregistered |
|
72 */ |
|
73 TBool UnregisterL( TInt32 aTransactionId ); |
|
74 |
|
75 |
|
76 /** |
|
77 * Unregister all observers |
|
78 * @since S60 v 5.0 |
|
79 */ |
|
80 void UnregisterAllL( ); |
|
81 |
|
82 protected: |
|
83 |
|
84 /** |
|
85 * From CActive, RunL. |
|
86 * Handles the active object’s request completion event |
|
87 */ |
|
88 void RunL(); |
|
89 |
|
90 /** |
|
91 * From CActive, DoCancel. |
|
92 * Implements cancellation of an outstanding request. |
|
93 */ |
|
94 void DoCancel(); |
|
95 |
|
96 /** |
|
97 * From CActive, RunError. |
|
98 * Implements cancellation of an outstanding request. |
|
99 */ |
|
100 TInt RunError( TInt aError ); |
|
101 |
|
102 private: |
|
103 |
|
104 /** |
|
105 * C++ default constructor. |
|
106 */ |
|
107 CCPActiveNotifier( RCPServerClient& aServerClient ); |
|
108 |
|
109 /** |
|
110 * Perform the second phase construction of a CCPActiveNotifier object. |
|
111 */ |
|
112 void ConstructL(); |
|
113 |
|
114 /* |
|
115 * Notify all observers |
|
116 */ |
|
117 void NotifyObserversL( TInt aErrorCode, |
|
118 CLiwGenericParamList* aEventParamList ); |
|
119 |
|
120 /* |
|
121 * Register observer |
|
122 */ |
|
123 void RegisterAgainL( ); |
|
124 |
|
125 |
|
126 private: |
|
127 |
|
128 /** |
|
129 * Descriptor where server can write to when passing data |
|
130 * Own. |
|
131 */ |
|
132 HBufC8 *iObserverBuf; |
|
133 |
|
134 /** |
|
135 * Size of the descriptor passed between server and client |
|
136 * Own. |
|
137 */ |
|
138 TPckgBuf<TInt>* iSizeDes; |
|
139 |
|
140 |
|
141 /** |
|
142 * Client-server session |
|
143 * Not Own. |
|
144 */ |
|
145 RCPServerClient iServerClient; |
|
146 |
|
147 /* |
|
148 * Array containing all observers |
|
149 * Own |
|
150 */ |
|
151 RHashMap<TInt32, MLiwNotifyCallback*> iObservers; |
|
152 |
|
153 }; |
|
154 |
|
155 #endif // CPCLIENTACTIVENOTIFIER_H |