|
1 /* |
|
2 * Copyright (c) 2009 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: API for clients of the Data Synchronization and Device Management. Used to start, stop and observe synchronization/device management session, and modify data synchronization/device management settings. |
|
15 * |
|
16 */ |
|
17 /////////////////////////////////////////////////////////////////////////////// |
|
18 // SyncMLClient.h |
|
19 // v09 |
|
20 // |
|
21 /////////////////////////////////////////////////////////////////////////////// |
|
22 #ifndef __SYNCMLCLIENT_H__ |
|
23 #define __SYNCMLCLIENT_H__ |
|
24 // |
|
25 #include <e32std.h> |
|
26 #include <badesca.h> |
|
27 #include <SyncMLDef.h> |
|
28 #include <SyncMLHistory.h> |
|
29 // |
|
30 class CClientSessionData; |
|
31 class CSmlActiveCallback; |
|
32 class CSyncMLTransportPropertiesArray; |
|
33 class MSyncMLEventObserver; |
|
34 class MSyncMLProgressObserver; |
|
35 // |
|
36 |
|
37 |
|
38 /////////////////////////////////////////////////////////////////////////////// |
|
39 // RSyncMLSession |
|
40 /////////////////////////////////////////////////////////////////////////////// |
|
41 class RSyncMLSession : public RSessionBase |
|
42 /** |
|
43 A client handle to a SyncML Sync Agent session. |
|
44 |
|
45 An instance of this class must be created in order to instantiate any of |
|
46 the other client-side classes. |
|
47 |
|
48 Accessor methods are provided to enable clients to retrieve identifiers |
|
49 of current and queued jobs, and of available profiles, transports, and |
|
50 data providers. These IDs can be used to open handles on these objects |
|
51 in order to manipulate them. |
|
52 |
|
53 Clients can request notifications of events related to jobs, profiles, transports, |
|
54 and the SyncML Agent, and can request progress for the currently running job. |
|
55 @publishedAll |
|
56 @released |
|
57 */ |
|
58 { |
|
59 public: |
|
60 IMPORT_C RSyncMLSession(); |
|
61 IMPORT_C void OpenL(); |
|
62 |
|
63 IMPORT_C void RequestEventL(MSyncMLEventObserver&); |
|
64 IMPORT_C void CancelEvent(); |
|
65 |
|
66 IMPORT_C void RequestProgressL(MSyncMLProgressObserver&); |
|
67 IMPORT_C void CancelProgress(); |
|
68 |
|
69 IMPORT_C void CurrentJobL(TSmlJobId&, TSmlUsageType&) const; |
|
70 IMPORT_C void ListQueuedJobsL(RArray<TSmlJobId>&, TSmlUsageType) const; |
|
71 |
|
72 IMPORT_C void ListProfilesL(RArray<TSmlProfileId>&, TSmlUsageType) const; |
|
73 IMPORT_C void ListTransportsL(RArray<TSmlTransportId>&) const; |
|
74 IMPORT_C void ListDataProvidersL(RArray<TSmlDataProviderId>&) const; |
|
75 |
|
76 IMPORT_C void DeleteProfileL(TSmlProfileId); |
|
77 |
|
78 IMPORT_C TSmlProtocolVersion ListProtocolVersionsL(TSmlUsageType, RArray<TSmlProtocolVersion>&) const; |
|
79 |
|
80 IMPORT_C void Close(); |
|
81 /**@internalTechnology*/ |
|
82 IMPORT_C void _DbgTestSettingL(TInt aSetting, TInt aParam); |
|
83 |
|
84 private: |
|
85 void ReceiveArrayL(RArray<TInt>&, TInt, TInt, TInt) const; |
|
86 private: |
|
87 mutable CClientSessionData* iData; |
|
88 friend class CSmlActiveCallback; |
|
89 CSmlActiveCallback* iEventCallback; |
|
90 private: |
|
91 // Prohibited. |
|
92 RSyncMLSession& operator=(const RSyncMLSession&); |
|
93 RSyncMLSession(const RSyncMLSession&); |
|
94 }; |
|
95 |
|
96 /////////////////////////////////////////////////////////////////////////////// |
|
97 /////////////////////////////////////////////////////////////////////////////// |
|
98 |
|
99 |
|
100 /////////////////////////////////////////////////////////////////////////////// |
|
101 // RSyncMLSettings |
|
102 /////////////////////////////////////////////////////////////////////////////// |
|
103 class RSyncMLSettings : public RSubSessionBase |
|
104 /** |
|
105 Handle to global settings for SyncML sync behaviour. |
|
106 |
|
107 @publishedAll |
|
108 @released |
|
109 @see TSmlGlobalSetting |
|
110 */ |
|
111 { |
|
112 public: |
|
113 IMPORT_C void OpenL(RSyncMLSession&); |
|
114 |
|
115 IMPORT_C TInt GetValueL(TSmlGlobalSetting) const; |
|
116 IMPORT_C void SetValueL(TSmlGlobalSetting, TInt aValue); |
|
117 |
|
118 IMPORT_C void Close(); |
|
119 }; |
|
120 |
|
121 /////////////////////////////////////////////////////////////////////////////// |
|
122 /////////////////////////////////////////////////////////////////////////////// |
|
123 |
|
124 /////////////////////////////////////////////////////////////////////////////// |
|
125 // RSyncMLHistoryLog |
|
126 /////////////////////////////////////////////////////////////////////////////// |
|
127 class RSyncMLHistoryLog : public RSubSessionBase |
|
128 /** |
|
129 Snapshot of history for a profile. |
|
130 @publishedAll |
|
131 @released |
|
132 */ |
|
133 { |
|
134 public: |
|
135 IMPORT_C RSyncMLHistoryLog(); |
|
136 IMPORT_C void OpenL(RSyncMLSession&, TSmlProfileId); |
|
137 IMPORT_C void SortEntries(CSyncMLHistoryEntry::TSortOrder); |
|
138 IMPORT_C void DeleteAllEntriesL(); |
|
139 IMPORT_C TSmlProfileId Profile() const; |
|
140 IMPORT_C TInt Count() const; |
|
141 IMPORT_C const CSyncMLHistoryEntry& Entry(TInt aIndex) const; |
|
142 inline const CSyncMLHistoryEntry& operator[](TInt aIndex) const; |
|
143 IMPORT_C void Close(); |
|
144 |
|
145 private: |
|
146 mutable CClientSessionData* iData; |
|
147 private: |
|
148 // Prohibited. |
|
149 RSyncMLHistoryLog& operator=(const RSyncMLHistoryLog&); |
|
150 RSyncMLHistoryLog(const RSyncMLHistoryLog&); |
|
151 }; |
|
152 |
|
153 /////////////////////////////////////////////////////////////////////////////// |
|
154 inline const CSyncMLHistoryEntry& RSyncMLHistoryLog::operator[](TInt aIndex) const |
|
155 /** |
|
156 Returns the entry at the specified index. |
|
157 @return The entry at the specified index. |
|
158 @param aIndex The index of the entry to retrieve. |
|
159 @publishedAll |
|
160 @released |
|
161 @pre The handle is open. |
|
162 */ |
|
163 { |
|
164 return Entry(aIndex); |
|
165 } |
|
166 |
|
167 /////////////////////////////////////////////////////////////////////////////// |
|
168 /////////////////////////////////////////////////////////////////////////////// |
|
169 |
|
170 |
|
171 /////////////////////////////////////////////////////////////////////////////// |
|
172 // RSyncMLJobBase |
|
173 /////////////////////////////////////////////////////////////////////////////// |
|
174 class RSyncMLJobBase : public RSubSessionBase |
|
175 /** |
|
176 Base class for a handle to a job. |
|
177 |
|
178 Data synchronisation and device management job handles are implemented |
|
179 by derived classes. |
|
180 |
|
181 Not intended for user derivation. Public derived classes: |
|
182 @see RSyncMLDataSyncJob |
|
183 @see RSyncMLDevManJob |
|
184 |
|
185 @publishedAll |
|
186 @released |
|
187 */ |
|
188 { |
|
189 public: |
|
190 IMPORT_C TSmlJobId Identifier() const; |
|
191 IMPORT_C TSmlProfileId Profile() const; |
|
192 IMPORT_C void Close(); |
|
193 protected: |
|
194 RSyncMLJobBase(); |
|
195 void GetJobL(TInt, TBool); |
|
196 protected: |
|
197 /** @internalTechnology */ |
|
198 mutable CClientSessionData* iData; |
|
199 private: |
|
200 // Prohibited. |
|
201 RSyncMLJobBase& operator=(const RSyncMLJobBase&); |
|
202 RSyncMLJobBase(const RSyncMLJobBase&); |
|
203 }; |
|
204 |
|
205 /////////////////////////////////////////////////////////////////////////////// |
|
206 /////////////////////////////////////////////////////////////////////////////// |
|
207 |
|
208 |
|
209 /////////////////////////////////////////////////////////////////////////////// |
|
210 // RSyncMLProfileBase |
|
211 /////////////////////////////////////////////////////////////////////////////// |
|
212 class RSyncMLProfileBase : public RSubSessionBase |
|
213 /** |
|
214 Base class for a handle to a SyncML profile. |
|
215 |
|
216 A profile encapsulates a relationship with a single SyncML remote server for |
|
217 either Device Management or Data Synchronisation. |
|
218 |
|
219 Not intended for user derivation. Derived classes: |
|
220 @see RSyncMLDataSyncProfile |
|
221 @see RSyncMLDevManProfile |
|
222 |
|
223 @publishedAll |
|
224 @released |
|
225 */ |
|
226 { |
|
227 public: |
|
228 IMPORT_C void SetCreatorId(TSmlCreatorId); |
|
229 IMPORT_C void SetDisplayNameL(const TDesC&); |
|
230 IMPORT_C void SetUserNameL(const TDesC8&); |
|
231 IMPORT_C void SetPasswordL(const TDesC8&); |
|
232 IMPORT_C void SetServerIdL(const TDesC8&); |
|
233 IMPORT_C void SetServerPasswordL(const TDesC8&); |
|
234 IMPORT_C void SetSanUserInteractionL(TSmlServerAlertedAction); |
|
235 IMPORT_C void SetProtocolVersionL(TSmlProtocolVersion); |
|
236 |
|
237 IMPORT_C void DeleteConnectionL(TSmlTransportId); |
|
238 IMPORT_C void DeleteConnectionByConnectionIdL(TSmlConnectionId); |
|
239 |
|
240 IMPORT_C TSmlProfileId Identifier() const; |
|
241 IMPORT_C TSmlUsageType Type() const; |
|
242 IMPORT_C TSmlCreatorId CreatorId() const; |
|
243 IMPORT_C const TDesC& DisplayName() const; |
|
244 IMPORT_C const TDesC8& UserName() const; |
|
245 IMPORT_C const TDesC8& Password() const; |
|
246 IMPORT_C const TDesC8& ServerId() const; |
|
247 IMPORT_C const TDesC8& ServerPassword() const; |
|
248 IMPORT_C TSmlServerAlertedAction SanUserInteraction() const; |
|
249 IMPORT_C TSmlProtocolVersion ProtocolVersion() const; |
|
250 |
|
251 IMPORT_C void ListConnectionsL(RArray<TSmlTransportId>&) const; |
|
252 IMPORT_C void ListConnectionsByConnectionIdL(RArray<TSmlConnectionId>&) const; |
|
253 |
|
254 IMPORT_C TBool IsReadOnly() const; |
|
255 IMPORT_C TBool DeleteAllowed() const; |
|
256 |
|
257 IMPORT_C void UpdateL(); |
|
258 |
|
259 IMPORT_C void Close(); |
|
260 |
|
261 const RSessionBase Session(); |
|
262 protected: |
|
263 RSyncMLProfileBase(); |
|
264 void GetProfileL(TInt aSize); |
|
265 void ReceiveArrayL(RArray<TInt>&, TInt, TInt) const; |
|
266 protected: |
|
267 /** @internalTechnology */ |
|
268 mutable CClientSessionData* iData; |
|
269 private: |
|
270 // Prohibited. |
|
271 RSyncMLProfileBase& operator=(const RSyncMLProfileBase&); |
|
272 RSyncMLProfileBase(const RSyncMLProfileBase&); |
|
273 }; |
|
274 |
|
275 /////////////////////////////////////////////////////////////////////////////// |
|
276 /////////////////////////////////////////////////////////////////////////////// |
|
277 |
|
278 |
|
279 /////////////////////////////////////////////////////////////////////////////// |
|
280 // RSyncMLConnection |
|
281 /////////////////////////////////////////////////////////////////////////////// |
|
282 class RSyncMLConnection : public RSubSessionBase |
|
283 /** |
|
284 Handle to data defining a connection to a remote SyncML server in the context of a profile. |
|
285 |
|
286 @publishedAll |
|
287 @released |
|
288 */ |
|
289 { |
|
290 public: |
|
291 IMPORT_C RSyncMLConnection(); |
|
292 IMPORT_C void CreateL(RSyncMLProfileBase&, TSmlTransportId); |
|
293 IMPORT_C void OpenL(RSyncMLProfileBase&, TSmlTransportId); |
|
294 IMPORT_C void OpenByConnectionIdL(RSyncMLProfileBase&, TSmlConnectionId); |
|
295 |
|
296 IMPORT_C TSmlTransportId Identifier() const; |
|
297 IMPORT_C TSmlProfileId Profile() const; |
|
298 IMPORT_C TSmlConnectionId ConnectionId() const; |
|
299 |
|
300 IMPORT_C TUint Priority() const; |
|
301 IMPORT_C TUint RetryCount() const; |
|
302 IMPORT_C const TDesC8& ServerURI() const; |
|
303 IMPORT_C const TDesC8& GetPropertyL(const TDesC8& aName) const; |
|
304 |
|
305 IMPORT_C void SetPriority(TUint); |
|
306 IMPORT_C void SetRetryCount(TUint); |
|
307 IMPORT_C void SetServerURIL(const TDesC8&); |
|
308 IMPORT_C void SetPropertyL(const TDesC8& aName, const TDesC8& aValue); |
|
309 |
|
310 IMPORT_C TBool IsReadOnly() const; |
|
311 IMPORT_C void UpdateL(); |
|
312 IMPORT_C void Close(); |
|
313 |
|
314 private: |
|
315 mutable CClientSessionData* iData; |
|
316 private: |
|
317 // Prohibited. |
|
318 RSyncMLConnection& operator=(const RSyncMLConnection&); |
|
319 RSyncMLConnection(const RSyncMLConnection&); |
|
320 }; |
|
321 |
|
322 /////////////////////////////////////////////////////////////////////////////// |
|
323 /////////////////////////////////////////////////////////////////////////////// |
|
324 |
|
325 |
|
326 /////////////////////////////////////////////////////////////////////////////// |
|
327 // RSyncMLTransport |
|
328 /////////////////////////////////////////////////////////////////////////////// |
|
329 class RSyncMLTransport : public RSubSessionBase |
|
330 /** |
|
331 Handle to information about an available SyncML transport. |
|
332 |
|
333 @publishedAll |
|
334 @released |
|
335 */ |
|
336 { |
|
337 public: |
|
338 IMPORT_C RSyncMLTransport(); |
|
339 IMPORT_C void OpenL(RSyncMLSession&, TSmlTransportId); |
|
340 |
|
341 IMPORT_C TSmlTransportId Identifier() const; |
|
342 IMPORT_C const TDesC& DisplayName() const; |
|
343 |
|
344 IMPORT_C TBool SupportsCapability(TSmlTransportCap) const; |
|
345 IMPORT_C const CSyncMLTransportPropertiesArray& Properties() const; |
|
346 |
|
347 IMPORT_C void StartListeningL() const; // Check ESmlCapCanListen supported first. |
|
348 IMPORT_C void StopListeningL() const; |
|
349 |
|
350 IMPORT_C void Close(); |
|
351 |
|
352 private: |
|
353 mutable CClientSessionData* iData; |
|
354 private: |
|
355 // Prohibited. |
|
356 RSyncMLTransport& operator=(const RSyncMLTransport&); |
|
357 RSyncMLTransport(const RSyncMLTransport&); |
|
358 }; |
|
359 |
|
360 /////////////////////////////////////////////////////////////////////////////// |
|
361 /////////////////////////////////////////////////////////////////////////////// |
|
362 |
|
363 /////////////////////////////////////////////////////////////////////////////// |
|
364 // TSmlOpenMode |
|
365 /////////////////////////////////////////////////////////////////////////////// |
|
366 enum TSmlOpenMode |
|
367 /** |
|
368 Defines the access mode for opening a handle to a SyncML profile. |
|
369 */ |
|
370 { |
|
371 /** |
|
372 Open for read-only access to data. |
|
373 |
|
374 @capability ReadDeviceData |
|
375 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode) |
|
376 */ |
|
377 ESmlOpenRead, |
|
378 |
|
379 /** |
|
380 Open for read and write access to data. |
|
381 |
|
382 @capability ReadDeviceData |
|
383 @capability WriteDeviceData |
|
384 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode) |
|
385 */ |
|
386 ESmlOpenReadWrite |
|
387 }; |
|
388 |
|
389 /////////////////////////////////////////////////////////////////////////////// |
|
390 /////////////////////////////////////////////////////////////////////////////// |
|
391 |
|
392 /////////////////////////////////////////////////////////////////////////////// |
|
393 // Panic codes. |
|
394 /////////////////////////////////////////////////////////////////////////////// |
|
395 enum TSyncMLClientPanic |
|
396 { |
|
397 ESmlClientPanicSessionNotOpen, |
|
398 ESmlClientPanicSessionAlreadyOpen, |
|
399 ESmlClientPanicEventAlreadyRequested |
|
400 }; |
|
401 |
|
402 /////////////////////////////////////////////////////////////////////////////// |
|
403 /////////////////////////////////////////////////////////////////////////////// |
|
404 |
|
405 /////////////////////////////////////////////////////////////////////////////// |
|
406 /////////////////////////////////////////////////////////////////////////////// |
|
407 /////////////////////////////////////////////////////////////////////////////// |
|
408 #endif |