os/persistentdata/loggingservices/eventlogger/LogCli/inc/logservcli.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/loggingservices/eventlogger/LogCli/inc/logservcli.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,135 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// LOGSERVERCLI.H
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __LOGSERVERCLI_H__
    1.22 +#define __LOGSERVERCLI_H__
    1.23 +
    1.24 +// System includes
    1.25 +#include <e32std.h>
    1.26 +
    1.27 +// User includes
    1.28 +#include <logcli.h>
    1.29 +#include "LogCliServShared.h"
    1.30 +
    1.31 +class RLogSession : public RSessionBase
    1.32 +/**
    1.33 +@internalComponent
    1.34 +*/
    1.35 +	{
    1.36 +public:
    1.37 +	/**
    1.38 +	 * Constructor
    1.39 +	 */
    1.40 +	RLogSession();
    1.41 +
    1.42 +	/**
    1.43 +	 * Connect to Log Server
    1.44 +	 */
    1.45 +	TInt Connect();
    1.46 +
    1.47 +public:
    1.48 +
    1.49 +	/**
    1.50 +	 * Asynchronous send to server. Reply received via aStatus
    1.51 +	 */
    1.52 +	void Send(TInt aType, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
    1.53 +
    1.54 +	/**
    1.55 +	 * Synchronous send to server. Reply returned to caller
    1.56 +	 */
    1.57 +	TInt Send(TInt aType, const TIpcArgs& aArgs) const;
    1.58 +
    1.59 +	/**
    1.60 +	 * Get the next free operation id
    1.61 +	 */
    1.62 +	inline TLogOperationId AllocateIdOperation();
    1.63 +
    1.64 +	/**
    1.65 +	 * Get the next free view id
    1.66 +	 */
    1.67 +	inline TLogViewId AllocateIdView();
    1.68 +
    1.69 +private:
    1.70 +	TInt SendWithRetry(TInt aType, const TIpcArgs& aParam) const;
    1.71 +	void SendWithRetryAsync(TInt aType, const TIpcArgs& aParam, TRequestStatus& aStatus) const;
    1.72 +
    1.73 +private:
    1.74 +	TLogOperationId iOperationId;
    1.75 +	TLogViewId iViewId;
    1.76 +	};
    1.77 +
    1.78 +
    1.79 +inline TLogOperationId RLogSession::AllocateIdOperation()
    1.80 +	{
    1.81 +	return iOperationId++;
    1.82 +	}
    1.83 +
    1.84 +inline TLogViewId RLogSession::AllocateIdView()
    1.85 +	{
    1.86 +	return iViewId++;
    1.87 +	}
    1.88 +
    1.89 +
    1.90 +#ifdef LOGGING_ENABLED
    1.91 +
    1.92 +#include <f32file.h>
    1.93 +#include <flogger.h>
    1.94 +
    1.95 +/**
    1.96 +@internalComponent
    1.97 +*/
    1.98 +_LIT(KLogFileName, "LogEng.txt");
    1.99 +_LIT(KLogFolder,   "LogEng");
   1.100 +_LIT(KTimeFormat, "%02d.%02d:%02d:%06d    ");
   1.101 +_LIT(KTextFormat, "%S");
   1.102 +
   1.103 +class Log : public RFileLogger
   1.104 +/**
   1.105 +@internalComponent
   1.106 +*/
   1.107 +	{
   1.108 +public:
   1.109 +	static void New();
   1.110 +	static void Write(const TDesC& aText);
   1.111 +	static void WriteFormat(TRefByValue<const TDesC> aFmt, ...);
   1.112 +
   1.113 +private:
   1.114 +	static void PruneLogFile();
   1.115 +    };
   1.116 +
   1.117 +/**
   1.118 +@internalComponent
   1.119 +*/
   1.120 +#define LOGNEW							Log::New()
   1.121 +#define LOGTEXT(AAA)					{ _LIT(KString, AAA); Log::Write(KString); }
   1.122 +#define LOGTEXT2(AAA, BBB)				{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB); }
   1.123 +#define LOGTEXT3(AAA, BBB, CCC)			{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC); }
   1.124 +#define LOGTEXT4(AAA, BBB, CCC, DDD)	{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC, DDD); }
   1.125 +
   1.126 +#else
   1.127 +
   1.128 +#define LOGNEW
   1.129 +#define LOGTEXT(AAA)
   1.130 +#define LOGTEXT2(AAA, BBB)
   1.131 +#define LOGTEXT3(AAA, BBB, CCC)
   1.132 +#define LOGTEXT4(AAA, BBB, CCC, DDD)
   1.133 +
   1.134 +#endif
   1.135 +
   1.136 +
   1.137 +#endif
   1.138 +