|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Sync state class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef NSMLDMSYNCSTATE_H |
|
21 #define NSMLDMSYNCSTATE_H |
|
22 |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 // CLASS DECLARATION |
|
28 |
|
29 /* |
|
30 * CNSmlDMSyncState |
|
31 * |
|
32 * CNSmlDMSyncState handles sync states |
|
33 */ |
|
34 NONSHARABLE_CLASS (CNSmlDMSyncState) : public CBase |
|
35 { |
|
36 public: |
|
37 enum TSyncPhase |
|
38 { |
|
39 EPhaseConnecting = 0, |
|
40 EPhaseInitialising, |
|
41 EPhaseSending, |
|
42 EPhaseReceiving, |
|
43 EPhaseSynchronizing, |
|
44 EPhaseDisconnecting, |
|
45 EPhaseCanceling, |
|
46 EPhaseNone, |
|
47 EPhaseFinal |
|
48 |
|
49 }; |
|
50 |
|
51 public: |
|
52 /** |
|
53 * Two-phased constructor. |
|
54 */ |
|
55 static CNSmlDMSyncState* NewL(); |
|
56 |
|
57 /** |
|
58 * Destructor. |
|
59 */ |
|
60 virtual ~CNSmlDMSyncState(); |
|
61 |
|
62 private: |
|
63 /** |
|
64 * By default Symbian 2nd phase constructor is private. |
|
65 */ |
|
66 CNSmlDMSyncState(); |
|
67 |
|
68 /** |
|
69 * C++ default constructor. |
|
70 */ |
|
71 void ConstructL(); |
|
72 |
|
73 public: |
|
74 /** |
|
75 * Reset state variables. |
|
76 * @param None. |
|
77 * @return None. |
|
78 */ |
|
79 void Reset(); |
|
80 |
|
81 public: |
|
82 /** |
|
83 * Set synchronization phase. |
|
84 * @param aPhase synchronization phase. |
|
85 * @return None. |
|
86 */ |
|
87 void SetSyncPhase(TInt aPhase); |
|
88 |
|
89 /** |
|
90 * Get synchronization phase. |
|
91 * @param None. |
|
92 * @return Synchronization phase. |
|
93 */ |
|
94 TInt SyncPhase(); |
|
95 |
|
96 /** |
|
97 * Set total sync progress. |
|
98 * @param aCount Progress count. |
|
99 * @return None. |
|
100 */ |
|
101 void SetTotalProgress(TInt aCount); |
|
102 |
|
103 /** |
|
104 * Get total sync progress. |
|
105 * @param None. |
|
106 * @return Progress count. |
|
107 */ |
|
108 TInt TotalProgress(); |
|
109 |
|
110 /** |
|
111 * Set sync progress. |
|
112 * @param aCount Progress count. |
|
113 * @return None. |
|
114 */ |
|
115 void SetProgress(TInt aCount); |
|
116 |
|
117 /** |
|
118 * Increase sync progress. |
|
119 * @param None. |
|
120 * @return None. |
|
121 */ |
|
122 void IncreaseProgress(); |
|
123 |
|
124 /** |
|
125 * Get sync progress. |
|
126 * @param None. |
|
127 * @return Progress count. |
|
128 */ |
|
129 TInt Progress(); |
|
130 |
|
131 /** |
|
132 * Set sync content name. |
|
133 * @param aContent Content name. |
|
134 * @return None. |
|
135 */ |
|
136 void SetContent(const TDesC& aContent); |
|
137 |
|
138 /** |
|
139 * Get sync content name. |
|
140 * @param None. |
|
141 * @return Content name. |
|
142 */ |
|
143 const TDesC& Content(); |
|
144 |
|
145 /** |
|
146 * Resets progress state. |
|
147 * @param None. |
|
148 * @return None. |
|
149 */ |
|
150 void ResetProgress(); |
|
151 |
|
152 /** |
|
153 * Finds out whether total progress count is known. |
|
154 * @param None. |
|
155 * @return ETrue if total progress count is known, EFalse otherwise. |
|
156 */ |
|
157 TBool ProgressKnown(); |
|
158 |
|
159 private: |
|
160 // synchronization phase |
|
161 TInt iSyncPhase; |
|
162 |
|
163 // total number of sent/received sync items |
|
164 TInt iTotalProgressCount; |
|
165 |
|
166 // number of sent/received sync items |
|
167 TInt iProgressCount; |
|
168 |
|
169 // name of the content being synced |
|
170 TName iSyncContent; |
|
171 }; |
|
172 |
|
173 #endif // NSMLDMSYNCSTATE_H |
|
174 |
|
175 // End of File |