testexecfw/stf/stffw/logger/STFLoggingServer/inc/STFLogServer.h
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     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: 
       
    15 * 
       
    16 * 
       
    17 */
       
    18 
       
    19 #ifndef __STFLOGGINGSERVER_H__
       
    20 #define __STFLOGGINGSERVER_H__
       
    21 
       
    22 //  Include Files
       
    23 
       
    24 #include <e32base.h>
       
    25 #include "STFLoggerCSCommon.h"
       
    26 #include "stifloggerbase.h"
       
    27 
       
    28 enum TServerPanic
       
    29 	{
       
    30 	EPanicBadDescriptor,
       
    31 	EPanicNotSupported
       
    32 	};
       
    33 
       
    34 void PanicClient(const RMessage2& aMessage,TServerPanic TMyPanic);
       
    35 
       
    36 const TInt KShutdownDelay=200000; // approx 2 seconds
       
    37 class CShutdown : public CTimer
       
    38 	{
       
    39 public:
       
    40 	inline CShutdown();
       
    41 	inline void ConstructL();
       
    42 	inline void Start();
       
    43 private:
       
    44 	void RunL();
       
    45 	};
       
    46 
       
    47 
       
    48 inline CShutdown::CShutdown()
       
    49 	:CTimer(-1)
       
    50 	{CActiveScheduler::Add(this);}
       
    51 inline void CShutdown::ConstructL()
       
    52 	{CTimer::ConstructL();}
       
    53 inline void CShutdown::Start()
       
    54 	{After(KShutdownDelay);}
       
    55 
       
    56 class CSTFLogServer : public CServer2
       
    57 	{
       
    58 	public:
       
    59 		static CServer2* NewLC();
       
    60 		void AddSession();
       
    61 		void RemoveSession();
       
    62 	private:
       
    63 		CSTFLogServer();
       
    64 		void ConstructL();
       
    65 		// From CServer2
       
    66 		virtual CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; 
       
    67 	private:
       
    68 		TInt iSessionCount;
       
    69 		CShutdown iShutdown;		
       
    70 	};
       
    71 
       
    72 inline CSTFLogServer::CSTFLogServer()
       
    73 	:CServer2(CActive::EPriorityStandard)
       
    74 	{}
       
    75 
       
    76 class CSTFLogSession : public CSession2
       
    77 	{
       
    78 public:
       
    79 	CSTFLogSession();
       
    80 	void CreateL();
       
    81 public:
       
    82 	virtual void ServiceL(const RMessage2& aMessage); // From CSession2
       
    83 	virtual void ServiceError(const RMessage2& aMessage, TInt aError); // From CSession2
       
    84 private:
       
    85 	void CreateLogger(const RMessage2& aMessage);
       
    86 	void Log_TInt_TDesCL(const RMessage2& aMessage);
       
    87 	void Log_TInt_TDesC8L(const RMessage2& aMessage);
       
    88 	void CreationResult(const RMessage2& aMessage);
       
    89 	void OutputType(const RMessage2& aMessage);
       
    90 
       
    91 private:
       
    92 	~CSTFLogSession();
       
    93 private:
       
    94 	CStifLoggerBase* iLogger;
       
    95 	};
       
    96 
       
    97 inline CSTFLogSession::CSTFLogSession()
       
    98 	{}
       
    99 
       
   100 
       
   101 GLDEF_C TInt E32Main();
       
   102 
       
   103 #endif  // __STFLOGGINGSERVER_H__
       
   104