serviceproviders/sapi_calendar/calendarservice/inc/calendarnotify.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 __CALENDARNOTIFY_H
       
    20 #define __CALENDARNOTIFY_H
       
    21 
       
    22 class MCalCallbackBase;
       
    23 class CAsyncRequestObserver;
       
    24 
       
    25 /**
       
    26  *This class implements CalendarNotify SAPI core logic.It includes  
       
    27  * methods for notification of changes in calendar.
       
    28  * 
       
    29  */
       
    30 class CCalendarObserver : public CCalendarASyncRequest, /*public CActive, */public MCalChangeCallBack2
       
    31 	{
       
    32 	public:
       
    33 	
       
    34 		/**
       
    35 		 * Two-phased constructor.
       
    36 		 * @param CCalendarSessionInfo* a calendar session information.
       
    37 		 * @param aFilter* Filter object. 
       
    38 		 * @param aAsyncRequestObserver Asynchronous request observer
       
    39 	     * @param aNotifyCallback Callback Object for Change notification. 
       
    40 		*/
       
    41 		static CCalendarObserver* NewL( CCalendarSessionInfo* aSessionInfo, 
       
    42 											CCalendarFilter* aFilter, 
       
    43 											CAsyncRequestObserver* aAsyncRequestObserver,
       
    44 											MCalCallbackBase* aNotifyCallback );
       
    45 		
       
    46 		/**
       
    47 		* Start the notification process
       
    48 		*/
       
    49 		void StartChangeNotificationL();
       
    50 		
       
    51 		/**
       
    52 	     * Destructor.
       
    53     	*/
       
    54 		virtual ~CCalendarObserver();
       
    55 
       
    56 		/**
       
    57 		 * Inherited from MCalChangeCallBack2 class 
       
    58 		*/ 
       
    59 		virtual void CalChangeNotification(RArray< TCalChangeEntry > &aChangeItems);		
       
    60 	
       
    61 		virtual TBool IsInProgress();
       
    62 	
       
    63 	private:
       
    64 
       
    65 		/** 
       
    66 	     * Default  constructor.
       
    67 	     * @param aSessionInfo  It is an object of CCalSession Class which
       
    68 	     *        represents a channel of communication between a client thread  
       
    69 	     *        and the calendar Server thread .
       
    70 	     * @param aNotifyCallback It is a callback notification
       
    71 	    */
       
    72 		CCalendarObserver( CCalendarSessionInfo* aSessionInfo, 
       
    73 									CAsyncRequestObserver* aAsyncRequestObserver, 
       
    74 									MCalCallbackBase* aNotifyCallback );
       
    75 
       
    76 		void ConstructL( CCalendarFilter* aFilter );
       
    77 		
       
    78 		/**
       
    79 		 * Inherited from CActive class 
       
    80 		*/ 
       
    81     	virtual void DoCancel();
       
    82 
       
    83 		/**
       
    84 		 * Inherited from CActive class 
       
    85 		*/ 
       
    86         virtual void RunL();
       
    87 
       
    88 		/**
       
    89 		 * Activates the request and call SetActive() function
       
    90 		*/ 
       
    91 		void ActivateRequest(TInt aReason);
       
    92 
       
    93 		/**
       
    94 		 * Gives the result for notification request.
       
    95 		*/ 
       
    96 		void NotifyRequestResult(TInt aReason);
       
    97 	
       
    98 	private:
       
    99 
       
   100 		/**
       
   101 		 * Calendar server session
       
   102 		*/ 
       
   103 		CCalendarSessionInfo* iSessionInfo;
       
   104 
       
   105 		/**
       
   106 		 * Calendar server session for notifications
       
   107 		*/ 
       
   108 		CCalSession* 			iSession;
       
   109 
       
   110 		/**
       
   111 		 * Callback Object
       
   112 		*/ 
       
   113 		MCalCallbackBase* iNotifyCallback;
       
   114 
       
   115 		/**
       
   116 		 * Filter Object
       
   117 		*/ 
       
   118 		CCalendarFilter* iFilter;
       
   119 
       
   120 		/**
       
   121 		 * Asynchronous request observer, Used to get infromed of completion or request
       
   122 		*/ 
       
   123 		CAsyncRequestObserver* 	iAsyncRequestObserver;
       
   124 		
       
   125 		TBool			iIsInProgress;
       
   126 
       
   127 	};
       
   128 
       
   129 
       
   130 
       
   131 #endif __CALENDARNOTIFY_H