stif/TestEngine/inc/SettingServer.h
branchRCL_3
changeset 59 8ad140f3dd41
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains the header file of the 
       
    15 * CSettingServer.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef SETTING_SERVER_H
       
    20 #define SETTING_SERVER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32std.h>
       
    24 #include <e32base.h>
       
    25 #include <StifLogger.h>
       
    26 #include "Logging.h"
       
    27 #include "TestEngineClient.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // Server heap size
       
    32 const TUint KDefaultHeapSize = 0x10000;     // 64 K
       
    33 const TUint KMaxHeapSize     = 0x20000;     // 128 K 
       
    34 
       
    35 // MACROS
       
    36 
       
    37 // DATA TYPES
       
    38 
       
    39 // Panic reasons
       
    40 enum TSettingServerPanic
       
    41     {
       
    42     EBadRequest,
       
    43     EBadDescriptor,
       
    44     EMainSchedulerError,
       
    45     ESvrCreateServer,
       
    46     ECreateTrapCleanup,
       
    47     ENoStartupInformation,
       
    48     ETooManyCloseSessions,
       
    49     EPopFromEmptyStack
       
    50     };
       
    51 
       
    52 // FORWARD DECLARATIONS
       
    53 // None
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 // DESCRIPTION
       
    58 // CSettingServer is a server class.
       
    59 class CSettingServer
       
    60     :public CServer2 // Inter Process Communication version 2 is used(EKA2)
       
    61     {
       
    62     public: // Enumerations
       
    63         enum { ESettingServerSchedulerPriority = CActive::EPriorityHigh };
       
    64 
       
    65     private: // Enumerations
       
    66 
       
    67     public:  // Constructors and destructor
       
    68 
       
    69         /**
       
    70         * NewL is first phase of two-phased constructor.
       
    71         */
       
    72         static CSettingServer* NewL( const TName& aName );
       
    73 
       
    74         /**
       
    75         * Destructor of CSettingServer.
       
    76         */
       
    77         ~CSettingServer();
       
    78 
       
    79     public: // New functions
       
    80 
       
    81         /**
       
    82         * ThreadFunction is used to create new thread.
       
    83         */
       
    84         static TInt ThreadFunction( TAny* aStarted );       
       
    85 
       
    86         /**
       
    87         * PanicServer panics the CSettingServer
       
    88         */
       
    89         static void PanicServer( const TSettingServerPanic aPanic );
       
    90 
       
    91         /**
       
    92         * Return pointer to the Logger(iSettingServerLogger)
       
    93         */
       
    94         CStifLogger* CSettingServer::Logger();
       
    95 
       
    96     public: // Functions from base classes
       
    97 
       
    98         /**
       
    99         * NewSessionL creates new CSettingServer session.
       
   100         */
       
   101         CSession2* NewSessionL( const TVersion &aVersion,
       
   102                                     const RMessage2& aMessage ) const;
       
   103         /**
       
   104         * Open session
       
   105         */
       
   106         void OpenSession();
       
   107 
       
   108         /**
       
   109         * Close session
       
   110         */
       
   111         void CloseSession();
       
   112 
       
   113     protected:  // New functions
       
   114         // None
       
   115 
       
   116     protected:  // Functions from base classes
       
   117         // None
       
   118 
       
   119     private:
       
   120 
       
   121         /** 
       
   122         * C++ default constructor.
       
   123         */
       
   124         CSettingServer();
       
   125 
       
   126         /**
       
   127         * By default Symbian OS constructor is private.
       
   128         */
       
   129         void ConstructL();
       
   130 
       
   131     public:   //Data
       
   132 
       
   133         // NOTE:
       
   134         // There is one CSettingServer and may be many CLoggerSetting sessions
       
   135         // so variables are defined here and are available to all sessions.
       
   136 
       
   137         // Logger overwrite settings
       
   138         TLoggerSettings         iLoggerSettings;
       
   139 
       
   140         // Includes inifile name and path information
       
   141         TFileName               iIniFile;
       
   142         
       
   143         // Engine settings
       
   144         TEngineSettings         iEngineSettings;
       
   145     
       
   146     protected:  // Data
       
   147         // None
       
   148 
       
   149     private:    // Data
       
   150 
       
   151         // Session counter
       
   152         TInt                    iSessions;
       
   153 
       
   154         // Logger instance
       
   155         CStifLogger*            iSettingServerLogger;
       
   156 
       
   157     public:     // Friend classes
       
   158         // None
       
   159 
       
   160     protected:  // Friend classes
       
   161         // None
       
   162 
       
   163     private:    // Friend classes
       
   164         // None
       
   165 
       
   166     };
       
   167 
       
   168 // DESCRIPTION
       
   169 // CLoggerSetting is a session class.
       
   170 // Session for the CSettingServer server, to a single client-side session
       
   171 // a session may own any number of CCounter objects
       
   172 
       
   173 class CLoggerSetting
       
   174     :public CSession2
       
   175     {    
       
   176     public:
       
   177         // None
       
   178 
       
   179     private: // Enumerations
       
   180         // None
       
   181 
       
   182     public:  // Constructors and destructor
       
   183 
       
   184         /**
       
   185         * Construct a clean-up server session
       
   186         */
       
   187         static CLoggerSetting* NewL( CSettingServer* aServer );
       
   188 
       
   189         /**
       
   190         * Destructor
       
   191         */
       
   192         virtual ~CLoggerSetting();
       
   193 
       
   194     public: // New functions
       
   195 
       
   196         /**
       
   197         * Dispatch message
       
   198         */
       
   199         TInt DispatchMessageL( const RMessage2& aMessage,
       
   200                                 TBool& aIsMessageSync );
       
   201 
       
   202         /**
       
   203         * Close the session to CSettingpServer.
       
   204         */
       
   205         TInt CloseSession( /*const RMessage& aMessage*/ );
       
   206 
       
   207         /**
       
   208         * Read Logger setting from initialization file. Mainly use from
       
   209         * TestEngine side.
       
   210         */
       
   211         TInt ReadLoggerSettingsFromIniFile( const RMessage2& aMessage );
       
   212 
       
   213         /**
       
   214         * Set initialization filename and path settings to Setting server.
       
   215         */
       
   216         TInt SetIniFileSettings( const RMessage2& aMessage );
       
   217 
       
   218         /**
       
   219         * Get Logger settings. Mainly use from Logger side.
       
   220         */
       
   221         TInt GetLoggerSettings( const RMessage2& aMessage );
       
   222 
       
   223         /**
       
   224         * 
       
   225         */
       
   226         TInt SetNewIniFileSetting( const RMessage2& aMessage );
       
   227 
       
   228         /**
       
   229         * PanicClient panics the user of CLoggerSetting
       
   230         */
       
   231         void PanicClient( TInt aPanic, const RMessage2& aMessage ) const;
       
   232         
       
   233         /**
       
   234         * Get test engine settings
       
   235         */
       
   236         TInt GetEngineSettings(const RMessage2& aMessage);
       
   237 
       
   238         /**
       
   239         * Set (store) test engine settings
       
   240         */
       
   241         TInt StoreEngineSettings(const RMessage2& aMessage);
       
   242 
       
   243     public: // Functions from base classes
       
   244 
       
   245         /**
       
   246         * ServiceL handles the messages to CSettingServer
       
   247         */
       
   248         virtual void ServiceL( const RMessage2& aMessage );
       
   249 
       
   250     protected:  // New functions
       
   251         // None
       
   252 
       
   253     protected:  // Functions from base classes
       
   254         // None
       
   255 
       
   256     private:
       
   257 
       
   258         /** 
       
   259         * C++ default constructor.
       
   260         */
       
   261         CLoggerSetting();
       
   262 
       
   263         /**
       
   264         * By default Symbian OS constructor is private.
       
   265         */
       
   266         void ConstructL( CSettingServer* aServer );
       
   267 
       
   268         /**
       
   269         * Real resource reservation routine
       
   270         */
       
   271         TInt ReserveInternalL( const RMessage2& aMessage );
       
   272 
       
   273         /**
       
   274         * Read Logger default parameters for initialization file.
       
   275         */
       
   276         TInt ReadLoggerDefaults();
       
   277 
       
   278     public:     // Data
       
   279         // None
       
   280    
       
   281     protected:  // Data
       
   282         // None
       
   283 
       
   284     private:    // Data
       
   285 
       
   286         // Pointer to "parent"
       
   287         CSettingServer*         iSettingServer;
       
   288 
       
   289         // Indication for reading logger defaults from initialization file.
       
   290         TBool                   iReadOrUpdateLoggerDefaults;
       
   291 
       
   292     public:     // Friend classes
       
   293         // None
       
   294 
       
   295     protected:  // Friend classes
       
   296         // None
       
   297 
       
   298     private:    // Friend classes
       
   299         // None
       
   300 
       
   301     };
       
   302 
       
   303 #endif // SETTING_SERVER_H
       
   304 
       
   305 // End of File