|
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: Profile container class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CNSMLDMSYNCPROFILE_H |
|
21 #define CNSMLDMSYNCPROFILE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include <SyncMLClient.h> |
|
26 #include <SyncMLClientDM.h> |
|
27 #include "NSmlDMdef.h" |
|
28 |
|
29 #include "NSmlDMSyncApp.h" |
|
30 |
|
31 |
|
32 /** |
|
33 * CNSmlDMSyncProfile |
|
34 * |
|
35 * CNSmlDMSyncProfile is used for getting/setting sync profile settings. |
|
36 */ |
|
37 NONSHARABLE_CLASS (CNSmlDMSyncProfile) : public CBase |
|
38 { |
|
39 enum TOpenMode |
|
40 { |
|
41 EOpenRead, |
|
42 EOpenReadWrite |
|
43 }; |
|
44 |
|
45 public: |
|
46 /** |
|
47 * Two-phased constructor. |
|
48 * @param aParam |
|
49 */ |
|
50 static CNSmlDMSyncProfile* NewLC( const TInt aApplicationId, |
|
51 RSyncMLSession* aSyncSession); |
|
52 |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 * @param aParam |
|
56 */ |
|
57 static CNSmlDMSyncProfile* NewL( const TInt aApplicationId, |
|
58 RSyncMLSession* aSyncSession ); |
|
59 |
|
60 /** |
|
61 * Destructor. |
|
62 */ |
|
63 virtual ~CNSmlDMSyncProfile(); |
|
64 |
|
65 private: |
|
66 /** |
|
67 * C++ default constructor. |
|
68 * @param aParam |
|
69 */ |
|
70 CNSmlDMSyncProfile( const TInt aApplicationId, |
|
71 RSyncMLSession* aSyncSession ); |
|
72 |
|
73 /** |
|
74 * By default Symbian 2nd phase constructor is private. |
|
75 */ |
|
76 void ConstructL(); |
|
77 |
|
78 public: |
|
79 /** |
|
80 * Open profile |
|
81 * @param aProfileId Profile id to open |
|
82 * @param aOpenMode Opening mode |
|
83 * @return None |
|
84 */ |
|
85 void OpenL( TInt aProfileId, TInt aOpenMode ); |
|
86 |
|
87 /** |
|
88 * Create profile |
|
89 * @param None. |
|
90 * @return Profile ID. |
|
91 */ |
|
92 TInt CreateL(); |
|
93 |
|
94 /** |
|
95 * Create copy profile |
|
96 * @param aProfileId Profile that is used for copying |
|
97 * @return None |
|
98 */ |
|
99 void CreateCopyL( TInt aProfileId ); |
|
100 |
|
101 /** |
|
102 * Save profile |
|
103 * @param None |
|
104 * @return None |
|
105 */ |
|
106 void SaveL(); |
|
107 |
|
108 public: |
|
109 |
|
110 /** |
|
111 * Set name for profile |
|
112 * @param aText name for profile |
|
113 * @return None |
|
114 */ |
|
115 void SetNameL(const TDesC& aText); |
|
116 |
|
117 /** |
|
118 * Get profile name |
|
119 * @param aText name for profile |
|
120 * @return None |
|
121 */ |
|
122 void GetName( TDes& aText ); |
|
123 |
|
124 /** |
|
125 * Set creator id for the profile |
|
126 * @param aCreatorId creator id |
|
127 * @return None |
|
128 */ |
|
129 void SetCreatorId(TInt aCraetorId); |
|
130 |
|
131 /** |
|
132 * Get creator id |
|
133 * @param None |
|
134 * @return creator id |
|
135 */ |
|
136 TInt CreatorId(); |
|
137 |
|
138 /** |
|
139 * Get profile id |
|
140 * @param None |
|
141 * @return Currently open profile id |
|
142 */ |
|
143 TInt ProfileId(); |
|
144 |
|
145 /** |
|
146 * Check if delete is allowed |
|
147 * @param None |
|
148 * @return ETrue if allowed |
|
149 */ |
|
150 TBool DeleteAllowed(); |
|
151 |
|
152 |
|
153 TBool ProfileLocked(); |
|
154 /** |
|
155 * Has profile been synced |
|
156 * @param None |
|
157 * @return ETrue if synced |
|
158 */ |
|
159 TBool IsSynced(); |
|
160 |
|
161 /** |
|
162 * Last sync time |
|
163 * @param None |
|
164 * @return Time of sync |
|
165 */ |
|
166 TTime LastSync(); |
|
167 |
|
168 /** |
|
169 * Last Success sync time |
|
170 * @param None |
|
171 * @return Time of sync |
|
172 */ |
|
173 TTime LastSuccessSync(); |
|
174 |
|
175 // settings that connection dialog displays |
|
176 public: |
|
177 /** |
|
178 * Set server id |
|
179 * @param aText server id |
|
180 * @return None |
|
181 */ |
|
182 void SetServerIdL(const TDesC& aText); |
|
183 |
|
184 /** |
|
185 * Get server id |
|
186 * @param aText server id |
|
187 * @return NOne |
|
188 */ |
|
189 void GetServerId(TDes& aText); |
|
190 |
|
191 /** |
|
192 * Get server password |
|
193 * @param aText server password |
|
194 * @return None |
|
195 */ |
|
196 void GetServerPassword( TDes& aText ); |
|
197 |
|
198 /** |
|
199 * Set server password |
|
200 * @param aText server password |
|
201 * @return None |
|
202 */ |
|
203 void SetServerPasswordL( const TDesC& aText ); |
|
204 |
|
205 /** |
|
206 * Get protocol version |
|
207 * @param None |
|
208 * @return Version |
|
209 */ |
|
210 TInt ProtocolVersion(); |
|
211 |
|
212 /** |
|
213 * Set Protocol version |
|
214 * @param aProtocolVersion protocol version |
|
215 * @return None |
|
216 */ |
|
217 void SetProtocolVersionL( TInt aProtocolVersion ); |
|
218 |
|
219 /** |
|
220 * Get bearer type |
|
221 * @param None |
|
222 * @return bearer type |
|
223 */ |
|
224 TInt BearerType(); |
|
225 |
|
226 /** |
|
227 * Set bearer type |
|
228 * @param aId bearer type |
|
229 * @return None |
|
230 */ |
|
231 void SetBearerTypeL( TInt aId ); |
|
232 |
|
233 /** |
|
234 * Get accesspoint |
|
235 * @param None |
|
236 * @return accespoint |
|
237 */ |
|
238 TInt AccessPointL(); |
|
239 |
|
240 /** |
|
241 * Set accesspoint |
|
242 * @param aId accespoint id |
|
243 * @return None |
|
244 */ |
|
245 void SetAccessPointL(const TInt aId); |
|
246 |
|
247 /** |
|
248 * Get host address |
|
249 * @param aText host address |
|
250 * @param aPort host port |
|
251 * @return None |
|
252 */ |
|
253 void GetHostAddress( TDes& aText, TInt& aPort ); |
|
254 |
|
255 /** |
|
256 * set host address |
|
257 * @param aText host address |
|
258 * @param aPort host |
|
259 * @return None |
|
260 */ |
|
261 void SetHostAddressL( const TDesC& aText, const TInt aPort ); |
|
262 |
|
263 /** |
|
264 * Get port number |
|
265 * @param None |
|
266 * @return port number |
|
267 */ |
|
268 TInt PortNumber(); |
|
269 |
|
270 /** |
|
271 * Set port number |
|
272 * @param aPortNumber port number |
|
273 * @return None |
|
274 */ |
|
275 void SetPortNumber( TInt aPortNumber ); |
|
276 |
|
277 /** |
|
278 * Get user name |
|
279 * @param aText user name |
|
280 * @return None |
|
281 */ |
|
282 void GetUserName( TDes& aText ); |
|
283 |
|
284 /** |
|
285 * Set user name |
|
286 * @param aText user name |
|
287 * @return None |
|
288 */ |
|
289 void SetUserNameL( const TDesC& aText ); |
|
290 |
|
291 /** |
|
292 * Get user password |
|
293 * @param aText user password |
|
294 * @return None |
|
295 */ |
|
296 void GetPassword( TDes& aText ); |
|
297 |
|
298 /** |
|
299 * Set user password |
|
300 * @param aText user password |
|
301 * @return None |
|
302 */ |
|
303 void SetPasswordL( const TDesC& aText ); |
|
304 |
|
305 /** |
|
306 * Set server alert state |
|
307 * @param aState server alert state |
|
308 * @return None |
|
309 */ |
|
310 void SetSASyncStateL( TInt aState ); |
|
311 |
|
312 /** |
|
313 * Get Server alert state |
|
314 * @param None |
|
315 * @return server alert state |
|
316 */ |
|
317 TInt SASyncState(); |
|
318 |
|
319 /** |
|
320 * Set http used state |
|
321 * @param aEnable ETrue if http authentication needs to be used |
|
322 * @return None |
|
323 */ |
|
324 void SetHttpUsedL( TBool aEnable ); |
|
325 |
|
326 /** |
|
327 * Check whether http authentication is used |
|
328 * @param None |
|
329 * @return ETrue if http authentication is used |
|
330 */ |
|
331 TBool HttpUsedL(); |
|
332 |
|
333 /** |
|
334 * Get http user name |
|
335 * @param aText user name |
|
336 * @return None |
|
337 */ |
|
338 void GetHttpUserNameL( TDes& aText ); |
|
339 |
|
340 /** |
|
341 * Set http user name |
|
342 * @param aText user name |
|
343 * @return None |
|
344 */ |
|
345 void SetHttpUserNameL( const TDesC& aText ); |
|
346 |
|
347 /** |
|
348 * Get http password |
|
349 * @param aText password |
|
350 * @return None |
|
351 */ |
|
352 void GetHttpPasswordL( TDes& aText ); |
|
353 |
|
354 /** |
|
355 * Set http password |
|
356 * @param aText password |
|
357 * @return None |
|
358 */ |
|
359 void SetHttpPasswordL( const TDesC& aText ); |
|
360 |
|
361 |
|
362 public: |
|
363 |
|
364 /** |
|
365 * Return latest history job |
|
366 * @param None |
|
367 * @return CSyncMLHistoryJob* |
|
368 */ |
|
369 const CSyncMLHistoryJob* LatestHistoryJob(); |
|
370 |
|
371 /** |
|
372 * Open connection |
|
373 * @param None |
|
374 * @return None |
|
375 */ |
|
376 void OpenConnection(); |
|
377 |
|
378 /** |
|
379 * Open history log |
|
380 * @param None |
|
381 * @return None |
|
382 */ |
|
383 void OpenHistoryLog(); |
|
384 |
|
385 /** |
|
386 * Close history log |
|
387 * @param None |
|
388 * @return None |
|
389 */ |
|
390 void CloseHistoryLog(); |
|
391 |
|
392 /** |
|
393 * Return DevMan profile |
|
394 * @param None |
|
395 * @return RSyncMLDevManProfile& |
|
396 */ |
|
397 RSyncMLDevManProfile& Profile(); |
|
398 |
|
399 /** |
|
400 * Return SyncML Session |
|
401 * @param None |
|
402 * @return RSyncMLSession& |
|
403 */ |
|
404 RSyncMLSession& Session(); |
|
405 |
|
406 public: |
|
407 /** |
|
408 * Get connection name |
|
409 * @param aText name |
|
410 * @param aPropertyPos position at the array |
|
411 * @return None |
|
412 */ |
|
413 void GetConnectionPropertyNameL( TDes8& aText, TInt aPropertyPos ); |
|
414 |
|
415 private: |
|
416 |
|
417 /** |
|
418 * Copy values from one profile to another |
|
419 * @param aSource source profile |
|
420 * @return None |
|
421 */ |
|
422 void CopyValuesL( CNSmlDMSyncProfile* aSource ); |
|
423 |
|
424 private: |
|
425 // profile id |
|
426 TInt iProfileId; |
|
427 // Log open |
|
428 TBool iHistoryLogOpen; |
|
429 // Connection open |
|
430 TBool iConnectionOpen; |
|
431 // Port number |
|
432 TInt iPortNumber; |
|
433 // needed for setting creator id |
|
434 TInt iApplicationId; |
|
435 // long buffer for string handling |
|
436 TBuf<KBufSize255> iBuf; |
|
437 // long buffer for string handling |
|
438 TBuf8<KBufSize255> iBuf8; |
|
439 // sync session |
|
440 RSyncMLSession* iSyncSession; |
|
441 // sync profile |
|
442 RSyncMLDevManProfile iProfile; |
|
443 // history log |
|
444 RSyncMLHistoryLog iHistoryLog; |
|
445 // sync connection |
|
446 RSyncMLConnection iConnection; |
|
447 }; |
|
448 |
|
449 #endif // CNSMLDMSYNCPROFILE_H |
|
450 |
|
451 // End of file |