sysanadatacapture/piprofiler/piprofiler/plugins/DebugOutputWriterPlugin/inc/DebOutWriterPlugin.h
changeset 2 6a82cd05fb1e
parent 1 3ff3fecb12fe
equal deleted inserted replaced
1:3ff3fecb12fe 2:6a82cd05fb1e
     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 <StringLoader.h>
       
    27 
       
    28 #include <piprofiler/WriterPluginInterface.h>
       
    29 #include <piprofiler/ProfilerGenericClassesUsr.h>
       
    30 #include <e32base.h>	// CBase
       
    31 #include <e32std.h>	 // TBuf
       
    32 #include <e32property.h>
       
    33 
       
    34 _LIT(KDebOutShortName, "dow");
       
    35 
       
    36 // forward declarations
       
    37 class CDebOutWriterHandler;
       
    38 
       
    39 //  Class Definitions
       
    40 
       
    41 class CDebOutWriterPlugin : public CWriterPluginInterface
       
    42 	{
       
    43 public:
       
    44 	// new function
       
    45 	static CDebOutWriterPlugin* NewL(const TUid aImplementationUid, TAny* /*aInitParams*/);
       
    46 	~CDebOutWriterPlugin();
       
    47 
       
    48 	void	DoCancel();
       
    49 	static void 	PrintDescriptorAsBase64(TDesC8& aDes, TRequestStatus* aStatus, TUint32 sampleTime, TBool aEmptying);
       
    50 
       
    51 public: // new functions
       
    52 
       
    53 	TInt 	Start();
       
    54 
       
    55 	void 	Stop();
       
    56 
       
    57 	void 	GetCaption( TDes& aCaption ) const;
       
    58     
       
    59 	void 	GetValue( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    60 	
       
    61 	void 	SetValue( const TWriterPluginValueKeys aKey, TDes& aValue ); 
       
    62     
       
    63 	TUid 	Id() const;
       
    64 		 
       
    65 	void 	GetWriterVersion(TDes* aDes);
       
    66 	
       
    67 	TUint32 GetWriterType();
       
    68 	
       
    69 	void    SetStream(CProfilerSampleStream& aStream) { iStream = &aStream; }
       
    70 	
       
    71 	void   HandleError(TInt aError);
       
    72 	   
       
    73 	void   WriteData();
       
    74 private: // new functions
       
    75 	CDebOutWriterPlugin(const TUid aImplementationUid);
       
    76 	void 	ConstructL();
       
    77 	
       
    78 	void 	GetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    79 	void 	SetValueL( const TWriterPluginValueKeys aKey, TDes& aValue );
       
    80 	TBool	GetEnabled();
       
    81 public:
       
    82     CProfilerSampleStream*          iStream;
       
    83 private: // data
       
    84 	TBapBuf*						iBufferBeingWritten;
       
    85 	
       
    86 	TInt 							iWriterType;
       
    87 	TInt							iWriterId;
       
    88 	CDebOutWriterHandler*			iWriterHandler;
       
    89 	RProperty                       iErrorStatus;
       
    90 	};
       
    91 
       
    92 /*
       
    93  * 
       
    94  * Definition of class CDebOutWriterHandler
       
    95  * 
       
    96  */
       
    97 class CDebOutWriterHandler : public CActive
       
    98 	{
       
    99 public:
       
   100  
       
   101 
       
   102 	static CDebOutWriterHandler* NewL(CDebOutWriterPlugin* aWriter);
       
   103 	~CDebOutWriterHandler();
       
   104     void DoCancel();
       
   105 	void StartL();
       
   106 
       
   107 	void Stop();
       
   108     
       
   109     void Reset();
       
   110 private:
       
   111 	CDebOutWriterHandler(CDebOutWriterPlugin* aWriter); 
       
   112 	
       
   113 	void ConstructL();
       
   114     void RunL();
       
   115     
       
   116 	void WriteBufferToOutput(TBapBuf* aBuf);
       
   117 	void PrintBufferToOutput(TBapBuf* aBuffer, TRequestStatus& aStatus);
       
   118 	void HandleFullBuffers();
       
   119 private:
       
   120 	CDebOutWriterPlugin* 			iWriter;
       
   121     RFile                           iFile;
       
   122     RFs                             iFs;
       
   123     TBuf<256>                       iFileName;
       
   124 //  CPeriodic*                      iTimer;
       
   125     TBapBuf*                        iBufferBeingWritten;
       
   126     TBool                           iStopping;
       
   127 	};
       
   128 
       
   129 #endif  // __DEBOUTWRITERPLUGIN_H__
       
   130