os/persistentdata/loggingservices/eventlogger/LogCli/inc/logservcli.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// LOGSERVERCLI.H
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __LOGSERVERCLI_H__
sl@0
    19
#define __LOGSERVERCLI_H__
sl@0
    20
sl@0
    21
// System includes
sl@0
    22
#include <e32std.h>
sl@0
    23
sl@0
    24
// User includes
sl@0
    25
#include <logcli.h>
sl@0
    26
#include "LogCliServShared.h"
sl@0
    27
sl@0
    28
class RLogSession : public RSessionBase
sl@0
    29
/**
sl@0
    30
@internalComponent
sl@0
    31
*/
sl@0
    32
	{
sl@0
    33
public:
sl@0
    34
	/**
sl@0
    35
	 * Constructor
sl@0
    36
	 */
sl@0
    37
	RLogSession();
sl@0
    38
sl@0
    39
	/**
sl@0
    40
	 * Connect to Log Server
sl@0
    41
	 */
sl@0
    42
	TInt Connect();
sl@0
    43
sl@0
    44
public:
sl@0
    45
sl@0
    46
	/**
sl@0
    47
	 * Asynchronous send to server. Reply received via aStatus
sl@0
    48
	 */
sl@0
    49
	void Send(TInt aType, const TIpcArgs& aArgs, TRequestStatus& aStatus) const;
sl@0
    50
sl@0
    51
	/**
sl@0
    52
	 * Synchronous send to server. Reply returned to caller
sl@0
    53
	 */
sl@0
    54
	TInt Send(TInt aType, const TIpcArgs& aArgs) const;
sl@0
    55
sl@0
    56
	/**
sl@0
    57
	 * Get the next free operation id
sl@0
    58
	 */
sl@0
    59
	inline TLogOperationId AllocateIdOperation();
sl@0
    60
sl@0
    61
	/**
sl@0
    62
	 * Get the next free view id
sl@0
    63
	 */
sl@0
    64
	inline TLogViewId AllocateIdView();
sl@0
    65
sl@0
    66
private:
sl@0
    67
	TInt SendWithRetry(TInt aType, const TIpcArgs& aParam) const;
sl@0
    68
	void SendWithRetryAsync(TInt aType, const TIpcArgs& aParam, TRequestStatus& aStatus) const;
sl@0
    69
sl@0
    70
private:
sl@0
    71
	TLogOperationId iOperationId;
sl@0
    72
	TLogViewId iViewId;
sl@0
    73
	};
sl@0
    74
sl@0
    75
sl@0
    76
inline TLogOperationId RLogSession::AllocateIdOperation()
sl@0
    77
	{
sl@0
    78
	return iOperationId++;
sl@0
    79
	}
sl@0
    80
sl@0
    81
inline TLogViewId RLogSession::AllocateIdView()
sl@0
    82
	{
sl@0
    83
	return iViewId++;
sl@0
    84
	}
sl@0
    85
sl@0
    86
sl@0
    87
#ifdef LOGGING_ENABLED
sl@0
    88
sl@0
    89
#include <f32file.h>
sl@0
    90
#include <flogger.h>
sl@0
    91
sl@0
    92
/**
sl@0
    93
@internalComponent
sl@0
    94
*/
sl@0
    95
_LIT(KLogFileName, "LogEng.txt");
sl@0
    96
_LIT(KLogFolder,   "LogEng");
sl@0
    97
_LIT(KTimeFormat, "%02d.%02d:%02d:%06d    ");
sl@0
    98
_LIT(KTextFormat, "%S");
sl@0
    99
sl@0
   100
class Log : public RFileLogger
sl@0
   101
/**
sl@0
   102
@internalComponent
sl@0
   103
*/
sl@0
   104
	{
sl@0
   105
public:
sl@0
   106
	static void New();
sl@0
   107
	static void Write(const TDesC& aText);
sl@0
   108
	static void WriteFormat(TRefByValue<const TDesC> aFmt, ...);
sl@0
   109
sl@0
   110
private:
sl@0
   111
	static void PruneLogFile();
sl@0
   112
    };
sl@0
   113
sl@0
   114
/**
sl@0
   115
@internalComponent
sl@0
   116
*/
sl@0
   117
#define LOGNEW							Log::New()
sl@0
   118
#define LOGTEXT(AAA)					{ _LIT(KString, AAA); Log::Write(KString); }
sl@0
   119
#define LOGTEXT2(AAA, BBB)				{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB); }
sl@0
   120
#define LOGTEXT3(AAA, BBB, CCC)			{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC); }
sl@0
   121
#define LOGTEXT4(AAA, BBB, CCC, DDD)	{ _LIT(KString, AAA); Log::WriteFormat(TRefByValue<const TDesC>(KString()), BBB, CCC, DDD); }
sl@0
   122
sl@0
   123
#else
sl@0
   124
sl@0
   125
#define LOGNEW
sl@0
   126
#define LOGTEXT(AAA)
sl@0
   127
#define LOGTEXT2(AAA, BBB)
sl@0
   128
#define LOGTEXT3(AAA, BBB, CCC)
sl@0
   129
#define LOGTEXT4(AAA, BBB, CCC, DDD)
sl@0
   130
sl@0
   131
#endif
sl@0
   132
sl@0
   133
sl@0
   134
#endif
sl@0
   135