os/kernelhwsrv/kerneltest/e32test/debug/d_logtofile.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2005-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 the License "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 // e32test\debug\d_logtofile.h
    15 // 
    16 //
    17 
    18 #ifndef __D_LOGTOFILE_H__
    19 #define __D_LOGTOFILE_H__
    20 
    21 #include <e32cmn.h>
    22 #ifndef __KERNEL_MODE__
    23 #include <e32std.h>
    24 #endif
    25 
    26 /**
    27 Data structure for CreateChunk call to ldd
    28 */
    29 struct TChunkCreateStr
    30 {
    31 TInt iSize;			/**The size of the chunk to be created*/
    32 TBuf8<10> iPattern; /**The matching pattern*/
    33 };
    34 
    35 /**
    36 The user side class for controlling trace handler hook.
    37 */
    38 class RLogToFileDevice : public RBusLogicalChannel
    39 	{
    40 public:
    41 	enum TControl
    42 		{
    43 		EControlCreateChunk,
    44 		EControlStart,
    45 		EControlStop,
    46 		EControlRemoveChunk,
    47 		};
    48 public:
    49 #ifndef __KERNEL_MODE__
    50 	
    51 	inline TInt Open(); 
    52 	inline TInt CreateChunk(TChunkCreateStr* aStr);
    53 	inline void Start();
    54 	inline TInt Stop();
    55 	inline void RemoveChunk();
    56 #endif //__KERNEL_MODE__
    57 	};
    58 
    59 _LIT(KLogToFileName,"d_logtofile");
    60 
    61 #ifndef __KERNEL_MODE__
    62 /** Opens a channel*/
    63 inline TInt RLogToFileDevice::Open()
    64 	{return DoCreate(KLogToFileName,TVersion(1,0,0),KNullUnit,NULL,NULL);}
    65 /**Creates a chunk. Returns user side handle*/
    66 inline TInt RLogToFileDevice::CreateChunk(TChunkCreateStr* aStr)
    67 	{return DoControl(EControlCreateChunk, reinterpret_cast<TAny*>(aStr));}
    68 /**Starts logging into the chunk*/
    69 inline void RLogToFileDevice::Start()
    70 	{DoControl(EControlStart);}
    71 /**Stops logging into the chunk. Returns the size of the log.*/
    72 inline TInt RLogToFileDevice::Stop()
    73 	{return DoControl(EControlStop);}
    74 /*Destroys the chunk*/
    75 inline void RLogToFileDevice::RemoveChunk()
    76 	{DoControl(EControlRemoveChunk);}
    77 #endif //__KERNEL_MODE__
    78 #endif //__D_LOGTOFILE_H__