sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Flogger (File and Serial logger) utils header sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalTechnology sl@0: */ sl@0: sl@0: #ifndef __COMSDBGAUX_H__ sl@0: #define __COMSDBGAUX_H__ sl@0: sl@0: #include sl@0: #include "comsdbgsvr.h" sl@0: sl@0: class CFileLoggerServer; sl@0: class RFs; sl@0: sl@0: sl@0: class CIniFileWatcher : public CActive sl@0: { sl@0: public: sl@0: static CIniFileWatcher* NewL(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile); sl@0: //From CActive sl@0: virtual void RunL(); sl@0: virtual void DoCancel(); sl@0: ~CIniFileWatcher(); sl@0: private: sl@0: CIniFileWatcher(RFs& aFs, CFileLoggerServer& aServer, const TDesC& aIniFile); sl@0: void Initialize(); sl@0: void NotifyChange(); sl@0: private: sl@0: RFs& iFs; sl@0: CFileLoggerServer& iServer; sl@0: TFullName iWatchedIniFile; sl@0: }; sl@0: sl@0: class MLogArrayAccess; sl@0: sl@0: class CTimeManager : public CBase, public MBeating sl@0: { sl@0: public: sl@0: static CTimeManager* NewL(MLogArrayAccess& aArrayAccess); sl@0: //From MBeating sl@0: virtual void Beat(); sl@0: virtual void Synchronize(); sl@0: ~CTimeManager(); sl@0: private: sl@0: CTimeManager(MLogArrayAccess& aArrayAccess); sl@0: void ConstructL(); sl@0: void SendTimeUpdate(); sl@0: private: sl@0: MLogArrayAccess& iArrayAccess; sl@0: CHeartbeat* iHeartbeat; sl@0: TTime iTime; sl@0: }; sl@0: sl@0: class MIniFlushModeAndLogValidQuery sl@0: { sl@0: public: sl@0: virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const = 0; sl@0: virtual void FlushingOn(TBool& aFlushOn) const = 0; sl@0: }; sl@0: sl@0: class MIniLoggingMediaQuery sl@0: { sl@0: public: sl@0: virtual void LogMediaSetting(TDes8& aString) const = 0; sl@0: virtual void FlushingOn(TBool& aFlushOn) const = 0; sl@0: virtual void LogPathSetting(TDes8& aString) const = 0; sl@0: }; sl@0: sl@0: sl@0: sl@0: class CSubsystemSettings : public CBase sl@0: { sl@0: public: sl@0: CSubsystemSettings(const TDesC8& aName); sl@0: public: sl@0: ~CSubsystemSettings(); sl@0: void SetSubsystemName(const TDesC8& aName); sl@0: TInt AddComponent(const TDesC8& aComponent); sl@0: static TInt CompareCSubsystemSettings(const CSubsystemSettings& aFirst, const CSubsystemSettings& aSecond); sl@0: static TInt CompareTComponent(const TNameTag& aFirst, const TNameTag& aSecond); sl@0: void SetWildCarded(TBool aWildCarded); sl@0: TBool IsWildCarded() const {return iSubsystemWildcarded;} sl@0: TBool ElementExistsInArray(const TDesC8& aComponent) const ; sl@0: private: sl@0: TBool iSubsystemWildcarded; sl@0: TNameTag iSubsystemName; sl@0: RArray iComponentArray; sl@0: }; sl@0: sl@0: class CIniLoggingPairs : public CBase sl@0: { sl@0: public: sl@0: static CIniLoggingPairs* NewL(); sl@0: void AddSettingL(const TDesC8& aSubsystem, const TDesC8& aComponent); sl@0: ~CIniLoggingPairs(); sl@0: TBool SettingValid(const TDesC8& aSubSystem, const TDesC8& aComponent) const; sl@0: private: sl@0: CIniLoggingPairs() sl@0: { } sl@0: private: sl@0: RPointerArray iSubsystems; sl@0: CSubsystemSettings* iProbeSubsystem; sl@0: }; sl@0: sl@0: class CIniFileParser : public CBase, public MIniFlushModeAndLogValidQuery, public MIniLoggingMediaQuery sl@0: { sl@0: public: sl@0: static CIniFileParser* NewL(RFs& aFs); sl@0: ~CIniFileParser(); sl@0: TInt ParseIniFile(TDesC& aIniFile); sl@0: //From MIniFlushModeAndLogValidQuery sl@0: virtual TBool LogValid(const TDesC8& aSubsystem, const TDesC8& aComponent) const; sl@0: //From MiniLoggingMediaQuery sl@0: virtual void LogMediaSetting(TDes8& aString) const; sl@0: virtual void LogPathSetting(TDes8& aString) const; sl@0: // From MIniFlushModeAndLogValidQuery and MiniLoggingMediaQuery sl@0: virtual void FlushingOn(TBool& aFlushOn) const; sl@0: void FinaliseFlushSetting(); sl@0: TBool Win32DebugEnabled() const { return iWin32DebugEnabled; } sl@0: private: sl@0: CIniFileParser(RFs& aFs); sl@0: void DoParseIniFileL(TDesC& aIniFile); sl@0: TInt GetNextTokenAndCheck(TLex8& lex, TPtr8& tempPtr); sl@0: private: sl@0: RFs& iFs; sl@0: TBuf8 iLoggingMediaString; sl@0: TFlushStates iForceFlushState; sl@0: TBool iWin32DebugEnabled; sl@0: //iIniSettings == NULL <==> bad ini file, logging is off and client has been told. sl@0: CIniLoggingPairs* iIniSettings; sl@0: TFilePath iLoggingPathString; sl@0: }; sl@0: sl@0: #endif //__COMSDBGAUX_H__ sl@0: