|
1 // Copyright (c) 2007-2010 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 "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 // Handler implementation for ascii printf |
|
15 // |
|
16 |
|
17 #ifndef __TRACECOREPRINTFTRACEHANDLER_H__ |
|
18 #define __TRACECOREPRINTFTRACEHANDLER_H__ |
|
19 |
|
20 |
|
21 // Include files |
|
22 #include <kernel/kernel.h> |
|
23 #include <TraceCoreNotificationReceiver.h> |
|
24 #include "TraceCoreHandler.h" |
|
25 |
|
26 |
|
27 // Forward declarations |
|
28 class DTraceCoreWriter; |
|
29 class DTraceCoreSettings; |
|
30 |
|
31 |
|
32 /** |
|
33 * Handler implementation for ascii printf |
|
34 */ |
|
35 NONSHARABLE_CLASS( DTraceCorePrintfTraceHandler ) : public MTraceCoreNotificationReceiver, |
|
36 public DTraceCoreHandler |
|
37 |
|
38 { |
|
39 public: |
|
40 |
|
41 /** |
|
42 * Constructor |
|
43 */ |
|
44 DTraceCorePrintfTraceHandler(); |
|
45 |
|
46 /** |
|
47 * Destructor |
|
48 */ |
|
49 ~DTraceCorePrintfTraceHandler(); |
|
50 |
|
51 /** |
|
52 * Initializes this handler |
|
53 */ |
|
54 TInt Init(); |
|
55 |
|
56 /** |
|
57 * Prepares the change in writer |
|
58 * |
|
59 * @param aWriter the new writer |
|
60 */ |
|
61 void PrepareSetWriter( DTraceCoreWriter* aWriter ); |
|
62 |
|
63 /** |
|
64 * Kern/RDebug::Printf handler function |
|
65 */ |
|
66 static TBool PrintfHandler( const TDesC8& aText, TTraceSource aTraceSource ); |
|
67 |
|
68 /** |
|
69 * Callback function for Trace Activation |
|
70 * from MTraceCoreNotificationReceiver |
|
71 * |
|
72 * @param aComponentId |
|
73 * @param aGroupId |
|
74 * @return None |
|
75 */ |
|
76 void TraceActivated( TUint32 aComponentId, TUint16 aGroupId ); |
|
77 |
|
78 /** |
|
79 * Callback function for Trace Deactivation |
|
80 * from MTraceCoreNotificationReceiver |
|
81 * |
|
82 * @param aComponentId |
|
83 * @param aGroupId |
|
84 * @return None |
|
85 */ |
|
86 void TraceDeactivated( TUint32 aComponentId, TUint16 aGroupId ); |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * Checks if there is a dropped trace and sends dropped trace message and |
|
92 * normal trace as well if writer is ready to write that data. |
|
93 * |
|
94 * @param aHandler Printf trace handler |
|
95 */ |
|
96 inline static void HandleTrace(const TDesC8& aText); |
|
97 |
|
98 /** |
|
99 * Trace output function |
|
100 */ |
|
101 void DebugPrint( const TDesC8& aDes ); |
|
102 |
|
103 /** |
|
104 * Static instance, accessed from the printf trace handler callback |
|
105 */ |
|
106 static DTraceCorePrintfTraceHandler* iInstance; |
|
107 |
|
108 /** |
|
109 * Printf trace handler |
|
110 */ |
|
111 TBool ( *iPrintfHandler )( const TDesC8&, TTraceSource ); |
|
112 |
|
113 /** |
|
114 * State of the Printf activations |
|
115 */ |
|
116 static TBool iKernPrintfActive; |
|
117 static TBool iRDebugPrintfActive; |
|
118 static TBool iPlatSecPrintfActive; |
|
119 |
|
120 }; |
|
121 |
|
122 #endif |
|
123 |
|
124 // End of File |