syncmlfw/common/sosserver_clientapi/inc/NSmlClientAPIActiveCallback.h
changeset 0 b497e44ab2fc
child 23 4af31167ea77
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2005 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: 
       
    15 *		Declaration file for client API's event/progress notifiers
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CLIENTAPIACTIVECALLBACK_H__
       
    21 #define __CLIENTAPIACTIVECALLBACK_H__
       
    22 
       
    23 #include <SyncMLClient.h>
       
    24 #include <SyncMLObservers.h>
       
    25 
       
    26 class CSmlActiveEventCallback;
       
    27 class CSmlActiveProgressCallback;
       
    28 
       
    29 // 
       
    30 // container class from event and progress callbacks
       
    31 // 
       
    32 class CSmlActiveCallback : public CBase
       
    33 	{
       
    34 	public:
       
    35 		CSmlActiveCallback( RSyncMLSession& aSession );
       
    36 		~CSmlActiveCallback();
       
    37 		
       
    38 		void SetEventObserverL( MSyncMLEventObserver& aObserver );
       
    39 		void SetProgressObserverL( MSyncMLProgressObserver& aObserver );
       
    40 		
       
    41 		void CancelEvent();
       
    42 		void CancelProgress();
       
    43 		
       
    44 		void SendReceive( TInt aCmd, const TIpcArgs& aArgs, TRequestStatus& aStatus ) const;
       
    45 		void SendReceive( TInt aCmd ) const;
       
    46 		
       
    47 	private:
       
    48 	
       
    49 		RSyncMLSession&				iSession;
       
    50 		CSmlActiveEventCallback*	iEventCallback;
       
    51 		CSmlActiveProgressCallback*	iProgressCallback;
       
    52 	};
       
    53 
       
    54 
       
    55 // 
       
    56 // event callback
       
    57 // 
       
    58 class CSmlActiveEventCallback : public CActive
       
    59 	{
       
    60 	public:
       
    61 		static CSmlActiveEventCallback* NewL( const CSmlActiveCallback* aCallback );
       
    62 		virtual ~CSmlActiveEventCallback();
       
    63 		
       
    64 		void SetObserver( MSyncMLEventObserver& aObserver );
       
    65 		void CancelEvent();
       
    66 		
       
    67 		// from CActive
       
    68 		virtual void DoCancel();
       
    69 		virtual void RunL();
       
    70 		
       
    71 	private:
       
    72 		void Request();
       
    73 		void ConstructL();
       
    74 		CSmlActiveEventCallback( const CSmlActiveCallback* aCallback );
       
    75 		
       
    76 	private:
       
    77 		TBool	iRequesting;
       
    78 		TPtr8	iBufPtr;
       
    79 		HBufC8*	iBuf;
       
    80 		
       
    81 		MSyncMLEventObserver*		iObserver; // not owned
       
    82 		const CSmlActiveCallback*	iCallback; // not owned
       
    83 	};
       
    84 
       
    85 
       
    86 // 
       
    87 // progress callback
       
    88 // 
       
    89 class CSmlActiveProgressCallback : public CActive
       
    90 	{
       
    91 	public:
       
    92 		static CSmlActiveProgressCallback* NewL( const CSmlActiveCallback* aCallback );
       
    93 		virtual ~CSmlActiveProgressCallback();
       
    94 		
       
    95 		void SetObserver( MSyncMLProgressObserver& aObserver );
       
    96 		void CancelProgress();
       
    97 		
       
    98 		// from CActive
       
    99 		virtual void DoCancel();
       
   100 		virtual void RunL();
       
   101 		
       
   102 	private:
       
   103 		void Request();
       
   104 		void ConstructL();
       
   105 		CSmlActiveProgressCallback( const CSmlActiveCallback* aCallback );
       
   106 		
       
   107 		void NotifyErrorL( RReadStream& aStream ) const;
       
   108 		void NotifyProgressL( RReadStream& aStream ) const;
       
   109 		void NotifyModificationsL( RReadStream& aStream );
       
   110 		
       
   111 	private:
       
   112 		TBool	iRequesting;
       
   113 		TPtr8	iBufPtr;
       
   114 		HBufC8*	iBuf;
       
   115 		
       
   116 		MSyncMLProgressObserver::TSyncMLDataSyncModifications iClientMods;
       
   117 		MSyncMLProgressObserver::TSyncMLDataSyncModifications iServerMods;
       
   118 		
       
   119 		MSyncMLProgressObserver*	iObserver; // not owned
       
   120 		const CSmlActiveCallback*	iCallback; // not owned
       
   121 	};
       
   122 
       
   123 
       
   124 #endif // __CLIENTAPIACTIVECALLBACK_H__