epoc32/include/SyncMLClient.h
branchSymbian2
changeset 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/SyncMLClient.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,408 @@
     1.4 +/*
     1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* 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
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* 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.
    1.18 +*
    1.19 +*/
    1.20 +///////////////////////////////////////////////////////////////////////////////
    1.21 +// SyncMLClient.h
    1.22 +// v09
    1.23 +//
    1.24 +///////////////////////////////////////////////////////////////////////////////
    1.25 +#ifndef __SYNCMLCLIENT_H__
    1.26 +#define __SYNCMLCLIENT_H__
    1.27 +//
    1.28 +#include <e32std.h>
    1.29 +#include <badesca.h>
    1.30 +#include <SyncMLDef.h>
    1.31 +#include <SyncMLHistory.h>
    1.32 +//
    1.33 +class CClientSessionData;
    1.34 +class CSmlActiveCallback;
    1.35 +class CSyncMLTransportPropertiesArray;
    1.36 +class MSyncMLEventObserver;
    1.37 +class MSyncMLProgressObserver;
    1.38 +//
    1.39 +
    1.40 +
    1.41 +///////////////////////////////////////////////////////////////////////////////
    1.42 +// RSyncMLSession
    1.43 +///////////////////////////////////////////////////////////////////////////////
    1.44 +class RSyncMLSession : public RSessionBase
    1.45 +/**
    1.46 +	A client handle to a SyncML Sync Agent session.
    1.47 +
    1.48 +	An instance of this class must be created in order to instantiate any of 
    1.49 +	the other client-side classes.
    1.50 +
    1.51 +	Accessor methods are provided to enable clients to retrieve identifiers 
    1.52 +	of current and queued jobs, and of available profiles, transports, and 
    1.53 +	data providers. These IDs can be used to open handles on these objects 
    1.54 +	in order to manipulate them.
    1.55 +
    1.56 +	Clients can request notifications of events related to jobs, profiles, transports,
    1.57 +	and the SyncML Agent, and can request progress for the currently running job.
    1.58 +	@publishedAll
    1.59 +	@released
    1.60 +*/
    1.61 +	{
    1.62 +public:
    1.63 +	IMPORT_C RSyncMLSession();
    1.64 +	IMPORT_C void OpenL();
    1.65 +
    1.66 +	IMPORT_C void RequestEventL(MSyncMLEventObserver&);
    1.67 +	IMPORT_C void CancelEvent();
    1.68 +
    1.69 +	IMPORT_C void RequestProgressL(MSyncMLProgressObserver&);
    1.70 +	IMPORT_C void CancelProgress();
    1.71 +
    1.72 +	IMPORT_C void CurrentJobL(TSmlJobId&, TSmlUsageType&) const;
    1.73 +	IMPORT_C void ListQueuedJobsL(RArray<TSmlJobId>&, TSmlUsageType) const;
    1.74 +
    1.75 +	IMPORT_C void ListProfilesL(RArray<TSmlProfileId>&, TSmlUsageType) const;
    1.76 +	IMPORT_C void ListTransportsL(RArray<TSmlTransportId>&) const;
    1.77 +	IMPORT_C void ListDataProvidersL(RArray<TSmlDataProviderId>&) const;
    1.78 +
    1.79 +	IMPORT_C void DeleteProfileL(TSmlProfileId);
    1.80 +
    1.81 +	IMPORT_C TSmlProtocolVersion ListProtocolVersionsL(TSmlUsageType, RArray<TSmlProtocolVersion>&) const;
    1.82 +
    1.83 +	IMPORT_C void Close();
    1.84 +    /**@internalTechnology*/
    1.85 +	IMPORT_C void _DbgTestSettingL(TInt aSetting, TInt aParam);
    1.86 +
    1.87 +private:
    1.88 +	void ReceiveArrayL(RArray<TInt>&, TInt, TInt, TInt) const;
    1.89 +private:
    1.90 +	mutable CClientSessionData* iData;
    1.91 +	friend class CSmlActiveCallback;
    1.92 +	CSmlActiveCallback* iEventCallback;
    1.93 +private:
    1.94 +	// Prohibited.
    1.95 +	RSyncMLSession& operator=(const RSyncMLSession&);
    1.96 +	RSyncMLSession(const RSyncMLSession&);
    1.97 +	};
    1.98 +
    1.99 +///////////////////////////////////////////////////////////////////////////////
   1.100 +///////////////////////////////////////////////////////////////////////////////
   1.101 +
   1.102 +
   1.103 +///////////////////////////////////////////////////////////////////////////////
   1.104 +// RSyncMLSettings
   1.105 +///////////////////////////////////////////////////////////////////////////////
   1.106 +class RSyncMLSettings : public RSubSessionBase
   1.107 +/**
   1.108 +	Handle to global settings for SyncML sync behaviour.
   1.109 +
   1.110 +	@publishedAll
   1.111 +	@released
   1.112 +	@see TSmlGlobalSetting
   1.113 +*/
   1.114 +	{
   1.115 +public:
   1.116 +	IMPORT_C void OpenL(RSyncMLSession&);
   1.117 +
   1.118 +	IMPORT_C TInt GetValueL(TSmlGlobalSetting) const;
   1.119 +	IMPORT_C void SetValueL(TSmlGlobalSetting, TInt aValue);
   1.120 +
   1.121 +	IMPORT_C void Close();
   1.122 +	};
   1.123 +
   1.124 +///////////////////////////////////////////////////////////////////////////////
   1.125 +///////////////////////////////////////////////////////////////////////////////
   1.126 +
   1.127 +///////////////////////////////////////////////////////////////////////////////
   1.128 +// RSyncMLHistoryLog
   1.129 +///////////////////////////////////////////////////////////////////////////////
   1.130 +class RSyncMLHistoryLog : public RSubSessionBase
   1.131 +/**
   1.132 +	Snapshot of history for a profile.
   1.133 +	@publishedAll
   1.134 +	@released
   1.135 +*/
   1.136 +	{
   1.137 +public:
   1.138 +	IMPORT_C RSyncMLHistoryLog();
   1.139 +	IMPORT_C void OpenL(RSyncMLSession&, TSmlProfileId);
   1.140 +	IMPORT_C void SortEntries(CSyncMLHistoryEntry::TSortOrder);
   1.141 +	IMPORT_C void DeleteAllEntriesL();
   1.142 +	IMPORT_C TSmlProfileId Profile() const;
   1.143 +	IMPORT_C TInt Count() const;
   1.144 +	IMPORT_C const CSyncMLHistoryEntry& Entry(TInt aIndex) const;
   1.145 +	inline const CSyncMLHistoryEntry& operator[](TInt aIndex) const;
   1.146 +	IMPORT_C void Close();
   1.147 +
   1.148 +private:
   1.149 +	mutable CClientSessionData* iData;
   1.150 +private:
   1.151 +	// Prohibited.
   1.152 +	RSyncMLHistoryLog& operator=(const RSyncMLHistoryLog&);
   1.153 +	RSyncMLHistoryLog(const RSyncMLHistoryLog&);
   1.154 +	};
   1.155 +
   1.156 +///////////////////////////////////////////////////////////////////////////////
   1.157 +inline const CSyncMLHistoryEntry& RSyncMLHistoryLog::operator[](TInt aIndex) const
   1.158 +/**
   1.159 +	Returns the entry at the specified index.
   1.160 +@return				The entry at the specified index.
   1.161 +@param				aIndex The index of the entry to retrieve.
   1.162 +@publishedAll
   1.163 +@released
   1.164 +@pre				The handle is open.
   1.165 +*/
   1.166 +	{
   1.167 +	return Entry(aIndex);
   1.168 +	}
   1.169 +
   1.170 +///////////////////////////////////////////////////////////////////////////////
   1.171 +///////////////////////////////////////////////////////////////////////////////
   1.172 +
   1.173 +
   1.174 +///////////////////////////////////////////////////////////////////////////////
   1.175 +// RSyncMLJobBase
   1.176 +///////////////////////////////////////////////////////////////////////////////
   1.177 +class RSyncMLJobBase : public RSubSessionBase
   1.178 +/**
   1.179 +	Base class for a handle to a job.
   1.180 +
   1.181 +	Data synchronisation and device management job handles are implemented
   1.182 +	by derived classes.
   1.183 +
   1.184 +	Not intended for user derivation. Public derived classes: 
   1.185 +	@see RSyncMLDataSyncJob 
   1.186 +	@see RSyncMLDevManJob
   1.187 +
   1.188 +	@publishedAll
   1.189 +	@released
   1.190 +*/
   1.191 +	{
   1.192 +public:
   1.193 +	IMPORT_C TSmlJobId Identifier() const;
   1.194 +	IMPORT_C TSmlProfileId Profile() const;
   1.195 +	IMPORT_C void Close();
   1.196 +protected:
   1.197 +	RSyncMLJobBase();
   1.198 +	void GetJobL(TInt, TBool);
   1.199 +protected:
   1.200 +	/** @internalTechnology */
   1.201 +	mutable CClientSessionData* iData;
   1.202 +private:
   1.203 +	// Prohibited.
   1.204 +	RSyncMLJobBase& operator=(const RSyncMLJobBase&);
   1.205 +	RSyncMLJobBase(const RSyncMLJobBase&);
   1.206 +	};
   1.207 +
   1.208 +///////////////////////////////////////////////////////////////////////////////
   1.209 +///////////////////////////////////////////////////////////////////////////////
   1.210 +
   1.211 +
   1.212 +///////////////////////////////////////////////////////////////////////////////
   1.213 +// RSyncMLProfileBase
   1.214 +///////////////////////////////////////////////////////////////////////////////
   1.215 +class RSyncMLProfileBase : public RSubSessionBase
   1.216 +/**
   1.217 +	Base class for a handle to a SyncML profile. 
   1.218 +	
   1.219 +	A profile encapsulates a relationship with a single SyncML remote server for 
   1.220 +	either Device Management or Data Synchronisation.
   1.221 +
   1.222 +	Not intended for user derivation. Derived classes: 
   1.223 +	@see RSyncMLDataSyncProfile 
   1.224 +	@see RSyncMLDevManProfile 
   1.225 +
   1.226 +	@publishedAll
   1.227 +	@released
   1.228 +*/
   1.229 +	{
   1.230 +public:
   1.231 +	IMPORT_C void SetCreatorId(TSmlCreatorId);
   1.232 +	IMPORT_C void SetDisplayNameL(const TDesC&);
   1.233 +	IMPORT_C void SetUserNameL(const TDesC8&);
   1.234 +	IMPORT_C void SetPasswordL(const TDesC8&);
   1.235 +	IMPORT_C void SetServerIdL(const TDesC8&);
   1.236 +	IMPORT_C void SetServerPasswordL(const TDesC8&);
   1.237 +	IMPORT_C void SetSanUserInteractionL(TSmlServerAlertedAction);
   1.238 +	IMPORT_C void SetProtocolVersionL(TSmlProtocolVersion);
   1.239 +
   1.240 +	IMPORT_C void DeleteConnectionL(TSmlTransportId);
   1.241 +	IMPORT_C void DeleteConnectionByConnectionIdL(TSmlConnectionId);
   1.242 +
   1.243 +	IMPORT_C TSmlProfileId Identifier() const;
   1.244 +	IMPORT_C TSmlUsageType Type() const;
   1.245 +	IMPORT_C TSmlCreatorId CreatorId() const;
   1.246 +	IMPORT_C const TDesC& DisplayName() const;
   1.247 +	IMPORT_C const TDesC8& UserName() const;
   1.248 +	IMPORT_C const TDesC8& Password() const;
   1.249 +	IMPORT_C const TDesC8& ServerId() const;
   1.250 +	IMPORT_C const TDesC8& ServerPassword() const;
   1.251 +	IMPORT_C TSmlServerAlertedAction SanUserInteraction() const;
   1.252 +	IMPORT_C TSmlProtocolVersion ProtocolVersion() const;
   1.253 +
   1.254 +	IMPORT_C void ListConnectionsL(RArray<TSmlTransportId>&) const;
   1.255 +	IMPORT_C void ListConnectionsByConnectionIdL(RArray<TSmlConnectionId>&) const;
   1.256 +
   1.257 +	IMPORT_C TBool IsReadOnly() const;
   1.258 +	IMPORT_C TBool DeleteAllowed() const;
   1.259 +
   1.260 +	IMPORT_C void UpdateL();
   1.261 +
   1.262 +	IMPORT_C void Close();
   1.263 +
   1.264 +	const RSessionBase Session();
   1.265 +protected:
   1.266 +	RSyncMLProfileBase();
   1.267 +	void GetProfileL(TInt aSize);
   1.268 +	void ReceiveArrayL(RArray<TInt>&, TInt, TInt) const;
   1.269 +protected:
   1.270 +	/** @internalTechnology */
   1.271 +	mutable CClientSessionData* iData;
   1.272 +private:
   1.273 +	// Prohibited.
   1.274 +	RSyncMLProfileBase& operator=(const RSyncMLProfileBase&);
   1.275 +	RSyncMLProfileBase(const RSyncMLProfileBase&);
   1.276 +	};
   1.277 +
   1.278 +///////////////////////////////////////////////////////////////////////////////
   1.279 +///////////////////////////////////////////////////////////////////////////////
   1.280 +
   1.281 +
   1.282 +///////////////////////////////////////////////////////////////////////////////
   1.283 +// RSyncMLConnection
   1.284 +///////////////////////////////////////////////////////////////////////////////
   1.285 +class RSyncMLConnection : public RSubSessionBase
   1.286 +/**
   1.287 +	Handle to data defining a connection to a remote SyncML server in the context of a profile.
   1.288 +
   1.289 +	@publishedAll
   1.290 +	@released
   1.291 +*/
   1.292 +	{
   1.293 +public:
   1.294 +	IMPORT_C RSyncMLConnection();
   1.295 +	IMPORT_C void CreateL(RSyncMLProfileBase&, TSmlTransportId);
   1.296 +	IMPORT_C void OpenL(RSyncMLProfileBase&, TSmlTransportId);
   1.297 +	IMPORT_C void OpenByConnectionIdL(RSyncMLProfileBase&, TSmlConnectionId);
   1.298 +
   1.299 +	IMPORT_C TSmlTransportId Identifier() const;
   1.300 +	IMPORT_C TSmlProfileId Profile() const;
   1.301 +	IMPORT_C TSmlConnectionId ConnectionId() const;
   1.302 +
   1.303 +	IMPORT_C TUint Priority() const;
   1.304 +	IMPORT_C TUint RetryCount() const;
   1.305 +	IMPORT_C const TDesC8& ServerURI() const;
   1.306 +	IMPORT_C const TDesC8& GetPropertyL(const TDesC8& aName) const;
   1.307 +
   1.308 +	IMPORT_C void SetPriority(TUint);
   1.309 +	IMPORT_C void SetRetryCount(TUint);
   1.310 +	IMPORT_C void SetServerURIL(const TDesC8&);
   1.311 +	IMPORT_C void SetPropertyL(const TDesC8& aName, const TDesC8& aValue);
   1.312 +
   1.313 +	IMPORT_C TBool IsReadOnly() const;
   1.314 +	IMPORT_C void UpdateL();
   1.315 +	IMPORT_C void Close();
   1.316 +
   1.317 +private:
   1.318 +	mutable CClientSessionData* iData;
   1.319 +private:
   1.320 +	// Prohibited.
   1.321 +	RSyncMLConnection& operator=(const RSyncMLConnection&);
   1.322 +	RSyncMLConnection(const RSyncMLConnection&);
   1.323 +	};
   1.324 +
   1.325 +///////////////////////////////////////////////////////////////////////////////
   1.326 +///////////////////////////////////////////////////////////////////////////////
   1.327 +
   1.328 +
   1.329 +///////////////////////////////////////////////////////////////////////////////
   1.330 +// RSyncMLTransport
   1.331 +///////////////////////////////////////////////////////////////////////////////
   1.332 +class RSyncMLTransport : public RSubSessionBase
   1.333 +/**
   1.334 +	Handle to information about an available SyncML transport.
   1.335 +
   1.336 +	@publishedAll
   1.337 +	@released
   1.338 +*/
   1.339 +	{
   1.340 +public:
   1.341 +	IMPORT_C RSyncMLTransport();
   1.342 +	IMPORT_C void OpenL(RSyncMLSession&, TSmlTransportId);
   1.343 +
   1.344 +	IMPORT_C TSmlTransportId Identifier() const;
   1.345 +	IMPORT_C const TDesC& DisplayName() const;
   1.346 +
   1.347 +	IMPORT_C TBool SupportsCapability(TSmlTransportCap) const;
   1.348 +	IMPORT_C const CSyncMLTransportPropertiesArray& Properties() const;
   1.349 +
   1.350 +	IMPORT_C void StartListeningL() const; // Check ESmlCapCanListen supported first.
   1.351 +	IMPORT_C void StopListeningL() const;
   1.352 +
   1.353 +	IMPORT_C void Close();
   1.354 +
   1.355 +private:
   1.356 +	mutable CClientSessionData* iData;
   1.357 +private:
   1.358 +	// Prohibited.
   1.359 +	RSyncMLTransport& operator=(const RSyncMLTransport&);
   1.360 +	RSyncMLTransport(const RSyncMLTransport&);
   1.361 +	};
   1.362 +
   1.363 +///////////////////////////////////////////////////////////////////////////////
   1.364 +///////////////////////////////////////////////////////////////////////////////
   1.365 +
   1.366 +///////////////////////////////////////////////////////////////////////////////
   1.367 +// TSmlOpenMode
   1.368 +///////////////////////////////////////////////////////////////////////////////
   1.369 +enum TSmlOpenMode
   1.370 +/**
   1.371 +	Defines the access mode for opening a handle to a SyncML profile.
   1.372 +*/
   1.373 +	{
   1.374 +	/** 
   1.375 +	Open for read-only access to data. 
   1.376 +	
   1.377 +	@capability ReadDeviceData
   1.378 +	@Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
   1.379 +	*/
   1.380 +	ESmlOpenRead,
   1.381 +	
   1.382 +	/** 
   1.383 +	Open for read and write access to data.
   1.384 +	
   1.385 +	@capability ReadDeviceData
   1.386 +	@capability WriteDeviceData
   1.387 +	@Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
   1.388 +	*/
   1.389 +	ESmlOpenReadWrite
   1.390 +	};
   1.391 +
   1.392 +///////////////////////////////////////////////////////////////////////////////
   1.393 +///////////////////////////////////////////////////////////////////////////////
   1.394 +
   1.395 +///////////////////////////////////////////////////////////////////////////////
   1.396 +// Panic codes.
   1.397 +///////////////////////////////////////////////////////////////////////////////
   1.398 +enum TSyncMLClientPanic
   1.399 +	{
   1.400 +	ESmlClientPanicSessionNotOpen,
   1.401 +	ESmlClientPanicSessionAlreadyOpen,
   1.402 +	ESmlClientPanicEventAlreadyRequested
   1.403 +	};
   1.404 +
   1.405 +///////////////////////////////////////////////////////////////////////////////
   1.406 +///////////////////////////////////////////////////////////////////////////////
   1.407 +
   1.408 +///////////////////////////////////////////////////////////////////////////////
   1.409 +///////////////////////////////////////////////////////////////////////////////
   1.410 +///////////////////////////////////////////////////////////////////////////////
   1.411 +#endif