|
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: Interface class of cdssync. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 #ifndef __CDSSYNC_H__ |
|
24 #define __CDSSYNC_H__ |
|
25 |
|
26 #include <e32cons.h> |
|
27 #include <e32base.h> |
|
28 |
|
29 class CCdsSyncImpl; |
|
30 |
|
31 /** |
|
32 * Callback class of CdsSync |
|
33 * |
|
34 * @lib cdssync.lib |
|
35 * |
|
36 * @since S60 5.1 |
|
37 */ |
|
38 class MCdsSyncObserver |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Indicates the number of processed items. |
|
44 * |
|
45 * @since S60 5.1 |
|
46 * @param aItemCount, number of processed items |
|
47 */ |
|
48 virtual void ProgressL( TInt aItemCount ) = 0; |
|
49 |
|
50 /** |
|
51 * Indicates that new chunk is completely processed. |
|
52 * |
|
53 * @since S60 5.1 |
|
54 */ |
|
55 virtual void ChunkCompleteL() = 0; |
|
56 |
|
57 /** |
|
58 * Whole synchronization is complete without errors |
|
59 * |
|
60 * @since S60 5.1 |
|
61 */ |
|
62 virtual void SyncCompleteL() = 0; |
|
63 |
|
64 /** |
|
65 * Error happened during synchronization. |
|
66 * |
|
67 * @since S60 5.1 |
|
68 * @param aError, error code |
|
69 */ |
|
70 virtual void SyncErrorL( TInt aError ) = 0; |
|
71 }; |
|
72 |
|
73 /** |
|
74 * CDS Sync class definition |
|
75 * |
|
76 * @since S60 5.1 |
|
77 */ |
|
78 class CCdsSync : public CBase |
|
79 { |
|
80 |
|
81 public: |
|
82 |
|
83 /** |
|
84 * Two-phase constructor |
|
85 */ |
|
86 IMPORT_C static CCdsSync* NewLC(); |
|
87 |
|
88 /** |
|
89 * Two-phase constructor |
|
90 */ |
|
91 IMPORT_C static CCdsSync* NewL(); |
|
92 |
|
93 /** |
|
94 * Destructor |
|
95 */ |
|
96 virtual ~CCdsSync(); |
|
97 |
|
98 |
|
99 public: |
|
100 |
|
101 /** |
|
102 * Initialises the instance with source array and correct device id |
|
103 * |
|
104 * @since S60 5.1 |
|
105 * @param aSourceDataArray, array where search responses are added |
|
106 * @param aDeviceId, database id of the device which is harvested |
|
107 * @param aObserver, callback to observer |
|
108 * @param aAddGranularity, granularity how much items are |
|
109 * added to db at once |
|
110 */ |
|
111 IMPORT_C void InitL( RPointerArray<HBufC8>& aSourceDataArray, |
|
112 const TInt& aDeviceId, |
|
113 MCdsSyncObserver& aObserver, |
|
114 TInt aAddGranularity); |
|
115 |
|
116 |
|
117 /** |
|
118 * Client indicates that new search response has been added to |
|
119 * source data array. |
|
120 * |
|
121 * @since S60 5.1 |
|
122 * @param aSourceDataComplete, boolean indicating whether the device |
|
123 * has been fully searched. |
|
124 */ |
|
125 IMPORT_C void NotifySourceDataAddedL( |
|
126 TBool aSourceDataComplete = EFalse ); |
|
127 |
|
128 /** |
|
129 * Reset the cdssync instance to default state. |
|
130 * |
|
131 * @since S60 5.1 |
|
132 */ |
|
133 IMPORT_C void ResetL(); |
|
134 |
|
135 /** |
|
136 * Returns the source data chunk count including the current chunk |
|
137 * in process. |
|
138 * |
|
139 * @since S60 5.1 |
|
140 * @return TInt, count of chunks to be processed |
|
141 */ |
|
142 IMPORT_C TInt ChunkCount(); |
|
143 |
|
144 |
|
145 /** |
|
146 * Returns successfully processed item count. |
|
147 * |
|
148 * @since S60 5.1 |
|
149 * @return TInt count of items that has been processed successfully. |
|
150 */ |
|
151 IMPORT_C TInt ProcessedItemCount(); |
|
152 |
|
153 /** |
|
154 * Sets search index to cds sync |
|
155 * |
|
156 * @since S60 5.1 |
|
157 * @param aSearchIndex, search index |
|
158 */ |
|
159 IMPORT_C void SetSearchIndex( const TInt aSearchIndex ); |
|
160 |
|
161 private: |
|
162 |
|
163 // Default constructor |
|
164 CCdsSync(); |
|
165 |
|
166 // Second-phase constructor |
|
167 void ConstructL(); |
|
168 |
|
169 private: |
|
170 |
|
171 /** |
|
172 * Actual implementation instance |
|
173 */ |
|
174 CCdsSyncImpl* iSyncImpl; // Owned |
|
175 |
|
176 }; |
|
177 |
|
178 #endif |