os/persistentdata/traceservices/commsdebugutility/INC/comsdbgaux.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) 1997-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
// Flogger (File and Serial logger) utils header
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalTechnology
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __COMSDBGAUX_H__
sl@0
    24
#define __COMSDBGAUX_H__
sl@0
    25
sl@0
    26
#include <e32base.h>
sl@0
    27
#include "comsdbgsvr.h"
sl@0
    28
sl@0
    29
class CFileLoggerServer;
sl@0
    30
class RFs;
sl@0
    31
sl@0
    32
sl@0
    33
class CIniFileWatcher : public CActive
sl@0
    34
	{
sl@0
    35
public:
sl@0
    36
	static CIniFileWatcher* NewL(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile);
sl@0
    37
	//From CActive
sl@0
    38
	virtual void RunL();
sl@0
    39
	virtual void DoCancel();
sl@0
    40
	~CIniFileWatcher();
sl@0
    41
private:
sl@0
    42
	CIniFileWatcher(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile);
sl@0
    43
	void Initialize();
sl@0
    44
   void NotifyChange();
sl@0
    45
private:
sl@0
    46
	RFs& iFs;
sl@0
    47
	CFileLoggerServer& iServer;
sl@0
    48
	TFullName iWatchedIniFile;
sl@0
    49
	};
sl@0
    50
sl@0
    51
class MLogArrayAccess;
sl@0
    52
sl@0
    53
class CTimeManager : public CBase, public MBeating
sl@0
    54
	{
sl@0
    55
public:
sl@0
    56
	static CTimeManager* NewL(MLogArrayAccess& aArrayAccess);
sl@0
    57
	//From MBeating
sl@0
    58
	virtual void Beat();
sl@0
    59
	virtual void Synchronize();
sl@0
    60
	~CTimeManager();
sl@0
    61
private:
sl@0
    62
	CTimeManager(MLogArrayAccess& aArrayAccess);
sl@0
    63
	void ConstructL();
sl@0
    64
	void SendTimeUpdate();
sl@0
    65
private:
sl@0
    66
	MLogArrayAccess& iArrayAccess;
sl@0
    67
	CHeartbeat* iHeartbeat;
sl@0
    68
	TTime iTime;
sl@0
    69
	};
sl@0
    70
sl@0
    71
class MIniFlushModeAndLogValidQuery
sl@0
    72
	{
sl@0
    73
public:
sl@0
    74
	virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const = 0;
sl@0
    75
	virtual void FlushingOn(TBool& aFlushOn) const = 0;
sl@0
    76
	};
sl@0
    77
sl@0
    78
class MIniLoggingMediaQuery
sl@0
    79
	{
sl@0
    80
public:
sl@0
    81
	virtual void LogMediaSetting(TDes8& aString) const = 0;
sl@0
    82
	virtual void FlushingOn(TBool& aFlushOn) const = 0;
sl@0
    83
	virtual void LogPathSetting(TDes8& aString) const = 0;
sl@0
    84
	};
sl@0
    85
sl@0
    86
sl@0
    87
sl@0
    88
class CSubsystemSettings : public CBase
sl@0
    89
	{
sl@0
    90
public:
sl@0
    91
	CSubsystemSettings(const TDesC8& aName);
sl@0
    92
public:
sl@0
    93
	~CSubsystemSettings();
sl@0
    94
	void SetSubsystemName(const TDesC8& aName);
sl@0
    95
	TInt AddComponent(const TDesC8& aComponent);
sl@0
    96
	static TInt CompareCSubsystemSettings(const CSubsystemSettings& aFirst, const CSubsystemSettings& aSecond);
sl@0
    97
	static TInt CompareTComponent(const TNameTag& aFirst, const TNameTag& aSecond);
sl@0
    98
	void SetWildCarded(TBool aWildCarded);
sl@0
    99
	TBool IsWildCarded() const {return iSubsystemWildcarded;}
sl@0
   100
	TBool ElementExistsInArray(const TDesC8& aComponent) const ;
sl@0
   101
private:
sl@0
   102
	TBool iSubsystemWildcarded;
sl@0
   103
	TNameTag iSubsystemName;
sl@0
   104
	RArray<TNameTag> iComponentArray;
sl@0
   105
	};
sl@0
   106
sl@0
   107
class CIniLoggingPairs : public CBase
sl@0
   108
	{
sl@0
   109
public:
sl@0
   110
	static CIniLoggingPairs* NewL();
sl@0
   111
	void AddSettingL(const TDesC8& aSubsystem, const TDesC8& aComponent);
sl@0
   112
	~CIniLoggingPairs();
sl@0
   113
	TBool SettingValid(const TDesC8& aSubSystem, const TDesC8& aComponent) const;
sl@0
   114
private:
sl@0
   115
	CIniLoggingPairs()
sl@0
   116
		{ }
sl@0
   117
private:
sl@0
   118
	RPointerArray<CSubsystemSettings> iSubsystems;
sl@0
   119
	CSubsystemSettings* iProbeSubsystem;
sl@0
   120
	};
sl@0
   121
sl@0
   122
class CIniFileParser : public CBase, public MIniFlushModeAndLogValidQuery, public MIniLoggingMediaQuery
sl@0
   123
	{
sl@0
   124
public:
sl@0
   125
	static CIniFileParser* NewL(RFs& aFs);
sl@0
   126
	~CIniFileParser();
sl@0
   127
	TInt ParseIniFile(TDesC& aIniFile);
sl@0
   128
	//From MIniFlushModeAndLogValidQuery
sl@0
   129
	virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const;
sl@0
   130
	//From MiniLoggingMediaQuery
sl@0
   131
	virtual void LogMediaSetting(TDes8& aString) const;
sl@0
   132
	virtual void LogPathSetting(TDes8& aString) const;
sl@0
   133
	// From MIniFlushModeAndLogValidQuery and MiniLoggingMediaQuery
sl@0
   134
	virtual void FlushingOn(TBool& aFlushOn) const;
sl@0
   135
	void FinaliseFlushSetting();
sl@0
   136
	TBool Win32DebugEnabled() const { return iWin32DebugEnabled; }
sl@0
   137
private:
sl@0
   138
	CIniFileParser(RFs& aFs);
sl@0
   139
	void DoParseIniFileL(TDesC& aIniFile);
sl@0
   140
	TInt GetNextTokenAndCheck(TLex8& lex, TPtr8& tempPtr);
sl@0
   141
private:
sl@0
   142
	RFs& iFs;
sl@0
   143
	TBuf8<KMaxMediaStringLength> iLoggingMediaString;
sl@0
   144
	TFlushStates iForceFlushState;
sl@0
   145
	TBool iWin32DebugEnabled;
sl@0
   146
	//iIniSettings == NULL <==> bad ini file, logging is off and client has been told.
sl@0
   147
	CIniLoggingPairs* iIniSettings;
sl@0
   148
	TFilePath iLoggingPathString;
sl@0
   149
	};
sl@0
   150
sl@0
   151
#endif //__COMSDBGAUX_H__
sl@0
   152