|
1 /* |
|
2 * Copyright (c) 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: Application engine for the sync events |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNSMLDMSYNCAPPENGINE_H |
|
21 #define CNSMLDMSYNCAPPENGINE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <SyncMLClient.h> |
|
26 #include "nsmldmdef.h" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CNSmlDMSyncHandler; |
|
30 class CNSmlDMSyncProfile; |
|
31 class DmInfo; |
|
32 //class CNSmlDMSyncDocument; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * MNSmlDMSyncObserver |
|
38 * |
|
39 * MNSmlDMSyncObserver is for observing Sync. |
|
40 */ |
|
41 class MNSmlDMSyncObserver |
|
42 { |
|
43 public: |
|
44 virtual void SyncComplete( TNSmlStatus aStatus ) = 0; |
|
45 }; |
|
46 |
|
47 /** |
|
48 * CNSmlDMSyncAppEngine |
|
49 * Sync engine for handling synchronization and profiles. |
|
50 */ |
|
51 NONSHARABLE_CLASS (CNSmlDMSyncAppEngine) : public CBase |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 */ |
|
58 static CNSmlDMSyncAppEngine* NewL(DmInfo* dmObj); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CNSmlDMSyncAppEngine(); |
|
64 |
|
65 public: // New functions |
|
66 |
|
67 /** |
|
68 * Delete profile |
|
69 * @param aProfileId Profile to be deleted. |
|
70 * @return None |
|
71 */ |
|
72 void DeleteProfileL( TInt aProfileId ); |
|
73 |
|
74 /** |
|
75 * Create profile |
|
76 * @param None. |
|
77 * @return None |
|
78 */ |
|
79 TInt CreateProfileL(); |
|
80 |
|
81 /** |
|
82 * Create copy profile |
|
83 * @param aProfileId Profile that is used for copying |
|
84 * @return None |
|
85 */ |
|
86 CNSmlDMSyncProfile* CreateCopyProfileL( TInt aProfileId ); |
|
87 |
|
88 /** |
|
89 * Return current profile |
|
90 * @param None. |
|
91 * @return CNSmlDMSyncProfile* |
|
92 */ |
|
93 CNSmlDMSyncProfile* Profile( ); |
|
94 |
|
95 /** |
|
96 * Cancel synchronization |
|
97 * @param None. |
|
98 * @return None |
|
99 */ |
|
100 void CancelSyncL(); |
|
101 |
|
102 /** |
|
103 * Return RSyncMLSession |
|
104 * @param None. |
|
105 * @return RSyncMLSession* |
|
106 */ |
|
107 RSyncMLSession* Session(); |
|
108 |
|
109 /** |
|
110 * Open profile |
|
111 * @param aProfileId Profile id to open |
|
112 * @param aOpenMode opening mode |
|
113 * @return None |
|
114 */ |
|
115 CNSmlDMSyncProfile* OpenProfileL( TInt aProfileId, |
|
116 TInt aOpenMode = ESmlOpenReadWrite ); |
|
117 |
|
118 /** |
|
119 * Close profile |
|
120 * @param None. |
|
121 * @return None |
|
122 */ |
|
123 void CloseProfile(); |
|
124 |
|
125 /** |
|
126 * Start synchronization |
|
127 * @param aProfileId Profile id to sync |
|
128 * @return None |
|
129 */ |
|
130 void SynchronizeL( TDesC& aServerName, |
|
131 const TInt aProfileId, |
|
132 const TInt aConnectionBearer, |
|
133 const TBool aUseFotaProgressNote ); |
|
134 |
|
135 /** |
|
136 * Start synchronization |
|
137 * @param aProfileId Profile id to sync |
|
138 * @param aJobId Jod id to sync |
|
139 * @return None |
|
140 */ |
|
141 void SynchronizeL( TDesC& aServerName, |
|
142 const TInt aProfileId, |
|
143 const TInt aJobId, |
|
144 const TInt aConnectionBearer, |
|
145 const TBool aUseFotaProgressNote ); |
|
146 |
|
147 /** |
|
148 * Check if duplicate server id is found |
|
149 * @param aServerId Server id |
|
150 * @param aProfileId current profile id |
|
151 * @return ETrue if server id found |
|
152 */ |
|
153 TBool ServerIdFoundL( const TDesC& aServerId, const TInt aProfileId ); |
|
154 |
|
155 /** |
|
156 * Compare two descriptors |
|
157 * @param aLeft |
|
158 * @param aRight |
|
159 * @return - Positive, if this descriptor is |
|
160 * greater than the specified descriptor. |
|
161 * Negative, if this descriptor is |
|
162 * less than the specified descriptor. |
|
163 * Zero, if the content of both descriptors match |
|
164 */ |
|
165 TInt Compare( const TDesC& aLeft, const TDesC& aRight ); |
|
166 |
|
167 /** |
|
168 * Sync state |
|
169 * @param None |
|
170 * @return ETrue if sync is running |
|
171 */ |
|
172 TBool SyncRunning(); |
|
173 |
|
174 /** |
|
175 * Utility function. |
|
176 * @param aSyncObserver |
|
177 * @return None |
|
178 */ |
|
179 void RequestSyncStatus( MNSmlDMSyncObserver* aSyncObserver ); |
|
180 |
|
181 void SyncCompleted( TNSmlStatus aStatus ); |
|
182 |
|
183 /** |
|
184 * Hides or shows the device management progress dialog. |
|
185 * @since Series 60 3.1 |
|
186 * @param aShow ETrue -> The progress dialog is shown; EFalse -> The dialog is hidden. |
|
187 * @return None |
|
188 */ |
|
189 void ShowProgressDialogL( TBool aShow ); |
|
190 |
|
191 private: |
|
192 |
|
193 /** |
|
194 * C++ default constructor. |
|
195 */ |
|
196 CNSmlDMSyncAppEngine(); |
|
197 |
|
198 /** |
|
199 * By default Symbian 2nd phase constructor is private. |
|
200 */ |
|
201 void ConstructL( DmInfo* dmcallback ); |
|
202 |
|
203 |
|
204 private: // Data |
|
205 // SyncML Session |
|
206 RSyncMLSession iSyncMLSession; |
|
207 // Sync profile |
|
208 CNSmlDMSyncProfile* iProfile; |
|
209 // Sync handler |
|
210 CNSmlDMSyncHandler* iSyncHandler; |
|
211 TBool iProgressShown; |
|
212 // Sync Observer |
|
213 MNSmlDMSyncObserver* iSyncObserver; |
|
214 DmInfo* iDmcallback; |
|
215 }; |
|
216 |
|
217 #endif // CNSMLDMSYNCAPPENGINE_H |
|
218 |
|
219 // End of File |