multimediacommsengine/tsrc/testdriver/testclient/filehandler/src/CTcFileHandlerServer.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2004 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:  See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CTCFILEHANDLERSERVER_H__
       
    19 #define __CTCFILEHANDLERSERVER_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 
       
    24 //  CLASS DEFINITION
       
    25 /**
       
    26  * CTcFileHandler is the main server class responsible for starting
       
    27  * and running the server process/thread.
       
    28  */
       
    29 class CTcFileHandlerServer : public CServer2
       
    30     {
       
    31     public: // Constructors and destructor
       
    32 
       
    33 		/**
       
    34 		 * Static constructor, leaves pointer to cleanup-stack
       
    35 		 *
       
    36 		 * @return An initialised instance of this class.
       
    37 		 */
       
    38 		static CTcFileHandlerServer* NewLC();
       
    39 
       
    40 		/// Destructor
       
    41 		~CTcFileHandlerServer();
       
    42 
       
    43     private: // Constructors
       
    44 
       
    45 		/// Default constructor
       
    46         CTcFileHandlerServer();
       
    47 
       
    48 		/// 2nd phase constructor
       
    49         void ConstructL();
       
    50 
       
    51 	private: // From CActive
       
    52 
       
    53 		TInt RunError( TInt aError );
       
    54 
       
    55 	private: // From CServer
       
    56 
       
    57 	    CSession2* NewSessionL( const TVersion& aVersion,
       
    58 	    						const RMessage2& aMessage ) const;
       
    59 
       
    60 	public: // New methods
       
    61 
       
    62 		/**
       
    63 		 * Server entry point method (Thread entry point!)
       
    64 		 * Starts the server up. Creates a cleanupstack and activescheduler
       
    65 		 *
       
    66 		 * @param aParam Thread arguments. Not used.
       
    67 		 */
       
    68 		static TInt ThreadMain( TAny* aParam );
       
    69 
       
    70 		/// Called by a session when it is created. Increments iSessionCount
       
    71 		void SessionAdded();
       
    72 
       
    73 		/// Called by a session when it is destroyed. Decrements iSessionCount.
       
    74 		/// Stops the ActiveScheduler if there are no more sessions.
       
    75 		void SessionRemoved();
       
    76 
       
    77 		/// Called by ThreadMain, starts and initialises the server.
       
    78 		/// This function will block for the lifetime of the server.
       
    79 		static void InitServerL();
       
    80 
       
    81 	private: // Data
       
    82 
       
    83 		/// Number of active sessions.
       
    84 		TInt iSessionCount;
       
    85 
       
    86     };
       
    87 
       
    88 #endif // __CTCFILEHANDLERSERVER_H__