|
1 /* |
|
2 * Copyright (c) 2006-2007 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: Server side session for thumbnail engine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef THUMBNAILSERVERSESSION_H |
|
20 #define THUMBNAILSERVERSESSION_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32capability.h> |
|
24 |
|
25 #include "thumbnailmanagerconstants.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class CThumbnailServer; |
|
29 |
|
30 /** |
|
31 * Server side session for thumbnail engine. |
|
32 * |
|
33 * @since S60 v5.0 |
|
34 */ |
|
35 NONSHARABLE_CLASS( CThumbnailServerSession ): public CSession2 |
|
36 { |
|
37 public: |
|
38 |
|
39 /** |
|
40 * Constructor. |
|
41 * |
|
42 * @since S60 v5.0 |
|
43 * @return New CThumbnailServerSession session. |
|
44 */ |
|
45 CThumbnailServerSession(); |
|
46 |
|
47 /** |
|
48 * Destructor |
|
49 * |
|
50 * @since S60 v5.0 |
|
51 */ |
|
52 virtual ~CThumbnailServerSession(); |
|
53 |
|
54 public: |
|
55 |
|
56 /** |
|
57 * Message dispatcher. |
|
58 * |
|
59 * @since S60 v5.0 |
|
60 * @param aMessage Message to be passed. |
|
61 * @return Error code. |
|
62 */ |
|
63 TInt DispatchMessageL( const RMessage2& aMessage ); |
|
64 |
|
65 public: |
|
66 // Functions from base classes |
|
67 |
|
68 /** |
|
69 * CreateL |
|
70 * |
|
71 * @since S60 v5.0 |
|
72 */ |
|
73 void CreateL(); |
|
74 |
|
75 /** |
|
76 * From CSharableSession (pure virtual). |
|
77 * Handles service request messages from clients. |
|
78 * |
|
79 * @since S60 v5.0 |
|
80 * @param aMessage message from client. |
|
81 */ |
|
82 void ServiceL( const RMessage2& aMessage ); |
|
83 |
|
84 public: |
|
85 // New functions |
|
86 |
|
87 /** |
|
88 * Returns the server pointer. |
|
89 * |
|
90 * @since S60 v5.0 |
|
91 * @return Server pointer. |
|
92 */ |
|
93 CThumbnailServer* Server(); |
|
94 |
|
95 /** |
|
96 * Cancellation method. |
|
97 * |
|
98 * @since S60 v5.0 |
|
99 */ |
|
100 void Cancel(); |
|
101 |
|
102 /** |
|
103 * Converts SQL error to E32 error. |
|
104 * |
|
105 * @since S60 v5.0 |
|
106 * @param aReason Request message complete value which may be SQL error |
|
107 * @return Request message complete value but not SQL error |
|
108 */ |
|
109 static TInt ConvertSqlErrToE32Err( TInt aReason ); |
|
110 |
|
111 void ResolveMimeTypeL( RFile64* aFile ); |
|
112 |
|
113 void ModifyThumbnailSize( TInt aSourceType ); |
|
114 |
|
115 private: |
|
116 |
|
117 /** |
|
118 * RequestThumbByFileHandleAsyncL |
|
119 * |
|
120 * @since S60 v5.0 |
|
121 * @param aMessage Message. |
|
122 */ |
|
123 void RequestThumbByFileHandleAsyncL( const RMessage2& aMessage ); |
|
124 |
|
125 /** |
|
126 * RequestThumbByPathAsyncL |
|
127 * |
|
128 * @since S60 v5.0 |
|
129 * @param aMessage Message. |
|
130 */ |
|
131 void RequestThumbByPathAsyncL( const RMessage2& aMessage ); |
|
132 |
|
133 /** |
|
134 * RequestThumbByIdAsyncL |
|
135 * |
|
136 * @since S60 v5.0 |
|
137 * @param aMessage Message. |
|
138 */ |
|
139 void RequestThumbByIdAsyncL( const RMessage2& aMessage ); |
|
140 |
|
141 /** |
|
142 * RequestSetThumbnailByBufferL |
|
143 * |
|
144 * @since S60 v5.0 |
|
145 * @param aMessage Message. |
|
146 */ |
|
147 void RequestSetThumbnailByBufferL( const RMessage2& aMessage ); |
|
148 |
|
149 /** |
|
150 * RequestSetThumbnailByBitmapL |
|
151 * |
|
152 * @since S60 v5.0 |
|
153 * @param aMessage Message. |
|
154 */ |
|
155 void RequestSetThumbnailByBitmapL( const RMessage2& aMessage ); |
|
156 |
|
157 /** |
|
158 * Fetch thumbnail data from database. |
|
159 * |
|
160 * @since S60 v5.0 |
|
161 */ |
|
162 void FetchThumbnailL(); |
|
163 |
|
164 /** |
|
165 * Create a task to generate a new thumbnail |
|
166 * |
|
167 * @since S60 v5.0 |
|
168 * @param aFile File handle |
|
169 */ |
|
170 void CreateGenerateTaskFromFileHandleL( RFile64* aFile); |
|
171 |
|
172 /** |
|
173 * Create a task to generate a new thumbnail |
|
174 * |
|
175 * @since S60 v5.0 |
|
176 * @param aBuffer Source image buffer to be set |
|
177 */ |
|
178 void CreateGenerateTaskFromBufferL( TDesC8* aBuffer ); |
|
179 |
|
180 /** |
|
181 * Process a fetched bitmap by creating scale tasks |
|
182 * or by returning the bitmap as such. |
|
183 * |
|
184 * @since S60 v5.0 |
|
185 */ |
|
186 void ProcessBitmapL(); |
|
187 |
|
188 /** |
|
189 * ReleaseBitmap() |
|
190 * |
|
191 * @since S60 v5.0 |
|
192 * @param aMessage Message. |
|
193 */ |
|
194 void ReleaseBitmap( const RMessage2& aMessage ); |
|
195 |
|
196 /** |
|
197 * Cancels pending request. |
|
198 * |
|
199 * @since S60 v5.0 |
|
200 * @param aMessage Message. |
|
201 * @return Error code. |
|
202 */ |
|
203 TInt CancelRequest( const RMessage2& aMessage ); |
|
204 |
|
205 /** |
|
206 * Changes priority of pending request. |
|
207 * |
|
208 * @since S60 v5.0 |
|
209 * @param aMessage Message. |
|
210 * @return Error code. |
|
211 */ |
|
212 TInt ChangePriority( const RMessage2& aMessage ); |
|
213 |
|
214 /** |
|
215 * Create thumbnails. |
|
216 * |
|
217 * @since S60 v5.0 |
|
218 * @param aMessage Message. |
|
219 */ |
|
220 void CreateThumbnailsL( const RMessage2& aMessage ); |
|
221 |
|
222 /** |
|
223 * Delete thumbnails. |
|
224 * |
|
225 * @since S60 v5.0 |
|
226 * @param aMessage Message. |
|
227 */ |
|
228 void DeleteThumbnailsL( const RMessage2& aMessage ); |
|
229 |
|
230 /** |
|
231 * Delete thumbnails by Id. |
|
232 * |
|
233 * @since S60 v5.0 |
|
234 * @param aMessage Message. |
|
235 */ |
|
236 void DeleteThumbnailsByIdL( const RMessage2& aMessage ); |
|
237 |
|
238 /** |
|
239 * Get the required size (in characters) for a buffer that contains the |
|
240 * list of supported MIME types |
|
241 * |
|
242 * @since S60 v5.0 |
|
243 * @param aMessage Message. |
|
244 */ |
|
245 void GetMimeTypeBufferSizeL( const RMessage2& aMessage ); |
|
246 |
|
247 /** |
|
248 * Get the list of supported MIME types and store them in the buffer |
|
249 * allocated by the client. |
|
250 * |
|
251 * @since S60 v5.0 |
|
252 * @param aMessage Message. |
|
253 */ |
|
254 void GetMimeTypeListL( const RMessage2& aMessage ); |
|
255 |
|
256 /** |
|
257 * Update thumbnails by Thumbnail ID. |
|
258 * |
|
259 * |
|
260 * @since S60 v5.0 |
|
261 * @param aMessage Message. |
|
262 */ |
|
263 void UpdateThumbnailsL( const RMessage2& aMessage ); |
|
264 |
|
265 private: |
|
266 // data |
|
267 /** |
|
268 * Temporary store for any bitmaps fetched from the store. |
|
269 * Own. |
|
270 */ |
|
271 CFbsBitmap* iBitmap; |
|
272 |
|
273 /** |
|
274 * Temporary store for thumbnail request parameters as received |
|
275 * from the client. |
|
276 */ |
|
277 TThumbnailRequestParamsPckgBuf iRequestParams; |
|
278 |
|
279 /** |
|
280 * Message from client. This is kept in a member variable to make |
|
281 * sure the message is completed if a leave occurs while handling |
|
282 * the request. |
|
283 */ |
|
284 RMessage2 iMessage; |
|
285 |
|
286 /** |
|
287 * Size of the original object. Only valid if a stored thumbnail |
|
288 * was found when processing a request. |
|
289 */ |
|
290 TSize iOriginalSize; |
|
291 |
|
292 /** |
|
293 * Temporary store for any jpegs fetched from the store. |
|
294 * Own. |
|
295 */ |
|
296 TDesC8* iBuffer; |
|
297 |
|
298 TInt iBitmapHandle; |
|
299 }; |
|
300 |
|
301 #endif // THUMBNAILSERVERSESSION_H |