|
1 // Copyright (c) 2008-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 |
|
17 #ifndef __CMSVCONVERTERWAITER_H__ |
|
18 #define __CMSVCONVERTERWAITER_H__ |
|
19 |
|
20 #include "MSVSERV.H" |
|
21 #include <f32file.h> |
|
22 #include "e32std.h" |
|
23 #include "e32const.h" |
|
24 #include <e32property.h> |
|
25 |
|
26 |
|
27 // Constants. These are used in public and subscribe mechanism that is used to handle |
|
28 // conversion cancel request |
|
29 const TUint KMyPropertyName = 0x0003; |
|
30 const TUid KMyPropertyCat = {0x10034567}; |
|
31 |
|
32 |
|
33 /** |
|
34 CMsvConverterWaiter |
|
35 This acts as a waiter class and is responsible for creating, initiating and communicating with the |
|
36 converter thread. It initiates message store conversion on the specified drive and upon successful |
|
37 completion, updates the drive status to supported in preferred drive list. This class provides a |
|
38 way of asynchronous handling of store conversion. |
|
39 |
|
40 @internalAll |
|
41 @released |
|
42 */ |
|
43 NONSHARABLE_CLASS (CMsvConverterWaiter) : public CActive |
|
44 { |
|
45 public: |
|
46 static CMsvConverterWaiter* InstanceL(CMsvServer* aServer); |
|
47 static CMsvConverterWaiter* Instance(); |
|
48 ~CMsvConverterWaiter(); |
|
49 void StartMessageStoreConversionL(const RMessage2& aMessage,TBool aQueuedRequest); |
|
50 void CancelConversionL(const RMessage2& aMessage); |
|
51 void GetConversionStatus(const RMessage2& aMessage); |
|
52 TBool isRunningMessageStoreConverter(); |
|
53 void QueueConversionRequestL(const RMessage2& aMessage); |
|
54 |
|
55 private: |
|
56 CMsvConverterWaiter(CMsvServer* aServer); |
|
57 TInt ValidateRequestedDriveL(TDriveNumber aDrive); |
|
58 TInt ValidateDriveInPreferredDriveListL(TDriveNumber aDrive); |
|
59 |
|
60 TInt Start(); |
|
61 void Completed(const TInt aStatus); |
|
62 // active object |
|
63 void DoCancel(); |
|
64 void RunL(); |
|
65 TInt DefineProperty(); |
|
66 TInt PublishProperty(TInt aValue); |
|
67 private: |
|
68 |
|
69 // conversion queue structure |
|
70 struct TConversionQueue |
|
71 { |
|
72 TDriveNumber iDriveNumber; |
|
73 RMessage2 iMessage; |
|
74 }; |
|
75 |
|
76 static CMsvConverterWaiter* iConverterWaiter; |
|
77 RArray<TConversionQueue> iConverterQueue; |
|
78 RThread iConverterThread; |
|
79 CMsvServer *iServer; |
|
80 TDriveNumber iDriveNumber; |
|
81 RProperty iProperty; |
|
82 |
|
83 #if (defined SYMBIAN_MESSAGESTORE_UNIT_TESTCODE) |
|
84 friend class CTestMessageConverterWaiter; |
|
85 #endif |
|
86 }; |
|
87 |
|
88 #endif //__CMSVCONVERTERWAITER_H__ |
|
89 |
|
90 |
|
91 |
|
92 |