messagingapp/msgappfw/server/inc/ccsserver.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 main class. Co-ordinates server startup 
       
    15  *                and shutdown and receives client requests.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef __C_CS_SERVER_H
       
    20 #define __C_CS_SERVER_H
       
    21 
       
    22 // SYSTEM INCLUDE FILES
       
    23 #include <mcsplugineventobserver.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class MCsPluginEventObserver;
       
    27 class CCsPluginInterface;
       
    28 class CCsConversationCache;
       
    29 class CCsConversationEntry;
       
    30 class CCsSession;
       
    31 class CCsContactsManager;
       
    32 class CCsClientConversation;
       
    33 class CCsBackUpHandler;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 /** 
       
    37  * CS Server main class. Co-ordinates server startup and shutdown 
       
    38  * and receives client requests.
       
    39  */
       
    40 class CCsServer : public CServer2,
       
    41         public MCsPluginEventObserver
       
    42 {
       
    43 public:
       
    44 
       
    45     /**
       
    46      * NewL
       
    47      * Two phase construction
       
    48      */
       
    49     static CCsServer* NewL();
       
    50 
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     ~CCsServer();
       
    55 
       
    56     /**
       
    57      * NewSessionL
       
    58      * Creates a server side session object
       
    59      * Implements NewSessionL of CServer2
       
    60      * 
       
    61      * @param aVersion, defines the version
       
    62      * @param aMessage, instance of the PDU b/w server and client
       
    63      * @return session instance
       
    64      */
       
    65     CSession2
       
    66             * NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
       
    67 
       
    68     /**
       
    69      * ConversationCacheInterface
       
    70      * Return the Conversation Cache interface instance
       
    71      * 
       
    72      * @return CCsConversationCache instance
       
    73      */
       
    74     CCsConversationCache* ConversationCacheInterface();
       
    75 
       
    76     /**
       
    77      * Get caching status
       
    78      */
       
    79     TUint8 GetCachingStatus()
       
    80     {
       
    81         return iCsCachingStatus;
       
    82     }
       
    83 
       
    84     /* ------------ from MCsPluginEventObserver class ----------------------*/
       
    85     /**
       
    86      * AddConversations
       
    87      * Handle Conversation event from  Plugin, to handle new events
       
    88      * 
       
    89      * @param aConversationEntryLists, List of conversation entries.
       
    90      */
       
    91     void
       
    92             AddConversations(
       
    93                              const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
    94 
       
    95     /**
       
    96      * ModifyConversations
       
    97      * event to modify existing conversation
       
    98      * 
       
    99      * @param aConversationEntryLists, List of conversation entries.
       
   100      */
       
   101     void
       
   102             ModifyConversations(
       
   103                                 const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
   104 
       
   105     /**
       
   106      * DeleteConversations
       
   107      * Handle delete Conversation event from Plugin
       
   108      * 
       
   109      * @param aConversationEntryLists, List of conversation entries
       
   110      * to be deleted.
       
   111      */
       
   112     void
       
   113             DeleteConversations(
       
   114                                 const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
       
   115 
       
   116     /**
       
   117      * RefreshConversations
       
   118      * Refresh conversations from plugin.
       
   119      */
       
   120     void RefreshConversations();
       
   121 
       
   122     /**
       
   123      * Caching completed.
       
   124      */
       
   125     void CachingCompleted();
       
   126 
       
   127     /**
       
   128      * Caching error
       
   129      * @param Error Code
       
   130      */
       
   131     void CachingError(const TInt /*aError*/)
       
   132     {
       
   133     }
       
   134     ;
       
   135     
       
   136 	/**
       
   137 	 * Reload the plugins, once they are unloaded after a 
       
   138 	 * backup/ restore
       
   139 	 */
       
   140     void LoadPlugins();
       
   141 	
       
   142 	/**
       
   143 	 * Unload the plugins, for backup/ restore
       
   144 	 */
       
   145     void DeletePlugins();
       
   146     
       
   147 public:
       
   148 
       
   149     /**
       
   150      * NotifySessions 
       
   151      * Notify on-the-fly data changes to all sessions
       
   152      * 
       
   153      * @param aConversation , conversation 
       
   154      * @param aEvent,  event for the change
       
   155      */
       
   156     void NotifySessions(CCsClientConversation* aConversation, TUint32 aEvent);
       
   157 
       
   158 private:
       
   159 
       
   160     /**
       
   161      * Constructor
       
   162      */
       
   163     CCsServer();
       
   164 
       
   165     /**
       
   166      * Second phase constructor
       
   167      */
       
   168     void ConstructL();
       
   169 
       
   170 private:
       
   171 
       
   172     /**
       
   173      * iContactsManager
       
   174      * Contact manager instance
       
   175      * Own.
       
   176      */
       
   177     CCsContactsManager* iContactsManager;
       
   178 
       
   179     /**
       
   180      * iConversationPlugin
       
   181      * A CS Plugin instance 
       
   182      * Own.
       
   183      */
       
   184     CCsPluginInterface* iConversationPlugin;
       
   185 
       
   186     /** 
       
   187      * iConversationCache
       
   188      * Conversation Cache
       
   189      * Own. 
       
   190      */
       
   191     CCsConversationCache* iConversationCache;
       
   192 
       
   193     /**
       
   194      * iCsCachingStatus
       
   195      * Caching status
       
   196      */
       
   197     TUint8 iCsCachingStatus;
       
   198     
       
   199     /**
       
   200      * The backup handler class
       
   201      */
       
   202     CCsBackUpHandler* iBackUpHandler;
       
   203 };
       
   204 
       
   205 #endif // __C_CS_SERVER_H