serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagenotify.h
changeset 22 fc9cf246af83
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
       
     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 
       
    20 #ifndef __MESSAGENOTIFY_H
       
    21 #define __MESSAGENOTIFY_H
       
    22 
       
    23 class CMsgCallbackBase;
       
    24 class CMessageHeader;
       
    25 
       
    26 #include <msvapi.h>
       
    27 
       
    28 /**
       
    29  *This class implements MessageNotify SAPI core logic.It includes  
       
    30  * methods for notification of new messages.
       
    31  * 
       
    32  */
       
    33 class CMessageObserver : public CBase, public MMsvSessionObserver
       
    34 	{
       
    35 	public:
       
    36 	
       
    37 		/**
       
    38 		* Two-phased constructor.
       
    39 		* @param CMsvSession* a message server session.
       
    40 		* @param CMsgCallbackBase* 
       
    41 		*/
       
    42 		static CMessageObserver* NewL( CMsvSession* aSession = NULL, 
       
    43 										CMsgCallbackBase* aNotifyCallback = NULL );
       
    44 		
       
    45 		/**
       
    46 	     * Destructor.
       
    47     	*/
       
    48 		virtual ~CMessageObserver();
       
    49 
       
    50 		/**
       
    51 		 * Inherited from MMsvSessionObserver class 
       
    52 		*/ 
       
    53 		virtual void HandleSessionEventL( TMsvSessionEvent aEvent, 
       
    54 											TAny* aArg1, 
       
    55 											TAny* aArg2, 
       
    56 											TAny* aArg3 );		
       
    57 	
       
    58 		/**
       
    59 		 * Sets the message server session
       
    60 		 * @param aSession It is a message server session.
       
    61 		*/ 
       
    62 		void SetSession( CMsvSession* aSession );
       
    63 
       
    64 		/**
       
    65 		 * Sets the callback object
       
    66 		 * @param aCallback It is callback object to be registered
       
    67 		 * @return Old callback object
       
    68 		*/ 
       
    69 		CMsgCallbackBase* SetCallback( CMsgCallbackBase* aCallback );
       
    70 		
       
    71 		/**
       
    72 		 * Checks if Notification is activated
       
    73 		 * 
       
    74 		 * @return True if notification request is active.
       
    75 		*/ 
       
    76 		TBool IsActive();
       
    77 
       
    78 	private:
       
    79 
       
    80 		/** 
       
    81 	     * Default  constructor.
       
    82 	     * @param aSession  It is an object of CMsvSession Class which
       
    83 	     *        represents a channel of communication between a client thread  
       
    84 	     *        and the Message Server thread .
       
    85 	     * @param aNotifyCallback It is a callback notification
       
    86 	    */
       
    87 		CMessageObserver( CMsvSession* aSession, CMsgCallbackBase* aNotifyCallback );
       
    88 
       
    89 		/**
       
    90 		 * Sets the message header fields
       
    91 		 * @param aMessageId It is the ID of  message whose header fields are to be set
       
    92 		*/ 
       
    93 		CMessageHeader* MessageHeaderL( TMsvId aMessageId );
       
    94 		
       
    95 	private:
       
    96 
       
    97 		/**
       
    98 		 * Message server session
       
    99 		 * Not own.
       
   100 		*/ 
       
   101 		CMsvSession* iServerSession;
       
   102 
       
   103 		/**
       
   104 		 * Callback Object
       
   105 		 * Not own.
       
   106 		*/ 
       
   107 		CMsgCallbackBase* iNotifyCallback;
       
   108 
       
   109 		/**
       
   110 		 * Message ID
       
   111 		*/
       
   112 		TMsvId iNewMessageId;
       
   113 	};
       
   114 
       
   115 
       
   116 
       
   117 #endif __MESSAGENOTIFY_H