epoc32/include/SyncMLClient.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     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 "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: 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 	 
   258    * Set Reset Profile lock Not supported for DS profiles
   259    * @since 3.23
   260    * @param  
   261    * aReadWriteValue  EFalse for reading ETrue for writing
   262    * aLockValue       EFalse for Unloacking ETrue for Locking the profile
   263    * @return  TInt 
   264    */
   265 	
   266 	
   267   IMPORT_C TInt ProfileLocked(TBool aReadWriteValue, TBool aLockValue) const;
   268 	IMPORT_C void UpdateL();
   269 
   270 	IMPORT_C void Close();
   271 
   272 	const RSessionBase Session();
   273 protected:
   274 	RSyncMLProfileBase();
   275 	void GetProfileL(TInt aSize);
   276 	void ReceiveArrayL(RArray<TInt>&, TInt, TInt) const;
   277 protected:
   278 	/** @internalTechnology */
   279 	mutable CClientSessionData* iData;
   280 private:
   281 	// Prohibited.
   282 	RSyncMLProfileBase& operator=(const RSyncMLProfileBase&);
   283 	RSyncMLProfileBase(const RSyncMLProfileBase&);
   284 	};
   285 
   286 ///////////////////////////////////////////////////////////////////////////////
   287 ///////////////////////////////////////////////////////////////////////////////
   288 
   289 
   290 ///////////////////////////////////////////////////////////////////////////////
   291 // RSyncMLConnection
   292 ///////////////////////////////////////////////////////////////////////////////
   293 class RSyncMLConnection : public RSubSessionBase
   294 /**
   295 	Handle to data defining a connection to a remote SyncML server in the context of a profile.
   296 
   297 	@publishedAll
   298 	@released
   299 */
   300 	{
   301 public:
   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);
   306 
   307 	IMPORT_C TSmlTransportId Identifier() const;
   308 	IMPORT_C TSmlProfileId Profile() const;
   309 	IMPORT_C TSmlConnectionId ConnectionId() const;
   310 
   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;
   315 
   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);
   320 
   321 	IMPORT_C TBool IsReadOnly() const;
   322 	IMPORT_C void UpdateL();
   323 	IMPORT_C void Close();
   324 
   325 private:
   326 	mutable CClientSessionData* iData;
   327 private:
   328 	// Prohibited.
   329 	RSyncMLConnection& operator=(const RSyncMLConnection&);
   330 	RSyncMLConnection(const RSyncMLConnection&);
   331 	};
   332 
   333 ///////////////////////////////////////////////////////////////////////////////
   334 ///////////////////////////////////////////////////////////////////////////////
   335 
   336 
   337 ///////////////////////////////////////////////////////////////////////////////
   338 // RSyncMLTransport
   339 ///////////////////////////////////////////////////////////////////////////////
   340 class RSyncMLTransport : public RSubSessionBase
   341 /**
   342 	Handle to information about an available SyncML transport.
   343 
   344 	@publishedAll
   345 	@released
   346 */
   347 	{
   348 public:
   349 	IMPORT_C RSyncMLTransport();
   350 	IMPORT_C void OpenL(RSyncMLSession&, TSmlTransportId);
   351 
   352 	IMPORT_C TSmlTransportId Identifier() const;
   353 	IMPORT_C const TDesC& DisplayName() const;
   354 
   355 	IMPORT_C TBool SupportsCapability(TSmlTransportCap) const;
   356 	IMPORT_C const CSyncMLTransportPropertiesArray& Properties() const;
   357 
   358 	IMPORT_C void StartListeningL() const; // Check ESmlCapCanListen supported first.
   359 	IMPORT_C void StopListeningL() const;
   360 
   361 	IMPORT_C void Close();
   362 
   363 private:
   364 	mutable CClientSessionData* iData;
   365 private:
   366 	// Prohibited.
   367 	RSyncMLTransport& operator=(const RSyncMLTransport&);
   368 	RSyncMLTransport(const RSyncMLTransport&);
   369 	};
   370 
   371 ///////////////////////////////////////////////////////////////////////////////
   372 ///////////////////////////////////////////////////////////////////////////////
   373 
   374 ///////////////////////////////////////////////////////////////////////////////
   375 // TSmlOpenMode
   376 ///////////////////////////////////////////////////////////////////////////////
   377 enum TSmlOpenMode
   378 /**
   379 	Defines the access mode for opening a handle to a SyncML profile.
   380 */
   381 	{
   382 	/** 
   383 	Open for read-only access to data. 
   384 	
   385 	@capability ReadDeviceData
   386 	@Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
   387 	*/
   388 	ESmlOpenRead,
   389 	
   390 	/** 
   391 	Open for read and write access to data.
   392 	
   393 	@capability ReadDeviceData
   394 	@capability WriteDeviceData
   395 	@Ref void RSyncMLDataSyncProfile::OpenL(RSyncMLSession& aSession, TSmlProfileId aId, TSmlOpenMode aMode)
   396 	*/
   397 	ESmlOpenReadWrite
   398 	};
   399 
   400 ///////////////////////////////////////////////////////////////////////////////
   401 ///////////////////////////////////////////////////////////////////////////////
   402 
   403 ///////////////////////////////////////////////////////////////////////////////
   404 // Panic codes.
   405 ///////////////////////////////////////////////////////////////////////////////
   406 enum TSyncMLClientPanic
   407 	{
   408 	ESmlClientPanicSessionNotOpen,
   409 	ESmlClientPanicSessionAlreadyOpen,
   410 	ESmlClientPanicEventAlreadyRequested
   411 	};
   412 
   413 ///////////////////////////////////////////////////////////////////////////////
   414 ///////////////////////////////////////////////////////////////////////////////
   415 
   416 ///////////////////////////////////////////////////////////////////////////////
   417 ///////////////////////////////////////////////////////////////////////////////
   418 ///////////////////////////////////////////////////////////////////////////////
   419 #endif