serviceproviders/sapi_messaging/tsrc/testing/tmessagingtest/get_message_async/inc/messagingservice.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 __MESSAGINGSERVICE_H
       
    21 #define __MESSAGINGSERVICE_H
       
    22 
       
    23 #include "messageheader.h"
       
    24 
       
    25 class CMessageObserver;
       
    26 
       
    27 
       
    28 /**
       
    29  * Messaging Service class 
       
    30 */
       
    31 class CMessagingService : public CBase, public MAsyncRequestObserver
       
    32 	{
       
    33 	public:
       
    34 
       
    35 		/**
       
    36 		 * Two Phase Constructor
       
    37 		*/ 
       
    38 		IMPORT_C static CMessagingService* NewL();
       
    39 
       
    40 		/**
       
    41 		 * Destructor
       
    42 		*/ 
       
    43 		virtual ~CMessagingService();
       
    44 
       
    45 	private:
       
    46 
       
    47 		/**
       
    48 		 * Constructor
       
    49 		*/ 
       
    50 		CMessagingService();
       
    51 
       
    52 		/**
       
    53 		 * Constructor
       
    54 		*/ 
       
    55 		void ConstructL();
       
    56 		
       
    57 		/**
       
    58 		 * Adds asynchronous request object
       
    59 		 * @param aTransactionId Transcation Id os Async object
       
    60 		 * @param aAsyncObj  Async object
       
    61 		*/ 
       
    62 		void AddAsyncObjL( const TInt32 aTransactionId, CActive* aAsyncObj );
       
    63 
       
    64 		/**
       
    65 		 * Deletes all the Asynchronous request objects
       
    66 		*/
       
    67 		void DeleteAsyncObjects();
       
    68 		
       
    69 	public:
       
    70 
       
    71 		/**
       
    72 		 * Sends Message
       
    73 		 * @param aMessageParam Structure containing details about the message
       
    74 		 *         							which is being send
       
    75 		 * @param aCallback     CallBack object for asynchronous operation
       
    76 		*/ 
       
    77 		IMPORT_C void SendMessageL( CSendMessageParams* aMessageParam, 
       
    78 											CMsgCallbackBase* aCallback = NULL );
       
    79 
       
    80 		/**
       
    81 		 * Deletes Message
       
    82 		 * @param aMessageId  Message Id of message which is to be deleted
       
    83 		 * @param aCallback   CallBack object for asynchronous operation
       
    84 		*/ 
       
    85 		IMPORT_C void DeleteMessageL( const TMsvId aMessageId,
       
    86 											CMsgCallbackBase* aCallback = NULL );
       
    87 
       
    88 		/**
       
    89 		 * Changes Status
       
    90 		 * @param aMessageId  Message Id of message which is to be deleted
       
    91 		 * @param aStatusFlag Status flag
       
    92 		 * @param aFlagValue  Flag value
       
    93 		 * @param aCallback   CallBack object for asynchronous operation
       
    94 		*/ 
       
    95 		IMPORT_C void ChangeStatusL( const TMsvId aMessageId,
       
    96 											const TMessageStatusFlag aStatusFlag,
       
    97 											const TBool  aFlagValue,
       
    98 											CMsgCallbackBase* aCallback = NULL );
       
    99 
       
   100 		/**
       
   101 		 * Gives notification 
       
   102 		 * @param aNotification  Notification type
       
   103 		 * @param aCallback   CallBack object for asynchronous operation
       
   104 		*/ 		
       
   105 		IMPORT_C TInt RequestNotification( const TNotificationType aNotification, 
       
   106 											CMsgCallbackBase* aCallback );
       
   107 
       
   108 		/**
       
   109 		 * Cancels notification 
       
   110 		 * @param aNotification  Notification type
       
   111 		 * @param aCallback      CallBack object for asynchronous operation
       
   112 		*/ 				
       
   113 		IMPORT_C TInt CancelNotification( const TNotificationType aNotification, 
       
   114 											CMsgCallbackBase* aCallback = NULL );
       
   115 
       
   116 		
       
   117 		/**
       
   118 		 * Gives list of message ids
       
   119 		 * @param aFilterParams  Filter parameters
       
   120 		 * @param aFolderId  	 Folder to be used (Inbox/outbox/send/...)
       
   121 		 * @param aCallback      CallBack object for asynchronous operation
       
   122 		 * @param aEntrySelection   output pararmeter for the result id array
       
   123 		*/ 				
       
   124 		IMPORT_C void GetIdListL( CFilterParamInfo* aFilterParams,
       
   125 											TMsvId aFolderId,
       
   126 									        CMsgCallbackBase* 	/*aCallback*/,
       
   127 									        CMsvEntrySelection*& aEntrySelection );
       
   128 											        
       
   129 		/**
       
   130 		 * Gives next header based on inputs 
       
   131 		 * @param aFilterParams  Filter parameters
       
   132 		 * @param aEntrySelection array of message ids on which filteration to be done
       
   133 		 * @param aIndex      starting position on aEntrySelection to be start search
       
   134 		 * @param aCallback   CallBack object for asynchronous operation
       
   135 		 * @param aHeader   output pararmeter for the result header
       
   136 		*/ 				
       
   137 		IMPORT_C void GetNextHeaderL( CFilterParamInfo* aFilterParams,
       
   138 											CMsvEntrySelection* aEntrySelection,
       
   139 											TInt& aIndex, 
       
   140 							        		CMsgCallbackBase* 	/*aCallback*/,
       
   141 							        		CMessageHeader*& aHeader );
       
   142 		/**
       
   143 		 * Gives message details 
       
   144 		 * @param aMessageId     Message id 
       
   145 		 * @param aCallback      CallBack object for asynchronous operation
       
   146 		 * @param aResult        Output parameter containing requested message details
       
   147 		*/ 				
       
   148 		IMPORT_C void GetMessageDetailL( const TMsvId aMessageId, 
       
   149 											CMsgCallbackBase* aCallback, 
       
   150 											CMessageDetailInfo*& aResult );
       
   151 
       
   152 		/**
       
   153 		 * Cancels asynchronous request
       
   154 		 * @param aTransactionId     asynchronous transaction id
       
   155 		 * @param aResult        error code
       
   156 		*/ 				
       
   157 		IMPORT_C TInt Cancel( const TInt32 aTransactionId );
       
   158 
       
   159 
       
   160 	//MAsyncRequestObserver	drived
       
   161 	public:
       
   162 
       
   163 		/**
       
   164 		   * Notifies Messaging service about the completeion of the request
       
   165 		   * @param aTransactionId TransactionId of Asynchronous request object
       
   166 		   * @return void
       
   167 	  	*/
       
   168 		void RequestComplete( const TInt32 aTransactionId );
       
   169 
       
   170 	private:
       
   171 		
       
   172 		/**
       
   173 		 * Represents a channel of communication between a client thread 
       
   174 		 * and the Message Server thread.
       
   175 	  	*/ 
       
   176 		CMsvSession* iMsgServerSession;
       
   177 		
       
   178 		/**
       
   179 		 * Provides the interface for notification of events from a Message Server session.
       
   180 	  	*/ 
       
   181 		CMessageObserver* iSessionObserver;
       
   182 		
       
   183 		/**
       
   184 		 * Contains handles of all asynchronous requests
       
   185 	  	*/ 
       
   186 		RArray<TAsyncRequestInfo> iAsyncObjArray;
       
   187 	};
       
   188 
       
   189 
       
   190 #endif __MESSAGINGSERVICE_H