serviceproviders/sapi_calendar/calendarservice/inc/asyncreqobserver.h
changeset 19 989d2f495d90
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     1 /*
       
     2 * Copyright (c) 2007 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 the License "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 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __ASYNCREQOBSERVER_H
       
    20 #define __ASYNCREQOBSERVER_H
       
    21 
       
    22 
       
    23 /**
       
    24  * Structure for storing transaction id and associated active object.
       
    25 */
       
    26 struct TAsyncRequestInfo
       
    27 	{
       
    28 
       
    29     /**
       
    30      * TransactionId
       
    31     */
       
    32 	TInt32 iTransactionId;
       
    33 
       
    34     /**
       
    35      * Active object pointer
       
    36     */
       
    37 	CCalendarASyncRequest* iAsyncObj;
       
    38 	};	
       
    39 	
       
    40 
       
    41 /**
       
    42  *  Class used to get callback notification from async request module 
       
    43  *	about completion of request. 
       
    44 */
       
    45 class CAsyncRequestObserver : public CBase
       
    46 	{
       
    47 	public:
       
    48 	
       
    49 		/**
       
    50 		 * Two-Phase Constructor
       
    51 		*/ 
       
    52 		static CAsyncRequestObserver* NewL();
       
    53 		
       
    54 		/**
       
    55 		 * Destructor
       
    56 		*/ 
       
    57 		~CAsyncRequestObserver();
       
    58 		
       
    59 		/**
       
    60 		   * Notifies about the completeion of an async request
       
    61 		   * @param aTransactionId TransactionId of Asynchronous request object
       
    62 		   * @return void
       
    63 	  	*/
       
    64 		void RequestComplete( const TInt32 aTransactionId );
       
    65 
       
    66 		/**
       
    67 		 * Cancels asynchronous request
       
    68 		 * @param aTransactionId     asynchronous transaction id
       
    69 		 * @param aResult        error code
       
    70 		*/ 				
       
    71 		TInt Cancel( const TInt32 aTransectionID );
       
    72 		
       
    73 		/**
       
    74 		 * Adds asynchronous request object
       
    75 		 * @param aTransactionId Transcation Id os Async object
       
    76 		 * @param aAsyncObj  Async object
       
    77 		*/ 
       
    78 		void AddAsyncObjL( const TInt32 aTransactionId, CCalendarASyncRequest* aAsyncObj );
       
    79 
       
    80 	private:
       
    81 	   /**
       
    82 		 * Deletes all the Asynchronous request objects
       
    83 		*/
       
    84 		void DeleteAsyncObjects();
       
    85 
       
    86 	
       
    87 	private:
       
    88 
       
    89 		/**
       
    90 		 * Contains handles of all asynchronous requests
       
    91 	  	*/ 
       
    92 		RArray<TAsyncRequestInfo> iAsyncObjArray;
       
    93 		
       
    94 	};
       
    95 	
       
    96 
       
    97 
       
    98 #endif __ASYNCREQOBSERVER_H