|
1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__MSVIPC_H__) |
|
17 #define __MSVIPC_H__ |
|
18 |
|
19 #if !defined(__E32BASE_H__) |
|
20 #include <e32base.h> |
|
21 #endif |
|
22 |
|
23 #if !defined(__MSVSTD_H__) |
|
24 #include <msvstd.h> |
|
25 #endif |
|
26 |
|
27 #if !defined(__MSVSEARCHSORTQUERY_H__) |
|
28 #include <msvsearchsortquery.h> |
|
29 #endif |
|
30 |
|
31 // |
|
32 const TInt KMsvNullOperation=0; |
|
33 const TInt KMsvFirstOperation=1; |
|
34 |
|
35 // |
|
36 const TInt KMsvSessionBufferLength=0x1000; |
|
37 const TInt KMsvProgressBufferLength=256; |
|
38 |
|
39 struct TMsvIdWithSortField; |
|
40 |
|
41 // ***** NOTE!!!!! TMsvPackedChangeNotification::UnpackL() MUST be **** |
|
42 // ***** updated when adding new types ***** |
|
43 /** |
|
44 @internalComponent |
|
45 @released |
|
46 */ |
|
47 enum TMsvServerChangeNotificationType |
|
48 { |
|
49 EMsvNullNotification=-1, |
|
50 EMsvEntriesNoChange=0, |
|
51 EMsvEntriesCreated=1, |
|
52 EMsvEntriesChanged=2, |
|
53 EMsvEntriesDeleted=3, |
|
54 EMsvEntriesMoved=4, |
|
55 EMsvMtmGroupInstalled=5, |
|
56 EMsvMtmGroupDeInstalled=6, |
|
57 EMsvStoreDeleted=7, |
|
58 EMsvCloseSession=8, |
|
59 EMsvIndexLoaded=9, |
|
60 EMsvIndexFailedToLoad=10, |
|
61 EMsvMediaChanged=12, // Note: I assume the following four follow each other in order |
|
62 EMsvMediaUnavailable=13, |
|
63 EMsvMediaAvailable=14, |
|
64 EMsvMediaIncorrect=15, |
|
65 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
66 EMsvMessageStoreNotSupported=16, |
|
67 EMsvMessageStoreCorrupt=17, |
|
68 EMsvRefreshMessageView=18, |
|
69 EMsvDiskNotAvailable=19, |
|
70 EMsvUnableToProcessDiskNotification=20 |
|
71 #endif |
|
72 }; |
|
73 |
|
74 |
|
75 //********************************** |
|
76 // TMsvPackedEntry |
|
77 //********************************** |
|
78 // |
|
79 // Packs a TMsvEntry and the two associated descriptors into a buffer for |
|
80 // sending across IPC. Also unpacks the data into a TMsvEntry and two heap |
|
81 // descriptors |
|
82 // |
|
83 // |
|
84 class TMsvEntry; |
|
85 |
|
86 class TMsvPackedEntry |
|
87 /** |
|
88 @internalComponent |
|
89 @released |
|
90 */ |
|
91 { |
|
92 public: |
|
93 IMPORT_C TMsvPackedEntry(HBufC8*& aBuffer); |
|
94 IMPORT_C TInt PackEntry(const TMsvEntry& aEntry); |
|
95 IMPORT_C void UnpackEntry(TMsvEntry& aEntry); |
|
96 private: |
|
97 HBufC8*& iBuffer; |
|
98 }; |
|
99 |
|
100 |
|
101 //********************************** |
|
102 // TMsvPackedEntryArray |
|
103 //********************************** |
|
104 // |
|
105 // Packs 1+ TMsvEntry's and the associated descriptors into a buffer for |
|
106 // sending across IPC. Also unpacks the data into a TMsvEntry and two heap |
|
107 // descriptors using indexed access |
|
108 // |
|
109 // |
|
110 |
|
111 class TMsvPackedEntryArray |
|
112 /** |
|
113 @internalComponent |
|
114 @released |
|
115 */ |
|
116 { |
|
117 public: |
|
118 IMPORT_C TMsvPackedEntryArray(HBufC8*& aBuffer, TInt aCount=0); |
|
119 IMPORT_C TInt PackEntry(const TMsvEntry& aEntry); |
|
120 IMPORT_C TInt UnpackEntry(TInt aEntryIndex, TMsvEntry& aEntry); |
|
121 IMPORT_C void Reset(); |
|
122 private: |
|
123 TInt FindEntryInArray(TInt aIndex); |
|
124 private: |
|
125 TInt iIndex; |
|
126 TInt iCount; |
|
127 const TUint8* iPos; |
|
128 HBufC8*& iBuffer; |
|
129 }; |
|
130 |
|
131 |
|
132 //********************************** |
|
133 // TMsvChildrenDetails |
|
134 //********************************** |
|
135 // |
|
136 // Contains the information about the number of children of an entry and how many |
|
137 // have been sent in the main buffer |
|
138 // |
|
139 |
|
140 class TMsvChildrenDetails |
|
141 /** |
|
142 @internalComponent |
|
143 @released |
|
144 */ |
|
145 { |
|
146 public: |
|
147 IMPORT_C TMsvChildrenDetails(); |
|
148 public: |
|
149 TMsvId iParentId; |
|
150 TInt iTotalNumberChildren; |
|
151 TInt iNumberChildrenInArray; |
|
152 TInt iLastEntryInArray; |
|
153 }; |
|
154 |
|
155 |
|
156 //********************************** |
|
157 // TMsvLocalOperationProgress |
|
158 //********************************** |
|
159 // |
|
160 // Contains the information about a local operation |
|
161 // |
|
162 |
|
163 class TMsvLocalOperationProgress |
|
164 /** Encapsulates progress information returned by a local operation. A local operation |
|
165 is a CMsvOperation-derived object returned by a function that affects only |
|
166 local entries. For example, such a function would be a CMsvEntry::ChangeL() |
|
167 call on a local entry. You can check if the operation is local from CMsvOperation::Mtm(): |
|
168 a local operation returns a value of KUidMsvLocalServiceMtm. |
|
169 |
|
170 Progress information is obtained, in a packaged format, by calling CMsvOperation::ProgressL(). |
|
171 Understanding the TMsvLocalOperationProgress structure enables an application |
|
172 to use that information for a local operation. |
|
173 @publishedAll |
|
174 @released |
|
175 */ |
|
176 { |
|
177 public: |
|
178 /** Defines the possible values for the type of operation progress report. |
|
179 @publishedAll |
|
180 @released |
|
181 */ |
|
182 enum TLocalOperation |
|
183 { |
|
184 /** Default value for new TMsvLocalOperationProgress */ |
|
185 ELocalNone=0, |
|
186 /** Move operation */ |
|
187 ELocalMove, |
|
188 /** Delete operation */ |
|
189 ELocalDelete, |
|
190 /** Copy operation */ |
|
191 ELocalCopy, |
|
192 /** Create operation */ |
|
193 ELocalNew, |
|
194 /** Change operation */ |
|
195 ELocalChanged |
|
196 }; |
|
197 public: |
|
198 IMPORT_C TMsvLocalOperationProgress(); |
|
199 public: |
|
200 /** The type of operation on which the progress is reporting */ |
|
201 TLocalOperation iType; |
|
202 /** The number of entries on which the operation was or will be attempted */ |
|
203 TInt iTotalNumberOfEntries; |
|
204 /** The number of entries on which the operation has been successful */ |
|
205 TInt iNumberCompleted; |
|
206 /** The number of entries on which the operation has failed */ |
|
207 TInt iNumberFailed; |
|
208 /** The number of entries on which the operation has yet to be attempted */ |
|
209 TInt iNumberRemaining; |
|
210 /** The error code for the latest failed operation */ |
|
211 TInt iError; |
|
212 /** This contains different information for different operation types: |
|
213 |
|
214 1. copying a single entry: ID of the new entry |
|
215 |
|
216 2. moving an entry: ID of the entry moved |
|
217 |
|
218 3. copying or moving multiple entries: ID of the first entry in the selection */ |
|
219 TMsvId iId; |
|
220 }; |
|
221 |
|
222 //********************************** |
|
223 // TMsvServerOperationProgress |
|
224 //********************************** |
|
225 /** Encapsulates progress information returned by a non-MTM specific Message Server |
|
226 operation. |
|
227 |
|
228 You can check if an operation has this type of progress information by calling |
|
229 CMsvOperation::Mtm(): a suitable operation returns a value of KUidMsvServerMtm. |
|
230 |
|
231 Progress information is obtained, in a packaged format, by calling CMsvOperation::ProgressL(). |
|
232 Understanding the TMsvServerOperationProgress class enables an application |
|
233 to use that information for a Message Server operation. |
|
234 |
|
235 @see TMsvLocalOperationProgress |
|
236 @see CMsvSession::CopyStoreL() |
|
237 @see CMsvSession::DeleteStoreL() |
|
238 @publishedAll |
|
239 @released |
|
240 */ |
|
241 |
|
242 class TMsvServerOperationProgress |
|
243 { |
|
244 public: |
|
245 |
|
246 enum TMsvServerOperationType |
|
247 { |
|
248 /** No operation in progress. */ |
|
249 EMsvNoOperation = 0, |
|
250 /** Change drive operation in progress. |
|
251 |
|
252 @see CMsvSession::ChangeDriveL() */ |
|
253 EMsvChangeDriveOperation |
|
254 |
|
255 , |
|
256 /** Copy Store operation in progress. |
|
257 @see CMsvSession::CopyStoreL() */ |
|
258 EMsvCopyOperation, |
|
259 |
|
260 /** Delete Store operation in progress. |
|
261 @see CMsvSession::DeleteStoreL() */ |
|
262 EMsvDeleteOperation |
|
263 |
|
264 |
|
265 }; |
|
266 // |
|
267 public: |
|
268 IMPORT_C TMsvServerOperationProgress(); |
|
269 TMsvServerOperationProgress(TMsvServerOperationType aType); |
|
270 // |
|
271 public: |
|
272 /** The type of operation in progress. */ |
|
273 TMsvServerOperationType iOperationType; |
|
274 }; |
|
275 |
|
276 |
|
277 //********************************** |
|
278 // TMsvIndexProgress |
|
279 //********************************** |
|
280 |
|
281 class TMsvIndexProgress |
|
282 /** Provides details of index loading progress. |
|
283 |
|
284 @see TMsvIndexLoadProgress |
|
285 @publishedAll |
|
286 @released |
|
287 */ |
|
288 { |
|
289 public: |
|
290 IMPORT_C TMsvIndexProgress(); |
|
291 // |
|
292 public: |
|
293 /** Total number of entries in the index. */ |
|
294 TInt iTotal; |
|
295 /** Number of entries created so far. */ |
|
296 TInt iCompleted; |
|
297 /** Number of entries remaining. */ |
|
298 TInt iRemaining; |
|
299 /** ID of entry last created. */ |
|
300 TMsvId iId; |
|
301 }; |
|
302 |
|
303 |
|
304 //********************************** |
|
305 // TMsvIndexLoadProgress |
|
306 //********************************** |
|
307 |
|
308 class TMsvIndexLoadProgress : public TMsvServerOperationProgress |
|
309 /** Progress information for an operation controlling the Message Server loading |
|
310 its index. |
|
311 |
|
312 Such an operation can occur when the Message Server changes drive. |
|
313 |
|
314 @see CMsvOperation |
|
315 @see CMsvSession::ChangeDriveL() |
|
316 @publishedAll |
|
317 @released |
|
318 */ |
|
319 { |
|
320 public: |
|
321 /** States for the index loading process. |
|
322 @publishedAll |
|
323 @released |
|
324 */ |
|
325 enum TIndexState |
|
326 { |
|
327 /** Index loading has not begun. */ |
|
328 EIndexNotLoaded = 0, |
|
329 /** Index loading is in progress. */ |
|
330 EIndexLoading, |
|
331 /** Index is being built. */ |
|
332 EIndexRebuilding, |
|
333 /** Index loading is complete. */ |
|
334 EIndexComplete}; |
|
335 // |
|
336 public: |
|
337 IMPORT_C TMsvIndexLoadProgress(); |
|
338 // |
|
339 public: |
|
340 /** Stores any errors that prevented the index being loaded. */ |
|
341 TInt iError; |
|
342 /** Current state of the index loading process. */ |
|
343 TIndexState iState; |
|
344 /** Details of the index loading progress. */ |
|
345 TMsvIndexProgress iIndex; |
|
346 }; |
|
347 |
|
348 |
|
349 |
|
350 //********************************** |
|
351 // TMsvCopyProgress |
|
352 //********************************** |
|
353 |
|
354 /** Progress information for the copy operation. |
|
355 |
|
356 @see CMsvOperation |
|
357 @see CMsvSession::CopyStoreL() |
|
358 @publishedAll |
|
359 @released |
|
360 */ |
|
361 class TMsvCopyProgress : public TMsvServerOperationProgress |
|
362 { |
|
363 public: |
|
364 /** States for the copy operation. |
|
365 @publishedAll |
|
366 @released |
|
367 */ |
|
368 enum TCopyState |
|
369 { |
|
370 /** Operation not yet started */ |
|
371 ENotYetStarted = 0, |
|
372 /** Mail Store is being locked */ |
|
373 ELock, |
|
374 /** Initialising Copy operation */ |
|
375 EInitCopy, |
|
376 /** Mail Store is being copied */ |
|
377 ECopyStore, |
|
378 /** Mail Store is being unlocked. */ |
|
379 EUnlock, |
|
380 /** Operation completed */ |
|
381 ECompleted |
|
382 }; |
|
383 |
|
384 /** Stores any errors that the operation encountered. */ |
|
385 TInt iError; |
|
386 TInt iTotal; // Total number of items to be copied |
|
387 TInt iCurrent; // Current item number being copied |
|
388 TCopyState iState; |
|
389 |
|
390 public: |
|
391 IMPORT_C TMsvCopyProgress(); |
|
392 }; |
|
393 |
|
394 |
|
395 //********************************** |
|
396 // TMsvDeleteProgress |
|
397 //********************************** |
|
398 |
|
399 /** Progress information for the delete operation. |
|
400 |
|
401 @see CMsvOperation |
|
402 @see CMsvSession::DeleteStoreL() |
|
403 @publishedAll |
|
404 @released |
|
405 */ |
|
406 class TMsvDeleteProgress : public TMsvServerOperationProgress |
|
407 { |
|
408 public: |
|
409 /** States for the delete operation. |
|
410 @publishedAll |
|
411 @released |
|
412 */ |
|
413 enum TDeleteState |
|
414 { |
|
415 /** Operation not yet started */ |
|
416 ENotYetStarted = 0, |
|
417 /** Mail Store is being deleted */ |
|
418 EDeleteStore, |
|
419 /** Operation is complete */ |
|
420 ECompleted |
|
421 }; |
|
422 |
|
423 /** Stores any errors that the operation encountered. */ |
|
424 TInt iError; |
|
425 TDeleteState iState; |
|
426 |
|
427 public: |
|
428 IMPORT_C TMsvDeleteProgress(); |
|
429 }; |
|
430 |
|
431 |
|
432 |
|
433 //********************************** |
|
434 // TMsvPackedOperation |
|
435 //********************************** |
|
436 // |
|
437 // Packs an operation, the selection, and some associated parameters (TInt) into the |
|
438 // IPC buffer |
|
439 // |
|
440 // |
|
441 |
|
442 class TMsvPackedOperation |
|
443 /** |
|
444 @internalComponent |
|
445 @released |
|
446 */ |
|
447 { |
|
448 public: |
|
449 IMPORT_C TMsvPackedOperation(HBufC8*& aBuffer); |
|
450 IMPORT_C TInt Pack(const CMsvEntrySelection& aSelection, TInt aParameter1=0, TInt aParameter2=0); |
|
451 IMPORT_C void UnpackL(CMsvEntrySelection& aSelection, TInt& aParameter1, TInt& aParameter2); |
|
452 private: |
|
453 HBufC8*& iBuffer; |
|
454 }; |
|
455 |
|
456 |
|
457 //********************************** |
|
458 // TMsvPackedChangeNotification |
|
459 //********************************** |
|
460 // |
|
461 // Packs the CMsvEntrySelection of index entries that have been changed, and also |
|
462 // the integer describing the type of change. There is a limit of KMsvPackedChangeLimit |
|
463 // top the number of entry ids that can be sent at one time |
|
464 // |
|
465 // |
|
466 |
|
467 typedef TBuf8<128> TMsvNotifBuffer; |
|
468 |
|
469 class TMsvPackedChangeNotification |
|
470 /** |
|
471 @internalComponent |
|
472 @released |
|
473 */ |
|
474 { |
|
475 public: |
|
476 enum { KMsvChangeNotificationNumberOfTInts=4, |
|
477 KMsvPackedChangeLimit=28, // 32-KMsvChangeNotificationNumberOfTInts |
|
478 }; |
|
479 public: |
|
480 IMPORT_C TMsvPackedChangeNotification(TMsvNotifBuffer& aBuffer); |
|
481 inline void Pack(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2); |
|
482 IMPORT_C void Pack(TMsvServerChangeNotificationType aChangeType, const CMsvEntrySelection& aSelection, TInt aParameter1, TInt aParameter2, TInt aStartIndex, TInt aFinishIndex); |
|
483 IMPORT_C void Pack(TMsvServerChangeNotificationType aChangeType, TMsvId aId, TInt aParameter1, TInt aParameter2); |
|
484 IMPORT_C void UnpackL(TMsvServerChangeNotificationType& aChangeType, CMsvEntrySelection& aSelection, TInt& aParameter1, TInt& aParameter2); |
|
485 private: |
|
486 TMsvNotifBuffer& iBuffer; |
|
487 }; |
|
488 |
|
489 //********************************** |
|
490 // TMsvPackedEntryFilter |
|
491 //********************************** |
|
492 |
|
493 class TMsvPackedEntryFilter |
|
494 /** |
|
495 @internalComponent |
|
496 @released |
|
497 */ |
|
498 { |
|
499 public: |
|
500 TMsvPackedEntryFilter(HBufC8*& aBuffer); |
|
501 TInt PackFilter(const CMsvEntryFilter& aFilter); |
|
502 void UnpackFilter(CMsvEntryFilter& aFilter); |
|
503 private: |
|
504 HBufC8*& iBuffer; |
|
505 }; |
|
506 |
|
507 /** |
|
508 Packs TMsvSearchSortQuery object into a buffer for sending across IPC. |
|
509 Also unpacks the buffer to TMsvSearchSortQuery |
|
510 @internalComponent |
|
511 @released |
|
512 */ |
|
513 class TMsvPackQuery |
|
514 { |
|
515 public: |
|
516 IMPORT_C TMsvPackQuery(HBufC8*& aBuffer); |
|
517 IMPORT_C TInt PackQuery(const CMsvSearchSortQuery* aQuery); |
|
518 IMPORT_C void UnpackQuery(CMsvSearchSortQuery* aQuery); |
|
519 private: |
|
520 TInt DoPackQuery(const TUint8*& aPtrStart, const TUint8* aPtrEnd, const CMsvSearchSortQuery* aQuery); |
|
521 void DoUnpackQuery(TUint8*& aPtr, CMsvSearchSortQuery* aQuery); |
|
522 private: |
|
523 HBufC8*& iBuffer; |
|
524 }; |
|
525 |
|
526 |
|
527 /** |
|
528 Packs RArray of TMsvId into a buffer for sending across IPC. |
|
529 Also unpacks the TMsvId's to RArray |
|
530 @internalComponent |
|
531 @released |
|
532 */ |
|
533 class TMsvPackedIdOperation |
|
534 { |
|
535 public: |
|
536 IMPORT_C TMsvPackedIdOperation(HBufC8*& aBuffer); |
|
537 IMPORT_C TInt Pack(const RArray<TMsvId>& aId); |
|
538 IMPORT_C void UnpackL(RArray<TMsvId>& aId); |
|
539 private: |
|
540 HBufC8*& iBuffer; |
|
541 }; |
|
542 |
|
543 /** |
|
544 Packs RArray of TMsvId with Sort field into a buffer for sending across IPC. |
|
545 Also unpacks the TMsvId and Sort filed to RArray |
|
546 @internalComponent |
|
547 @released |
|
548 */ |
|
549 class TMsvPackedIdAndMessagePart |
|
550 { |
|
551 public: |
|
552 IMPORT_C TMsvPackedIdAndMessagePart(); |
|
553 IMPORT_C TInt Size(const RArray<TMsvIdWithSortField>& aData); |
|
554 IMPORT_C void ExternalizeL(RWriteStream& aWriteStream, RArray<TMsvIdWithSortField>& aData) const; |
|
555 IMPORT_C void InternalizeL(RReadStream& aReadStream, RArray<TMsvIdWithSortField>& aData); |
|
556 }; |
|
557 |
|
558 |
|
559 #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
560 /** |
|
561 @internalComponent |
|
562 @released |
|
563 */ |
|
564 class TMsvPackedDriveIdOperation |
|
565 { |
|
566 public: |
|
567 IMPORT_C TMsvPackedDriveIdOperation(HBufC8*& aBuffer); |
|
568 IMPORT_C TInt Pack(const RArray<TDriveNumber>& aDriveNumber); |
|
569 IMPORT_C void UnpackL(RArray<TDriveNumber>& aDriveNumber); |
|
570 private: |
|
571 HBufC8*& iBuffer; |
|
572 }; |
|
573 #endif // #if (defined SYMBIAN_MSGS_ENHANCED_REMOVABLE_MEDIA_SUPPORT) |
|
574 |
|
575 |
|
576 |
|
577 #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
578 |
|
579 /** |
|
580 * Pack unpack the header structure from a buffer |
|
581 * @internalComponent |
|
582 * @released |
|
583 */ |
|
584 class TMsvPackedHeaderStructure |
|
585 { |
|
586 public: |
|
587 IMPORT_C TMsvPackedHeaderStructure(HBufC8*& aBuffer); |
|
588 IMPORT_C TInt Pack(const RPointerArray<CFieldPair>& aFieldDetails); |
|
589 IMPORT_C void UnpackL(RPointerArray<CFieldPair>& aFieldDetails); |
|
590 private: |
|
591 HBufC8*& iBuffer; |
|
592 }; |
|
593 |
|
594 |
|
595 /** |
|
596 * Pack unpack the header data from a buffer |
|
597 * @internalComponent |
|
598 * @released |
|
599 */ |
|
600 class TMsvPackedHeaderData |
|
601 { |
|
602 public: |
|
603 IMPORT_C TMsvPackedHeaderData(HBufC8*& aBuffer); |
|
604 IMPORT_C TInt Pack(const RPointerArray<CHeaderFields>& aFieldDetails); |
|
605 IMPORT_C void UnpackL(RPointerArray<CHeaderFields>& aFieldDetails); |
|
606 private: |
|
607 HBufC8*& iBuffer; |
|
608 }; |
|
609 |
|
610 #endif // #if (defined SYMBIAN_MESSAGESTORE_HEADER_BODY_USING_SQLDB) |
|
611 #include <msvipc.inl> |
|
612 |
|
613 #endif |
|
614 |