ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2008 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:  CMS Server
       
    15 *       
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef __CMSSERVER_H__
       
    21 #define __CMSSERVER_H__
       
    22 
       
    23 // INCLUDES
       
    24 #include <f32file.h>
       
    25 #include "cmscommondefines.h"
       
    26 #include "MCmsPhonebookOperationsObserver.h"
       
    27 
       
    28 //FORWARD DECLARATIONS
       
    29 class CCmsPhonebookProxy;
       
    30 class MPresenceTrafficLights;
       
    31 class MVPbkContactLink;
       
    32 class CCmsServerSession;
       
    33 class CCmsServerContact;
       
    34 class CCmsPhonebookProxy;
       
    35 class CRCSEProfileRegistry;
       
    36 
       
    37 /** 
       
    38  * CCmsScheduler is used instead of default active scheduler to
       
    39  * make customized handling of leaves in RunL methods of active 
       
    40  * objects.
       
    41  */
       
    42 class CCmsScheduler : public CActiveScheduler
       
    43     {
       
    44     public:  // from base class
       
    45 
       
    46         /**
       
    47         * Error handling that ignores leaves of
       
    48         * active object RunL methods
       
    49         */
       
    50         void Error( TInt aError ) const;
       
    51     };
       
    52 
       
    53 /**
       
    54  * CCmsServer class is responsible for starting the server thread and creating
       
    55  * sessions for its clients. 
       
    56  */ 
       
    57 NONSHARABLE_CLASS( CCmsServer ) : public CServer2,
       
    58                                   public MCmsPhonebookOperationsObserver                        
       
    59     {
       
    60     public: // Constructors and destructor
       
    61         
       
    62         /**
       
    63         * Start the server thread
       
    64         *
       
    65         * @return Error code
       
    66         */
       
    67         static TInt StartThreadL();
       
    68 
       
    69         /**
       
    70         * Create a new session
       
    71         *
       
    72         * @param TVersion The version of the client interface
       
    73         * @param RMessage2& Kernel message
       
    74         * @return The new session
       
    75         */
       
    76         CSession2* NewSessionL( const TVersion& aVersion,
       
    77         						const RMessage2& /*aMessage*/ ) const;
       
    78         
       
    79         /**
       
    80         * Destructor
       
    81         */
       
    82         ~CCmsServer();
       
    83 
       
    84     private: // Constructors
       
    85         
       
    86         /**
       
    87         * Create the main server object
       
    88         *
       
    89         * @return Main server object
       
    90         */
       
    91         static CCmsServer* NewLC();
       
    92         
       
    93         /**
       
    94         * Private default constructor
       
    95         * 
       
    96         * @param aPriority Active object priority
       
    97         */
       
    98         CCmsServer( TInt aPriority );
       
    99         
       
   100         /**
       
   101         * The Symbian OS second-phase constructor
       
   102         */
       
   103         void ConstructL();
       
   104     
       
   105     public:
       
   106         
       
   107         /**
       
   108         * Return a reference to phonebook proxy
       
   109         * 
       
   110         * @return Reference to phonebook proxy
       
   111         */
       
   112         CCmsPhonebookProxy& PhonebookProxyHandle();
       
   113 
       
   114         /**
       
   115         * Return a reference to file session handle
       
   116         *
       
   117         * @return File session handle
       
   118         */
       
   119         RFs& FileSession();
       
   120         
       
   121         /**
       
   122          * Return a reference to RCSE Profile registry.
       
   123          * Uses lazy initialization
       
   124          * 
       
   125          * @return RCSE Profile Registry instance 
       
   126          */
       
   127         CRCSEProfileRegistry& RCSEProfileRegistryL();
       
   128         
       
   129     public:  //static
       
   130         
       
   131         /**
       
   132         * Panic the server
       
   133         *
       
   134         * @param aPanic Panic code
       
   135         */
       
   136         static void PanicServer( TCmsServerPanic aPanic );
       
   137             
       
   138     public:  // From MCmsPhonebookOperationsObserver
       
   139     
       
   140         void StoreOpenComplete();  
       
   141         void CmsSingleContactOperationComplete( TInt aError );
       
   142     
       
   143     private:            // Data
       
   144         
       
   145         /// Global handler to file server session, available for all
       
   146         /// CMS sessions. Owned.
       
   147         RFs                                     iFS;
       
   148 
       
   149         /// Phonebook proxy which is responsible for common phonebook 
       
   150         /// operations. Available for all CMS sessions. Owned.
       
   151         CCmsPhonebookProxy*                     iPhonebookProxy;
       
   152         
       
   153         /// Owned. Shared RCSE Profile registry instance for all sessions.
       
   154         /// Constructing this instance is slow and therefore it's kept
       
   155         /// in server where it can be quickly aquired.
       
   156         CRCSEProfileRegistry*                   iRCSEProfileRegistry;
       
   157     };
       
   158 
       
   159 #endif
       
   160 
       
   161 // End of File