sl@0: // Copyright (c) 2005-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 the License "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: // e32test\debug\d_logtofile.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __D_LOGTOFILE_H__ sl@0: #define __D_LOGTOFILE_H__ sl@0: sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: /** sl@0: Data structure for CreateChunk call to ldd sl@0: */ sl@0: struct TChunkCreateStr sl@0: { sl@0: TInt iSize; /**The size of the chunk to be created*/ sl@0: TBuf8<10> iPattern; /**The matching pattern*/ sl@0: }; sl@0: sl@0: /** sl@0: The user side class for controlling trace handler hook. sl@0: */ sl@0: class RLogToFileDevice : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum TControl sl@0: { sl@0: EControlCreateChunk, sl@0: EControlStart, sl@0: EControlStop, sl@0: EControlRemoveChunk, sl@0: }; sl@0: public: sl@0: #ifndef __KERNEL_MODE__ sl@0: sl@0: inline TInt Open(); sl@0: inline TInt CreateChunk(TChunkCreateStr* aStr); sl@0: inline void Start(); sl@0: inline TInt Stop(); sl@0: inline void RemoveChunk(); sl@0: #endif //__KERNEL_MODE__ sl@0: }; sl@0: sl@0: _LIT(KLogToFileName,"d_logtofile"); sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: /** Opens a channel*/ sl@0: inline TInt RLogToFileDevice::Open() sl@0: {return DoCreate(KLogToFileName,TVersion(1,0,0),KNullUnit,NULL,NULL);} sl@0: /**Creates a chunk. Returns user side handle*/ sl@0: inline TInt RLogToFileDevice::CreateChunk(TChunkCreateStr* aStr) sl@0: {return DoControl(EControlCreateChunk, reinterpret_cast(aStr));} sl@0: /**Starts logging into the chunk*/ sl@0: inline void RLogToFileDevice::Start() sl@0: {DoControl(EControlStart);} sl@0: /**Stops logging into the chunk. Returns the size of the log.*/ sl@0: inline TInt RLogToFileDevice::Stop() sl@0: {return DoControl(EControlStop);} sl@0: /*Destroys the chunk*/ sl@0: inline void RLogToFileDevice::RemoveChunk() sl@0: {DoControl(EControlRemoveChunk);} sl@0: #endif //__KERNEL_MODE__ sl@0: #endif //__D_LOGTOFILE_H__