85
|
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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CASRVSESSION_H
|
|
19 |
#define CASRVSESSION_H
|
|
20 |
|
|
21 |
// INCLUDES
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <e32hashtab.h>
|
|
25 |
#include "casrv.h"
|
|
26 |
#include "cadef.h"
|
|
27 |
|
|
28 |
// CLASS DECLARATION
|
|
29 |
class CCaSrvNotifier;
|
|
30 |
class CCaInnerEntry;
|
|
31 |
class CCaDataManager;
|
|
32 |
class CCaInnerQuery;
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Interface for session changing events.
|
|
36 |
*
|
|
37 |
* @since S60 v5.0
|
|
38 |
*/
|
|
39 |
class MCaSessionNorifier
|
|
40 |
{
|
|
41 |
|
|
42 |
public:
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Pure virtual method.
|
|
46 |
* @param aEntry was changed.
|
|
47 |
* @param aChangeType - update, add, remove.
|
|
48 |
* @param aParentIds - array with parents ids.
|
|
49 |
*/
|
|
50 |
virtual void EntryChanged( const CCaInnerEntry* aEntry, TChangeType aChangeType,
|
|
51 |
const RArray<TInt>& aParentIds ) = 0;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Pure virtual method.
|
|
55 |
* @param aId entry(group) id.
|
|
56 |
*/
|
|
57 |
virtual void EntryTouched( TInt aId ) = 0;
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Pure virtual method.
|
|
61 |
* @param aParentIds entries(groups) id.
|
|
62 |
*/
|
|
63 |
virtual void GroupContentChanged( const RArray<TInt>& aParentIds ) = 0;
|
|
64 |
};
|
|
65 |
|
|
66 |
/**
|
|
67 |
* Content Arsenal Server Session.
|
|
68 |
*/
|
|
69 |
NONSHARABLE_CLASS( CCaSrvSession ): public CSession2, public MCaSessionNorifier
|
|
70 |
{
|
|
71 |
enum TGetListType
|
|
72 |
{
|
|
73 |
EFull,
|
|
74 |
EIds
|
|
75 |
};
|
|
76 |
|
|
77 |
public:
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Destructor.
|
|
81 |
*/
|
|
82 |
virtual ~CCaSrvSession();
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Two phase constructor. Leaves on failure.
|
|
86 |
* @param aMenuSrv Menu Server.
|
|
87 |
*/
|
|
88 |
static CCaSrvSession* NewL( CCaSrv& aCaSrv );
|
|
89 |
|
|
90 |
protected:
|
|
91 |
// construct
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Constructor. Leaves on failure.
|
|
95 |
* @param aMenuSrv Menu Server.
|
|
96 |
*/
|
|
97 |
CCaSrvSession( CCaSrv& aCaSrv );
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Second phase constructor. Leaves on failure.
|
|
101 |
*/
|
|
102 |
void ConstructL();
|
|
103 |
|
|
104 |
private:
|
|
105 |
// From CSession2
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Service message.
|
|
109 |
* @param aMessage Message.
|
|
110 |
*/
|
|
111 |
virtual void ServiceL( const RMessage2& aMessage );
|
|
112 |
|
|
113 |
private:
|
|
114 |
//new methods
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Selects correct function from message.
|
|
118 |
* @param aMessage message from client
|
|
119 |
* (containing requested operation and any data).
|
|
120 |
* @param aPanicedClient returns ETrue
|
|
121 |
* if server paniced a client.
|
|
122 |
*/
|
|
123 |
void DispatchMessageL( const RMessage2& aMessage,
|
|
124 |
TBool& aPanicedClient );
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Get Data request - first phase.
|
|
128 |
* @param aMessage message from client
|
|
129 |
* (containing requested operation and any data).
|
|
130 |
* @param aOnlyIds ETrue if array of ids is going to be fetched,
|
|
131 |
* EFalse if entries array will be fetched.
|
|
132 |
*/
|
|
133 |
void GetListSizeL( const RMessage2& aMessage, TGetListType aType );
|
|
134 |
|
|
135 |
/**
|
|
136 |
* Gets entries from the storage.
|
|
137 |
* @param aQuery query.
|
|
138 |
* @return size of serialized descriptor containing output entries.
|
|
139 |
*/
|
|
140 |
TInt GetEntriesL( const CCaInnerQuery* aQuery );
|
|
141 |
|
|
142 |
/**
|
|
143 |
* Gets entries ids from the storage.
|
|
144 |
* @param aQuery query.
|
|
145 |
* @return size of serialized descriptor containing output ids.
|
|
146 |
*/
|
|
147 |
TInt GetIdsL( const CCaInnerQuery* aQuery );
|
|
148 |
|
|
149 |
/**
|
|
150 |
* Get Data request - second phase.
|
|
151 |
* @param aMessage message from client
|
|
152 |
* (containing requested operation and any data).
|
|
153 |
*/
|
|
154 |
void GetListDataL( const RMessage2& aMessage );
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Get Entries Ids request - second phase.
|
|
158 |
* @param aMessage message from client
|
|
159 |
* (containing requested operation and any data).
|
|
160 |
*/
|
|
161 |
void GetIdsDataL( const RMessage2& aMessage );
|
|
162 |
|
|
163 |
/**
|
|
164 |
* Add data request.
|
|
165 |
* @param aMessage message from client
|
|
166 |
* (containing requested operation and any data).
|
|
167 |
*/
|
|
168 |
void AddL( const RMessage2& aMessage);
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Remove data request.
|
|
172 |
* @param aMessage message from client
|
|
173 |
* (containing requested operation and any data).
|
|
174 |
*/
|
|
175 |
void RemoveL( const RMessage2& aMessage );
|
|
176 |
|
|
177 |
/**
|
|
178 |
* Organize data request.
|
|
179 |
* @param aMessage message from client
|
|
180 |
* (containing requested operation and any data).
|
|
181 |
*/
|
|
182 |
void OrganizeL( const RMessage2& aMessage );
|
|
183 |
|
|
184 |
/**
|
|
185 |
* Touch data request.
|
|
186 |
* @param aMessage message from client
|
|
187 |
* (containing requested operation and any data).
|
|
188 |
*/
|
|
189 |
void TouchL( const RMessage2& aMessage );
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Custom sort data request.
|
|
193 |
* @param aMessage message from client
|
|
194 |
* (containing requested operation and any data).
|
|
195 |
*/
|
|
196 |
void CustomSortL( const RMessage2& aMessage );
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Create new notifier object,
|
|
200 |
* write its subsession handle back in slot 3.
|
|
201 |
* @param aMessage Message.
|
|
202 |
*/
|
|
203 |
void NewNotifierL( const RMessage2& aMessage );
|
|
204 |
|
|
205 |
/**
|
|
206 |
* Get notifier by handle. Leaves with KErrBadHandle (==panics client)
|
|
207 |
* if not found.
|
|
208 |
* @param aHandle Handle.
|
|
209 |
* @return Notifier.
|
|
210 |
*/
|
|
211 |
CCaSrvNotifier* NotifierL( TInt aHandle );
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Remove notifier by handle from message.
|
|
215 |
* Leaves with KErrBadHandle (==panics client) if not found.
|
|
216 |
* @param aMessage Message.
|
|
217 |
*/
|
|
218 |
void RemoveNotifierL( const RMessage2& aMessage );
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Get Change Info from notifier.
|
|
222 |
* @param aMessage Message.
|
|
223 |
*/
|
|
224 |
void GetChangeInfoL( const RMessage2& aMessage );
|
|
225 |
|
|
226 |
public:
|
|
227 |
// from MCaSessionNorifier
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Call EntryChangeL for each one CCaSrvNotifier object.
|
|
231 |
* @param aEntry was changed.
|
|
232 |
* @param aChangeType - update, add, remove.
|
|
233 |
* @param aParentIds - array with parents ids.
|
|
234 |
*/
|
|
235 |
void EntryChanged( const CCaInnerEntry* aEntry, TChangeType aChangeType,
|
|
236 |
const RArray<TInt>& aParentIds );
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Call EntryTouchedL for each one CCaSrvNotifier object.
|
|
240 |
* @param aId entry(group) id.
|
|
241 |
*/
|
|
242 |
void EntryTouched( TInt aId );
|
|
243 |
|
|
244 |
/**
|
|
245 |
* Call GroupContentChangedL for each one CCaSrvNotifier object.
|
|
246 |
* @param aParentIds entries(groups) id.
|
|
247 |
*/
|
|
248 |
void GroupContentChanged( const RArray<TInt>& aParentIds );
|
|
249 |
|
|
250 |
private:
|
|
251 |
// Data
|
|
252 |
|
|
253 |
/*
|
|
254 |
* Server. Not own.
|
|
255 |
*/
|
|
256 |
CCaSrv& iCaSrv;
|
|
257 |
|
|
258 |
/*
|
|
259 |
* Data Manager. Own.
|
|
260 |
*/
|
|
261 |
CCaDataManager* iDataManager;
|
|
262 |
|
|
263 |
/**
|
|
264 |
* Hash map containing all CCaSrvNotifier of this session.
|
|
265 |
*/
|
|
266 |
RHashMap<TInt, CCaSrvNotifier*> iNotifiers;
|
|
267 |
|
|
268 |
/**
|
|
269 |
* Data storage. Not own.
|
|
270 |
*/
|
|
271 |
CCaStorageProxy& iStorageProxy;
|
|
272 |
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Serialized GetEntries operation result. Own
|
|
276 |
*/
|
|
277 |
HBufC8* iSerializedGetEntriesResult;
|
|
278 |
|
|
279 |
/**
|
|
280 |
* Serialized GetIds operation result. Own
|
|
281 |
*/
|
|
282 |
HBufC8* iSerializedGetIdsResult;
|
|
283 |
};
|
|
284 |
|
|
285 |
#endif // CASRVSESSION_H
|
|
286 |
// End of File
|