114
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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: Class used by session to handle asynchronous requests
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef C_CPNOTIFICATIONHANDLER_H
|
|
20 |
#define C_CPNOTIFICATIONHANDLER_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
#include <e32hashtab.h>
|
|
24 |
|
|
25 |
class CLiwGenericParamList;
|
|
26 |
class CLiwDefaultList;
|
|
27 |
class CLiwDefaultMap;
|
|
28 |
class CCPLiwMap;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Internal class for handling asynchronous request
|
|
32 |
* for notifications. Used by server session object.
|
|
33 |
*
|
|
34 |
* @since S60 v5.0
|
|
35 |
*/
|
|
36 |
class CCPNotificationHandler : public CBase
|
|
37 |
{
|
|
38 |
public:
|
|
39 |
|
|
40 |
/**
|
|
41 |
* Two-phased constructor.
|
|
42 |
*/
|
|
43 |
static CCPNotificationHandler* NewL( RPointerArray<CLiwDefaultList>&
|
|
44 |
aNotifications, TLiwVariant& aDataMapCache );
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Two-phased constructor.
|
|
48 |
*/
|
|
49 |
static CCPNotificationHandler* NewLC( RPointerArray<CLiwDefaultList>&
|
|
50 |
aNotifications, TLiwVariant& aDataMapCache );
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Destructor.
|
|
54 |
*/
|
|
55 |
virtual ~CCPNotificationHandler();
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Save message from client and initialize needed members
|
|
59 |
*/
|
|
60 |
void SaveMessageL( const RMessage2& aMessage );
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Adds observer
|
|
64 |
*/
|
|
65 |
void AddObserverL( const RMessage2& aMessage );
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Removes observer
|
|
69 |
*/
|
|
70 |
void RemoveObserverL( const RMessage2& aMessage );
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Invoked in order to send notification
|
|
74 |
* @param List of changes to send
|
|
75 |
*/
|
|
76 |
void SendNotificationL( CLiwDefaultList* aListOfMaps );
|
|
77 |
|
|
78 |
/**
|
|
79 |
* Getter
|
|
80 |
* @return pointer to current notification
|
|
81 |
*/
|
|
82 |
const CLiwGenericParamList* GetPointerToChangeInfoList();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Resets internal stare
|
|
86 |
*/
|
|
87 |
void Reset();
|
|
88 |
|
|
89 |
/**
|
|
90 |
* Completes iMessage with provided error
|
|
91 |
* @param Error Code
|
|
92 |
*/
|
|
93 |
void ErrorComplete( TInt aErrCode );
|
|
94 |
|
|
95 |
private:
|
|
96 |
|
|
97 |
/**
|
|
98 |
* C++ default constructor.
|
|
99 |
*/
|
|
100 |
CCPNotificationHandler(TLiwVariant& aDataMapCache);
|
|
101 |
|
|
102 |
/**
|
|
103 |
* By default Symbian 2nd phase constructor is private.
|
|
104 |
*/
|
|
105 |
void ConstructL(RPointerArray<CLiwDefaultList>& aNotifications);
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Invoked in order to send notification
|
|
109 |
* @param List of changes to send
|
|
110 |
* @since Series 60 5.0
|
|
111 |
*/
|
|
112 |
TBool SendChangeInfoListL( const CLiwDefaultList* aListOfMaps );
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Compares argument to stored filter
|
|
116 |
* @param aMap Information about change
|
|
117 |
* @param aFilter filter to compare with
|
|
118 |
* @return ETrue if argument matches filter
|
|
119 |
*/
|
|
120 |
TBool IsProperForFilterL( const CLiwMap& aMap,
|
|
121 |
const CCPLiwMap& aFilter );
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Extracts parameter from LIW Map
|
|
125 |
*
|
|
126 |
* @param aMap Source Map
|
|
127 |
* @param aProperty Key of parameter to extract
|
|
128 |
* @param aResult Target for value
|
|
129 |
*/
|
|
130 |
void GetPropertyL( const CLiwMap& aMap, const TDesC8& aProperty,
|
|
131 |
RBuf& aResult );
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Checks if IDs are the same
|
|
135 |
*
|
|
136 |
* @param aMap Map with notifications
|
|
137 |
* @param aFilter filter to compare with
|
|
138 |
* @return ETrue if ID are identical
|
|
139 |
*/
|
|
140 |
TBool CheckIdL( const CLiwMap& aMap, const CCPLiwMap& aFilter );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Checks if Properties like publisher,content type
|
|
144 |
* and content id are the same
|
|
145 |
*
|
|
146 |
* @param aMap Map with notifications
|
|
147 |
* @param aFilter filter to compare with
|
|
148 |
* @return ETrue if Parameters are identical
|
|
149 |
*/
|
|
150 |
TBool CheckPropertiesL( const CLiwMap& aMap,
|
|
151 |
const CCPLiwMap& aFilter );
|
|
152 |
|
|
153 |
/**
|
|
154 |
* Checks if operation types are the same
|
|
155 |
*
|
|
156 |
* @param aMap Map with notifications
|
|
157 |
* @param aFilter filter to compare with
|
|
158 |
* @return ETrue if operation types are the same
|
|
159 |
*/
|
|
160 |
TBool CheckOperationTypeL( const CLiwMap& aMap,
|
|
161 |
const CCPLiwMap& aFilter );
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Checks if registry types are the same
|
|
165 |
*
|
|
166 |
* @param aMap Map with notifications
|
|
167 |
* @param aFilter filter to compare with
|
|
168 |
* @return ETrue if registry types are the same
|
|
169 |
*/
|
|
170 |
TBool CheckRegistryTypeL( const CLiwMap& aMap,
|
|
171 |
const CCPLiwMap& aFilter );
|
|
172 |
|
|
173 |
/**
|
|
174 |
* Appends KDataMap for notification list if needed
|
|
175 |
*
|
|
176 |
* @param aMap Map with notifications
|
|
177 |
*/
|
|
178 |
void AppendDataMapL( CLiwDefaultList* aListOfMaps );
|
|
179 |
|
|
180 |
private:
|
|
181 |
// data
|
|
182 |
|
|
183 |
/*
|
|
184 |
* Own.
|
|
185 |
* ETrue if message is ready to send notification
|
|
186 |
*/
|
|
187 |
TBool iIsReadyToSend;
|
|
188 |
|
|
189 |
/*
|
|
190 |
* Own.
|
|
191 |
* List of waiting notifications.
|
|
192 |
*/
|
|
193 |
RPointerArray<CLiwDefaultList> iNotifications;
|
|
194 |
|
|
195 |
/*
|
|
196 |
* Not own.
|
|
197 |
* Message from client
|
|
198 |
*/
|
|
199 |
RMessage2 iMessage;
|
|
200 |
|
|
201 |
/*
|
|
202 |
* Own.
|
|
203 |
* Notification to send.
|
|
204 |
*/
|
|
205 |
CLiwGenericParamList* iChangeInfoList;
|
|
206 |
|
|
207 |
/*
|
|
208 |
* Own.
|
|
209 |
* Filters
|
|
210 |
*/
|
|
211 |
RHashMap< TInt32, CCPLiwMap*> iFilters;
|
|
212 |
|
|
213 |
|
|
214 |
/*
|
|
215 |
* Own.
|
|
216 |
* Filters
|
|
217 |
*/
|
|
218 |
RHashMap< TInt32, TBool> iExtendedFlags;
|
|
219 |
|
|
220 |
/*
|
|
221 |
* Not Own.
|
|
222 |
*/
|
|
223 |
TLiwVariant& iDataMapCache;
|
|
224 |
};
|
|
225 |
|
|
226 |
#endif // C_CPNOTIFICATIONHANDLER_H
|