piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h
branchRCL_3
changeset 13 da2cedce4920
equal deleted inserted replaced
12:d27dfa8884ad 13:da2cedce4920
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // This file defines the API for DebOutWriterPlugin.dll
       
    20 
       
    21 #ifndef __DEBOUTWRITERPLUGIN_H__
       
    22 #define __DEBOUTWRITERPLUGIN_H__
       
    23 
       
    24 //  Include Files
       
    25 #include <w32std.h>
       
    26 #include <piprofiler/WriterPluginInterface.h>
       
    27 #include <piprofiler/ProfilerGenericClassesUsr.h>
       
    28 #include <e32base.h>	// CBase
       
    29 #include <e32std.h>	 // TBuf
       
    30 #include <e32property.h>
       
    31 
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 // trace core ldd activation/deactivation interface
       
    34 #include <TcDriverIf.h>
       
    35 
       
    36 // trace core ldd global definitions
       
    37 _LIT( KTcLdd, "tcldd.ldd" );
       
    38 GLDEF_D RTcDriver tcldd;
       
    39 
       
    40 #endif
       
    41 
       
    42 _LIT(KDebOutShortName, "dow");
       
    43 
       
    44 // forward declarations
       
    45 class CDebOutWriterHandler;
       
    46 
       
    47 //  Class Definitions
       
    48 
       
    49 class CDebOutWriterPlugin : public CWriterPluginInterface
       
    50 	{
       
    51 public:
       
    52 	// new function
       
    53 	static CDebOutWriterPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
       
    54 	~CDebOutWriterPlugin();
       
    55 
       
    56 	void	DoCancel();
       
    57 	static void 	PrintDescriptorAsBase64(TDesC8& aDes, TRequestStatus* aStatus, TUint32 sampleTime, TBool aEmptying);
       
    58 
       
    59 public: // new functions
       
    60 
       
    61 	TInt 	Start();
       
    62 
       
    63 	void 	Stop();
       
    64     
       
    65 	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    66 	
       
    67 	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
       
    68     
       
    69 	TUid 	Id() const;
       
    70 		 
       
    71 	void 	GetWriterVersion(TDes* aDes);
       
    72 	
       
    73 	TUint32 GetWriterType();
       
    74 	
       
    75 	void    SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
       
    76 	
       
    77 	void   HandleError(TInt aError);
       
    78 	   
       
    79 	void   WriteData();
       
    80 private: // new functions
       
    81 	CDebOutWriterPlugin(const TUid aImplementationUid);
       
    82 	void 	ConstructL();
       
    83 	
       
    84 	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    85 	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    86 	TBool	GetEnabled();
       
    87 public:
       
    88     CProfilerSampleStream*          iStream;
       
    89 private: // data
       
    90 	TBapBuf*						iBufferBeingWritten;
       
    91 	
       
    92 	TInt 							iWriterType;
       
    93 	TInt							iWriterId;
       
    94 	CDebOutWriterHandler*			iWriterHandler;
       
    95 	RProperty                       iErrorStatus;
       
    96 
       
    97 	};
       
    98 
       
    99 /*
       
   100  * 
       
   101  * Definition of class CDebOutWriterHandler
       
   102  * 
       
   103  */
       
   104 class CDebOutWriterHandler : public CActive
       
   105 	{
       
   106 public:
       
   107  
       
   108 
       
   109 	static CDebOutWriterHandler* NewL(CDebOutWriterPlugin* aWriter);
       
   110 	~CDebOutWriterHandler();
       
   111     void DoCancel();
       
   112 	void StartL();
       
   113 
       
   114 	void Stop();
       
   115     
       
   116     void Reset();
       
   117 private:
       
   118 	CDebOutWriterHandler(CDebOutWriterPlugin* aWriter); 
       
   119 	
       
   120 	void ConstructL();
       
   121     void RunL();
       
   122     
       
   123 	void WriteBufferToOutput(TBapBuf* aBuf);
       
   124 	void PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus);
       
   125 	void HandleFullBuffers();
       
   126 private:
       
   127 	CDebOutWriterPlugin* 			iWriter;
       
   128     RFile                           iFile;
       
   129     RFs                             iFs;
       
   130     TBuf<256>                       iFileName;
       
   131 //  CPeriodic*                      iTimer;
       
   132     TBapBuf*                        iBufferBeingWritten;
       
   133     TBool                           iStopping;
       
   134 	};
       
   135 
       
   136 #endif  // __DEBOUTWRITERPLUGIN_H__
       
   137