PECengine/CoreUtilsLib2/SrvInc/PEngServerStarter.h
branchRCL_3
changeset 17 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
16:6ca72c0fe49a 17:a941bc465d9f
       
     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:  Generic thread safe server starter.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __PENGSERVERSTARTER_H__
       
    19 #define __PENGSERVERSTARTER_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <E32Std.h>
       
    23 
       
    24 
       
    25 
       
    26 // CLASS DECLARATION
       
    27 /**
       
    28 * Generic thread safe server starter used to start server
       
    29 * process from given exe/dll file.
       
    30 *
       
    31 * WINS environment requirements:
       
    32 * - target must be normal polymorphic dll
       
    33 * - 1st exported function must be castable to TThreadFunction
       
    34 * - Thread function parameter is TPEngServerParams*.
       
    35 *
       
    36 *
       
    37 * THUMB environment requirements:
       
    38 * - target must be normal executable, epocexe
       
    39 * - if started using this launcher, RProcess command line
       
    40 *   is TPEngServerParams contents. If exe is started by other
       
    41 *   means, e.g. with file browser, then no TPEngServerParams contents
       
    42 *   available in RProcess command line.
       
    43 *
       
    44 *  @since 3.0
       
    45 */
       
    46 class PEngServerStarter
       
    47     {
       
    48     public:     // New methods
       
    49 
       
    50         /**
       
    51          * Launch server process
       
    52          *
       
    53          * @since 3.0
       
    54          * @param aServerExeBaseName Plain server executable base name.
       
    55          *        Server path and drive are determined on the runtime
       
    56          *        from client dll location & compile time platsec
       
    57          *        definitions.
       
    58          * @param aServerName The name for the server.
       
    59          * @param aParams is optional parameter to supply to server process.
       
    60          * @return KErrNone if the server succesfully started or
       
    61          * if its already running. Else one of system wide error codes.
       
    62          */
       
    63         IMPORT_C static TInt LaunchServer( const TDesC& aServerExeBaseName,
       
    64                                            const TDesC& aServerName,
       
    65                                            TInt aParam1 = KErrNone,
       
    66                                            TInt aParam2 = KErrNone );
       
    67 
       
    68 
       
    69         /**
       
    70          * Connects to server process and starts new server if needed.
       
    71          * (Starting done with PEngServerStarter::LaunchServer() )
       
    72          *
       
    73          *
       
    74          * @since 3.0
       
    75          * @param aSession Session to open.
       
    76          * @param aServerName The server to connect.
       
    77          *                    Given to RSessionBase::CreateSession().
       
    78          * @param aVersion The required server version.
       
    79          *                    Given to RSessionBase::CreateSession().
       
    80          * @param aAsyncMessageSlots Amount of needed async slots.
       
    81          *                    Given to RSessionBase::CreateSession().
       
    82          * @param aServerExeBaseName The server exe to start if not yest running,
       
    83          * as in PEngServerStarter::LaunchServer()
       
    84          * @param aParam1 & 2 The extra parameters to provide to launched server
       
    85          * process as in PEngServerStarter::LaunchServer()
       
    86          *
       
    87          * @return Error code from RSessionBase::CreateSession() or
       
    88          * PEngServerStarter::LaunchServer(). If given session is already
       
    89          * opened (it's handle number is something else than KNullHandle)
       
    90          *  returns KErrInUse.
       
    91          */
       
    92         IMPORT_C static TInt ConnectServer( RSessionBase& aSession,
       
    93                                             const TDesC& aServerName,
       
    94                                             const TVersion& aVersion,
       
    95                                             TInt aAsyncMessageSlots,
       
    96                                             const TDesC& aServerExeBaseName,
       
    97                                             TInt aParam1 = KErrNone,
       
    98                                             TInt aParam2 = KErrNone  );
       
    99 
       
   100 
       
   101     private:    // Methods not implemented
       
   102 
       
   103         PEngServerStarter( const PEngServerStarter& );
       
   104         PEngServerStarter& operator=( const PEngServerStarter& );
       
   105     };
       
   106 
       
   107 #endif      //  __PENGSERVERSTARTER_H__
       
   108 
       
   109 
       
   110 //End of file