genericservices/activebackupclient/inc/abachandler.h
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 /**
       
     2 * Copyright (c) 2004-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:
       
    15 * Declaration of CActiveBackupCallbackHandler
       
    16 * 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 /**
       
    23  @file
       
    24 */
       
    25 #ifndef __ACTIVEBACKUPCALLBACKHANDLER_H__
       
    26 #define __ACTIVEBACKUPCALLBACKHANDLER_H__
       
    27 
       
    28 #include <e32base.h>
       
    29 #include <connect/abclient.h>
       
    30 #include <connect/abclientserver.h>
       
    31 
       
    32 namespace conn
       
    33 	{ 
       
    34 	class MActiveBackupDataClient;
       
    35 	class RABClientSession;
       
    36 	
       
    37 	class CActiveBackupCallbackHandler : public CActive
       
    38 		/**
       
    39 		CActiveBackupCallbackHandler is used to handle the asynchronous calls back from the
       
    40 		active backup server. IPC only allows client initiated message transfer and hence the 
       
    41 		Active Backup Callback Handler must prime the server with an initial message and use 
       
    42 		the async response to "send" a message to the client side.
       
    43 		
       
    44 		@internal component
       
    45 		*/
       
    46 		{
       
    47 	public:
       
    48 
       
    49 		/** 
       
    50 		Empty virtual destructor to avoid memory leaks
       
    51 		*/
       
    52 		virtual ~CActiveBackupCallbackHandler();
       
    53 		
       
    54 		static CActiveBackupCallbackHandler* NewL(MActiveBackupDataClient* aABDC, 
       
    55 			RABClientSession& aClientSession);
       
    56 		
       
    57 		/**
       
    58 		RunL will synchronously call the callback implementation passed in to this object
       
    59 		*/
       
    60 		void RunL();
       
    61 		
       
    62 		/**
       
    63 		*/
       
    64 		void DoCancel();
       
    65 		
       
    66 		/**
       
    67 		RunError implementation should send the leave code to the ABServer for propagation back 
       
    68 		to the SBEngine client. This enables any leaves from the callbacks to be returned to the 
       
    69 		PC for display/handling by the user
       
    70 		
       
    71 		@return any unhandled error code
       
    72 		*/
       
    73 		TInt RunError(TInt aError);
       
    74 		
       
    75 		void ConstructL();
       
    76 		
       
    77 		void StartListeningForServerMessagesL();
       
    78 	
       
    79 	private:
       
    80 		CActiveBackupCallbackHandler(MActiveBackupDataClient* aABDC, RABClientSession& aClientSession);
       
    81 		void PrimeServerForCallbackL();
       
    82 		void PrimeServerForCallbackWithResponseL(TInt aResponse);
       
    83 		void PrimeServerForCallbackWithResponseL(TDesC8& aResponse);
       
    84 		TPtr8 CreateFixedBufferL();
       
    85 			
       
    86 	private:
       
    87 		/** Callback mixin implementation provided by the active backup client */
       
    88 		MActiveBackupDataClient* iActiveBackupDataClient;
       
    89 		
       
    90 		/** The client session to call methods on */
       
    91 		RABClientSession& iClientSession;
       
    92 
       
    93 		/** This modifiable package buf is set by the Server to define which callback should 
       
    94 		be called on the client */
       
    95 		TPckgBuf<TABCallbackCommands> iCallbackCommand;
       
    96 		
       
    97 		/** Modifiable package buf containing the first of a maximum of two arguments for the callback */
       
    98 		TPckgBuf<TInt> iCallbackArg1;
       
    99 
       
   100 		/** Modifiable package buf containing the second of a maximum of two arguments for the callback */
       
   101 		TPckgBuf<TInt> iCallbackArg2;
       
   102 		
       
   103 		/** Buffer for holding transferred data from server */
       
   104 		HBufC8* iTransferBuffer;
       
   105 		};
       
   106 
       
   107 	} // end namespace
       
   108 
       
   109 #endif // __ACTIVEBACKUPCALLBACKHANDLER_H__
       
   110