PECengine/CoreUtilsLib2/SrvInc/TPEngServerParams.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Server startup parameters.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __TPENGSERVERPARAMS_H__
       
    19 #define __TPENGSERVERPARAMS_H__
       
    20 
       
    21 
       
    22 //  INCLUDES
       
    23 #include <E32Std.h>
       
    24 
       
    25 
       
    26 // CLASS DECLARATION
       
    27 /**
       
    28  * Server startup parameters.
       
    29  *
       
    30  * Container to pass startup params to launched server process.
       
    31  * This class is also used to signal client when the server
       
    32  * is fully started.
       
    33  *
       
    34  * @since 3.0
       
    35  */
       
    36 class TPEngServerParams
       
    37     {
       
    38     public:
       
    39 
       
    40         /**
       
    41          * C++ constructor (for server side).
       
    42          *
       
    43          * @since 3.0
       
    44          */
       
    45         IMPORT_C TPEngServerParams();
       
    46 
       
    47 
       
    48         /**
       
    49          * C++ constructor (for client side).
       
    50          *
       
    51          * @since 3.0
       
    52          * @param aServerName The name for started server.
       
    53          * @param aParam1 External parameter 1.
       
    54          * @param aParam2 External parameter 2.
       
    55          */
       
    56         IMPORT_C TPEngServerParams( const TDesC& aServerName,
       
    57                                     TInt aParam1,
       
    58                                     TInt aParam2 );
       
    59 
       
    60 
       
    61     public: //New methods for client side
       
    62 
       
    63 
       
    64         /**
       
    65          * Gets a descriptor presenting TPEngServerParams.
       
    66          *
       
    67          * @since 3.0
       
    68          * @return Descriptor presentation of TPEngServerParams.
       
    69          */
       
    70         IMPORT_C TPtrC AsCommandLine() const;
       
    71 
       
    72 
       
    73 
       
    74     public: //New methods for server side
       
    75 
       
    76         /**
       
    77          * Initializes TPEngServerParams contents from
       
    78          * process command line.
       
    79          *
       
    80          * This should be called in server E32Main() or
       
    81          * similar place to get retrieve parameter contents
       
    82          * from command line.
       
    83          *
       
    84          * @since 3.0
       
    85          * @return KErrNone if process command line
       
    86          * contained TPEngServerParams. Else KErrNotFound.
       
    87          */
       
    88         IMPORT_C TInt InitFromCmdLine();
       
    89 
       
    90 
       
    91 
       
    92         /**
       
    93          * Changes server thread name to given one.
       
    94          * (In __WINS__ build the renaming isn't done, as
       
    95          * it would break the ServerStarter.)
       
    96          *
       
    97          * Server should call this method as early as possible
       
    98          * during its construction.
       
    99          *
       
   100          * @since 3.0
       
   101          * @param aThreadName The new thread name to use.
       
   102          */
       
   103         IMPORT_C void RenameMainThread( const TDesC& aThreadName );
       
   104 
       
   105 
       
   106         /**
       
   107          * Signals the client that server is successfully
       
   108          * started.
       
   109          *
       
   110          * Server should call this method when server it is
       
   111          * fully started.
       
   112          *
       
   113          * @since 3.0
       
   114          */
       
   115         IMPORT_C void Signal();
       
   116 
       
   117 
       
   118         /**
       
   119          * Gets the parameters as given from the client side.
       
   120          *
       
   121          * @since 3.0
       
   122          * @return Param value as given from client side.
       
   123          */
       
   124         IMPORT_C TInt Param1() const;
       
   125         IMPORT_C TInt Param2() const;
       
   126 
       
   127 
       
   128         /**
       
   129          * Gets the server name as given from the client side.
       
   130          *
       
   131          * @since 3.0
       
   132          * @return Server name as given from client side.
       
   133          */
       
   134         IMPORT_C const TDesC& ServerName() const;
       
   135 
       
   136 
       
   137     private:    // Methods not implemented
       
   138 
       
   139         TPEngServerParams( const TPEngServerParams& );
       
   140         TPEngServerParams& operator=( const TPEngServerParams& );
       
   141 
       
   142 
       
   143     private: //data
       
   144 
       
   145         //OWN: Server name to identify the started server
       
   146         TName           iServerName;
       
   147 
       
   148         //OWN: Extra parameters
       
   149         TInt            iParam1;
       
   150         TInt            iParam2;
       
   151 
       
   152     };
       
   153 
       
   154 
       
   155 #endif      //  __TPENGSERVERPARAMS_H__
       
   156