messagingapp/msgappfw/server/inc/ccssession.h
branchRCL_3
changeset 57 ebe688cedc25
equal deleted inserted replaced
54:fa1df4b99609 57:ebe688cedc25
       
     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 "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:  CS Server Client Session class
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef __C_CS_SESSION_H
       
    19 #define __C_CS_SESSION_H
       
    20 
       
    21 // FORWARD DECLARATIONS
       
    22 class CCsServer;
       
    23 class CCsPluginInterface;
       
    24 class CCsClientConversation;
       
    25 class CCsConversationEvent;
       
    26 
       
    27 // CLASS DECLARATIONS
       
    28 
       
    29 /**
       
    30  * Represents a session (version 2) for a client thread on 
       
    31  * the server side
       
    32  */
       
    33 class CCsSession : public CSession2
       
    34     {
       
    35 public:
       
    36 
       
    37     /**
       
    38      * Two phase construction
       
    39      * 
       
    40      * @param aServer, instance of CsServer
       
    41      */
       
    42     static CCsSession* NewL(CCsServer* aServer);
       
    43 
       
    44     /**
       
    45      * ServiceL
       
    46      * Handles the servicing of client requests
       
    47      * Implements CSession2 ServiceL
       
    48      * 
       
    49      * @param aMessage  RMessage reference
       
    50      */
       
    51     void ServiceL(const RMessage2& aMessage);
       
    52 
       
    53     /**
       
    54      * ServiceError
       
    55      * Handles the leaves generated by ServiceL function
       
    56      * Implements CSession2 ServiceError
       
    57      * 
       
    58      * @param aMessage  RMessage instance
       
    59      * @parea, aError the error occured during the service 
       
    60      */
       
    61     void ServiceError(
       
    62             const RMessage2& aMessage, 
       
    63             TInt aError);
       
    64 
       
    65     /**
       
    66      * HandleNewConversationListEventL
       
    67      * Handles the new conversation list event received from cache
       
    68      * asynchronously
       
    69      * 
       
    70      * @param aClientConversation the client conversation to be processed
       
    71      */
       
    72     void HandleNewConversationListEventL(
       
    73             CCsClientConversation* aClientConversation);
       
    74 
       
    75     /**
       
    76      * HandleDeleteConversationListEventL
       
    77      * Handles the delete conversation  list event received from cache
       
    78      * asynchronously
       
    79      * 
       
    80      * @param aClientConversation the client conversation to be processed
       
    81      */
       
    82     void HandleDeleteConversationListEventL(
       
    83             CCsClientConversation* aClientConversation);
       
    84 
       
    85     /**
       
    86      * HandleModifyConversationListEventL
       
    87      * Handles the modify conversation modify event received from cache
       
    88      * asynchronously
       
    89      * 
       
    90      * @param aClientConversation the client conversation to be processed
       
    91      */
       
    92     void HandleModifyConversationListEventL(
       
    93             CCsClientConversation* aClientConversation);      
       
    94 
       
    95 	/**
       
    96 	 * HandlePartialDeleteConversationListEvent
       
    97 	 * Handles the partial delete conversation event from cache
       
    98 	 */
       
    99     void HandlePartialDeleteConversationListEvent(
       
   100             CCsClientConversation* aClientConversation);
       
   101     
       
   102     /**
       
   103      * HandleNewConversationEventL
       
   104      * Handles the new conversation event received from cache
       
   105      * asynchronously
       
   106      * 
       
   107      * @param aClientConversation the client conversation to be processed
       
   108      */
       
   109     void HandleNewConversationEventL(
       
   110             CCsClientConversation* aClientConversation);
       
   111 
       
   112     /**
       
   113      * HandleDeleteConversationEventL
       
   114      * Handles the delete conversation event received from cache
       
   115      * asynchronously
       
   116      * 
       
   117      * @param aClientConversation the client conversation to be processed
       
   118      */
       
   119     void HandleDeleteConversationEventL(
       
   120             CCsClientConversation* aClientConversation);
       
   121 
       
   122     /**
       
   123      * HandleModifyConversationEventL
       
   124      * Handles the modify conversation event received from cache
       
   125      * asynchronously
       
   126      * 
       
   127      * @param aClientConversation the client conversation to be processed
       
   128      */
       
   129     void HandleModifyConversationEventL(
       
   130             CCsClientConversation* aClientConversation);
       
   131 
       
   132     /**
       
   133      * HandleChangeEventL
       
   134      * Handle on-the-fly data changes event
       
   135      * 
       
   136      * @param aConversation , conversation change
       
   137      * @param aEvent,  event for the change
       
   138      */
       
   139     void HandleChangeEventL(CCsClientConversation* aConversation,
       
   140             TUint32 aEvent );
       
   141     
       
   142     /**
       
   143      * HandleRefreshConversationListL.
       
   144      * Notify client to refresh conversation list.
       
   145      */
       
   146     void HandleRefreshConversationListL();
       
   147     
       
   148     /**
       
   149      * HandleRefreshConversationList.
       
   150      * Notify client to refresh conversations.
       
   151      */
       
   152     void HandleRefreshConversationL();
       
   153 
       
   154    
       
   155 private:
       
   156 
       
   157     /**
       
   158      * Second phase constructor
       
   159      */
       
   160     void ConstructL();
       
   161 
       
   162     /**
       
   163      * Constructor
       
   164      */
       
   165     CCsSession(CCsServer* aServer);
       
   166 
       
   167     /**
       
   168      *  Destructor
       
   169      */
       
   170     ~CCsSession();
       
   171 
       
   172     /**
       
   173      * DoServiceL
       
   174      * Serve the client requests
       
   175      * 
       
   176      * @param aMessage, RMessage instace
       
   177      */
       
   178     void DoServiceL(const RMessage2& aMessage);
       
   179 
       
   180     /**
       
   181      * GetConversationsL
       
   182      * Service method to get the 
       
   183      * conversation entry list for one conversation entry ID
       
   184      * 
       
   185      * @param aMessage RMessage instace
       
   186      */		
       
   187     void GetConversationsL(const RMessage2& aMessage);
       
   188 
       
   189     /**
       
   190      * GetConversationListL
       
   191      * Service method to get the 
       
   192      * list of recent(latest) conversation entry and 
       
   193      * list of dispalyname for all stored conversation entry ID
       
   194      * 
       
   195      * @param aMessage RMessage instace
       
   196      */     
       
   197     void GetConversationListL(const RMessage2& aMessage);
       
   198 
       
   199     /**
       
   200      * GetConversationUnreadListL
       
   201      * Service method to get the
       
   202      * list of recent(latest) unread conversation entry and
       
   203      * list of dispalyname for all stored conversation entry ID
       
   204      *
       
   205      * @param aMessage RMessage instace
       
   206      */
       
   207     void GetConversationUnreadListL(const RMessage2& aMessage);
       
   208 
       
   209     /**
       
   210      * DeleteConversationL
       
   211      * Service method to delete a conversation
       
   212      * 
       
   213      * @param aMessage RMessage instace
       
   214      */     
       
   215     void DeleteConversationL(const RMessage2& aMessage);
       
   216 
       
   217     /**
       
   218      * ShutdownServerL
       
   219      * Service method to shutdown the server
       
   220      * 
       
   221      * @param aMessage RMessage instace
       
   222      */
       
   223     void ShutdownServerL(const RMessage2& aMessage);
       
   224 
       
   225     /**
       
   226      * RequestChangeEventL
       
   227      * Service method to request add as observer 
       
   228      * for on cache change events
       
   229      * 
       
   230      * @param aMessage RMessage instace
       
   231      */
       
   232     void RequestChangeEventL(const RMessage2& aMessage);
       
   233 
       
   234     /**
       
   235      * RemoveChangeEventL
       
   236      * Service method to remove as observer 
       
   237      * for on cache change events
       
   238      * 
       
   239      * @param aMessage RMessage instace
       
   240      */
       
   241     void RemoveChangeEventL(const RMessage2& aMessage);
       
   242 
       
   243     /**
       
   244      * GetCachingStatusL
       
   245      * Service method to request conversation server
       
   246      * to get caching status
       
   247      * 
       
   248      * @param aMessage RMessage instace
       
   249      */
       
   250     void GetCachingStatusL(const RMessage2& aMessage);
       
   251 
       
   252     /**
       
   253      * GetTotalUnreadCountL
       
   254      * Gets total unread conversation entries.
       
   255      *
       
   256      * @param aMessage RMessage instace
       
   257      */
       
   258     void GetTotalUnreadCountL(const RMessage2& aMessage);
       
   259 
       
   260     /**
       
   261      * SetConversationListChangeObserverL
       
   262      * Service method to request conversation server
       
   263      * to set conversation list change observer flag
       
   264      * 
       
   265      * @param aMessage RMessage instace
       
   266      */
       
   267     void SetConversationListChangeObserverL(const RMessage2& aMessage);  
       
   268 
       
   269     /**
       
   270      * ResetConversationListChangeObserverL
       
   271      * Service method to request conversation server
       
   272      * to reset conversation list change observer flag
       
   273      * 
       
   274      * @param aMessage RMessage instace
       
   275      */
       
   276     void ResetConversationListChangeObserverL(const RMessage2& aMessage);  
       
   277 
       
   278     /**
       
   279      * SetConversationChangeObserverL
       
   280      * Service method to request conversation server
       
   281      * to set conversation change observer flag for given
       
   282      * client conversation
       
   283      * 
       
   284      * @param aMessage RMessage instace
       
   285      */
       
   286     void SetConversationChangeObserverL(const RMessage2& aMessage);  
       
   287 
       
   288     /**
       
   289      * ResetConversationChangeObserverL
       
   290      * Service method to request conversation server
       
   291      * to reset conversation change observer flag for given
       
   292      * client conversation 
       
   293      * 
       
   294      * @param aMessage RMessage instace
       
   295      */
       
   296     void ResetConversationChangeObserverL(const RMessage2& aMessage);  
       
   297 
       
   298     /**
       
   299      * SetCachingStatusObserverL
       
   300      * Service method to request conversation server
       
   301      * to set caching status observer flag
       
   302      * 
       
   303      * @param aMessage RMessage instace
       
   304      */
       
   305     void SetCachingStatusObserverL(const RMessage2& aMessage);  
       
   306 
       
   307     /**
       
   308      * ResetCachingStatusObserverL
       
   309      * Service method to request conversation server
       
   310      * to reset caching status observer flag
       
   311      *  
       
   312      * @param aMessage RMessage instance
       
   313      */
       
   314     void ResetCachingStatusObserverL(const RMessage2& aMessage);  
       
   315 
       
   316     /**
       
   317      * NotifyClient
       
   318      * Notify client for cache change event
       
   319      * 
       
   320      * @param aConversationEvent instance of the event to be notified
       
   321      */		
       
   322     void NotifyClient(CCsConversationEvent* aConversationEvent);
       
   323 
       
   324     /**
       
   325      * GetConversationIdL
       
   326      * Get the conversation id.
       
   327      * 
       
   328      * @param aMessage RMessage instance
       
   329      */
       
   330     void GetConversationIdL(const RMessage2& aMessage);
       
   331     
       
   332     /**
       
   333      * GetConversationIdfromAddressL
       
   334      * Get the conversation id from address
       
   335      * 
       
   336      * @param aMessage RMessage instance
       
   337      */
       
   338     void GetConversationIdfromAddressL(const RMessage2& aMessage);
       
   339 
       
   340     void GetConversationFromConversationIdL(const RMessage2& aMessage);
       
   341 	
       
   342 	/**
       
   343      * GetConversationFromMessageIdL
       
   344      * Get the conversation from message-id
       
   345      * 
       
   346      * @param aMessage RMessage instance
       
   347      */
       
   348     void GetConversationFromMessageIdL(const RMessage2& aMessage);
       
   349     
       
   350     /**
       
   351      * MarkConversationReadL
       
   352      * Service method to mark a conversation as read.
       
   353      * 
       
   354      * @param aMessage RMessage instance
       
   355     */
       
   356     void MarkConversationReadL(const RMessage2& aMessage);
       
   357     
       
   358 private:
       
   359 
       
   360     /**
       
   361      * iServer
       
   362      * Reference to server (not owned)
       
   363      */
       
   364     CCsServer*  iServer;
       
   365 
       
   366     /**
       
   367      * Buf for doing IPC
       
   368      * Own
       
   369      */
       
   370     HBufC8*  iDes;
       
   371 
       
   372     /**
       
   373      * iEventList
       
   374      * Temp list of cache change event 
       
   375      * Own
       
   376      */
       
   377     RPointerArray<CCsConversationEvent>*  iEventList;
       
   378 
       
   379     /**
       
   380      * iMonitoredConversation
       
   381      * Conversation monitored for changes.
       
   382      */
       
   383     CCsClientConversation*  iMonitoredConversation;
       
   384 
       
   385     /**
       
   386      * iAsyncReqRMessage
       
   387      * Store RMeessage received from clinet
       
   388      * for cache change event notification
       
   389      *  (NotOwned)
       
   390      */
       
   391     RMessagePtr2  iAsyncReqRMessage;
       
   392 
       
   393     /**
       
   394      * iBufferOverflow
       
   395      * boolean to make if overflow has occured
       
   396      */
       
   397     TBool iBufferOverflow;
       
   398 
       
   399     /**
       
   400      * iGetConversationBufferOverflow
       
   401      * boolean to make if overflow has occured in API GetConversation
       
   402      */
       
   403     TBool iGetConversationBufferOverflow;
       
   404 
       
   405     /**
       
   406      * iNotifyHandling
       
   407      * iAsyncReqRMessage is valid or not for
       
   408      * notification handling
       
   409      * Owned
       
   410      */
       
   411     TBool iNotifyHandling;
       
   412 
       
   413     /**
       
   414      * iConversationListChangeObserver
       
   415      * It will true if observer
       
   416      * registered for conversation List change event
       
   417      * Owned
       
   418      */        
       
   419     TBool  iConversationListChangeObserver;
       
   420 
       
   421     /**
       
   422      * iConversationChangeObserver
       
   423      * It will true if observer
       
   424      * registered for conversation change observer
       
   425      * Owned
       
   426      */
       
   427     TBool  iConversationChangeObserver;
       
   428 
       
   429     /**
       
   430      * iCachingChangeObserver
       
   431      * It will true if observer
       
   432      * registered for caching status change observer
       
   433      * Owned
       
   434      */
       
   435     TBool  iCachingChangeObserver;
       
   436 
       
   437     /**
       
   438      * iReqCnt
       
   439      * Maintains the count of requests which are being served
       
   440      */
       
   441     TInt iReqCnt;
       
   442     };
       
   443 
       
   444 #endif // __C_CS_SESSION_H
       
   445