2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
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.
17 ///////////////////////////////////////////////////////////////////////////////
21 ///////////////////////////////////////////////////////////////////////////////
22 #ifndef __SYNCMLCLIENT_H__
23 #define __SYNCMLCLIENT_H__
27 #include <SyncMLDef.h>
28 #include <SyncMLHistory.h>
30 class CClientSessionData;
31 class CSmlActiveCallback;
32 class CSyncMLTransportPropertiesArray;
33 class MSyncMLEventObserver;
34 class MSyncMLProgressObserver;
38 ///////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////
41 class RSyncMLSession : public RSessionBase
43 A client handle to a SyncML Sync Agent session.
45 An instance of this class must be created in order to instantiate any of
46 the other client-side classes.
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.
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.
60 IMPORT_C RSyncMLSession();
61 IMPORT_C void OpenL();
63 IMPORT_C void RequestEventL(MSyncMLEventObserver&);
64 IMPORT_C void CancelEvent();
66 IMPORT_C void RequestProgressL(MSyncMLProgressObserver&);
67 IMPORT_C void CancelProgress();
69 IMPORT_C void CurrentJobL(TSmlJobId&, TSmlUsageType&) const;
70 IMPORT_C void ListQueuedJobsL(RArray<TSmlJobId>&, TSmlUsageType) const;
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;
76 IMPORT_C void DeleteProfileL(TSmlProfileId);
78 IMPORT_C TSmlProtocolVersion ListProtocolVersionsL(TSmlUsageType, RArray<TSmlProtocolVersion>&) const;
80 IMPORT_C void Close();
81 /**@internalTechnology*/
82 IMPORT_C void _DbgTestSettingL(TInt aSetting, TInt aParam);
85 void ReceiveArrayL(RArray<TInt>&, TInt, TInt, TInt) const;
87 mutable CClientSessionData* iData;
88 friend class CSmlActiveCallback;
89 CSmlActiveCallback* iEventCallback;
92 RSyncMLSession& operator=(const RSyncMLSession&);
93 RSyncMLSession(const RSyncMLSession&);
96 ///////////////////////////////////////////////////////////////////////////////
97 ///////////////////////////////////////////////////////////////////////////////
100 ///////////////////////////////////////////////////////////////////////////////
102 ///////////////////////////////////////////////////////////////////////////////
103 class RSyncMLSettings : public RSubSessionBase
105 Handle to global settings for SyncML sync behaviour.
109 @see TSmlGlobalSetting
113 IMPORT_C void OpenL(RSyncMLSession&);
115 IMPORT_C TInt GetValueL(TSmlGlobalSetting) const;
116 IMPORT_C void SetValueL(TSmlGlobalSetting, TInt aValue);
118 IMPORT_C void Close();
121 ///////////////////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////////////////
124 ///////////////////////////////////////////////////////////////////////////////
126 ///////////////////////////////////////////////////////////////////////////////
127 class RSyncMLHistoryLog : public RSubSessionBase
129 Snapshot of history for a profile.
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();
146 mutable CClientSessionData* iData;
149 RSyncMLHistoryLog& operator=(const RSyncMLHistoryLog&);
150 RSyncMLHistoryLog(const RSyncMLHistoryLog&);
153 ///////////////////////////////////////////////////////////////////////////////
154 inline const CSyncMLHistoryEntry& RSyncMLHistoryLog::operator[](TInt aIndex) const
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.
161 @pre The handle is open.
164 return Entry(aIndex);
167 ///////////////////////////////////////////////////////////////////////////////
168 ///////////////////////////////////////////////////////////////////////////////
171 ///////////////////////////////////////////////////////////////////////////////
173 ///////////////////////////////////////////////////////////////////////////////
174 class RSyncMLJobBase : public RSubSessionBase
176 Base class for a handle to a job.
178 Data synchronisation and device management job handles are implemented
181 Not intended for user derivation. Public derived classes:
182 @see RSyncMLDataSyncJob
183 @see RSyncMLDevManJob
190 IMPORT_C TSmlJobId Identifier() const;
191 IMPORT_C TSmlProfileId Profile() const;
192 IMPORT_C void Close();
195 void GetJobL(TInt, TBool);
197 /** @internalTechnology */
198 mutable CClientSessionData* iData;
201 RSyncMLJobBase& operator=(const RSyncMLJobBase&);
202 RSyncMLJobBase(const RSyncMLJobBase&);
205 ///////////////////////////////////////////////////////////////////////////////
206 ///////////////////////////////////////////////////////////////////////////////
209 ///////////////////////////////////////////////////////////////////////////////
210 // RSyncMLProfileBase
211 ///////////////////////////////////////////////////////////////////////////////
212 class RSyncMLProfileBase : public RSubSessionBase
214 Base class for a handle to a SyncML profile.
216 A profile encapsulates a relationship with a single SyncML remote server for
217 either Device Management or Data Synchronisation.
219 Not intended for user derivation. Derived classes:
220 @see RSyncMLDataSyncProfile
221 @see RSyncMLDevManProfile
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);
237 IMPORT_C void DeleteConnectionL(TSmlTransportId);
238 IMPORT_C void DeleteConnectionByConnectionIdL(TSmlConnectionId);
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;
251 IMPORT_C void ListConnectionsL(RArray<TSmlTransportId>&) const;
252 IMPORT_C void ListConnectionsByConnectionIdL(RArray<TSmlConnectionId>&) const;
254 IMPORT_C TBool IsReadOnly() const;
255 IMPORT_C TBool DeleteAllowed() const;
257 IMPORT_C void UpdateL();
259 IMPORT_C void Close();
261 const RSessionBase Session();
263 RSyncMLProfileBase();
264 void GetProfileL(TInt aSize);
265 void ReceiveArrayL(RArray<TInt>&, TInt, TInt) const;
267 /** @internalTechnology */
268 mutable CClientSessionData* iData;
271 RSyncMLProfileBase& operator=(const RSyncMLProfileBase&);
272 RSyncMLProfileBase(const RSyncMLProfileBase&);
275 ///////////////////////////////////////////////////////////////////////////////
276 ///////////////////////////////////////////////////////////////////////////////
279 ///////////////////////////////////////////////////////////////////////////////
281 ///////////////////////////////////////////////////////////////////////////////
282 class RSyncMLConnection : public RSubSessionBase
284 Handle to data defining a connection to a remote SyncML server in the context of a profile.
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);
296 IMPORT_C TSmlTransportId Identifier() const;
297 IMPORT_C TSmlProfileId Profile() const;
298 IMPORT_C TSmlConnectionId ConnectionId() const;
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;
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);
310 IMPORT_C TBool IsReadOnly() const;
311 IMPORT_C void UpdateL();
312 IMPORT_C void Close();
315 mutable CClientSessionData* iData;
318 RSyncMLConnection& operator=(const RSyncMLConnection&);
319 RSyncMLConnection(const RSyncMLConnection&);
322 ///////////////////////////////////////////////////////////////////////////////
323 ///////////////////////////////////////////////////////////////////////////////
326 ///////////////////////////////////////////////////////////////////////////////
328 ///////////////////////////////////////////////////////////////////////////////
329 class RSyncMLTransport : public RSubSessionBase
331 Handle to information about an available SyncML transport.
338 IMPORT_C RSyncMLTransport();
339 IMPORT_C void OpenL(RSyncMLSession&, TSmlTransportId);
341 IMPORT_C TSmlTransportId Identifier() const;
342 IMPORT_C const TDesC& DisplayName() const;
344 IMPORT_C TBool SupportsCapability(TSmlTransportCap) const;
345 IMPORT_C const CSyncMLTransportPropertiesArray& Properties() const;
347 IMPORT_C void StartListeningL() const; // Check ESmlCapCanListen supported first.
348 IMPORT_C void StopListeningL() const;
350 IMPORT_C void Close();
353 mutable CClientSessionData* iData;
356 RSyncMLTransport& operator=(const RSyncMLTransport&);
357 RSyncMLTransport(const RSyncMLTransport&);
360 ///////////////////////////////////////////////////////////////////////////////
361 ///////////////////////////////////////////////////////////////////////////////
363 ///////////////////////////////////////////////////////////////////////////////
365 ///////////////////////////////////////////////////////////////////////////////
368 Defines the access mode for opening a handle to a SyncML profile.
372 Open for read-only access to data.
374 @capability ReadDeviceData
375 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
380 Open for read and write access to data.
382 @capability ReadDeviceData
383 @capability WriteDeviceData
384 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
389 ///////////////////////////////////////////////////////////////////////////////
390 ///////////////////////////////////////////////////////////////////////////////
392 ///////////////////////////////////////////////////////////////////////////////
394 ///////////////////////////////////////////////////////////////////////////////
395 enum TSyncMLClientPanic
397 ESmlClientPanicSessionNotOpen,
398 ESmlClientPanicSessionAlreadyOpen,
399 ESmlClientPanicEventAlreadyRequested
402 ///////////////////////////////////////////////////////////////////////////////
403 ///////////////////////////////////////////////////////////////////////////////
405 ///////////////////////////////////////////////////////////////////////////////
406 ///////////////////////////////////////////////////////////////////////////////
407 ///////////////////////////////////////////////////////////////////////////////