traceservices/commsdebugutility/INC/comsdbgaux.h
changeset 0 08ec8eefde2f
equal deleted inserted replaced
-1:000000000000 0:08ec8eefde2f
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Flogger (File and Serial logger) utils header
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalTechnology
       
    21 */
       
    22 
       
    23 #ifndef __COMSDBGAUX_H__
       
    24 #define __COMSDBGAUX_H__
       
    25 
       
    26 #include <e32base.h>
       
    27 #include "comsdbgsvr.h"
       
    28 
       
    29 class CFileLoggerServer;
       
    30 class RFs;
       
    31 
       
    32 
       
    33 class CIniFileWatcher : public CActive
       
    34 	{
       
    35 public:
       
    36 	static CIniFileWatcher* NewL(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile);
       
    37 	//From CActive
       
    38 	virtual void RunL();
       
    39 	virtual void DoCancel();
       
    40 	~CIniFileWatcher();
       
    41 private:
       
    42 	CIniFileWatcher(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile);
       
    43 	void Initialize();
       
    44    void NotifyChange();
       
    45 private:
       
    46 	RFs& iFs;
       
    47 	CFileLoggerServer& iServer;
       
    48 	TFullName iWatchedIniFile;
       
    49 	};
       
    50 
       
    51 class MLogArrayAccess;
       
    52 
       
    53 class CTimeManager : public CBase, public MBeating
       
    54 	{
       
    55 public:
       
    56 	static CTimeManager* NewL(MLogArrayAccess& aArrayAccess);
       
    57 	//From MBeating
       
    58 	virtual void Beat();
       
    59 	virtual void Synchronize();
       
    60 	~CTimeManager();
       
    61 private:
       
    62 	CTimeManager(MLogArrayAccess& aArrayAccess);
       
    63 	void ConstructL();
       
    64 	void SendTimeUpdate();
       
    65 private:
       
    66 	MLogArrayAccess& iArrayAccess;
       
    67 	CHeartbeat* iHeartbeat;
       
    68 	TTime iTime;
       
    69 	};
       
    70 
       
    71 class MIniFlushModeAndLogValidQuery
       
    72 	{
       
    73 public:
       
    74 	virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const = 0;
       
    75 	virtual void FlushingOn(TBool& aFlushOn) const = 0;
       
    76 	};
       
    77 
       
    78 class MIniLoggingMediaQuery
       
    79 	{
       
    80 public:
       
    81 	virtual void LogMediaSetting(TDes8& aString) const = 0;
       
    82 	virtual void FlushingOn(TBool& aFlushOn) const = 0;
       
    83 	virtual void LogPathSetting(TDes8& aString) const = 0;
       
    84 	};
       
    85 
       
    86 
       
    87 
       
    88 class CSubsystemSettings : public CBase
       
    89 	{
       
    90 public:
       
    91 	CSubsystemSettings(const TDesC8& aName);
       
    92 public:
       
    93 	~CSubsystemSettings();
       
    94 	void SetSubsystemName(const TDesC8& aName);
       
    95 	TInt AddComponent(const TDesC8& aComponent);
       
    96 	static TInt CompareCSubsystemSettings(const CSubsystemSettings& aFirst, const CSubsystemSettings& aSecond);
       
    97 	static TInt CompareTComponent(const TNameTag& aFirst, const TNameTag& aSecond);
       
    98 	void SetWildCarded(TBool aWildCarded);
       
    99 	TBool IsWildCarded() const {return iSubsystemWildcarded;}
       
   100 	TBool ElementExistsInArray(const TDesC8& aComponent) const ;
       
   101 private:
       
   102 	TBool iSubsystemWildcarded;
       
   103 	TNameTag iSubsystemName;
       
   104 	RArray<TNameTag> iComponentArray;
       
   105 	};
       
   106 
       
   107 class CIniLoggingPairs : public CBase
       
   108 	{
       
   109 public:
       
   110 	static CIniLoggingPairs* NewL();
       
   111 	void AddSettingL(const TDesC8& aSubsystem, const TDesC8& aComponent);
       
   112 	~CIniLoggingPairs();
       
   113 	TBool SettingValid(const TDesC8& aSubSystem, const TDesC8& aComponent) const;
       
   114 private:
       
   115 	CIniLoggingPairs()
       
   116 		{ }
       
   117 private:
       
   118 	RPointerArray<CSubsystemSettings> iSubsystems;
       
   119 	CSubsystemSettings* iProbeSubsystem;
       
   120 	};
       
   121 
       
   122 class CIniFileParser : public CBase, public MIniFlushModeAndLogValidQuery, public MIniLoggingMediaQuery
       
   123 	{
       
   124 public:
       
   125 	static CIniFileParser* NewL(RFs& aFs);
       
   126 	~CIniFileParser();
       
   127 	TInt ParseIniFile(TDesC& aIniFile);
       
   128 	//From MIniFlushModeAndLogValidQuery
       
   129 	virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const;
       
   130 	//From MiniLoggingMediaQuery
       
   131 	virtual void LogMediaSetting(TDes8& aString) const;
       
   132 	virtual void LogPathSetting(TDes8& aString) const;
       
   133 	// From MIniFlushModeAndLogValidQuery and MiniLoggingMediaQuery
       
   134 	virtual void FlushingOn(TBool& aFlushOn) const;
       
   135 	void FinaliseFlushSetting();
       
   136 	TBool Win32DebugEnabled() const { return iWin32DebugEnabled; }
       
   137 private:
       
   138 	CIniFileParser(RFs& aFs);
       
   139 	void DoParseIniFileL(TDesC& aIniFile);
       
   140 	TInt GetNextTokenAndCheck(TLex8& lex, TPtr8& tempPtr);
       
   141 private:
       
   142 	RFs& iFs;
       
   143 	TBuf8<KMaxMediaStringLength> iLoggingMediaString;
       
   144 	TFlushStates iForceFlushState;
       
   145 	TBool iWin32DebugEnabled;
       
   146 	//iIniSettings == NULL <==> bad ini file, logging is off and client has been told.
       
   147 	CIniLoggingPairs* iIniSettings;
       
   148 	TFilePath iLoggingPathString;
       
   149 	};
       
   150 
       
   151 #endif //__COMSDBGAUX_H__
       
   152