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 "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".
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;
258 * Set Reset Profile lock Not supported for DS profiles
261 * aReadWriteValue EFalse for reading ETrue for writing
262 * aLockValue EFalse for Unloacking ETrue for Locking the profile
267 IMPORT_C TInt ProfileLocked(TBool aReadWriteValue, TBool aLockValue) const;
268 IMPORT_C void UpdateL();
270 IMPORT_C void Close();
272 const RSessionBase Session();
274 RSyncMLProfileBase();
275 void GetProfileL(TInt aSize);
276 void ReceiveArrayL(RArray<TInt>&, TInt, TInt) const;
278 /** @internalTechnology */
279 mutable CClientSessionData* iData;
282 RSyncMLProfileBase& operator=(const RSyncMLProfileBase&);
283 RSyncMLProfileBase(const RSyncMLProfileBase&);
286 ///////////////////////////////////////////////////////////////////////////////
287 ///////////////////////////////////////////////////////////////////////////////
290 ///////////////////////////////////////////////////////////////////////////////
292 ///////////////////////////////////////////////////////////////////////////////
293 class RSyncMLConnection : public RSubSessionBase
295 Handle to data defining a connection to a remote SyncML server in the context of a profile.
302 IMPORT_C RSyncMLConnection();
303 IMPORT_C void CreateL(RSyncMLProfileBase&, TSmlTransportId);
304 IMPORT_C void OpenL(RSyncMLProfileBase&, TSmlTransportId);
305 IMPORT_C void OpenByConnectionIdL(RSyncMLProfileBase&, TSmlConnectionId);
307 IMPORT_C TSmlTransportId Identifier() const;
308 IMPORT_C TSmlProfileId Profile() const;
309 IMPORT_C TSmlConnectionId ConnectionId() const;
311 IMPORT_C TUint Priority() const;
312 IMPORT_C TUint RetryCount() const;
313 IMPORT_C const TDesC8& ServerURI() const;
314 IMPORT_C const TDesC8& GetPropertyL(const TDesC8& aName) const;
316 IMPORT_C void SetPriority(TUint);
317 IMPORT_C void SetRetryCount(TUint);
318 IMPORT_C void SetServerURIL(const TDesC8&);
319 IMPORT_C void SetPropertyL(const TDesC8& aName, const TDesC8& aValue);
321 IMPORT_C TBool IsReadOnly() const;
322 IMPORT_C void UpdateL();
323 IMPORT_C void Close();
326 mutable CClientSessionData* iData;
329 RSyncMLConnection& operator=(const RSyncMLConnection&);
330 RSyncMLConnection(const RSyncMLConnection&);
333 ///////////////////////////////////////////////////////////////////////////////
334 ///////////////////////////////////////////////////////////////////////////////
337 ///////////////////////////////////////////////////////////////////////////////
339 ///////////////////////////////////////////////////////////////////////////////
340 class RSyncMLTransport : public RSubSessionBase
342 Handle to information about an available SyncML transport.
349 IMPORT_C RSyncMLTransport();
350 IMPORT_C void OpenL(RSyncMLSession&, TSmlTransportId);
352 IMPORT_C TSmlTransportId Identifier() const;
353 IMPORT_C const TDesC& DisplayName() const;
355 IMPORT_C TBool SupportsCapability(TSmlTransportCap) const;
356 IMPORT_C const CSyncMLTransportPropertiesArray& Properties() const;
358 IMPORT_C void StartListeningL() const; // Check ESmlCapCanListen supported first.
359 IMPORT_C void StopListeningL() const;
361 IMPORT_C void Close();
364 mutable CClientSessionData* iData;
367 RSyncMLTransport& operator=(const RSyncMLTransport&);
368 RSyncMLTransport(const RSyncMLTransport&);
371 ///////////////////////////////////////////////////////////////////////////////
372 ///////////////////////////////////////////////////////////////////////////////
374 ///////////////////////////////////////////////////////////////////////////////
376 ///////////////////////////////////////////////////////////////////////////////
379 Defines the access mode for opening a handle to a SyncML profile.
383 Open for read-only access to data.
385 @capability ReadDeviceData
386 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
391 Open for read and write access to data.
393 @capability ReadDeviceData
394 @capability WriteDeviceData
395 @Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
400 ///////////////////////////////////////////////////////////////////////////////
401 ///////////////////////////////////////////////////////////////////////////////
403 ///////////////////////////////////////////////////////////////////////////////
405 ///////////////////////////////////////////////////////////////////////////////
406 enum TSyncMLClientPanic
408 ESmlClientPanicSessionNotOpen,
409 ESmlClientPanicSessionAlreadyOpen,
410 ESmlClientPanicEventAlreadyRequested
413 ///////////////////////////////////////////////////////////////////////////////
414 ///////////////////////////////////////////////////////////////////////////////
416 ///////////////////////////////////////////////////////////////////////////////
417 ///////////////////////////////////////////////////////////////////////////////
418 ///////////////////////////////////////////////////////////////////////////////